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,276 @@
package com.adins.mss.base.login.view;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.commons.Helper;
import com.adins.mss.base.commons.ViewImpl;
import com.adins.mss.base.login.DefaultLoginModel;
import com.adins.mss.base.login.LoginImpl;
import com.adins.mss.base.login.LoginInterface;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.dialog.DialogManager;
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
import com.services.RefreshToken;
/**
* Created by kusnendi.muhamad on 01/08/2017.
*/
public class LoginView extends ViewImpl {
private final String DevModeEnable = "$ADIMOBILEDEVMODEON$";
private final String DevModeDisable = "$ADIMOBILEDEVMODEOFF$";
private final String txtDevModeOn = "ENABLE DEV MODE";
private final String txtDevModeOff = "DISABLE DEV MODE";
private Menu mainMenu;
private LoginInterface Login;
private DefaultLoginModel dataContex;
private ObscuredSharedPreferences loginPreferences;
public LoginView(Activity activity) {
super(activity);
this.activity = activity;
}
@Override
public void publish() {
//
}
@Override
public void onCreate() {
Login = new LoginImpl(activity);
initialize();
}
@Override
public void onResume() {
if (Login.isRooted()) {
DialogManager.showRootAlert(activity, activity.getApplicationContext());
}
if (checkPlayServices(activity)) {
// Then we're good to go!
}
showGPSAlert(activity);
DialogManager.showTimeProviderAlert(activity);
if (Helper.isDevEnabled(activity) && GlobalData.getSharedGlobalData().isDevEnabled()) {
if (!GlobalData.getSharedGlobalData().isByPassDeveloper()) {
DialogManager.showTurnOffDevMode(activity);
}
}
}
@Override
public void onCreateOptionsMenu(Menu menu) {
mainMenu = menu;
}
@Override
public void onDestroy() {
if (Login.getLocationManager() != null){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (activity.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && activity.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
} else {
Login.removeUpdateLocation();
}
} else {
Login.removeUpdateLocation();
}
}
}
private void initialize() {
PackageInfo pInfo;
try {
pInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0);
Global.APP_VERSION = pInfo.versionName;
Global.BUILD_VERSION = pInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
if (Global.IS_DEV)
e.printStackTrace();
}
TextView tvAppVersion = (TextView) activity.findViewById(R.id.contentVersion);
String versioning = activity.getString(R.string.app_name) + " v." + Global.APP_VERSION;
tvAppVersion.setText(versioning);
Login.initializePreferences();
loginPreferences = Login.getLoginPreferences();
attachEventListener();
}
private void attachEventListener() {
final Button loginButton = (Button) activity.findViewById(R.id.buttonLogin);
final Button exitButton = (Button) activity.findViewById(R.id.buttonExit);
final CheckBox checkShowPassword = (CheckBox) activity.findViewById(R.id.checkShowPassword);
final CheckBox checkRememberMe = (CheckBox) activity.findViewById(R.id.checkRememberMe);
final EditText editUserId = (EditText) activity.findViewById(R.id.editUserId);
final EditText editPassword = (EditText) activity.findViewById(R.id.editPassword);
editUserId.setText(loginPreferences.getString(DefaultLoginModel.LOGIN_PREFERENCES_USERNAME, activity.getString(R.string.text_empty)));
editPassword.setText(loginPreferences.getString(DefaultLoginModel.LOGIN_PREFERENCES_PASSWORD, activity.getString(R.string.text_empty)));
checkRememberMe.setChecked(loginPreferences.getBoolean(DefaultLoginModel.LOGIN_PREFERENCES_REMEMBER_ME, false));
if (checkRememberMe.isChecked()) {
getModel().setRememberMe(true);
}
getModel().setUsername(editUserId.getText().toString());
getModel().setPassword(editPassword.getText().toString());
exitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getModel().exit();
}
});
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new RefreshToken().onTokenRefresh();
if (loginButton.getText().equals(txtDevModeOn)) {
ObscuredSharedPreferences.Editor sharedPrefEditor = Login.getSharedPref().edit();
sharedPrefEditor.putBoolean("IS_DEV", true);
sharedPrefEditor.commit();
Global.IS_DEV = true;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
enableMenuItem(true);
editPassword.setText("");
}
});
} else if (loginButton.getText().equals(txtDevModeOff)) {
ObscuredSharedPreferences.Editor sharedPrefEditor = Login.getSharedPref().edit();
sharedPrefEditor.putBoolean("IS_DEV", false);
sharedPrefEditor.commit();
Global.IS_DEV = false;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
enableMenuItem(false);
editPassword.setText("");
}
});
} else {
getModel().login();
}
}
});
editUserId.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//EMPTY
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
getModel().setUsername(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
//EMPTY
}
});
editPassword.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//EMPTY
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
getModel().setPassword(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
String devMode = editPassword.getText().toString().trim();
if (devMode != null && devMode.length() > 0 && devMode.equals(DevModeEnable)) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
loginButton.setText(activity.getString(R.string.enableDevMode));
}
});
} else if (devMode != null && devMode.length() > 0 && devMode.equals(DevModeDisable)) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
loginButton.setText(activity.getString(R.string.disableDevMode));
}
});
} else {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
loginButton.setText(activity.getString(R.string.btnLogin));
}
});
}
}
});
checkShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
editPassword.setTransformationMethod(null);
} else {
editPassword.setTransformationMethod(new PasswordTransformationMethod());
}
}
});
checkRememberMe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
getModel().setRememberMe(isChecked);
}
});
}
public DefaultLoginModel getModel() {
return dataContex;
}
public void setModel(DefaultLoginModel dataContex) {
this.dataContex = dataContex;
}
public void enableMenuItem(boolean enable) {
if (enable) {
mainMenu.findItem(R.id.menuItem).setVisible(true);
mainMenu.findItem(R.id.serverLink).setVisible(true);
mainMenu.findItem(R.id.devOption).setVisible(true);
} else {
mainMenu.findItem(R.id.menuItem).setVisible(false);
mainMenu.findItem(R.id.serverLink).setVisible(false);
mainMenu.findItem(R.id.devOption).setVisible(false);
}
}
}

