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,99 @@
package com.adins.mss.base.dynamicform.form.questions.viewholder;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.adins.mss.base.R;
import com.adins.mss.base.dynamicform.form.questions.ImageViewerActivity;
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.image.Utils;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.util.ArrayList;
public class ReviewLuOnlineQuestionViewHolder extends RecyclerView.ViewHolder {
private final TextView mQuestionLabel;
private final ImageView imgPhotos;
private final Activity mActivity;
private QuestionBean bean;
public OnQuestionClickListener listener;
public ReviewLuOnlineQuestionViewHolder(View itemView, FragmentActivity activity, OnQuestionClickListener listener) {
super(itemView);
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionTextLabel);
imgPhotos = (ImageView) itemView.findViewById(R.id.imgPhotoLuOnlineAnswer);
mActivity = activity;
this.listener = listener;
}
public void bind(final QuestionBean item, final int group, final int number) {
bean = item;
String qLabel = number + ". " + bean.getQuestion_label();
mQuestionLabel.setText(qLabel);
// Keep Data for not happen moving to Other Question because do Scrolling
final LinearLayout layoutListDocument = (LinearLayout) itemView.findViewById(R.id.layoutListDocument);
if (bean.getListImgByteArray() != null) {
// To avoid trigger many times add photos on 'layoutListDocument'
layoutListDocument.removeAllViews();
// Show all list document have been saved on QuestionBean
if (bean.getListImgByteArray().size() > 0) {
imgPhotos.setVisibility(View.GONE);
ArrayList<byte[]> beanListLuDocKeep = bean.getListImgByteArray();
for (int index = 0; index < beanListLuDocKeep.size(); index++) {
ImageView imgView = new ImageView(mActivity);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(200, 200);
final byte[] imageByteArray = beanListLuDocKeep.get(index);
final Bitmap bitmap = BitmapFactory.decodeByteArray(imageByteArray, 0, imageByteArray.length);
layoutParams.setMargins(2, 8, 2, 8);
layoutParams.gravity = Gravity.CENTER;
imgView.setLayoutParams(layoutParams);
imgView.setImageBitmap(bitmap);
layoutListDocument.addView(imgView);
imgView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Global.isViewer = true;
Bundle extras = new Bundle();
extras.putByteArray(ImageViewerActivity.BUND_KEY_IMAGE, imageByteArray);
extras.putInt(ImageViewerActivity.BUND_KEY_IMAGE_QUALITY, Utils.picQuality);
extras.putBoolean(ImageViewerActivity.BUND_KEY_IMAGE_ISVIEWER, Global.isViewer);
Intent intent = new Intent(mActivity, ImageViewerActivity.class);
intent.putExtras(extras);
mActivity.startActivity(intent);
}
});
}
layoutListDocument.setVisibility(View.VISIBLE);
}
} else {
layoutListDocument.setVisibility(View.GONE);
imgPhotos.setImageResource(android.R.drawable.ic_menu_gallery);
}
imgPhotos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null)
listener.onReviewClickListener(bean, group, number - 1);
}
});
}
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45">
<shape android:shape="rectangle">
<solid android:color="@color/tv_white" />
</shape>
</rotate>
</item>
</layer-list>

View file

