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,103 @@
package com.adins.mss.dao;
import com.adins.mss.base.util.ExcludeFromGson;
import com.google.gson.annotations.SerializedName;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table "MS_HOLIDAY".
*/
public class Holiday {
/** Not-null value. */
@SerializedName("uuid_holiday")
private String uuid_holiday;
@SerializedName("h_date")
private java.util.Date h_date;
@SerializedName("h_desc")
private String h_desc;
@SerializedName("flag_holiday")
private String flag_holiday;
@SerializedName("dtm_upd")
private java.util.Date dtm_upd;
@SerializedName("flag_day")
private String flag_day;
@SerializedName("branch")
private String branch;
public Holiday() {
}
public Holiday(String uuid_holiday) {
this.uuid_holiday = uuid_holiday;
}
public Holiday(String uuid_holiday, java.util.Date h_date, String h_desc, String flag_holiday, java.util.Date dtm_upd, String flag_day, String branch) {
this.uuid_holiday = uuid_holiday;
this.h_date = h_date;
this.h_desc = h_desc;
this.flag_holiday = flag_holiday;
this.dtm_upd = dtm_upd;
this.flag_day = flag_day;
this.branch = branch;
}
/** Not-null value. */
public String getUuid_holiday() {
return uuid_holiday;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setUuid_holiday(String uuid_holiday) {
this.uuid_holiday = uuid_holiday;
}
public java.util.Date getH_date() {
return h_date;
}
public void setH_date(java.util.Date h_date) {
this.h_date = h_date;
}
public String getH_desc() {
return h_desc;
}
public void setH_desc(String h_desc) {
this.h_desc = h_desc;
}
public String getFlag_holiday() {
return flag_holiday;
}
public void setFlag_holiday(String flag_holiday) {
this.flag_holiday = flag_holiday;
}
public java.util.Date getDtm_upd() {
return dtm_upd;
}
public void setDtm_upd(java.util.Date dtm_upd) {
this.dtm_upd = dtm_upd;
}
public String getFlag_day() {
return flag_day;
}
public void setFlag_day(String flag_day) {
this.flag_day = flag_day;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
}

View file

@ -0,0 +1,103 @@
package com.adins.mss.dao;
import com.adins.mss.base.util.ExcludeFromGson;
import com.google.gson.annotations.SerializedName;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table "TR_LASTSYNC".
*/
public class LastSync {
/** Not-null value. */
@SerializedName("uuid_last_sync")
private String uuid_last_sync;
@SerializedName("dtm_lastsync")
private java.util.Date dtm_lastsync;
@SerializedName("dtm_req")
private String dtm_req;
@SerializedName("data")
private String data;
@SerializedName("listOfLOV")
private String listOfLOV;
@SerializedName("flag")
private String flag;
@SerializedName("is_send")
private Integer is_send;
public LastSync() {
}
public LastSync(String uuid_last_sync) {
this.uuid_last_sync = uuid_last_sync;
}
public LastSync(String uuid_last_sync, java.util.Date dtm_lastsync, String dtm_req, String data, String listOfLOV, String flag, Integer is_send) {
this.uuid_last_sync = uuid_last_sync;
this.dtm_lastsync = dtm_lastsync;
this.dtm_req = dtm_req;
this.data = data;
this.listOfLOV = listOfLOV;
this.flag = flag;
this.is_send = is_send;
}
/** Not-null value. */
public String getUuid_last_sync() {
return uuid_last_sync;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setUuid_last_sync(String uuid_last_sync) {
this.uuid_last_sync = uuid_last_sync;
}
public java.util.Date getDtm_lastsync() {
return dtm_lastsync;
}
public void setDtm_lastsync(java.util.Date dtm_lastsync) {
this.dtm_lastsync = dtm_lastsync;
}
public String getDtm_req() {
return dtm_req;
}
public void setDtm_req(String dtm_req) {
this.dtm_req = dtm_req;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getListOfLOV() {
return listOfLOV;
}
public void setListOfLOV(String listOfLOV) {
this.listOfLOV = listOfLOV;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public Integer getIs_send() {
return is_send;
}
public void setIs_send(Integer is_send) {
this.is_send = is_send;
}
}

View file

@ -0,0 +1,32 @@
package com.adins.mss.base.depositreport;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by dian.ina on 02/09/2015.
*/
public class DepositReportBatchIdRequest extends MssRequestType {
@SerializedName("listTaskID")
private List<String> listTaskID;
@SerializedName("flag")
private List<String> flag;
public List<String> getListTaskID() {
return listTaskID;
}
public void setListTaskID(List<String> listTaskID) {
this.listTaskID = listTaskID;
}
public List<String> getFlag() {
return flag;
}
public void setFlag(List<String> flag) {
this.flag = flag;
}
}

View file

@ -0,0 +1,12 @@
package com.adins.mss.coll.interfaces;
import androidx.annotation.Keep;
/**
* Created by kusnendi.muhamad on 31/07/2017.
*/
public interface ClosingTaskInterface {
@Keep
public void closingTask();
}

View file

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View file

@ -0,0 +1,293 @@
package com.adins.libs.nineoldandroids.view;
import android.view.View;
import static com.adins.libs.nineoldandroids.view.animation.AnimatorProxy.NEEDS_PROXY;
import static com.adins.libs.nineoldandroids.view.animation.AnimatorProxy.wrap;
public final class ViewHelper {
private ViewHelper() {
}
public static float getAlpha(View view) {
return NEEDS_PROXY ? wrap(view).getAlpha() : Honeycomb.getAlpha(view);
}
public static void setAlpha(View view, float alpha) {
if (NEEDS_PROXY) {
wrap(view).setAlpha(alpha);
} else {
Honeycomb.setAlpha(view, alpha);
}
}
public static float getPivotX(View view) {
return NEEDS_PROXY ? wrap(view).getPivotX() : Honeycomb.getPivotX(view);
}
public static void setPivotX(View view, float pivotX) {
if (NEEDS_PROXY) {
wrap(view).setPivotX(pivotX);
} else {
Honeycomb.setPivotX(view, pivotX);
}
}
public static float getPivotY(View view) {
return NEEDS_PROXY ? wrap(view).getPivotY() : Honeycomb.getPivotY(view);
}
public static void setPivotY(View view, float pivotY) {
if (NEEDS_PROXY) {
wrap(view).setPivotY(pivotY);
} else {
Honeycomb.setPivotY(view, pivotY);
}
}
public static float getRotation(View view) {
return NEEDS_PROXY ? wrap(view).getRotation() : Honeycomb.getRotation(view);
}
public static void setRotation(View view, float rotation) {
if (NEEDS_PROXY) {
wrap(view).setRotation(rotation);
} else {
Honeycomb.setRotation(view, rotation);
}
}
public static float getRotationX(View view) {
return NEEDS_PROXY ? wrap(view).getRotationX() : Honeycomb.getRotationX(view);
}
public static void setRotationX(View view, float rotationX) {
if (NEEDS_PROXY) {
wrap(view).setRotationX(rotationX);
} else {
Honeycomb.setRotationX(view, rotationX);
}
}
public static float getRotationY(View view) {
return NEEDS_PROXY ? wrap(view).getRotationY() : Honeycomb.getRotationY(view);
}
public static void setRotationY(View view, float rotationY) {
if (NEEDS_PROXY) {
wrap(view).setRotationY(rotationY);
} else {
Honeycomb.setRotationY(view, rotationY);
}
}
public static float getScaleX(View view) {
return NEEDS_PROXY ? wrap(view).getScaleX() : Honeycomb.getScaleX(view);
}
public static void setScaleX(View view, float scaleX) {
if (NEEDS_PROXY) {
wrap(view).setScaleX(scaleX);
} else {
Honeycomb.setScaleX(view, scaleX);
}
}
public static float getScaleY(View view) {
return NEEDS_PROXY ? wrap(view).getScaleY() : Honeycomb.getScaleY(view);
}
public static void setScaleY(View view, float scaleY) {
if (NEEDS_PROXY) {
wrap(view).setScaleY(scaleY);
} else {
Honeycomb.setScaleY(view, scaleY);
}
}
public static float getScrollX(View view) {
return NEEDS_PROXY ? wrap(view).getScrollX() : Honeycomb.getScrollX(view);
}
public static void setScrollX(View view, int scrollX) {
if (NEEDS_PROXY) {
wrap(view).setScrollX(scrollX);
} else {
Honeycomb.setScrollX(view, scrollX);
}
}
public static float getScrollY(View view) {
return NEEDS_PROXY ? wrap(view).getScrollY() : Honeycomb.getScrollY(view);
}
public static void setScrollY(View view, int scrollY) {
if (NEEDS_PROXY) {
wrap(view).setScrollY(scrollY);
} else {
Honeycomb.setScrollY(view, scrollY);
}
}
public static float getTranslationX(View view) {
return NEEDS_PROXY ? wrap(view).getTranslationX() : Honeycomb.getTranslationX(view);
}
public static void setTranslationX(View view, float translationX) {
if (NEEDS_PROXY) {
wrap(view).setTranslationX(translationX);
} else {
Honeycomb.setTranslationX(view, translationX);
}
}
public static float getTranslationY(View view) {
return NEEDS_PROXY ? wrap(view).getTranslationY() : Honeycomb.getTranslationY(view);
}
public static void setTranslationY(View view, float translationY) {
if (NEEDS_PROXY) {
wrap(view).setTranslationY(translationY);
} else {
Honeycomb.setTranslationY(view, translationY);
}
}
public static float getX(View view) {
return NEEDS_PROXY ? wrap(view).getX() : Honeycomb.getX(view);
}
public static void setX(View view, float x) {
if (NEEDS_PROXY) {
wrap(view).setX(x);
} else {
Honeycomb.setX(view, x);
}
}
public static float getY(View view) {
return NEEDS_PROXY ? wrap(view).getY() : Honeycomb.getY(view);
}
public static void setY(View view, float y) {
if (NEEDS_PROXY) {
wrap(view).setY(y);
} else {
Honeycomb.setY(view, y);
}
}
private static final class Honeycomb {
static float getAlpha(View view) {
return view.getAlpha();
}
static void setAlpha(View view, float alpha) {
view.setAlpha(alpha);
}
static float getPivotX(View view) {
return view.getPivotX();
}
static void setPivotX(View view, float pivotX) {
view.setPivotX(pivotX);
}
static float getPivotY(View view) {
return view.getPivotY();
}
static void setPivotY(View view, float pivotY) {
view.setPivotY(pivotY);
}
static float getRotation(View view) {
return view.getRotation();
}
static void setRotation(View view, float rotation) {
view.setRotation(rotation);
}
static float getRotationX(View view) {
return view.getRotationX();
}
static void setRotationX(View view, float rotationX) {
view.setRotationX(rotationX);
}
static float getRotationY(View view) {
return view.getRotationY();
}
static void setRotationY(View view, float rotationY) {
view.setRotationY(rotationY);
}
static float getScaleX(View view) {
return view.getScaleX();
}
static void setScaleX(View view, float scaleX) {
view.setScaleX(scaleX);
}
static float getScaleY(View view) {
return view.getScaleY();
}
static void setScaleY(View view, float scaleY) {
view.setScaleY(scaleY);
}
static float getScrollX(View view) {
return view.getScrollX();
}
static void setScrollX(View view, int scrollX) {
view.setScrollX(scrollX);
}
static float getScrollY(View view) {
return view.getScrollY();
}
static void setScrollY(View view, int scrollY) {
view.setScrollY(scrollY);
}
static float getTranslationX(View view) {
return view.getTranslationX();
}
static void setTranslationX(View view, float translationX) {
view.setTranslationX(translationX);
}
static float getTranslationY(View view) {
return view.getTranslationY();
}
static void setTranslationY(View view, float translationY) {
view.setTranslationY(translationY);
}
static float getX(View view) {
return view.getX();
}
static void setX(View view, float x) {
view.setX(x);
}
static float getY(View view) {
return view.getY();
}
static void setY(View view, float y) {
view.setY(y);
}
}
}

View file

@ -0,0 +1,598 @@
package com.adins.mss.base.dynamicform.newlead;
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.appcompat.widget.AppCompatSpinner;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.NewMainActivity;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.dynamicform.FormBean;
import com.adins.mss.base.dynamicform.JsonRequestOpenStartTask;
import com.adins.mss.base.dynamicform.QuestionSetTask;
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
import com.adins.mss.base.todo.form.JsonRequestScheme;
import com.adins.mss.base.todo.form.JsonResponseScheme;
import com.adins.mss.base.todolist.ToDoList;
import com.adins.mss.base.util.GsonHelper;
import com.adins.mss.base.util.Utility;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.Account;
import com.adins.mss.dao.Scheme;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.formatter.Tool;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import org.acra.ACRA;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import de.greenrobot.dao.DaoException;
/**
* Created by olivia.dg on 11/22/2017.
*/
public class NewLeadFragment extends Fragment {
public static final String SURVEY_MODE = "com.adins.mss.base.dynamicform.newlead.SURVEY_MODE";
public static final String SURVEY_HEADER = "com.adins.mss.base.dynamicform.newlead.SURVEY_HEADER";
public static final String SURVEY_UUID = "com.adins.mss.base.dynamicform.newlead.SURVEY_UUID";
public static final String CUSTOMER_NOTES = "com.adins.mss.base.dynamicform.newlead.CUSTOMER_NOTES";
public static final String UUID_ACCOUNT = "com.adins.mss.base.dynamicform.newlead.UUID_ACCOUNT";
private AppCompatSpinner spinner;
private TextView txtNotes;
private Button btnStart;
private Button btnView;
private List<Account> accountList;
public static SurveyHeaderBean header;
private Bundle bundleParams;
private Context context;
Scheme lastUpdateScheme;
private CheckScheme checkScheme;
public static Boolean isEditable=false;
public List<TaskH> listTaskH;
public ToDoList toDoList;
private RefreshBackgroundTask backgroundTask;
public static boolean viewTask = false;
private FirebaseAnalytics screenName;
public static NewLeadFragment create(Bundle data) {
NewLeadFragment fragment = new NewLeadFragment();
fragment.setArguments(data);
Global.IS_NEWLEAD = data.getBoolean(Global.BUND_KEY_IS_NEWLEAD);
return fragment;
}
public static NewLeadFragment create(SurveyHeaderBean header) {
NewLeadFragment.header = null;
Bundle bundle = new Bundle();
bundle.putString(UUID_ACCOUNT, header.getUuid_account());
bundle.putString(CUSTOMER_NOTES, header.getNotes());
String status = header.getStatus();
int mode = 0;
if(status.equals(TaskHDataAccess.STATUS_SEND_SAVEDRAFT)||
status.equals(TaskHDataAccess.STATUS_SEND_DOWNLOAD)||
status.equals(TaskHDataAccess.STATUS_SEND_PENDING)||
status.equals(TaskHDataAccess.STATUS_SEND_UPLOADING)||
status.equals(TaskHDataAccess.STATUS_TASK_APPROVAL_DOWNLOAD)||
status.equals(TaskHDataAccess.STATUS_TASK_VERIFICATION_DOWNLOAD))
mode = Global.MODE_SURVEY_TASK;
else if(status.equals(TaskHDataAccess.STATUS_SEND_SENT)||
status.equals(TaskHDataAccess.STATUS_SEND_REJECTED)){
mode = Global.MODE_VIEW_SENT_SURVEY;
}else if (status.equals(TaskHDataAccess.STATUS_TASK_VERIFICATION)||
status.equals(TaskHDataAccess.STATUS_TASK_APPROVAL)) {
mode = Global.MODE_SURVEY_TASK;
}
else{
if(header.getStatus().equals(TaskHDataAccess.STATUS_SEND_INIT)&&
header.getPriority()!=null){
mode = Global.MODE_SURVEY_TASK;
}else mode = Global.MODE_NEW_SURVEY;
}
bundle.putInt(SURVEY_MODE, mode);
bundle.putSerializable(SURVEY_HEADER, header);
bundle.putString(SURVEY_UUID, header.getUuid_scheme());
bundle.putBoolean(Global.BUND_KEY_IS_NEWLEAD, false);
return create(bundle);
}
@Override
public void onAttach(Context activity) {
super.onAttach(activity);
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
setHasOptionsMenu(true);
Utility.freeMemory();
bundleParams = getArguments();
context = activity;
header = (SurveyHeaderBean) bundleParams.getSerializable(SURVEY_HEADER);
if ((bundleParams.getInt(SURVEY_MODE) != Global.MODE_VIEW_SENT_SURVEY)) {
checkScheme = new CheckScheme();
checkScheme.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
else{
Global.getSharedGlobal().setSchemeIsChange(false);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_lead, container, false);
screenName = FirebaseAnalytics.getInstance(getActivity());
getActivity().findViewById(R.id.search).setVisibility(View.GONE);
getActivity().findViewById(R.id.spinner).setVisibility(View.GONE);
getActivity().setTitle(getString(R.string.title_mn_newlead));
spinner = (AppCompatSpinner) view.findViewById(R.id.spinnerAccount);
txtNotes = (TextView) view.findViewById(R.id.txtNotes);
btnStart = (Button) view.findViewById(R.id.btnStart);
btnView = (Button) view.findViewById(R.id.btnViewTask);
btnStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isEditable = false;
GlobalData.getSharedGlobalData().setDoingTask(true);
gotoNextDynamicForm();
}
});
btnView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Global.getSharedGlobal().setIsViewer(true);
viewTask = true;
header = (SurveyHeaderBean) bundleParams.getSerializable(SURVEY_HEADER);
cancelCheckScheme();
Bundle extras = new Bundle();
extras.putInt(Global.BUND_KEY_MODE_SURVEY, bundleParams.getInt(SURVEY_MODE));
extras.putSerializable(Global.BUND_KEY_SURVEY_BEAN, bundleParams.getSerializable(SURVEY_HEADER));
QuestionSetTask task =new QuestionSetTask(getActivity(), extras);
task.execute();
}
});
header = (SurveyHeaderBean) bundleParams.getSerializable(SURVEY_HEADER);
if (bundleParams.getInt(SURVEY_MODE) == Global.MODE_SURVEY_TASK ||
bundleParams.getInt(SURVEY_MODE) == Global.MODE_VIEW_SENT_SURVEY) {
if(!(TaskHDataAccess.STATUS_SEND_INIT.equals(header.getIs_prepocessed()) &&
TaskHDataAccess.STATUS_SEND_SAVEDRAFT.equals(header.getStatus()))) {
txtNotes.setText(header.getNotes());
spinner.setEnabled(false);
txtNotes.setEnabled(false);
}
}
if(TaskHDataAccess.STATUS_SEND_PENDING.equals(header.getStatus())||
TaskHDataAccess.STATUS_SEND_UPLOADING.equals(header.getStatus())){
btnStart.setVisibility(View.GONE);
}
if(header.getPriority()!=null&&header.getPriority().length()>0){
if(header.getOpen_date()==null){
header.setOpen_date(Tool.getSystemDateTime());
new SendOpenReadTaskH(getActivity(), header).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
toDoList = new ToDoList(getActivity());
listTaskH = toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, "");
isEditable = false;
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
accountList = new ArrayList<>();
accountList.clear();
List<Account> listAcc = AccountDataAccess.getAll(getActivity());
if (listAcc != null)
accountList.addAll(listAcc);
AccountAdapter accountSpinner = new AccountAdapter(getContext(), R.layout.spinner_style2, accountList);
spinner.setAdapter(accountSpinner);
if (bundleParams.getInt(SURVEY_MODE) == Global.MODE_SURVEY_TASK ||
bundleParams.getInt(SURVEY_MODE) == Global.MODE_VIEW_SENT_SURVEY) {
if(!(TaskHDataAccess.STATUS_SEND_INIT.equals(header.getIs_prepocessed()) &&
TaskHDataAccess.STATUS_SEND_SAVEDRAFT.equals(header.getStatus()))) {
Account account = AccountDataAccess.getOne(getActivity(), header.getUuid_account());
spinner.setSelection(accountList.indexOf(account));
txtNotes.setText(header.getNotes());
}
}
if (bundleParams.getInt(SURVEY_MODE) == Global.MODE_VIEW_SENT_SURVEY) {
btnStart.setVisibility(View.GONE);
btnView.setVisibility(View.VISIBLE);
}
}
@Override
public void onResume(){
super.onResume();
//Set Firebase screen name
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_new_lead), null);
getActivity().findViewById(R.id.search).setVisibility(View.GONE);
getActivity().findViewById(R.id.spinner).setVisibility(View.GONE);
getActivity().setTitle(getString(R.string.title_mn_newlead));
if (listTaskH != null) {
initiateRefresh();
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
Utility.freeMemory();
}
@Override
public void onPause() {
super.onPause();
cancelCheckScheme();
}
private void gotoNextDynamicForm() {
Global.getSharedGlobal().setIsViewer(false);
if(bundleParams.getInt(SURVEY_MODE) != Global.MODE_VIEW_SENT_SURVEY || (bundleParams.getInt(SURVEY_MODE) == Global.MODE_VIEW_SENT_SURVEY && isEditable)) {
cancelCheckScheme();
Scheme scheme = null;
try {
String uuidScheme = header.getUuid_scheme();
scheme = SchemeDataAccess.getOne(getActivity(), uuidScheme);
} catch (DaoException e) {
ACRA.getErrorReporter().putCustomData("errorGetScheme", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetSchemeTime", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Get Scheme"));
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorGetScheme", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetSchemeTime", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Get Scheme"));
}
if(scheme!=null) {
header.setScheme(scheme);
FormBean formBean = new FormBean(scheme);
if(lastUpdateScheme!=null){
formBean = new FormBean(lastUpdateScheme);
}
Account account = (Account) spinner.getSelectedItem();
String uuidAccount = account.getUuid_account();
header.setUuid_account(uuidAccount);
header.setNotes(txtNotes.getText().toString());
if (header.getStart_date() == null) {
if (header.getPriority() != null && header.getPriority().length() > 0) {
} else {
header.setStart_date(Tool.getSystemDateTime());
}
}
header.setForm(formBean);
header.setIs_preview_server(formBean.getIs_preview_server());
Bundle extras = new Bundle();
if(isEditable){
bundleParams.putInt(SURVEY_MODE, Global.MODE_SURVEY_TASK);
header.setStatus(TaskHDataAccess.STATUS_SEND_DOWNLOAD);
}
extras.putInt(Global.BUND_KEY_MODE_SURVEY, bundleParams.getInt(SURVEY_MODE));
extras.putString(Global.BUND_KEY_UUID_TASKH, header.getUuid_task_h());
extras.putSerializable(Global.BUND_KEY_SURVEY_BEAN, header);
extras.putSerializable(Global.BUND_KEY_FORM_BEAN, formBean);
QuestionSetTask task = new QuestionSetTask(getActivity(), extras);
task.execute();
onDetach();
}else{
Toast.makeText(getActivity(), getActivity().getString(R.string.request_error),
Toast.LENGTH_SHORT).show();
doBack();
}
}
}
private void initiateRefresh() {
cancelRefreshTask();
backgroundTask = new RefreshBackgroundTask();
backgroundTask.execute();
}
private void cancelRefreshTask(){
if(backgroundTask!=null){
backgroundTask.cancel(true);
backgroundTask=null;
}
}
public class CheckScheme extends AsyncTask<Void, Void, Boolean>{
@Override
protected Boolean doInBackground(Void... params) {
try {
String uuidScheme = header.getUuid_scheme();
Scheme schema = SchemeDataAccess.getOne(getActivity(), uuidScheme);
if(schema!=null){
JsonRequestScheme requestScheme = new JsonRequestScheme();
requestScheme.setAudit(GlobalData.getSharedGlobalData().getAuditData());
requestScheme.setUuid_user(GlobalData.getSharedGlobalData().getUser().getUuid_user());
requestScheme.setUuid_scheme(schema.getUuid_scheme());
requestScheme.setTask(Global.TASK_GETONE);
String json = GsonHelper.toJson(requestScheme);
String url = GlobalData.getSharedGlobalData().getURL_GET_SCHEME();
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
HttpConnectionResult serverResult = null;
//Firebase Performance Trace HTTP Request
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, json);
try {
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
Utility.metricStop(networkMetric, serverResult);
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat request to Server"));
if(Global.IS_DEV)
e.printStackTrace();
}
if(serverResult!=null && serverResult.isOK()){
try {
String result = serverResult.getResult();
JsonResponseScheme responseScheme = GsonHelper.fromJson(result, JsonResponseScheme.class);
List<Scheme> schemes = responseScheme.getListScheme();
Scheme scheme= schemes.get(0);
try {
Date new_last_update = scheme.getScheme_last_update();
Date temp_last_update = Global.TempScheme.get(scheme.getUuid_scheme());
lastUpdateScheme = scheme;
Global.getSharedGlobal().setSchemeIsChange(new_last_update.after(temp_last_update));
} catch (Exception e) {
FireCrash.log(e);
}
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorGetScheme", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetSchemeTime", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Get Scheme"));
Global.getSharedGlobal().setSchemeIsChange(false);
}
}
else{
Global.getSharedGlobal().setSchemeIsChange(false);
}
}
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorGetScheme", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetSchemeTime", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Get Scheme"));
Global.getSharedGlobal().setSchemeIsChange(false);
}
return true;
}
@Override
protected void onCancelled() {
super.onCancelled();
Global.getSharedGlobal().setSchemeIsChange(false);
}
}
private class RefreshBackgroundTask extends AsyncTask<Void, Void, List<TaskH>> {
static final int TASK_DURATION = 2 * 1000;
@Override
protected List<TaskH> doInBackground(Void... params) {
try {
Thread.sleep(TASK_DURATION);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
listTaskH.clear();
listTaskH.addAll(toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, ""));
ToDoList.setListOfSurveyStatus(null);
List<SurveyHeaderBean> list = new ArrayList<>();
for(TaskH h:listTaskH){
list.add(new SurveyHeaderBean(h));
}
ToDoList.setListOfSurveyStatus(list);
return listTaskH;
}
@Override
protected void onCancelled() {
super.onCancelled();
}
@Override
protected void onPostExecute(List<TaskH> result) {
super.onPostExecute(result);
}
}
public static class SendOpenReadTaskH extends AsyncTask<Void, Void, Void>{
private TaskH taskH;
private SurveyHeaderBean bean;
private Context context;
private Activity activity;
public SendOpenReadTaskH(Activity activity, SurveyHeaderBean bean){
this.bean=bean;
this.context=activity;
this.activity =activity;
}
@Override
protected Void doInBackground(Void... arg0) {
if(Tool.isInternetconnected(context)) {
taskH = bean.getTaskH();
try {
if(null==taskH.getFlag()){
taskH.setFlag("");
}
} catch (NullPointerException e){
taskH.setFlag("");
}
if(taskH.getFlag().equalsIgnoreCase("")) {
JsonRequestOpenStartTask task = new JsonRequestOpenStartTask();
task.setAudit(GlobalData.getSharedGlobalData().getAuditData());
task.addImeiAndroidIdToUnstructured();
task.setTaskH(taskH);
String json = GsonHelper.toJson(task);
String url = GlobalData.getSharedGlobalData().getURL_SUBMITOPENREADTASK();
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
HttpConnectionResult serverResult = null;
//Firebase Performance Trace HTTP Request
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, json);
try {
serverResult = httpConn.requestToServer(url, json);
Utility.metricStop(networkMetric, serverResult);
String response = serverResult.getResult();
MssResponseType responseType = GsonHelper.fromJson(response, MssResponseType.class);
if (responseType.getStatus().getCode() == 0) {
try {
TaskHDataAccess.addOrReplace(context, taskH);
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat convert json dari Server dan addOrReplace taskH"));
}
}
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errorRequestToServer", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorRequestToServer", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat request to server"));
if (Global.IS_DEV)
e.printStackTrace();
}
}
}
return null;
}
}
public class AccountAdapter extends ArrayAdapter<Account> {
private Context context;
private List<Account> values;
public AccountAdapter(Context context, int resource, List<Account> objects) {
super(context, resource, objects);
this.context = context;
this.values = objects;
}
@Override
public int getCount() {
return values.size();
}
@Override
public Account getItem(int position) {
return values.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
TextView label = (TextView) view.findViewById(R.id.text_spin);
label.setText(values.get(position).getAccount_name());
return label;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.spinner_style, parent, false);
TextView label = (TextView) view.findViewById(R.id.text_spin);
label.setText(values.get(position).getAccount_name());
return label;
}
}
public static void doBack(){
try {
if(NewMainActivity.fragmentManager.getBackStackEntryCount()>0) {
NewMainActivity.fragmentManager.popBackStack();
GlobalData.getSharedGlobalData().setDoingTask(false);
}
} catch (Exception e) {
ACRA.getErrorReporter().putCustomData("errordDoBack", e.getMessage());
ACRA.getErrorReporter().putCustomData("errordDoBack", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception do back in Customer Fragment"));
}
}
public void cancelCheckScheme(){
try {
if (checkScheme != null) {
checkScheme.cancel(true);
checkScheme = null;
}
}catch (Exception e){
ACRA.getErrorReporter().putCustomData("errorGetScheme", e.getMessage());
ACRA.getErrorReporter().putCustomData("errorGetSchemeTime", Tool.getSystemDateTime().toLocaleString());
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Get Scheme"));
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,9 @@
package com.adins.mss.coll.interfaces;
/**
* Created by kusnendi.muhamad on 28/07/2017.
*/
public interface NavigatorInterface {
public void route(String navigate);
}

View file

@ -0,0 +1,284 @@
package com.adins.mss.dao;
import java.util.List;
import java.util.ArrayList;
import android.database.Cursor;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.SqlUtils;
import de.greenrobot.dao.internal.DaoConfig;
import de.greenrobot.dao.database.Database;
import de.greenrobot.dao.database.DatabaseStatement;
import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
import com.adins.mss.dao.GeneralParameter;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "MS_GENERALPARAMETER".
*/
public class GeneralParameterDao extends AbstractDao<GeneralParameter, String> {
public static final String TABLENAME = "MS_GENERALPARAMETER";
/**
* Properties of entity GeneralParameter.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Uuid_general_parameter = new Property(0, String.class, "uuid_general_parameter", true, "UUID_GENERAL_PARAMETER");
public final static Property Gs_value = new Property(1, String.class, "gs_value", false, "GS_VALUE");
public final static Property Gs_code = new Property(2, String.class, "gs_code", false, "GS_CODE");
public final static Property Usr_crt = new Property(3, String.class, "usr_crt", false, "USR_CRT");
public final static Property Dtm_crt = new Property(4, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
public final static Property Usr_upd = new Property(5, String.class, "usr_upd", false, "USR_UPD");
public final static Property Dtm_upd = new Property(6, java.util.Date.class, "dtm_upd", false, "DTM_UPD");
public final static Property Uuid_user = new Property(7, String.class, "uuid_user", false, "UUID_USER");
public final static Property Uuid_scheme = new Property(8, String.class, "uuid_scheme", false, "UUID_SCHEME");
};
private DaoSession daoSession;
private Query<GeneralParameter> user_GeneralParameterListQuery;
public GeneralParameterDao(DaoConfig config) {
super(config);
}
public GeneralParameterDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"MS_GENERALPARAMETER\" (" + //
"\"UUID_GENERAL_PARAMETER\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_general_parameter
"\"GS_VALUE\" TEXT," + // 1: gs_value
"\"GS_CODE\" TEXT," + // 2: gs_code
"\"USR_CRT\" TEXT," + // 3: usr_crt
"\"DTM_CRT\" INTEGER," + // 4: dtm_crt
"\"USR_UPD\" TEXT," + // 5: usr_upd
"\"DTM_UPD\" INTEGER," + // 6: dtm_upd
"\"UUID_USER\" TEXT NOT NULL ," + // 7: uuid_user
"\"UUID_SCHEME\" TEXT);"); // 8: uuid_scheme
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MS_GENERALPARAMETER\"";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(DatabaseStatement stmt, GeneralParameter entity) {
stmt.clearBindings();
stmt.bindString(1, entity.getUuid_general_parameter());
String gs_value = entity.getGs_value();
if (gs_value != null) {
stmt.bindString(2, gs_value);
}
String gs_code = entity.getGs_code();
if (gs_code != null) {
stmt.bindString(3, gs_code);
}
String usr_crt = entity.getUsr_crt();
if (usr_crt != null) {
stmt.bindString(4, usr_crt);
}
java.util.Date dtm_crt = entity.getDtm_crt();
if (dtm_crt != null) {
stmt.bindLong(5, dtm_crt.getTime());
}
String usr_upd = entity.getUsr_upd();
if (usr_upd != null) {
stmt.bindString(6, usr_upd);
}
java.util.Date dtm_upd = entity.getDtm_upd();
if (dtm_upd != null) {
stmt.bindLong(7, dtm_upd.getTime());
}
stmt.bindString(8, entity.getUuid_user());
}
@Override
protected void attachEntity(GeneralParameter entity) {
super.attachEntity(entity);
entity.__setDaoSession(daoSession);
}
/** @inheritdoc */
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.getString(offset + 0);
}
/** @inheritdoc */
@Override
public GeneralParameter readEntity(Cursor cursor, int offset) {
GeneralParameter entity = new GeneralParameter( //
cursor.getString(offset + 0), // uuid_general_parameter
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // gs_value
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // gs_code
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // usr_crt
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)), // dtm_crt
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // usr_upd
cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)), // dtm_upd
cursor.getString(offset + 7) // uuid_user
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, GeneralParameter entity, int offset) {
entity.setUuid_general_parameter(cursor.getString(offset + 0));
entity.setGs_value(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setGs_code(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setUsr_crt(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setDtm_crt(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)));
entity.setUsr_upd(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setDtm_upd(cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)));
entity.setUuid_user(cursor.getString(offset + 7));
}
/** @inheritdoc */
@Override
protected String updateKeyAfterInsert(GeneralParameter entity, long rowId) {
return entity.getUuid_general_parameter();
}
/** @inheritdoc */
@Override
public String getKey(GeneralParameter entity) {
if(entity != null) {
return entity.getUuid_general_parameter();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
/** Internal query to resolve the "generalParameterList" to-many relationship of User. */
public List<GeneralParameter> _queryUser_GeneralParameterList(String uuid_scheme) {
synchronized (this) {
if (user_GeneralParameterListQuery == null) {
QueryBuilder<GeneralParameter> queryBuilder = queryBuilder();
queryBuilder.where(Properties.Uuid_scheme.eq(null));
user_GeneralParameterListQuery = queryBuilder.build();
}
}
Query<GeneralParameter> query = user_GeneralParameterListQuery.forCurrentThread();
query.setParameter(0, uuid_scheme);
return query.list();
}
private String selectDeep;
protected String getSelectDeep() {
if (selectDeep == null) {
StringBuilder builder = new StringBuilder("SELECT ");
SqlUtils.appendColumns(builder, "T", getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T0", daoSession.getUserDao().getAllColumns());
builder.append(" FROM MS_GENERALPARAMETER T");
builder.append(" LEFT JOIN MS_USER T0 ON T.\"UUID_USER\"=T0.\"UUID_USER\"");
builder.append(' ');
selectDeep = builder.toString();
}
return selectDeep;
}
protected GeneralParameter loadCurrentDeep(Cursor cursor, boolean lock) {
GeneralParameter entity = loadCurrent(cursor, 0, lock);
int offset = getAllColumns().length;
User user = loadCurrentOther(daoSession.getUserDao(), cursor, offset);
if(user != null) {
entity.setUser(user);
}
return entity;
}
public GeneralParameter loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
public List<GeneralParameter> loadAllDeepFromCursor(Cursor cursor) {
int count = cursor.getCount();
List<GeneralParameter> list = new ArrayList<GeneralParameter>(count);
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();
identityScope.reserveRoom(count);
}
try {
do {
list.add(loadCurrentDeep(cursor, false));
} while (cursor.moveToNext());
} finally {
if (identityScope != null) {
identityScope.unlock();
}
}
}
return list;
}
protected List<GeneralParameter> loadDeepAllAndCloseCursor(Cursor cursor) {
try {
return loadAllDeepFromCursor(cursor);
} finally {
cursor.close();
}
}
/** A raw-style query where you can pass any WHERE clause and arguments. */
public List<GeneralParameter> queryDeep(String where, String... selectionArg) {
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
return loadDeepAllAndCloseCursor(cursor);
}
}

