add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/fieldAgrmnNo"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:gravity="center_horizontal"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/timelineLine" />
<TextView android:id="@+id/fieldStatus"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:gravity="center_horizontal"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/fieldResult"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:gravity="center_horizontal"/>
</TableRow>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,197 @@
package com.adins.mss.base.dynamicform.form.questions;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.util.LocaleHelper;
import com.adins.mss.foundation.image.ImageManipulation;
import com.adins.mss.foundation.image.Utils;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.Locale;
/**
* Created by gigin.ginanjar on 05/09/2016.
*/
public class ImageViewerActivity extends FragmentActivity implements View.OnClickListener {
public static final String BUND_KEY_IMAGE = "com.adins.mss.base.dynamicform.form.questions.BUND_KEY_IMAGE";
public static final String BUND_KEY_IMAGE_TEMP_LOCATION = "com.adins.mss.base.dynamicform.form.questions.BUND_KEY_IMAGE_TEMP_LOCATION";
public static final String BUND_KEY_IMAGE_QUALITY = "com.adins.mss.base.dynamicform.form.questions.BUND_KEY_IMAGE_QUALITY";
public static final String BUND_KEY_IMAGE_ISVIEWER = "com.adins.mss.base.dynamicform.form.questions.BUND_KEY_IMAGE_ISVIEWER";
TouchImageView imageView;
LinearLayout btnLayout;
Bitmap tempBitmap;
Bitmap imgBitmap;
int imgQuality;
private FirebaseAnalytics screenName;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image_viewer_layout);
imageView = (TouchImageView) findViewById(R.id.imageViewer);
imageView.setMaxZoom(8f);
btnLayout = (LinearLayout) findViewById(R.id.btnLayout);
byte[] imageByte = getIntent().getExtras().getByteArray(BUND_KEY_IMAGE);
imgQuality = getIntent().getExtras().getInt(BUND_KEY_IMAGE_QUALITY);
boolean isViewer = getIntent().getExtras().getBoolean(BUND_KEY_IMAGE_ISVIEWER, false);
screenName = FirebaseAnalytics.getInstance(this);
//for receiving bitmap with size over 500kb using temporary file storage then convert back to byte array
if (null == imageByte || 0 == imageByte.length) {
String imageLoc = getIntent().getExtras().getString(BUND_KEY_IMAGE_TEMP_LOCATION);
File file = new File(imageLoc);
imgBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
}
new BitmapWorkerTask(this, imageView, imageByte, imgBitmap, false, false).execute();
if (isViewer) {
btnLayout.setVisibility(View.GONE);
} else {
btnLayout.setVisibility(View.VISIBLE);
}
Button btnRotate = (Button) findViewById(R.id.btnRotate);
Button btnSave = (Button) findViewById(R.id.btnSave);
btnRotate.setOnClickListener(this);
btnSave.setOnClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
//Set Firebase screen name
screenName.setCurrentScreen(this, getString(R.string.screen_name_image_viewer), null);
}
@Override
protected void attachBaseContext(Context newBase) {
Context context = newBase;
Locale locale;
try{
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
context = LocaleHelper.wrap(newBase, locale);
} catch (Exception e) {
locale = new Locale(LocaleHelper.ENGLSIH);
context = LocaleHelper.wrap(newBase, locale);
} finally {
super.attachBaseContext(context);
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btnSave) {
new BitmapWorkerTask(this, imageView, null, null, false, true).execute();
} else if (id == R.id.btnRotate) {
new BitmapWorkerTask(this, imageView, null, null, true, false).execute();
}
}
public class BitmapWorkerTask extends AsyncTask<Void, Void, Bitmap> {
private final WeakReference<TouchImageView> imageViewReference;
private final byte[] data;
private final WeakReference<FragmentActivity> mContext;
boolean isRotate;
boolean isSave;
private ProgressDialog progressDialog;
private ByteArrayOutputStream stream;
private Bitmap bitmapImage;
public BitmapWorkerTask(FragmentActivity context, TouchImageView imageView, byte[] data) {
imageViewReference = new WeakReference<>(imageView);
this.data = data;
this.mContext = new WeakReference<>(context);
stream = new ByteArrayOutputStream();
}
public BitmapWorkerTask(FragmentActivity context, TouchImageView imageView, byte[] data, Bitmap bitmapImage, boolean isRotate, boolean isSave) {
imageViewReference = new WeakReference<>(imageView);
this.data = data;
this.mContext = new WeakReference<>(context);
this.isRotate = isRotate;
this.isSave = isSave;
this.bitmapImage = bitmapImage;
stream = new ByteArrayOutputStream();
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(mContext.get(), "", mContext.get().getString(R.string.processing_image), true);
progressDialog.show();
}
@Override
protected Bitmap doInBackground(Void... params) {
try {
if (null == bitmapImage){
Bitmap bitmap = null;
if (isRotate) {
bitmap = ImageManipulation.rotateImage(tempBitmap, 90);
tempBitmap = bitmap;
} else if (isSave) {
tempBitmap.compress(Bitmap.CompressFormat.JPEG, imgQuality, stream);
} else {
bitmap = Utils.byteToBitmap(data);
tempBitmap = bitmap;
}
return bitmap;
} else {
tempBitmap = bitmapImage;
return bitmapImage;
}
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(final Bitmap bitmap) {
super.onPostExecute(bitmap);
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
if (imageViewReference != null && bitmap != null) {
final TouchImageView imageView = imageViewReference.get();
if (imageView != null) {
imageView.setImageBitmap(bitmap);
imageView.rescalingImage();
}
}
if (isSave) {
byte[] _data = stream.toByteArray();
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putByteArray(BUND_KEY_IMAGE, _data);
intent.putExtras(bundle);
setResult(Activity.RESULT_OK, intent);
finish();
}
}
}
}

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/done_cancel_bar"
layout="@layout/crop__layout_done_cancel" />
<com.soundcloud.android.crop.CropImageView
android:id="@+id/crop_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:background="@drawable/crop__texture"
android:layout_below="@id/done_cancel_bar" />
</RelativeLayout>

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/taskHeader"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/fontColorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/thumbnail"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/circle_thumbnail"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/txtThumbnailCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="MA"
android:textColor="@color/fontColorWhite"
android:textSize="23dp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="MUHAMMAD AUDI"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/fontColorDarkGrey"
android:textSize="17dp"
android:textStyle="bold"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"/>
<ImageButton
android:id="@+id/callButtonAccount"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/call_button"
android:src="@drawable/ic_phone_color" />
</LinearLayout>
</LinearLayout>
<View style="@style/Divider" />
</LinearLayout>

View file

@ -0,0 +1,168 @@
package com.adins.mss.odr.catalogue;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.StrictMode;
import android.os.VibrationEffect;
import android.os.Vibrator;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.adins.mss.dao.MobileContentD;
import com.adins.mss.dao.MobileContentH;
import com.adins.mss.foundation.db.dataaccess.MobileContentDDataAccess;
import com.adins.mss.foundation.image.Utils;
import com.adins.mss.odr.R;
import com.adins.mss.odr.catalogue.imageslider.SliderIndicator;
import com.adins.mss.odr.news.NewsContentAdapter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import static android.content.Context.VIBRATOR_SERVICE;
/**
* Created by olivia.dg on 11/28/2017.
*/
public class PromoListAdapter extends RecyclerView.Adapter<PromoListAdapter.PromoViewHolder>{
private FragmentActivity activity;
private List<MobileContentH> objectsH;
public PromoListAdapter(FragmentActivity activity, List<MobileContentH> objects) {
this.activity = activity;
this.objectsH = objects;
}
public class PromoViewHolder extends RecyclerView.ViewHolder {
public final View mView;
private ImageView imageShare;
private ImageView image;
private TextView txtDesc;
private TextView txtName;
private ViewPager viewPager;
private NewsContentAdapter adapter;
private SliderIndicator mIndicator;
private LinearLayout mLinearLayout;
public PromoViewHolder(View itemView) {
super(itemView);
mView = itemView;
// image = (ImageView) itemView.findViewById(R.id.imgPromo);
imageShare = (ImageView) itemView.findViewById(R.id.imgShare);
txtDesc = (TextView) itemView.findViewById(R.id.txtDesc);
txtName = (TextView) itemView.findViewById(R.id.txtName);
viewPager = (ViewPager) itemView.findViewById(R.id.newsImage);
mLinearLayout = (LinearLayout) itemView.findViewById(R.id.pagesContainer);
}
}
@Override
public PromoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.promo_list_item, parent, false);
PromoViewHolder viewHolder = new PromoViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(final PromoViewHolder holder, final int position) {
// final Bitmap imagePromo = Utils.byteToBitmap(objectsH.get(position).getContent());
// holder.image.setImageBitmap(imagePromo);
String desc = objectsH.get(position).getContent_description();
String name = objectsH.get(position).getContent_name();
if(objectsH.get(position).getUuid_mobile_content_h()!=null){
List<MobileContentD> detailList = MobileContentDDataAccess.getAll(activity, objectsH.get(position).getUuid_mobile_content_h());
setupContent(holder, detailList);
}
holder.txtName.setText(name);
holder.txtDesc.setText(desc);
holder.imageShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= 26) {
((Vibrator) activity.getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(150,10));
} else {
((Vibrator) activity.getSystemService(VIBRATOR_SERVICE)).vibrate(150);
}
int position = holder.viewPager.getCurrentItem();
MobileContentD content = holder.adapter.objects.get(position);
// Get access to the URI for the bitmap
Bitmap imagePromo = Utils.byteToBitmap(content.getContent());
Uri bmpUri = getLocalBitmapUri(imagePromo);
if (bmpUri != null) {
// Construct a ShareIntent with link to image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/*");
// Launch sharing dialog for image
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
activity.startActivity(Intent.createChooser(shareIntent, "Share Image"));
}
}
});
}
@Override
public int getItemCount() {
if (objectsH == null || objectsH.size() == 0)
return 0;
else
return objectsH.size();
}
public Uri getLocalBitmapUri(Bitmap bitmapImage) {
// Extract Bitmap from ImageView drawable
Bitmap bmp = bitmapImage;
// Store image to default external storage directory
Uri bmpUri = null;
try {
// Use methods on Context to access package-specific directories on external storage.
// This way, you don't need to request external read/write permission.
// See https://youtu.be/5xVh-7ywKpE?t=25m25s
File file = new File(this.activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".jpg");
FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
// **Warning:** This will fail for API >= 24, use a FileProvider as shown below instead.
bmpUri = Uri.fromFile(file);
} catch (IOException e) {
e.printStackTrace();
}
return bmpUri;
}
private void setupContent(PromoViewHolder holder, List<MobileContentD> detailList) {
holder.adapter = new NewsContentAdapter(activity, detailList);
holder.viewPager.setAdapter(holder.adapter);
holder.mIndicator = new SliderIndicator(activity, holder.mLinearLayout, holder.viewPager, R.drawable.indicator_circle, false);
holder.mIndicator.setPageCount(detailList.size());
try {
holder.mIndicator.show();
} catch (Exception e) {
}
}
}

View file

@ -0,0 +1,36 @@
package com.adins.mss.foundation.print.rv;
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.adins.mss.base.R;
import com.adins.mss.dao.ReceiptVoucher;
/**
* Created by angga.permadi on 5/11/2016.
*/
public class RvNumberItem extends LinearLayout {
private View view;
public RvNumberItem(Context context) {
this(context, R.layout.spinner_style);
}
public RvNumberItem(Context context, int resource) {
super(context);
view = inflate(context, resource, this);
}
public void bind(ReceiptVoucher bean, int position) {
TextView tv = (TextView) view.findViewById(R.id.text_spin);
if (position == 0) {
tv.setVisibility(GONE);
} else {
tv.setVisibility(VISIBLE);
tv.setText(bean.getRv_number());
}
}
}