@ -0,0 +1,264 @@
package com.adins.mss.foundation.db.dataaccess;
import android.content.Context;
import com.adins.mss.dao.DaoSession;
import com.adins.mss.dao.ReceiptVoucher;
import com.adins.mss.dao.ReceiptVoucherDao;
import com.adins.mss.foundation.db.DaoOpenHelper;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.ListIterator;
import de.greenrobot.dao.query.QueryBuilder;
public class ReceiptVoucherDataAccess {
public static final String STATUS_NEW = "N";
public static final String STATUS_USED = "U";
// private static DaoOpenHelper daoOpenHelper;
/**
* use to generate dao session that you can access modelDao
*
* @param context --> context from activity
* @return
*/
protected static DaoSession getDaoSession(Context context) {
/*if(daoOpenHelper==null){
// if(daoOpenHelper.getDaoSession()==null)
daoOpenHelper = new DaoOpenHelper(context);
}
DaoSession daoSeesion = daoOpenHelper.getDaoSession();
return daoSeesion;*/
return DaoOpenHelper.getDaoSession(context);
}
/**
* get receiptVoucher dao and you can access the DB
*
* @param context
* @return
*/
protected static ReceiptVoucherDao getReceiptVoucherDao(Context context) {
return getDaoSession(context).getReceiptVoucherDao();
}
/**
* Clear session, close db and set daoOpenHelper to null
*/
public static void closeAll() {
/*if(daoOpenHelper!=null){
daoOpenHelper.closeAll();
daoOpenHelper = null;
}*/
DaoOpenHelper.closeAll();
}
/**
* add receiptVoucher as entity
*
* @param context
* @param receiptVoucher
*/
public static void add(Context context, ReceiptVoucher receiptVoucher) {
getReceiptVoucherDao(context).insertInTx(receiptVoucher);
getDaoSession(context).clear();
}
/**
* add receiptVoucher as list entity
*
* @param context
* @param receiptVoucherList
*/
public static void add(Context context, List<ReceiptVoucher> receiptVoucherList) {
getReceiptVoucherDao(context).insertInTx(receiptVoucherList);
getDaoSession(context).clear();
}
/**
* delete all content in table.
*
* @param context
*/
public static void clean(Context context) {
getReceiptVoucherDao(context).deleteAll();
getDaoSession(context).clear();
}
/**
* @param context
* @param receiptVoucher
*/
public static void delete(Context context, ReceiptVoucher receiptVoucher) {
getReceiptVoucherDao(context).deleteInTx(receiptVoucher);
getDaoSession(context).clear();
}
/**
* delete all record by user
*
* @param context
* @param uuidUser
*/
public static void delete(Context context, String uuidUser) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser));
qb.build();
getReceiptVoucherDao(context).deleteInTx(qb.list());
getDaoSession(context).clear();
}
/**
* @param context
* @param receiptVoucher
*/
public static void update(Context context, ReceiptVoucher receiptVoucher) {
getReceiptVoucherDao(context).updateInTx(receiptVoucher);
getDaoSession(context).clear();
}
/**
* select * from table where uuid_user = param
*
* @param context
* @param uuidUser
* @return
*/
public static List<ReceiptVoucher> getAll(Context context, String uuidUser) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser));
qb.build();
return qb.list();
}
/**
* select * from table where uuid_task_h = param
*
* @param context
* @param uuidUser
* @param keyTaskH
* @return
*/
public static List<ReceiptVoucher> getAll(Context context, String uuidUser, String keyTaskH) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser),
ReceiptVoucherDao.Properties.Uuid_task_h.eq(keyTaskH));
qb.build();
return qb.list();
}
public static List<ReceiptVoucher> getByStatus(Context context, String uuidUser, String status) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser));
qb.where(ReceiptVoucherDao.Properties.Rv_status.eq(status));
qb.build();
return qb.list();
}
public static ReceiptVoucher getOne(Context context, String uuidUser, String uuid_rv_number) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser));
qb.where(ReceiptVoucherDao.Properties.Uuid_receipt_voucher.eq(uuid_rv_number));
qb.build();
if (qb.list().size() == 0)
return null;
return qb.list().get(0);
}
public static void updateToUsed(Context context, String uuidUser, ReceiptVoucher receiptVoucher) {
receiptVoucher.setRv_status(STATUS_USED);
receiptVoucher.setDtm_use(new Date());
if (getOne(context, uuidUser, receiptVoucher.getUuid_receipt_voucher()) != null) {
update(context, receiptVoucher);
} else {
receiptVoucher.setUuid_user(uuidUser);
add(context, receiptVoucher);
}
getDaoSession(context).clear();
}
public static void updateToNew(Context context, String uuidUser, String uuidReceiptVoucher) {
ReceiptVoucher receiptVoucher = getOne(context, uuidUser, uuidReceiptVoucher);
if (receiptVoucher != null) {
receiptVoucher.setRv_status(STATUS_NEW);
receiptVoucher.setDtm_use(new Date());
if (getOne(context, uuidUser, receiptVoucher.getUuid_receipt_voucher()) != null) {
update(context, receiptVoucher);
} else {
receiptVoucher.setUuid_user(uuidUser);
add(context, receiptVoucher);
}
getDaoSession(context).clear();
}
}
public static void updateToUsed(Context context, String uuidUser, String uuidReceiptVoucher) {
ReceiptVoucher receiptVoucher = getOne(context, uuidUser, uuidReceiptVoucher);
if (receiptVoucher != null) {
receiptVoucher.setRv_status(STATUS_USED);
receiptVoucher.setDtm_use(new Date());
if (getOne(context, uuidUser, receiptVoucher.getUuid_receipt_voucher()) != null) {
update(context, receiptVoucher);
} else {
receiptVoucher.setUuid_user(uuidUser);
add(context, receiptVoucher);
}
getDaoSession(context).clear();
}
}
public static Date getLastDate(Context context, String uuidUser) {
QueryBuilder<ReceiptVoucher> qb = getReceiptVoucherDao(context).queryBuilder();
qb.where(ReceiptVoucherDao.Properties.Uuid_user.eq(uuidUser));
qb.orderDesc(ReceiptVoucherDao.Properties.Dtm_crt);
qb.build();
if (qb.list() == null || qb.list().size() == 0) {
return null;
} else {
return qb.list().get(0).getDtm_crt();
}
}
public static void deleteReceiptVoucherByStatus(Context context, String uuidUser, String status) {
List<ReceiptVoucher> ReceiptVouchers = getByStatus(context, uuidUser, status);
if (ReceiptVouchers != null && ReceiptVouchers.size() > 0) {
for (ReceiptVoucher rv : ReceiptVouchers) {
delete(context, rv);
}
}
getDaoSession(context).clear();
}
public static void addNewReceiptVoucher(Context context, String uuidUser, List<ReceiptVoucher> receiptVouchers) {
List<ReceiptVoucher> usedReceiverVoucher = getByStatus(context, uuidUser, STATUS_USED);
List<String> usedUUID = new ArrayList<>();
for (ReceiptVoucher receiptVoucher : usedReceiverVoucher) {
usedUUID.add(receiptVoucher.getUuid_receipt_voucher());
}
ListIterator<ReceiptVoucher> rvIterator = receiptVouchers.listIterator();
while (rvIterator.hasNext()){
ReceiptVoucher rv = rvIterator.next();
rv.setRv_status(ReceiptVoucherDataAccess.STATUS_NEW);
rv.setUuid_user(uuidUser);
if (usedUUID.contains(rv.getUuid_receipt_voucher())){
rvIterator.remove();
}
}
ReceiptVoucherDataAccess.deleteReceiptVoucherByStatus(context, uuidUser, ReceiptVoucherDataAccess.STATUS_NEW);
ReceiptVoucherDataAccess.add(context, receiptVouchers);
getDaoSession(context).clear();
}
private static void addOrReplace(Context context, List<ReceiptVoucher> receiptVoucherList) {
getReceiptVoucherDao(context).insertOrReplaceInTx(receiptVoucherList);
getDaoSession(context).clear();
}
}