View file

@ -0,0 +1,25 @@
package com.adins.mss.foundation.questiongenerator;
import android.app.DatePickerDialog;
import android.widget.DatePicker;
import com.adins.mss.foundation.formatter.Tool;
public class DateInputListener {
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
String month = Tool.appendZeroForDateTime(monthOfYear, true);
String dt = dayOfMonth + "/" + month + "/" + year;
DynamicQuestion.setTxtInFocusText(dt);
}
};
public DateInputListener() {
}
public DatePickerDialog.OnDateSetListener getmDateSetListener() {
return mDateSetListener;
}
}

View file

@ -0,0 +1,27 @@
package com.adins.mss.base.dynamicform;
import com.adins.mss.dao.LocationInfo;
public class LocationInfo2 extends LocationInfo {
public LocationInfo2(LocationInfo info) {
this.setUuid_location_info(info.getUuid_location_info());
this.setAccuracy(info.getAccuracy());
this.setCid(info.getCid());
this.setDtm_crt(info.getDtm_crt());
this.setGps_time(info.getGps_time());
this.setHandset_time(info.getHandset_time());
this.setIs_gps_time(info.getIs_gps_time());
this.setLac(info.getLac());
this.setLatitude(info.getLatitude());
this.setLocation_type(info.getLocation_type());
this.setLongitude(info.getLongitude());
this.setMcc(info.getMcc());
this.setMnc(info.getMnc());
this.setMode(info.getMode());
this.setUser(info.getUser());
this.setUsr_crt(info.getUsr_crt());
this.setUuid_user(info.getUuid_user());
}
}

View file