View file

@ -0,0 +1,51 @@
package com.adins.mss.base.util;
import com.adins.mss.foundation.formatter.Tool;
public class SecondFormatter {
private static String secondSuffix = " Seconds";
private static String minuteSuffix = " Minutes";
private static String hourSuffix = " Hours";
public static String secondsToDelimitedTime(long second, String delimiter) {
int seconds = (int) (second % 60);
int minutes = (int) ((second / 60) % 60);
int hours = (int) ((second / 3600) % 24);
String secondsStr = Tool.appendZeroForDateTime(seconds, false);
String minutesStr = Tool.appendZeroForDateTime(minutes, false);
String hoursStr = Tool.appendZeroForDateTime(hours, false);
StringBuilder sb = new StringBuilder();
if (hours > 0) {
sb.append(hoursStr).append(delimiter);
}
if (minutes > 0) {
sb.append(minutesStr).append(delimiter);
}
sb.append(secondsStr);
return sb.toString();
}
public static String secondsToString(long second) {
int seconds = (int) (second % 60);
int minutes = (int) ((second / 60) % 60);
int hours = (int) ((second / 3600) % 24);
String secondsStr = Tool.appendZeroForDateTime(seconds, false) + secondSuffix;
String minutesStr = Tool.appendZeroForDateTime(minutes, false) + minuteSuffix;
String hoursStr = Tool.appendZeroForDateTime(hours, false) + hourSuffix;
StringBuilder sb = new StringBuilder();
if (hours > 0) {
sb.append(hoursStr).append(' ');
}
if (minutes > 0) {
sb.append(minutesStr).append(' ');
}
sb.append(secondsStr);
return sb.toString();
}
}

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.adins.mss.foundation.camera2.Camera2Activity">
<TextureView
android:id="@+id/textureview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/item_camera_mode"
android:id="@+id/item_camera_mode"
android:layout_width="wrap_content"
android:layout_height="110dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:visibility="gone"
android:layout_alignParentStart="true" />
<include layout="@layout/item_review_mode"
android:id="@+id/item_review_mode"
android:layout_width="wrap_content"
android:visibility="gone"
android:layout_height="110dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>