View file

@ -0,0 +1,93 @@
package com.adins.mss.coll.dashboardcollection.model;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.formatter.Tool;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CollResultDetail {
public static final int PTP_TYPE = 1;
public static final int COLLECTED_TYPE = 0;
public static final int FAILED_TYPE = 2;
private int type;
private String agrNo;
private String custName;
private String result;
private SimpleDateFormat dateFormatter;
private SimpleDateFormat dateParser;
public CollResultDetail(int type,String agrNo, String custName, String result) {
dateParser = new SimpleDateFormat(Global.DATE_STR_FORMAT1);
dateFormatter = new SimpleDateFormat(Global.DATE_STR_FORMAT3);
this.type = type;
this.agrNo = agrNo;
this.custName = custName;
this.result = result;
}
public CollResultDetail() {
dateParser = new SimpleDateFormat(Global.DATE_STR_FORMAT1);
dateFormatter = new SimpleDateFormat(Global.DATE_STR_FORMAT3);
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getAgrNo() {
return agrNo;
}
public void setAgrNo(String agrNo) {
this.agrNo = agrNo;
}
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public String getResult() {
if(type == COLLECTED_TYPE){
try{
double doubleVal = Double.valueOf(result);
return Tool.formatToCurrency(doubleVal);
} catch (NumberFormatException e){
e.printStackTrace();
FireCrash.log(e);
return "0";
}
}
else if(type == PTP_TYPE){
Date date = null;
try {
date = dateParser.parse(result);
} catch (ParseException e) {
e.printStackTrace();
FireCrash.log(e);
return "Invalid Date";
}
return dateFormatter.format(date);
}
return result;
}
public void setResult(String result) {
this.result = result;
}
}

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/checkin_layout"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<fragment
android:id="@+id/mapTagging"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_above="@+id/btnOK"
android:layout_alignParentTop="true"
class="com.google.android.gms.maps.SupportMapFragment"
android:tag="mapTagging" />
<ImageButton
android:id="@+id/btnRefresh"
android:layout_margin="10dp"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:elevation="5dp"
android:background="@drawable/button_background_round"
android:src="@drawable/ic_menu_refresh_white" />
<Button
android:id="@+id/btnOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="@drawable/button_background"
android:textColor="@color/fontColorWhite"
android:text="@string/btnOk" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,151 @@
package com.adins.mss.base.synchronize;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.dynamictheme.DynamicTheme;
import com.adins.mss.base.dynamictheme.ThemeUtility;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.formatter.Formatter;
import com.adins.mss.foundation.formatter.Tool;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
import com.adins.mss.foundation.sync.Synchronize;
import com.adins.mss.foundation.sync.SynchronizeItem;
import java.util.Calendar;
import java.util.Date;
/**
* Created by kusnendi.muhamad on 27/07/2017.
*/
public class SynchronizeView extends SynchronizeImpl implements Synchronize.SynchronizeListener {
public Bundle savedInstaceState;
TextView progressLabel;
TextView syncLabel;
ImageView ring1;
ImageView ring2;
RelativeLayout layout;
public SynchronizeView(Activity activity, Intent intentMainMenu, ProgressListener progressListener) {
super(activity, intentMainMenu, progressListener);
this.activity = activity;
}
public void setSavedInstaceState(Bundle savedInstaceState) {
this.savedInstaceState = savedInstaceState;
}
public void applyColorTheme(DynamicTheme colorSet){
int syncBgColor = Color.parseColor(ThemeUtility.getColorItemValue(colorSet,"bg_solid"));
ThemeUtility.setViewBackground(layout,syncBgColor);
ThemeUtility.setStatusBarColor(activity,syncBgColor);
}
public void initialize() {
progressLabel = (TextView) activity.findViewById(R.id.progressLabel);
syncLabel = (TextView) activity.findViewById(R.id.syncLabel);
layout = (RelativeLayout) activity.findViewById(R.id.synchronize_activity);
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application))
layout.setBackgroundResource(R.drawable.bg_sync_coll_new);
else if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application))
layout.setBackgroundResource(R.drawable.bg_sync_survey);
else if (Global.APPLICATION_ORDER.equalsIgnoreCase(application))
layout.setBackgroundResource(R.drawable.bg_sync_order);
ring1 = (ImageView) activity.findViewById(R.id.ring1);
ring2 = (ImageView) activity.findViewById(R.id.ring2);
Animation rotate = AnimationUtils.loadAnimation(activity, R.anim.rotate_anim);
Animation reverse = AnimationUtils.loadAnimation(activity, R.anim.rotate_reverse_anim);
ring1.startAnimation(rotate);
ring2.startAnimation(reverse);
TextView tvAppVersion = (TextView) activity.findViewById(R.id.contentVersion);
String versioning = activity.getString(R.string.app_name) + " v." + Global.APP_VERSION;
tvAppVersion.setText(versioning);
}
@Override
public void progressUpdated(float progress) {
if (!isSyncScheme && !isSyncQuestionSet && !isSyncLookup) {
syncLabel.setText(activity.getString(R.string.sync_scheme));
} else if (isSyncScheme && !isSyncQuestionSet && !isSyncLookup) {
syncLabel.setText(activity.getString(R.string.sync_question_set));
} else if (isSyncScheme && isSyncQuestionSet && !isSyncPaymentChannel && !isSyncLookup && !isSyncHoliday) {
syncLabel.setText(activity.getString(R.string.sync_channel));
} else if (isSyncScheme && isSyncQuestionSet && isSyncPaymentChannel && !isSyncLookup && !isSyncHoliday) {
syncLabel.setText(activity.getString(R.string.sync_lookup));
if (progress >= 100) {
isSyncLookup = true;
}
} else if (isSyncScheme && isSyncQuestionSet && isSyncPaymentChannel && isSyncLookup && !isSyncHoliday) {
syncLabel.setText(activity.getString(R.string.sync_holiday));
if (progress >= 100 && isHoliday) {
isSyncHoliday = true;
}
if (progress == -0.0 && isHoliday) {
isSyncHoliday = true;
}
}
if (progress > 100)
progress = 100;
if (progress != 0.0) {
progressLabel.setText((int) progress + "%");
} else {
progressLabel.setText("100%");
}
if ((syncMax == 0 || progress >= 100) && (!isFinish && isSyncLookup && isSyncHoliday && isSyncPaymentChannel)) {
saveLastSyncToDB();
// Submit Last Sync Success
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
Date date = Tool.getSystemDateTime();
String format = Global.DATE_TIME_SEC_MS_STR_FORMAT;
String dateNow = Formatter.formatDate(date, format);
SubmitSyncParamSuccess syncParamSuccess = new SubmitSyncParamSuccess(activity, uuidUser, dateNow);
syncParamSuccess.execute();
Intent timelineIntent = IntentMainMenu;
activity.startActivity(timelineIntent);
activity.finish();
isFinish = true;
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
String day = String.valueOf(Calendar.getInstance().get(Calendar.DATE));
String month = String.valueOf(Calendar.getInstance().get(Calendar.MONTH) + 1);
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
ObscuredSharedPreferences synchronizationPreference = ObscuredSharedPreferences.getPrefs(activity, SynchronizeImpl.SYNCHRONIZATION_PREFERENCE, Context.MODE_PRIVATE);
if (Global.APPLICATION_ORDER.equalsIgnoreCase(application)) {
synchronizationPreference.edit().putString("MOSyncDate", day + month + year).commit();
} else if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application)) {
synchronizationPreference.edit().putString("MSSyncDate", day + month + year).commit();
} else if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
synchronizationPreference.edit().putString("MCSyncDate", day + month + year).commit();
}
}
}
@Override
public void synchronizeFailed(SynchronizeItem syncItem,
HttpConnectionResult errorResult, int numOfRetries) {
sync.resumeSync();
}
}