@ -0,0 +1,298 @@
package com.adins.mss.base.todolist.form;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
import com.adins.mss.base.Backup;
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.timeline.TimelineManager;
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.todolist.todayplanrepository.TodayPlanRepository;
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.Scheme;
import com.adins.mss.dao.TaskH;
import com.adins.mss.dao.User;
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.db.dataaccess.TimelineDataAccess;
import com.adins.mss.foundation.db.dataaccess.TimelineTypeDataAccess;
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.MssRequestType;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import org.acra.ACRA;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import static com.adins.mss.base.todolist.form.PriorityTabFragment.uuidSchemeDummy;
@SuppressLint("NewApi")
public class TaskListTask extends AsyncTask<Void, Void, Boolean> {
private WeakReference<FragmentActivity> activity;
private ProgressDialog progressDialog;
private String errMsg = null;
private String messageWait;
private String messageEmpty;
private int contentFrame;
public TaskListTask(FragmentActivity mainActivity, String messageWait, String messageEmpty, int contentFrame) {
this.activity = new WeakReference<>(mainActivity);
this.messageWait = messageWait;
this.messageEmpty = messageEmpty;
this.contentFrame = contentFrame;
}
@Override
protected void onPreExecute() {
this.progressDialog = ProgressDialog.show(activity.get(), "", this.messageWait, true);
}
@Override
protected Boolean doInBackground(Void... params) {
if (Tool.isInternetconnected(activity.get())) {
User user = GlobalData.getSharedGlobalData().getUser();
long totalData = 0;
List<TaskH> taskHList = new ToDoList(activity.get()).getListTask(0, uuidSchemeDummy, 0, "", "", "", "", "");
totalData = taskHList.size();
if (null == taskHList || totalData == 0) {
String result;
MssRequestType requestType = new MssRequestType();
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
requestType.addImeiAndroidIdToUnstructured();
String json = GsonHelper.toJson(requestType);
String url = GlobalData.getSharedGlobalData().getURL_GET_TASKLIST();
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity.get(), 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) {
FireCrash.log(e);
e.printStackTrace();
errMsg = e.getMessage();
}
List<String> listUuidTaskH = new ArrayList<>();
if (serverResult != null) {
if (serverResult.isOK()) {
try {
result = serverResult.getResult();
JsonResponseTaskList taskList = GsonHelper.fromJson(result, JsonResponseTaskList.class);
if (taskList.getStatus().getCode() == 0) {
List<TaskH> listTaskH = taskList.getListTaskList();
if (listTaskH != null && !listTaskH.isEmpty()) {
// bong 19 may 15 - delete all new taskH local before replace with the new ones from server
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
TaskHDataAccess.deleteTaskHByStatus(activity.get(), uuidUser, TaskHDataAccess.STATUS_SEND_INIT);
for (TaskH taskH : listTaskH) {
taskH.setUser(user);
taskH.setIs_verification(Global.TRUE_STRING);
String uuid_scheme = taskH.getUuid_scheme();
listUuidTaskH.add(taskH.getUuid_task_h());
Scheme scheme = SchemeDataAccess.getOne(activity.get(), uuid_scheme);
if (scheme != null) {
taskH.setScheme(scheme);
TaskH h = TaskHDataAccess.getOneHeader(activity.get(), taskH.getUuid_task_h());
String uuid_timelineType = TimelineTypeDataAccess.getTimelineTypebyType(activity.get(), Global.TIMELINE_TYPE_TASK).getUuid_timeline_type();
boolean wasInTimeline = TimelineDataAccess.getOneTimelineByTaskH(activity.get(), user.getUuid_user(), taskH.getUuid_task_h(), uuid_timelineType) != null;
if (h != null && h.getStatus() != null) {
if (!ToDoList.isOldTask(h)) {
taskH.setStatus(TaskHDataAccess.STATUS_SEND_INIT);
TaskHDataAccess.addOrReplace(activity.get(), taskH);
if (!wasInTimeline)
TimelineManager.insertTimeline(activity.get(), taskH);
} else {
if (taskH.getPts_date() != null) {
h.setPts_date(taskH.getPts_date());
TaskHDataAccess.addOrReplace(activity.get(), h);
}
}
} else {
taskH.setStatus(TaskHDataAccess.STATUS_SEND_INIT);
TaskHDataAccess.addOrReplace(activity.get(), taskH);
if (!wasInTimeline)
TimelineManager.insertTimeline(activity.get(), taskH);
}
} else {
errMsg = activity.get().getString(R.string.scheme_not_found);
ACRA.getErrorReporter().putCustomData("uuid Scheme", uuid_scheme);
ACRA.getErrorReporter().handleSilentException(new Exception("Error: Scheme not available in DB. " + errMsg));
}
}
List<TaskH> taskHs = TaskHDataAccess.getAllTaskByStatus(activity.get(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), TaskHDataAccess.STATUS_SEND_DOWNLOAD);
taskHs.addAll(TaskHDataAccess.getAllTaskByStatus(activity.get(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), TaskHDataAccess.STATUS_SEND_SAVEDRAFT));
List<TaskH> needRemoveFromBackup = new ArrayList<>();
for (TaskH h : taskHs) {
String uuid_task_h = h.getUuid_task_h();
boolean isSame = false;
for (String uuid_from_server : listUuidTaskH) {
if (uuid_task_h.equals(uuid_from_server)) {
isSame = true;
break;
}
}
if (!isSame) {
TaskHDataAccess.deleteWithRelation(activity.get(), h);
if(h.getStatus().equals(TaskHDataAccess.STATUS_SEND_SAVEDRAFT)){
needRemoveFromBackup.add(h);
}
}
}
Backup backup = new Backup(activity.get());
backup.removeTask(needRemoveFromBackup);
//generate plan task if needed
if(Global.PLAN_TASK_ENABLED){
TodayPlanRepository todayPlanRepository = GlobalData.getSharedGlobalData().getTodayPlanRepo();
todayPlanRepository.generatePlansFromTaskList(listTaskH);
}
}
} else {
errMsg = result;
}
} catch (Exception e) {
FireCrash.log(e);
errMsg = e.getMessage();
}
} else {
errMsg = serverResult.getResult();
}
return serverResult.isOK();
} else {
return false;
}
} else {
return false;
}
} else {
errMsg = activity.get().getString(R.string.use_offline_mode);
return false;
}
}
@Override
protected void onPostExecute(Boolean result) {
if (progressDialog.isShowing()) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FireCrash.log(e);
}
}
Bundle argument = new Bundle();
if (errMsg != null) {
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, true);
argument.putString(TaskList_Fragment.BUND_KEY_MESSAGE, errMsg);
} else if (Boolean.TRUE.equals(result)) {
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, false);
} else {
if (!TaskHDataAccess.getAll(activity.get(), GlobalData.getSharedGlobalData().getUser().getUuid_user()).isEmpty()) {
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, false);
} else {
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, true);
argument.putString(TaskList_Fragment.BUND_KEY_MESSAGE, errMsg);
}
}
Fragment fragment1 = null;
if(Global.PLAN_TASK_ENABLED){
fragment1 = new TaskListFragment_new();
}
else {
fragment1 = new PriorityTabFragment();
}
fragment1.setArguments(argument);
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
transaction.replace(R.id.content_frame, fragment1);
transaction.addToBackStack(null);
transaction.commitAllowingStateLoss();
}
public void cekScheme(Context context, String uuid_scheme) {
JsonRequestScheme requestScheme = new JsonRequestScheme();
requestScheme.setAudit(GlobalData.getSharedGlobalData().getAuditData());
requestScheme.setUuid_user(GlobalData.getSharedGlobalData().getUser()
.getUuid_user());
requestScheme.setUuid_scheme(uuid_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(activity.get(), 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) {
FireCrash.log(e);
e.printStackTrace();
}
if(serverResult == null){
return;
}
if (serverResult.isOK()) {
try {
String result = serverResult.getResult();
JsonResponseScheme responseScheme = GsonHelper.fromJson(result,
JsonResponseScheme.class);
List<Scheme> schemes = responseScheme.getListScheme();
try {
if (!schemes.isEmpty())
SchemeDataAccess.addOrReplace(context, schemes);
} catch (Exception e) {
FireCrash.log(e);
}
} catch (Exception e) {
FireCrash.log(e);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,26 @@
package com.adins.mss.coll.loyalti.barchart;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;
public class NonScrollListView extends ListView {
public NonScrollListView(Context context) {
super(context);
}
public NonScrollListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NonScrollListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bgColor">
<androidx.cardview.widget.CardView
android:id="@+id/taskHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:layout_toLeftOf="@+id/checkbox"
app:cardCornerRadius="10dp"
app:contentPadding="5dp"
app:cardElevation="5dp"
android:layout_margin="3dp"
app:cardBackgroundColor="@color/fontColorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txtAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Account"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_person_color"
android:drawablePadding="5dp" />
<TextView
android:id="@+id/txtStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:text="Status"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_info"
android:drawablePadding="5dp" />
<TextView
android:id="@+id/txtProduct"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:text="Product"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_product"
android:drawablePadding="5dp" />
<TextView
android:id="@+id/txtProjectNett"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:text="Project Nett"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_cash_color"
android:drawablePadding="5dp" />
<TextView
android:id="@+id/txtId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:text="GroupTaskID"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_form_color"
android:drawablePadding="5dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:button="@drawable/checkbox_selector"
android:layout_gravity="center_vertical|center_horizontal"/>
</RelativeLayout>

View file

@ -0,0 +1,22 @@
package com.adins.mss.coll.models;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.gson.annotations.SerializedName;
/**
* Created by dian.ina on 08/05/2015.
*/
public class CollectionActivityRequest extends MssRequestType {
@SerializedName("taskId")
public String taskId;
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public String getTaskId()
{
return taskId;
}
}

View file

@ -0,0 +1,164 @@
package com.adins.mss.dao;
import android.database.Cursor;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;
import de.greenrobot.dao.database.Database;
import de.greenrobot.dao.database.DatabaseStatement;
import com.adins.mss.dao.TimelineType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "MS_TIMELINETYPE".
*/
public class TimelineTypeDao extends AbstractDao<TimelineType, String> {
public static final String TABLENAME = "MS_TIMELINETYPE";
/**
* Properties of entity TimelineType.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Uuid_timeline_type = new Property(0, String.class, "uuid_timeline_type", true, "UUID_TIMELINE_TYPE");
public final static Property Timeline_description = new Property(1, String.class, "timeline_description", false, "TIMELINE_DESCRIPTION");
public final static Property Timeline_type = new Property(2, String.class, "timeline_type", false, "TIMELINE_TYPE");
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");
};
private DaoSession daoSession;
public TimelineTypeDao(DaoConfig config) {
super(config);
}
public TimelineTypeDao(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_TIMELINETYPE\" (" + //
"\"UUID_TIMELINE_TYPE\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_timeline_type
"\"TIMELINE_DESCRIPTION\" TEXT," + // 1: timeline_description
"\"TIMELINE_TYPE\" TEXT," + // 2: timeline_type
"\"USR_CRT\" TEXT," + // 3: usr_crt
"\"DTM_CRT\" INTEGER," + // 4: dtm_crt
"\"USR_UPD\" TEXT," + // 5: usr_upd
"\"DTM_UPD\" INTEGER);"); // 6: dtm_upd
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MS_TIMELINETYPE\"";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(DatabaseStatement stmt, TimelineType entity) {
stmt.clearBindings();
stmt.bindString(1, entity.getUuid_timeline_type());
String timeline_description = entity.getTimeline_description();
if (timeline_description != null) {
stmt.bindString(2, timeline_description);
}
String timeline_type = entity.getTimeline_type();
if (timeline_type != null) {
stmt.bindString(3, timeline_type);
}
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());
}
}
@Override
protected void attachEntity(TimelineType entity) {
super.attachEntity(entity);
entity.__setDaoSession(daoSession);
}
/** @inheritdoc */
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.getString(offset + 0);
}
/** @inheritdoc */
@Override
public TimelineType readEntity(Cursor cursor, int offset) {
TimelineType entity = new TimelineType( //
cursor.getString(offset + 0), // uuid_timeline_type
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // timeline_description
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // timeline_type
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
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, TimelineType entity, int offset) {
entity.setUuid_timeline_type(cursor.getString(offset + 0));
entity.setTimeline_description(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setTimeline_type(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)));
}
/** @inheritdoc */
@Override
protected String updateKeyAfterInsert(TimelineType entity, long rowId) {
return entity.getUuid_timeline_type();
}
/** @inheritdoc */
@Override
public String getKey(TimelineType entity) {
if(entity != null) {
return entity.getUuid_timeline_type();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}

View file

@ -0,0 +1,48 @@
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_PRINTDATE".
*/
public class PrintDate {
/** Not-null value. */
@SerializedName("dtm_print")
private java.util.Date dtm_print;
@SerializedName("uuid_task_h")
private String uuid_task_h;
public PrintDate() {
}
public PrintDate(java.util.Date dtm_print) {
this.dtm_print = dtm_print;
}
public PrintDate(java.util.Date dtm_print, String uuid_task_h) {
this.dtm_print = dtm_print;
this.uuid_task_h = uuid_task_h;
}
/** Not-null value. */
public java.util.Date getDtm_print() {
return dtm_print;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setDtm_print(java.util.Date dtm_print) {
this.dtm_print = dtm_print;
}
public String getUuid_task_h() {
return uuid_task_h;
}
public void setUuid_task_h(String uuid_task_h) {
this.uuid_task_h = uuid_task_h;
}
}

View file

@ -0,0 +1,49 @@
package com.adins.mss.base.todo.form;
import com.adins.mss.dao.PrintItem;
import com.adins.mss.dao.Scheme;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* @author gigin.ginanjar
*/
public class JsonResponseScheme extends MssResponseType {
/**
* Property listScheme
*/
@SerializedName("listScheme")
List<Scheme> listScheme;
@SerializedName("listPrintItems")
List<PrintItem> listPrintItems;
/**
* Gets the listScheme
*/
public List<Scheme> getListScheme() {
return this.listScheme;
}
/**
* Sets the listScheme
*/
public void setListScheme(List<Scheme> value) {
this.listScheme = value;
}
/**
* Gets the listPrintItems
*/
public List<PrintItem> getListPrintItems() {
return this.listPrintItems;
}
/**
* Sets the listPrintItems
*/
public void setListPrintItems(List<PrintItem> value) {
this.listPrintItems = value;
}
}

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<TableLayout
android:id="@+id/orderDetailTable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:stretchColumns="1" >
</TableLayout>
</ScrollView>
</RelativeLayout>
<LinearLayout
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true"
android:gravity="bottom"
android:orientation="vertical" >
<Button
android:id="@+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="openOrder"
android:text="@string/btnOpen"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,154 @@
package com.adins.mss.base.dynamicform.form.questions.viewholder;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
import com.adins.mss.base.dynamicform.form.models.CriteriaParameter;
import com.adins.mss.base.dynamicform.form.models.LookupAnswerBean;
import com.adins.mss.base.dynamicform.form.models.Parameter;
import com.adins.mss.base.dynamicform.form.questions.LookupAnswerTask;
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
import com.adins.mss.base.util.LocaleHelper;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static com.adins.mss.base.dynamicform.form.questions.viewholder.LookupCriteriaOnlineActivity.KEY_SELECTED_CRITERIA;
public class LookupFilterActivity extends FragmentActivity implements View.OnClickListener, OnQuestionClickListener {
public static QuestionBean selectedBean;
private List<LookupAnswerBean> beanList;
private RecyclerView qRecyclerView;
private LookupCriteriaViewAdapter viewAdapter;
private RelativeLayout filterLayout;
private EditText txtFilter;
private int mode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lookup_filter);
filterLayout = (RelativeLayout) findViewById(R.id.filterLayout);
txtFilter = (EditText) findViewById(R.id.edtFilter);
qRecyclerView = (RecyclerView) findViewById(R.id.criteriaRecycleView);
qRecyclerView.setLayoutManager(new ScrollingLinearLayoutManager(this, LinearLayoutManager.VERTICAL, false, 1000));
if (selectedBean != null)
beanList = selectedBean.getLookupsAnswerBean();
if (beanList == null) {
beanList = new ArrayList<>();
qRecyclerView.setVisibility(View.GONE);
filterLayout.setVisibility(View.VISIBLE);
} else {
qRecyclerView.setVisibility(View.VISIBLE);
filterLayout.setVisibility(View.GONE);
}
viewAdapter = new LookupCriteriaViewAdapter(this, beanList, this);
qRecyclerView.setAdapter(viewAdapter);
mode = getIntent().getIntExtra(Global.BUND_KEY_MODE_SURVEY, 0);
Button btnSearch = (Button) findViewById(R.id.btnSearch);
btnSearch.setOnClickListener(this);
}
@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.btnSearch) {
List<Parameter> parameters = new ArrayList<>();
if (beanList != null && beanList.size() > 0) {
for (LookupAnswerBean answerBean : beanList) {
String answer = QuestionBean.getAnswer(answerBean);
Parameter parameter = new Parameter();
parameter.setRefId(answerBean.getIdentifier_name());
parameter.setAnswer(answer);
parameters.add(parameter);
}
} else {
Parameter parameter = new Parameter();
parameter.setAnswer(txtFilter.getText().toString().trim());
parameters.add(parameter);
}
CriteriaParameter criteriaParameter = new CriteriaParameter();
criteriaParameter.setParameters(parameters);
new LookupAnswerTask(this, selectedBean, criteriaParameter, mode).execute();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == Global.REQUEST_LOOKUP_ANSWER) {
Bundle bundle = data.getExtras();
if (bundle != null) {
Intent intent = new Intent();
intent.putExtra(KEY_SELECTED_CRITERIA, bundle.getSerializable(KEY_SELECTED_CRITERIA));
setResult(RESULT_OK, intent);
finish();
}
}
} else if (resultCode == RESULT_CANCELED) {
onBackPressed();
}
}
@Override
public void onSetLocationClick(QuestionBean bean, int group, int position) {
}
@Override
public void onEditDrawingClick(QuestionBean bean, int group, int position) {
}
@Override
public void onCapturePhotoClick(QuestionBean bean, int group, int position) {
}
@Override
public void onLookupSelectedListener(QuestionBean bean, int group, int position) {
}
@Override
public void onReviewClickListener(QuestionBean bean, int group, int position) {
}
@Override
public void onValidasiDukcapilListener(QuestionBean bean, int group, int position) {
}
}

View file

@ -0,0 +1,175 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.soundcloud.android.crop;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.database.Cursor;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Handler;
import android.provider.MediaStore;
import android.text.TextUtils;
import com.soundcloud.android.crop.util.Log;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
/*
* Modified from original in AOSP.
*/
class CropUtil {
private static final String SCHEME_FILE = "file";
private static final String SCHEME_CONTENT = "content";
public static void closeSilently(Closeable c) {
if (c == null) return;
try {
c.close();
} catch (Throwable t) {
// Do nothing
}
}
public static int getExifRotation(File imageFile) {
if (imageFile == null) return 0;
try {
ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
// We only recognize a subset of orientation tag values
switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
case ExifInterface.ORIENTATION_ROTATE_90:
return 90;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default:
return ExifInterface.ORIENTATION_UNDEFINED;
}
} catch (IOException e) {
Log.e("Error getting Exif data", e);
return 0;
}
}
public static boolean copyExifRotation(File sourceFile, File destFile) {
if (sourceFile == null || destFile == null) return false;
try {
ExifInterface exifSource = new ExifInterface(sourceFile.getAbsolutePath());
ExifInterface exifDest = new ExifInterface(destFile.getAbsolutePath());
exifDest.setAttribute(ExifInterface.TAG_ORIENTATION, exifSource.getAttribute(ExifInterface.TAG_ORIENTATION));
exifDest.saveAttributes();
return true;
} catch (IOException e) {
Log.e("Error copying Exif data", e);
return false;
}
}
public static File getFromMediaUri(ContentResolver resolver, Uri uri) {
if (uri == null) return null;
if (SCHEME_FILE.equals(uri.getScheme())) {
return new File(uri.getPath());
} else if (SCHEME_CONTENT.equals(uri.getScheme())) {
final String[] filePathColumn = {MediaStore.MediaColumns.DATA, MediaStore.MediaColumns.DISPLAY_NAME};
Cursor cursor = null;
try {
cursor = resolver.query(uri, filePathColumn, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
final int columnIndex = (uri.toString().startsWith("content://com.google.android.gallery3d")) ?
cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME) :
cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
// Picasa image on newer devices with Honeycomb and up
if (columnIndex != -1) {
String filePath = cursor.getString(columnIndex);
if (!TextUtils.isEmpty(filePath)) {
return new File(filePath);
}
}
}
} catch (SecurityException ignored) {
// Nothing we can do
} finally {
if (cursor != null) cursor.close();
}
}
return null;
}
public static void startBackgroundJob(MonitoredActivity activity,
String title, String message, Runnable job, Handler handler) {
// Make the progress dialog uncancelable, so that we can gurantee
// the thread will be done before the activity getting destroyed
ProgressDialog dialog = ProgressDialog.show(
activity, title, message, true, false);
new Thread(new BackgroundJob(activity, job, dialog, handler)).start();
}
private static class BackgroundJob extends MonitoredActivity.LifeCycleAdapter implements Runnable {
private final MonitoredActivity mActivity;
private final ProgressDialog mDialog;
private final Runnable mJob;
private final Handler mHandler;
private final Runnable mCleanupRunner = new Runnable() {
public void run() {
mActivity.removeLifeCycleListener(BackgroundJob.this);
if (mDialog.getWindow() != null) mDialog.dismiss();
}
};
public BackgroundJob(MonitoredActivity activity, Runnable job,
ProgressDialog dialog, Handler handler) {
mActivity = activity;
mDialog = dialog;
mJob = job;
mActivity.addLifeCycleListener(this);
mHandler = handler;
}
public void run() {
try {
mJob.run();
} finally {
mHandler.post(mCleanupRunner);
}
}
@Override
public void onActivityDestroyed(MonitoredActivity activity) {
// We get here only when the onDestroyed being called before
// the mCleanupRunner. So, run it now and remove it from the queue
mCleanupRunner.run();
mHandler.removeCallbacks(mCleanupRunner);
}
@Override
public void onActivityStopped(MonitoredActivity activity) {
mDialog.hide();
}
@Override
public void onActivityStarted(MonitoredActivity activity) {
mDialog.show();
}
}
}

View file

@ -0,0 +1,22 @@
package com.adins.mss.coll.models;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by adityapurwa on 11/03/15.
*/
public class SynchronizeResponse<T> extends MssResponseType {
@SerializedName("listSync")
private List<T> listSync;
public List<T> getListSync() {
return listSync;
}
public void setListSync(List<T> listSync) {
this.listSync = listSync;
}
}