View file

@ -0,0 +1,33 @@
package com.adins.mss.base.mainmenu;
import com.adins.mss.base.NewMainActivity;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.dynamicform.DynamicFormActivity;
import com.adins.mss.base.dynamicform.form.FragmentQuestion;
import com.adins.mss.constant.Global;
public class UpdateMenuGPS {
/**
*
*/
public static void SetMenuIcon() {
// TODO Auto-generated method stub
try {
NewMainActivity.updateMenuIcon(Global.isGPS);
} catch (Exception e) {
FireCrash.log(e);
}
try {
DynamicFormActivity.updateMenuIcon();
} catch (Exception e) {
FireCrash.log(e);
}
try {
FragmentQuestion.updateMenuIcon();
} catch (Exception e) {
FireCrash.log(e);
}
}
}

View file

@ -0,0 +1,150 @@
package com.adins.mss.base.checkout;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.util.Log;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.errorhandler.ErrorMessageHandler;
import com.adins.mss.base.errorhandler.IShowError;
import com.adins.mss.base.timeline.TimelineManager;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.LocationInfo;
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
import com.adins.mss.foundation.formatter.Formatter;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import com.adins.mss.foundation.image.ImageLoader;
import java.io.ByteArrayOutputStream;
import java.lang.ref.WeakReference;
public class CheckOutLocationTask extends AsyncTask<Void, Void, String> implements IShowError {
private static String messageSuccess = "Check Out location success : ";
private static String TAG = "CHECK OUT LOCATION";
LocationInfo locationInfo;
private ProgressDialog progressDialog;
private WeakReference<Context> context;
private String messageWait;
private String messageUnavaiableLocation;
private String[] address;
private byte[] bitmapArray;
private ErrorMessageHandler errorMessageHandler;
public CheckOutLocationTask(Context context, String msgWait, String messageUnavaiableLocation, LocationInfo locationInfo, String[] address) {
this.context = new WeakReference<Context>(context);
this.messageWait = msgWait;
this.messageUnavaiableLocation = messageUnavaiableLocation;
this.address = address;
this.locationInfo = locationInfo;
errorMessageHandler = new ErrorMessageHandler(this);
}
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(context.get(), "", this.messageWait, true);
}
@Override
protected String doInBackground(Void... params) {
String result = "";
String lat;
String lng;
lat = locationInfo.getLatitude();
lng = locationInfo.getLongitude();
if (locationInfo != null) {
String data = CheckOutManager.toLocationCheckOutString(locationInfo);
try {
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(context.get(), encrypt, decrypt);
HttpConnectionResult resultServer = httpConn.requestToServer(GlobalData.getSharedGlobalData().getURL_SUBMIT_TRACK(), data, Global.DEFAULTCONNECTIONTIMEOUT);
result = data;
try {
String image_url = "https://maps.googleapis.com/maps/api/staticmap?center=" + lat + "," + lng + "&zoom=15&size=720x300&maptype=roadmap&markers=color:red%7Clabel:O%7C" + lat + "," + lng;
ImageLoader imgLoader = new ImageLoader(context.get());
Bitmap bitmap = imgLoader.getBitmap(image_url);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, stream);
bitmapArray = stream.toByteArray();
} catch (Exception e) {
FireCrash.log(e);
}
//** debug version
if (Global.IS_DEV) {
Log.i(TAG, "check in " + locationInfo.toString());
}
} catch (Exception e) {
FireCrash.log(e);
if (Global.IS_DEV)
e.printStackTrace();
// System.out.println("cekinLocation "+e);
CheckOutManager.insertLocationCheckOutToDB(context.get(), locationInfo);
}
}
return result;
}
@Override
protected void onPostExecute(String result) {
if (progressDialog.isShowing()) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FireCrash.log(e);
}
}
if ("".equals(result)) {
errorMessageHandler.processError("INFO",messageUnavaiableLocation, ErrorMessageHandler.DIALOG_TYPE);
/*NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(context.get());
dialogBuilder.withTitle("INFO")
.withMessage(messageUnavaiableLocation)
.show();*/
} else {
// result sementara tidak hanya digunakan sebagai parameter suksestidaknya
String time = Formatter.formatDate(locationInfo.getHandset_time(), Global.TIME_STR_FORMAT);
String date = Formatter.formatDate(locationInfo.getHandset_time(), Global.DATE_STR_FORMAT3);
String message = "Time : " + time + "\nDate : " + date + "\n" + address[1];
String attdAddress = address[1];
// TimelineManager.insertTimeline(context, message, locationInfo.getLatitude(),
// locationInfo.getLongitude(), locationInfo.getUsr_crt(),
// locationInfo.getDtm_crt(), Global.TIMELINE_TYPE_CHECKOUT, bitmapArray);
TimelineManager.insertTimeline(context.get(), locationInfo, message, attdAddress, bitmapArray);
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(context.get());
dialogBuilder.withTitle("Check In Success")
.withMessage(message)
.show();
}
//** debug version
if (Global.IS_DEV) {
Log.i(TAG, "check in " + result);
}
}
@Override
public void showError(String errorSubject, String errorMsg, int notifType) {
}
}

View file

@ -0,0 +1,100 @@
package com.adins.mss.odr.accounts.adapter;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import com.adins.libs.nineoldandroids.view.ViewHelper;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
import com.adins.mss.odr.R;
/**
* Created by muhammad.aap on 11/30/2018.
*/
public class LeadHistoryHolder extends ExpandableRecyclerView.GroupViewHolder {
public ImageView expandedIndicator;
public TextView text;
public TextView text2;
public TextView text3;
private boolean expanded;
public LeadHistoryHolder(View view){
super(view);
expandedIndicator = (ImageView) itemView.findViewById(R.id.leadHistoryExpandedIndicator);
text = (TextView) itemView.findViewById(R.id.txtStatusTaskAcc);
text2 = (TextView) itemView.findViewById(R.id.txtProductAcc);
text3 = (TextView) itemView.findViewById(R.id.txtDateAcc);
}
public void bind(LeadHistory leadHistory){
setText(leadHistory.getLeadStatus());
setText2(leadHistory.getLeadProduct());
setText3(leadHistory.getLeadLastDate());
}
public void expand() {
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(200);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewHelper.setRotation(expandedIndicator, 180 * (float) (animation.getAnimatedValue()));
expandedIndicator.postInvalidate();
}
});
animator.start();
expanded = true;
}
public void collapse() {
ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(200);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewHelper.setRotation(expandedIndicator, 180 * (float) (animation.getAnimatedValue()));
expandedIndicator.postInvalidate();
}
});
animator.start();
expanded = false;
}
public void setExpanded(boolean expanded) {
ViewHelper.setRotation(expandedIndicator, expanded ? 180 : 0);
this.expanded = expanded;
}
@Override
public boolean isExpanded() {
return expanded;
}
public void setText(String t) {
text.setText(t);
}
public String getText() {
return text.getText().toString();
}
public void setText2(String t) {
text2.setText(t);
}
public String getText2() {
return text2.getText().toString();
}
public void setText3(String t) {
text3.setText(t);
}
public String getText3() {
return text3.getText().toString();
}
}

View file

@ -0,0 +1,10 @@
package com.adins.mss.foundation.sync.api;
/**
* Created by adityapurwa on 11/03/15.
*/
public interface SynchronizationCallback {
void onSuccess();
void onFailed();
}

View file

@ -0,0 +1,78 @@
package com.adins.libs.nineoldandroids.animation;
/**
* This class provides a simple callback mechanism to listeners that is synchronized with other
* animators in the system. There is no duration, interpolation, or object value-setting
* with this Animator. Instead, it is simply started and proceeds to send out events on every
* animation frame to its TimeListener (if set), with information about this animator,
* the total elapsed time, and the time since the last animation frame.
*
* @hide
*/
public class TimeAnimator extends ValueAnimator {
private TimeListener mListener;
private long mPreviousTime = -1;
@Override
boolean animationFrame(long currentTime) {
if (mPlayingState == STOPPED) {
mPlayingState = RUNNING;
if (mSeekTime < 0) {
mStartTime = currentTime;
} else {
mStartTime = currentTime - mSeekTime;
// Now that we're playing, reset the seek time
mSeekTime = -1;
}
}
if (mListener != null) {
long totalTime = currentTime - mStartTime;
long deltaTime = (mPreviousTime < 0) ? 0 : (currentTime - mPreviousTime);
mPreviousTime = currentTime;
mListener.onTimeUpdate(this, totalTime, deltaTime);
}
return false;
}
/**
* Sets a listener that is sent update events throughout the life of
* an animation.
*
* @param listener the listener to be set.
*/
public void setTimeListener(TimeListener listener) {
mListener = listener;
}
@Override
void animateValue(float fraction) {
// Noop
}
@Override
void initAnimation() {
// noop
}
/**
* Implementors of this interface can set themselves as update listeners
* to a <code>TimeAnimator</code> instance to receive callbacks on every animation
* frame to receive the total time since the animator started and the delta time
* since the last frame. The first time the listener is called, totalTime and
* deltaTime should both be zero.
*
* @hide
*/
public static interface TimeListener {
/**
* <p>Notifies listeners of the occurrence of another frame of the animation,
* along with information about the elapsed time.</p>
*
* @param animation The animator sending out the notification.
* @param totalTime The
*/
void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime);
}
}

View file

@ -0,0 +1,43 @@
package com.adins.mss.odr.catalogue.api;
import com.google.gson.annotations.SerializedName;
public class PromoCatalogBean{
@SerializedName("uuid_mobile_content_d") private String uuidMobileContentD;
@SerializedName("uuid_mobile_content_h") private String uuidMobileContentH;
@SerializedName("content_name") private String contentName;
@SerializedName("content_description") private String contentDescription;
@SerializedName("content") private String content;
public String getUuidMobileContentD() {
return uuidMobileContentD;
}
public void setUuidMobileContentD(String uuidMobileContentD) {
this.uuidMobileContentD = uuidMobileContentD;
}
public String getUuidMobileContentH() {
return uuidMobileContentH;
}
public void setUuidMobileContentH(String uuidMobileContentH) {
this.uuidMobileContentH = uuidMobileContentH;
}
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getContentDescription() {
return contentDescription;
}
public void setContentDescription(String contentDescription) {
this.contentDescription = contentDescription;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

View file

@ -0,0 +1,44 @@
package com.adins.mss.base.dynamicform;
import com.adins.mss.dao.Scheme;
import java.io.Serializable;
import java.util.Date;
public class FormBean extends Scheme implements Serializable {
public FormBean(Scheme scheme) {
if (scheme == null)
throw new IllegalArgumentException("Scheme == null !");
setUuid_scheme(scheme.getUuid_scheme());
setScheme_description(scheme.getScheme_description());
setScheme_last_update(scheme.getScheme_last_update());
setIs_printable(scheme.getIs_printable());
setForm_id(scheme.getForm_id());
setUsr_crt(scheme.getUsr_crt());
setIs_preview_server(scheme.getIs_preview_server());
setDtm_crt(scheme.getDtm_crt());
setUsr_upd(scheme.getUsr_upd());
setDtm_upd(scheme.getDtm_upd());
setForm_type(scheme.getForm_type());
setIs_active(scheme.getIs_active());
setForm_version(scheme.getForm_version());//new
}
public FormBean(String id, Date lastUpdate, String isPrintable) {
setUuid_scheme(id);
setScheme_last_update(lastUpdate);
setIs_printable(isPrintable);
}
public void setPreviewServer(String bool) {
setIs_preview_server(bool);
}
public String toString() {
return getForm_id() + " - " + getScheme_description();
}
}