add project adins
14
MSS/BaseProject/Android/branches/BAFMCS_V3/.gitignore
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/libraries
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
for-testing-only/build/
|
||||||
|
google-play-services/build/
|
||||||
|
mssbase/build/
|
||||||
|
msscoll/build/
|
||||||
|
mssodr/build/
|
||||||
|
msssvy/build/
|
1
MSS/BaseProject/Android/branches/BAFMCS_V3/.svn/entries
Normal file
|
@ -0,0 +1 @@
|
||||||
|
12
|
1
MSS/BaseProject/Android/branches/BAFMCS_V3/.svn/format
Normal file
|
@ -0,0 +1 @@
|
||||||
|
12
|
|
@ -0,0 +1,139 @@
|
||||||
|
package com.adins.mss.coll;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.LoginActivity;
|
||||||
|
import com.adins.mss.base.NewMainActivity;
|
||||||
|
import com.adins.mss.base.dynamictheme.DynamicTheme;
|
||||||
|
import com.adins.mss.base.dynamictheme.ThemeLoader;
|
||||||
|
import com.adins.mss.base.login.DefaultLoginModel;
|
||||||
|
import com.adins.mss.coll.login.MCDefaultLoginModel;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.GeneralParameter;
|
||||||
|
import com.adins.mss.dao.User;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.UserDataAccess;
|
||||||
|
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
|
||||||
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
||||||
|
public class MCLoginActivity extends LoginActivity implements ThemeLoader.ColorSetLoaderCallback {
|
||||||
|
|
||||||
|
private FirebaseAnalytics screenName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
//instantiate theme loader
|
||||||
|
themeLoader = new ThemeLoader(this);
|
||||||
|
|
||||||
|
defaultConfig = new HashMap<>();
|
||||||
|
defaultConfig.put("cipher_unsupported_device", Global.SQLITE_CIPHER_UNSUPPORTED);
|
||||||
|
this.fetchConfig();
|
||||||
|
|
||||||
|
PackageInfo pInfo = null;
|
||||||
|
String sqliteCipherException;
|
||||||
|
String deviceModel = Build.MODEL;
|
||||||
|
|
||||||
|
screenName = FirebaseAnalytics.getInstance(this);
|
||||||
|
|
||||||
|
try {
|
||||||
|
sqliteCipherException = GlobalData.getSharedGlobalData().getRemoteConfig().getString("cipher_unsupported_device");
|
||||||
|
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
Global.APP_VERSION = pInfo.versionName;
|
||||||
|
Global.BUILD_VERSION = pInfo.versionCode;
|
||||||
|
Global.IS_DEV = BuildConfig.IS_DEV;
|
||||||
|
Global.FLAVORS = BuildConfig.IS_FLAVORS;
|
||||||
|
Global.IS_BYPASSROOT = BuildConfig.IS_BYPASSROOT;
|
||||||
|
Global.IS_DBENCRYPT = (!sqliteCipherException.contains(deviceModel)) && BuildConfig.IS_DBENCRYPT;
|
||||||
|
} catch (NameNotFoundException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Global.AUTOLOGIN_ENABLE){
|
||||||
|
NewMainActivity.setMainMenuClass(NewMCMainActivity.class);
|
||||||
|
ObscuredSharedPreferences sharedPref = ObscuredSharedPreferences.getPrefs(getApplicationContext(),
|
||||||
|
"GlobalData", Context.MODE_PRIVATE);
|
||||||
|
hasLogged = sharedPref.getBoolean("HAS_LOGGED", false);
|
||||||
|
if (hasLogged /*&& GlobalData.getSharedGlobalData().getUser() != null*/) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
NewMainActivity.InitializeGlobalDataIfError(getApplicationContext());
|
||||||
|
|
||||||
|
String uuidUser = GlobalData.getSharedGlobalData().getUser() == null ? sharedPref.getString("UUID_USER", "") : GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||||
|
//check theme config.
|
||||||
|
GeneralParameter generalParameter = GeneralParameterDataAccess.getOne(this, uuidUser,
|
||||||
|
Global.GS_THEME_CONFIG_COLLECTION);
|
||||||
|
|
||||||
|
if(generalParameter != null){
|
||||||
|
String urlConfig = generalParameter.getGs_value();
|
||||||
|
themeLoader.loadThemeFromUrl(urlConfig,this);
|
||||||
|
}
|
||||||
|
else {//go to main activity
|
||||||
|
Intent intent = new Intent(getApplicationContext(), NewMCMainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {//load directly login page and load saved theme
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
logo.setImageResource(com.adins.mss.base.R.drawable.icon_coll_act);
|
||||||
|
try {
|
||||||
|
loadSavedTheme();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {//load directly login page and load saved theme
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
logo.setImageResource(com.adins.mss.base.R.drawable.icon_coll_act);
|
||||||
|
loadSavedTheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadSavedTheme(){
|
||||||
|
if(themeLoader != null){
|
||||||
|
themeLoader.loadSavedColorSet(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DefaultLoginModel getNewDefaultLoginModel(Context context) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new MCDefaultLoginModel(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHasLoaded(DynamicTheme dynamicTheme) {//callback load from local db
|
||||||
|
if(dynamicTheme != null && dynamicTheme.getThemeItemList().size() > 0){
|
||||||
|
applyColorTheme(dynamicTheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHasLoaded(DynamicTheme dynamicTheme, boolean needUpdate) {//callback load from server
|
||||||
|
Intent intent = new Intent(getApplicationContext(), NewMCMainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
//Set Firebase screen name
|
||||||
|
screenName.setCurrentScreen(this,getString(R.string.screen_name_coll_login),null);
|
||||||
|
|
||||||
|
defaultConfig = new HashMap<>();
|
||||||
|
defaultConfig.put("cipher_unsupported_device", Global.SQLITE_CIPHER_UNSUPPORTED);
|
||||||
|
this.fetchConfig();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.adins.mss.odr;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.test.ApplicationTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||||
|
*/
|
||||||
|
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||||
|
public ApplicationTest() {
|
||||||
|
super(Application.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,256 @@
|
||||||
|
package com.adins.mss.base.timeline;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.base.todolist.ToDoList;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.Timeline;
|
||||||
|
import com.adins.mss.dao.User;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.UserDataAccess;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
import com.adins.mss.foundation.image.Utils;
|
||||||
|
|
||||||
|
import org.acra.ACRA;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by kusnendi.muhamad on 26/07/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TimelineImpl implements TimelineInterface {
|
||||||
|
|
||||||
|
private static String tempUuidUser;
|
||||||
|
private Activity activity;
|
||||||
|
private Context context;
|
||||||
|
private Bitmap bitmap;
|
||||||
|
private List<Timeline> timelines;
|
||||||
|
private String cashLimit;
|
||||||
|
private String coh;
|
||||||
|
private double limit;
|
||||||
|
private double cashOnHand;
|
||||||
|
private String sLimit;
|
||||||
|
private String sCOH;
|
||||||
|
private TimelineListener timelineListener;
|
||||||
|
private int position = 0;
|
||||||
|
private NewTimelineFragment timelineFragment;
|
||||||
|
private static final String DATE_TIME_FORMAT = "yyyy.MM.dd G \'at\' HH:mm:ss z";
|
||||||
|
private static final String ERROR_REFRESH_BACKGROUND = "errorRefreshBackgroundTask";
|
||||||
|
|
||||||
|
public TimelineImpl(Activity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimelineImpl(Activity activity, TimelineListener timelineListener) {
|
||||||
|
this.activity = activity;
|
||||||
|
this.timelineListener = timelineListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(int position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
setTempUuidUser(GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||||
|
return UserDataAccess.getOne(context, getTempUuidUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCOHAktif() {
|
||||||
|
String parameter = GeneralParameterDataAccess.getOne(activity, GlobalData.getSharedGlobalData().getUser().getUuid_user(),
|
||||||
|
Global.GS_CASHONHAND).getGs_value();
|
||||||
|
return parameter != null && parameter.equals(Global.TRUE_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsyncTask<Void, Void, Bitmap> refreshImageBitmap(final int viewId, final int defaultDrawable, final byte[] byteImage) {
|
||||||
|
return new AsyncTask<Void, Void, Bitmap>() {
|
||||||
|
@Override
|
||||||
|
protected Bitmap doInBackground(Void... args) {
|
||||||
|
if (byteImage != null) {
|
||||||
|
try {
|
||||||
|
return Utils.byteToBitmap(byteImage);
|
||||||
|
} catch (OutOfMemoryError ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOutOfMemory", ex.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOutOfMemory", DateFormat.format(DATE_TIME_FORMAT, Calendar.getInstance().getTime()).toString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception OutOfMemory"));
|
||||||
|
return null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorConvertingByteToBitmap", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorConvertingByteToBitmap", DateFormat.format(DATE_TIME_FORMAT, Calendar.getInstance().getTime()).toString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat convert byte to bitmap"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Bitmap res) {
|
||||||
|
super.onPostExecute(res);
|
||||||
|
if (res != null) {
|
||||||
|
setBitmap(res);
|
||||||
|
timelineListener.onSuccessImageBitmap(res, viewId, defaultDrawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsyncTask<Void, Void, List<Timeline>> refreshBackgroundTask() {
|
||||||
|
final int TASK_DURATION = 2 * 1000; // 2 seconds
|
||||||
|
return new AsyncTask<Void, Void, List<Timeline>>() {
|
||||||
|
@Override
|
||||||
|
protected List<Timeline> doInBackground(Void... params) {
|
||||||
|
// Sleep for a small amount of time to simulate a background-task
|
||||||
|
try {
|
||||||
|
Thread.sleep(TASK_DURATION);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
ACRA.getErrorReporter().putCustomData(ERROR_REFRESH_BACKGROUND, e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData(ERROR_REFRESH_BACKGROUND, DateFormat.format(DATE_TIME_FORMAT, Calendar.getInstance().getTime()).toString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Thread.sleep"));
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int range = GlobalData.getSharedGlobalData().getKeepTimelineInDays();
|
||||||
|
position = getPosition();
|
||||||
|
timelineFragment = new NewTimelineFragment();
|
||||||
|
return timelineFragment.getTimeline(position, range);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
ACRA.getErrorReporter().putCustomData(ERROR_REFRESH_BACKGROUND, e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData(ERROR_REFRESH_BACKGROUND, DateFormat.format(DATE_TIME_FORMAT, Calendar.getInstance().getTime()).toString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set range"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(List<Timeline> records) {
|
||||||
|
super.onPostExecute(records);
|
||||||
|
if (records != null) {
|
||||||
|
setTimelines(records);
|
||||||
|
timelineListener.onSuccessBackgroundTask(records);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCashOnHand() {
|
||||||
|
try {
|
||||||
|
setCashLimit(GlobalData.getSharedGlobalData().getUser().getCash_limit());
|
||||||
|
setLimit(cashLimit != null ? Double.parseDouble(cashLimit) : 0.0);
|
||||||
|
setCoh(GlobalData.getSharedGlobalData().getUser().getCash_on_hand());
|
||||||
|
setCashOnHand(coh != null ? Double.parseDouble(coh) : 0.0);
|
||||||
|
setsLimit(Tool.separateThousand(limit));
|
||||||
|
setsCOH(Tool.separateThousand(cashOnHand));
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Timeline> getTimelines() {
|
||||||
|
return timelines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimelines(List<Timeline> timelines) {
|
||||||
|
this.timelines = timelines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap getBitmap() {
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBitmap(Bitmap bitmap) {
|
||||||
|
this.bitmap = bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCashLimit() {
|
||||||
|
return cashLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCashLimit(String cashLimit) {
|
||||||
|
this.cashLimit = cashLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCoh() {
|
||||||
|
return coh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoh(String coh) {
|
||||||
|
this.coh = coh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getCashOnHand() {
|
||||||
|
return cashOnHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCashOnHand(double cashOnHand) {
|
||||||
|
this.cashOnHand = cashOnHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(double limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getsLimit() {
|
||||||
|
return sLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setsLimit(String sLimit) {
|
||||||
|
this.sLimit = sLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getsCOH() {
|
||||||
|
return sCOH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setsCOH(String sCOH) {
|
||||||
|
this.sCOH = sCOH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTaskListCounter() {
|
||||||
|
return ToDoList.getAllCounter(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getTempUuidUser() {
|
||||||
|
return tempUuidUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTempUuidUser(String tempUuidUser) {
|
||||||
|
TimelineImpl.tempUuidUser = tempUuidUser;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="5">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
<component name="SvnBranchConfigurationManager">
|
||||||
|
<option name="myConfigurationMap">
|
||||||
|
<map>
|
||||||
|
<entry key="$PROJECT_DIR$">
|
||||||
|
<value>
|
||||||
|
<SvnBranchConfiguration>
|
||||||
|
<option name="branchUrls">
|
||||||
|
<list>
|
||||||
|
<option value="https://ppd-vsc-svr.ad-ins.com/svn/MSS/BaseProject/Android/branches" />
|
||||||
|
<option value="https://ppd-vsc-svr.ad-ins.com/svn/MSS/BaseProject/Android/tags" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="trunkUrl" value="https://ppd-vsc-svr.ad-ins.com/svn/MSS/BaseProject/Android/trunk" />
|
||||||
|
</SvnBranchConfiguration>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="mySupportsUserInfoFilter" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,772 @@
|
||||||
|
package com.adins.mss.base.todolist.form;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.widget.AppCompatSpinner;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
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.CustomerFragment;
|
||||||
|
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
|
||||||
|
import com.adins.mss.base.dynamicform.TaskManager;
|
||||||
|
import com.adins.mss.base.dynamicform.newlead.NewLeadFragment;
|
||||||
|
import com.adins.mss.base.timeline.TimelineImpl;
|
||||||
|
import com.adins.mss.base.timeline.TimelineInterface;
|
||||||
|
import com.adins.mss.base.todolist.ToDoList;
|
||||||
|
import com.adins.mss.base.util.Utility;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.GeneralParameter;
|
||||||
|
import com.adins.mss.dao.Scheme;
|
||||||
|
import com.adins.mss.dao.TaskD;
|
||||||
|
import com.adins.mss.dao.TaskH;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||||
|
import com.adins.mss.foundation.dialog.DialogManager;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder_PL;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
|
||||||
|
import org.acra.ACRA;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by muhammad.aap on 11/12/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class NewToDoListTabFragment extends Fragment implements OnTaskListClickListener, TasklistListener {
|
||||||
|
public static final String uuidSchemeDummy = "schemeDummy";
|
||||||
|
private static final String ARG_COLUMN_COUNT = "column-count";
|
||||||
|
public static ToDoList toDoList;
|
||||||
|
private List<TaskH> listTaskH;
|
||||||
|
public static Handler mHandler;
|
||||||
|
private static String param;
|
||||||
|
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
public static NewToDoListViewAdapter viewAdapter;
|
||||||
|
public NewToDoListTabFragment.FormAdapter formAdapter;
|
||||||
|
public NewToDoListTabFragment.NewToDoListAdapter newToDoListAdapter;
|
||||||
|
private List<Scheme> formListName;
|
||||||
|
private static Scheme selectedScheme;
|
||||||
|
private TextView textView;
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
private RelativeLayout layout;
|
||||||
|
private TextView dataNotFound;
|
||||||
|
private boolean isNewToDoListOpen = false;
|
||||||
|
public static NewToDoListTabFragment.NewToDoListHandler handler;
|
||||||
|
private TasklistInterface iTasklist;
|
||||||
|
private TimelineInterface iTimeline;
|
||||||
|
|
||||||
|
private static Menu mainMenu;
|
||||||
|
public static boolean isMenuClicked = false;
|
||||||
|
|
||||||
|
private BottomNavigationView bottomNav;
|
||||||
|
|
||||||
|
private int formPosition = 0;
|
||||||
|
public static int taskPosition = 0;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static NewToDoListTabFragment newInstance(int columnCount) {
|
||||||
|
NewToDoListTabFragment fragment = new NewToDoListTabFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(ARG_COLUMN_COUNT, Integer.parseInt(param));
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setToolbar() {
|
||||||
|
getActivity().findViewById(R.id.search).setVisibility(View.VISIBLE);
|
||||||
|
getActivity().findViewById(R.id.spinner).setVisibility(View.GONE);
|
||||||
|
getActivity().setTitle("");
|
||||||
|
|
||||||
|
// olivia : set tampilan toolbar untuk masing" density
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
switch (displayMetrics.densityDpi) {
|
||||||
|
case DisplayMetrics.DENSITY_MEDIUM:
|
||||||
|
getActivity().findViewById(R.id.search).setLayoutParams(new Toolbar.LayoutParams(200, Toolbar.LayoutParams.WRAP_CONTENT));
|
||||||
|
break;
|
||||||
|
case DisplayMetrics.DENSITY_HIGH:
|
||||||
|
getActivity().findViewById(R.id.search).setLayoutParams(new Toolbar.LayoutParams(300, Toolbar.LayoutParams.WRAP_CONTENT));
|
||||||
|
break;
|
||||||
|
case DisplayMetrics.DENSITY_XHIGH:
|
||||||
|
getActivity().findViewById(R.id.search).setLayoutParams(new Toolbar.LayoutParams(470, Toolbar.LayoutParams.WRAP_CONTENT));
|
||||||
|
break;
|
||||||
|
case DisplayMetrics.DENSITY_XXHIGH:
|
||||||
|
getActivity().findViewById(R.id.search).setLayoutParams(new Toolbar.LayoutParams(710, Toolbar.LayoutParams.WRAP_CONTENT));
|
||||||
|
break;
|
||||||
|
case DisplayMetrics.DENSITY_XXXHIGH:
|
||||||
|
getActivity().findViewById(R.id.search).setLayoutParams(new Toolbar.LayoutParams(950, Toolbar.LayoutParams.WRAP_CONTENT));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
mainMenu = menu;
|
||||||
|
menu.findItem(R.id.menuMore).setVisible(true);
|
||||||
|
setToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle item selection
|
||||||
|
if(isMenuClicked == false){
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == R.id.menuMore) {
|
||||||
|
mainMenu.findItem(R.id.mnViewMap).setVisible(true);
|
||||||
|
isMenuClicked=false;
|
||||||
|
}
|
||||||
|
if (id == R.id.mnViewMap) {
|
||||||
|
MapsViewerFragment fragment = new MapsViewerFragment();
|
||||||
|
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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
isMenuClicked=true;
|
||||||
|
}
|
||||||
|
// olivia : menu View All Header sdh tidak digunakan karena hampir sama dgn Task List
|
||||||
|
else if (id == R.id.mnViewAllHeader) {
|
||||||
|
AllHeaderViewerFragment viewerFragment = AllHeaderViewerFragment.newInstance(AllHeaderViewerFragment.REQ_PRIORITY_LIST);
|
||||||
|
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, viewerFragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
isMenuClicked=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
isNewToDoListOpen = false;
|
||||||
|
bottomNav.getMenu().findItem(R.id.taskListNav).setEnabled(true);
|
||||||
|
|
||||||
|
if (mSwipeRefreshLayout != null) {
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
mSwipeRefreshLayout.destroyDrawingCache();
|
||||||
|
mSwipeRefreshLayout.clearAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
isNewToDoListOpen = true;
|
||||||
|
isMenuClicked = false;
|
||||||
|
setToolbar();
|
||||||
|
|
||||||
|
bottomNav.getMenu().findItem(R.id.taskListNav).setEnabled(false);
|
||||||
|
|
||||||
|
listTaskH = iTasklist.getSelectedTaskH(taskPosition);
|
||||||
|
viewAdapter = new NewToDoListViewAdapter(getActivity(), listTaskH, NewToDoListTabFragment.this, param);
|
||||||
|
recyclerView.setAdapter(viewAdapter);
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
initBackground(listTaskH);
|
||||||
|
|
||||||
|
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||||
|
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||||
|
try {
|
||||||
|
setCashOnHandUI();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOnResume", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOnResume", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Set Cash UI"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
NewMainActivity.setCounter();
|
||||||
|
} catch (Exception e) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Drawer Counter"));
|
||||||
|
}
|
||||||
|
DialogManager.showTimeProviderAlert(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
Fragment fragment = this;
|
||||||
|
iTasklist = new TasklistImpl(fragment, this);
|
||||||
|
iTimeline = new TimelineImpl(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
param = iTasklist.getParam();
|
||||||
|
toDoList = iTasklist.getTodoList();
|
||||||
|
listTaskH = new ArrayList<>();
|
||||||
|
|
||||||
|
mHandler = new Handler();
|
||||||
|
|
||||||
|
try {
|
||||||
|
listTaskH = iTasklist.getTaskH(null, 0);
|
||||||
|
ViewMapActivity.setListTaskH(listTaskH);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnCreate", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnCreate", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set List TaskH"));
|
||||||
|
if (Global.IS_DEV)
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
formListName = new ArrayList<>();
|
||||||
|
formListName.clear();
|
||||||
|
setAllschemeSpinner();
|
||||||
|
formListName.addAll(SchemeDataAccess.getAllActivePriorityScheme(getActivity()));
|
||||||
|
viewAdapter = new NewToDoListViewAdapter(getActivity(), listTaskH, this, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.new_fragment_task_list, container, false);
|
||||||
|
|
||||||
|
bottomNav = (BottomNavigationView) getActivity().findViewById(R.id.bottomNav);
|
||||||
|
|
||||||
|
// olivia : untuk trigger dialog search ketika klik layout search di toolbar
|
||||||
|
textView = (TextView) getActivity().findViewById(R.id.searchTask);
|
||||||
|
textView.setText(getString(R.string.all_form_all_task));
|
||||||
|
taskPosition = 0;
|
||||||
|
formPosition = 0;
|
||||||
|
getActivity().findViewById(R.id.buttonSearch).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
searchDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the adapter
|
||||||
|
if (view instanceof RelativeLayout) {
|
||||||
|
handler = new NewToDoListTabFragment.NewToDoListHandler();
|
||||||
|
Context context = view.getContext();
|
||||||
|
recyclerView = (RecyclerView) view.findViewById(R.id.listTask);
|
||||||
|
layout = (RelativeLayout) view.findViewById(R.id.layout);
|
||||||
|
dataNotFound = (TextView) view.findViewById(R.id.txv_data_not_found);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
recyclerView.getRecycledViewPool().setMaxRecycledViews(1, 500);
|
||||||
|
recyclerView.setHasFixedSize(true);
|
||||||
|
|
||||||
|
initBackground(listTaskH);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
recyclerView.setAdapter(viewAdapter);
|
||||||
|
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refreshTimeline);
|
||||||
|
mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.tv_light),
|
||||||
|
getResources().getColor(R.color.tv_normal),
|
||||||
|
getResources().getColor(R.color.tv_dark),
|
||||||
|
getResources().getColor(R.color.tv_darker));
|
||||||
|
mSwipeRefreshLayout
|
||||||
|
.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
iTasklist.setSelectedScheme(selectedScheme);
|
||||||
|
iTasklist.setSelectedTask(taskPosition);
|
||||||
|
iTasklist.initiateRefresh(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||||
|
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||||
|
try {
|
||||||
|
setCashOnHandUI();
|
||||||
|
} catch (Exception e) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOnResume", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorOnResume", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat Set Cash UI"));
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initBackground(List<TaskH> taskHList) {
|
||||||
|
if (taskHList.size() == 0) {
|
||||||
|
layout.setBackgroundResource(R.drawable.bg_notfound);
|
||||||
|
} else {
|
||||||
|
layout.setBackgroundResource(R.color.bgColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// olivia : melakukan search sesuai value di dropdown
|
||||||
|
public void doSearch() {
|
||||||
|
selectedScheme = formAdapter.getItem(formPosition);
|
||||||
|
iTasklist.setSelectedScheme(selectedScheme);
|
||||||
|
iTasklist.cancelRefreshTask();
|
||||||
|
iTasklist.setSelectedTask(taskPosition);
|
||||||
|
listTaskH = iTasklist.getSelectedTaskH(taskPosition);
|
||||||
|
|
||||||
|
viewAdapter = new NewToDoListViewAdapter(getActivity(), listTaskH, NewToDoListTabFragment.this, param);
|
||||||
|
recyclerView.setAdapter(viewAdapter);
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
initBackground(listTaskH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdapter(String[] listTask) {
|
||||||
|
formListName = new ArrayList<>();
|
||||||
|
formListName.clear();
|
||||||
|
setAllschemeSpinner();
|
||||||
|
formListName.addAll(SchemeDataAccess.getAllActivePriorityScheme(getActivity()));
|
||||||
|
newToDoListAdapter = new NewToDoListTabFragment.NewToDoListAdapter(getActivity(), R.layout.spinner_style2, listTask);
|
||||||
|
newToDoListAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||||
|
formAdapter = new NewToDoListTabFragment.FormAdapter(getActivity(), R.layout.spinner_style2, R.id.text_spin, formListName);
|
||||||
|
formAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshBackgroundCancelled(boolean value) {
|
||||||
|
if (mSwipeRefreshLayout != null && mSwipeRefreshLayout.isRefreshing())
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshBackgroundComplete(List<TaskH> result) {
|
||||||
|
onRefreshComplete(result);
|
||||||
|
initBackground(listTaskH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCashOnHandUI() {
|
||||||
|
iTimeline.setCashOnHand();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAllschemeSpinner() {
|
||||||
|
Scheme schemeDummy = new Scheme();
|
||||||
|
schemeDummy.setUuid_scheme(uuidSchemeDummy);
|
||||||
|
schemeDummy.setScheme_description(getString(R.string.all_form));
|
||||||
|
schemeDummy.setForm_id("schemeDummy");
|
||||||
|
|
||||||
|
formListName.add(0, schemeDummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
iTasklist.cancelRefreshTask();
|
||||||
|
Utility.freeMemory();
|
||||||
|
try {
|
||||||
|
mainMenu.findItem(R.id.menuMore).setVisible(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
bottomNav.getMenu().findItem(R.id.taskListNav).setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickListener(TaskH item, int position) {
|
||||||
|
try {
|
||||||
|
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||||
|
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application) && iTimeline.isCOHAktif() && iTimeline.getLimit() > 0 && iTimeline.getCashOnHand() >= iTimeline.getLimit()) {
|
||||||
|
DialogManager.showAlertNotif(getActivity(), getActivity().getString(R.string.limit_coh), "Cash On Hand");
|
||||||
|
} else {
|
||||||
|
Scheme scheme = null;
|
||||||
|
scheme = item.getScheme();
|
||||||
|
if (scheme == null) {
|
||||||
|
if (item.getUuid_scheme() != null) {
|
||||||
|
scheme = SchemeDataAccess.getOne(getActivity(),
|
||||||
|
item.getUuid_scheme());
|
||||||
|
if (scheme != null)
|
||||||
|
item.setScheme(scheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scheme == null) {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.task_cant_seen),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
if (!GlobalData.getSharedGlobalData().getDoingTask()) {
|
||||||
|
SurveyHeaderBean header = new SurveyHeaderBean(item);
|
||||||
|
Fragment fragment = null;
|
||||||
|
if (GlobalData.getSharedGlobalData().getApplication().equals(Global.APPLICATION_ORDER))
|
||||||
|
fragment = NewLeadFragment.create(header);
|
||||||
|
else
|
||||||
|
fragment = CustomerFragment.create(header);
|
||||||
|
FragmentTransaction transaction = getFragmentManager().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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorClickListener", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorClickListener", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat click item"));
|
||||||
|
String message = e.getMessage();
|
||||||
|
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClickListener(final TaskH item, int position) {
|
||||||
|
try {
|
||||||
|
if(item.getStatus().equals(TaskHDataAccess.STATUS_SEND_UPLOADING)){
|
||||||
|
try {
|
||||||
|
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
dialogBuilder.withTitle(getActivity().getString(R.string.info_capital))
|
||||||
|
.withMessage(getActivity().getString(R.string.confirm_upload)+" "+item.getCustomer_name()+" ?")
|
||||||
|
.withButton1Text(getActivity().getString(R.string.btnYes))
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnCancel))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
if (Tool.isInternetconnected(getActivity())) {
|
||||||
|
if (Global.isIsUploading() || Global.isIsManualUploading()) {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.upload_on_queue), Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
List<TaskD> taskd = TaskDDataAccess.getUnsentImageByTaskH(getActivity(), item.getUuid_user(), item.getUuid_task_h());
|
||||||
|
TaskManager.ManualUploadImage(getActivity(), taskd);
|
||||||
|
for (int i = 1; i < getActivity().getSupportFragmentManager().getBackStackEntryCount(); i++)
|
||||||
|
getActivity().getSupportFragmentManager().popBackStack();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.request_error), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}else if(item.getStatus().equals(TaskHDataAccess.STATUS_SEND_PENDING)){
|
||||||
|
String btnText1 = getActivity().getString(R.string.btnSend);
|
||||||
|
if(item.getIs_prepocessed()!= null && item.getIs_prepocessed().equals(Global.FORM_TYPE_VERIFICATION))
|
||||||
|
btnText1 = getActivity().getString(R.string.verifyBtn);
|
||||||
|
else if(item.getIs_prepocessed()!= null && item.getIs_prepocessed().equals(Global.FORM_TYPE_APPROVAL))
|
||||||
|
btnText1 = getActivity().getString(R.string.approveBtn);
|
||||||
|
final NiftyDialogBuilder_PL dialogBuilder = NiftyDialogBuilder_PL.getInstance(getActivity());
|
||||||
|
dialogBuilder.withNoTitle()
|
||||||
|
.withNoMessage()
|
||||||
|
.withButton1Text(btnText1)
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnDelete))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
if (Tool.isInternetconnected(getActivity())) {
|
||||||
|
if(item.getTask_id()!=null) {
|
||||||
|
if(item.getIs_prepocessed() != null && item.getIs_prepocessed().equals(Global.FORM_TYPE_VERIFICATION)) {
|
||||||
|
if (item.getFlag_survey() != null && item.getFlag_survey().equals(Global.FLAG_FOR_REJECTEDTASK))
|
||||||
|
new TaskManager().sendApprovalTaskOnBackground(getActivity(), item, Global.FLAG_FOR_REJECTEDTASK, false, item.getVerification_notes());
|
||||||
|
else if (item.getFlag_survey() != null && item.getFlag_survey().equals(Global.FLAG_FOR_REJECTEDTASK_WITHRESURVEY))
|
||||||
|
new TaskManager().sendRejectedWithReSurveyTask(getActivity(), item, Global.FLAG_FOR_REJECTEDTASK_WITHRESURVEY, Global.VERIFICATION_FLAG);
|
||||||
|
else
|
||||||
|
new TaskManager.ForceSendTaskOnBackground(getActivity(), item.getTask_id()).execute();
|
||||||
|
} else if(item.getIs_prepocessed() != null && item.getIs_prepocessed().equals(Global.FORM_TYPE_APPROVAL)) {
|
||||||
|
if (item.getFlag_survey() != null && item.getFlag_survey().equals(Global.FLAG_FOR_REJECTEDTASK))
|
||||||
|
new TaskManager().sendApprovalTaskOnBackground(getActivity(), item, Global.FLAG_FOR_REJECTEDTASK, true, item.getVerification_notes());
|
||||||
|
else if (item.getFlag_survey() != null && item.getFlag_survey().equals(Global.FLAG_FOR_REJECTEDTASK_WITHRESURVEY))
|
||||||
|
new TaskManager().sendRejectedWithReSurveyTask(getActivity(), item, Global.FLAG_FOR_REJECTEDTASK_WITHRESURVEY, Global.APPROVAL_FLAG);
|
||||||
|
else
|
||||||
|
new TaskManager().sendApprovalTaskOnBackground(getActivity(), item, Global.FLAG_FOR_APPROVALTASK, true, item.getVerification_notes());
|
||||||
|
} else
|
||||||
|
new TaskManager.ForceSendTaskOnBackground(getActivity(), item.getTask_id()).execute();
|
||||||
|
|
||||||
|
for (int i = 1; i < getActivity().getSupportFragmentManager().getBackStackEntryCount(); i++)
|
||||||
|
getActivity().getSupportFragmentManager().popBackStack();
|
||||||
|
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH.addAll(iTasklist.getSelectedTaskH(0));
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
TaskHDataAccess.deleteWithRelation(getActivity(), item);
|
||||||
|
if(item.getTask_id()!=null)
|
||||||
|
ToDoList.removeSurveyFromList(item.getTask_id());
|
||||||
|
iTasklist.setSelectedScheme(selectedScheme);
|
||||||
|
iTasklist.setSelectedTask(taskPosition);
|
||||||
|
iTasklist.initiateRefresh(true);
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}else if (item.getStatus().equals(TaskHDataAccess.STATUS_SEND_SAVEDRAFT)){
|
||||||
|
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
dialogBuilder.withTitle(getActivity().getString(R.string.info_capital))
|
||||||
|
.withMessage(getActivity().getString(R.string.confirm_delete)+" "+item.getCustomer_name()+" ?")
|
||||||
|
.withButton1Text(getActivity().getString(R.string.btnYes))
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnCancel))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
TaskHDataAccess.deleteWithRelation(getActivity(), item);
|
||||||
|
ToDoList.removeSurveyFromList(item.getTask_id());
|
||||||
|
iTasklist.setSelectedScheme(selectedScheme);
|
||||||
|
iTasklist.setSelectedTask(taskPosition);
|
||||||
|
iTasklist.initiateRefresh(true);
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
FireCrash.log(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onRefreshComplete(List<TaskH> result) {
|
||||||
|
try {
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH = result;
|
||||||
|
viewAdapter = new NewToDoListViewAdapter(getActivity(), listTaskH, NewToDoListTabFragment.this, param);
|
||||||
|
recyclerView.setAdapter(viewAdapter);
|
||||||
|
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
try {
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
} catch (Exception e2) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnRefreshCompleted", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnRefreshCompleted", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Notify Data Set Changed"));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
} catch (Exception e2) {
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnRefreshCompleted", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("ErrorOnRefreshCompleted", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Notify Data Set Changed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Stop the refreshing indicator
|
||||||
|
if (mSwipeRefreshLayout != null && mSwipeRefreshLayout.isRefreshing())
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void searchDialog() {
|
||||||
|
final AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.Dialog_NoTitle)
|
||||||
|
.setView(R.layout.new_dialog_search)
|
||||||
|
.create();
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();
|
||||||
|
wmlp.gravity = Gravity.BOTTOM;
|
||||||
|
wmlp.windowAnimations = R.style.DialogAnimation;
|
||||||
|
dialog.show();
|
||||||
|
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
final AppCompatSpinner searchForm = (AppCompatSpinner) dialog.findViewById(R.id.spinnerForm);
|
||||||
|
final AppCompatSpinner searchTask = (AppCompatSpinner) dialog.findViewById(R.id.spinnerTask);
|
||||||
|
Button search = (Button) dialog.findViewById(R.id.btnSearch);
|
||||||
|
|
||||||
|
String[] listTask = getActivity().getResources().getStringArray(R.array.taskSearch);
|
||||||
|
|
||||||
|
newToDoListAdapter = new NewToDoListTabFragment.NewToDoListAdapter(getActivity(), R.layout.spinner_style2, listTask);
|
||||||
|
newToDoListAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||||
|
formAdapter = new NewToDoListTabFragment.FormAdapter(getActivity(), R.layout.spinner_style2, R.id.text_spin, formListName);
|
||||||
|
formAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||||
|
|
||||||
|
searchForm.setAdapter(formAdapter);
|
||||||
|
searchTask.setAdapter(newToDoListAdapter);
|
||||||
|
|
||||||
|
searchForm.setSelection(formPosition);
|
||||||
|
searchTask.setSelection(taskPosition);
|
||||||
|
|
||||||
|
search.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
taskPosition = searchTask.getSelectedItemPosition();
|
||||||
|
formPosition = searchForm.getSelectedItemPosition();
|
||||||
|
|
||||||
|
Scheme scheme = (Scheme) searchForm.getSelectedItem();
|
||||||
|
|
||||||
|
textView.setText(scheme.getScheme_description() + " . " + searchTask.getSelectedItem().toString());
|
||||||
|
|
||||||
|
doSearch();
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FormAdapter extends ArrayAdapter<Scheme> {
|
||||||
|
private Activity activity;
|
||||||
|
private List<Scheme> values;
|
||||||
|
|
||||||
|
public FormAdapter(Activity activity, int resource, int textViewResourceId, List<Scheme> objects) {
|
||||||
|
super(activity, resource, textViewResourceId, objects);
|
||||||
|
this.activity = activity;
|
||||||
|
this.values = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return values.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Scheme getItem(int position) {
|
||||||
|
return values.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = activity.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).getScheme_description());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = activity.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).getScheme_description());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NewToDoListAdapter extends ArrayAdapter<String> {
|
||||||
|
private Activity activity;
|
||||||
|
private String[] values;
|
||||||
|
|
||||||
|
public NewToDoListAdapter(Activity activity, int resource, String[] objects) {
|
||||||
|
super(activity, resource, objects);
|
||||||
|
this.activity = activity;
|
||||||
|
this.values = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return values.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItem(int position) {
|
||||||
|
return values[position];
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = activity.getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||||
|
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||||
|
label.setText(values[position]);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = activity.getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||||
|
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||||
|
label.setText(values[position]);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NewToDoListTabFragment.NewToDoListHandler getHandler() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHandler(NewToDoListTabFragment.NewToDoListHandler handler) {
|
||||||
|
NewToDoListTabFragment.handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NewToDoListHandler extends Handler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
try {
|
||||||
|
if (isNewToDoListOpen) {
|
||||||
|
iTasklist.initiateRefresh(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorRefresh", e.getMessage());
|
||||||
|
ACRA.getErrorReporter().putCustomData("errorRefresh", Tool.getSystemDateTime().toLocaleString());
|
||||||
|
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat initiate Refresh"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.adins.mss.foundation.db.dataaccess;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.Account;
|
||||||
|
import com.adins.mss.dao.AccountDao;
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by olivia.dg on 11/16/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AccountDataAccess {
|
||||||
|
|
||||||
|
protected static DaoSession getDaoSession(Context context){
|
||||||
|
return DaoOpenHelper.getDaoSession(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static AccountDao getAccountDao(Context context) {
|
||||||
|
return getDaoSession(context).getAccountDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void add(Context context, Account account){
|
||||||
|
getAccountDao(context).insert(account);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void add(Context context, List<Account> accountList){
|
||||||
|
getAccountDao(context).insertInTx(accountList);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addOrReplace(Context context, Account account){
|
||||||
|
getAccountDao(context).insertOrReplaceInTx(account);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addOrReplace(Context context, List<Account> accountList){
|
||||||
|
getAccountDao(context).insertOrReplaceInTx(accountList);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clean(Context context){
|
||||||
|
getAccountDao(context).deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void delete(Context context, Account account){
|
||||||
|
getAccountDao(context).delete(account);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void update(Context context, Account account){
|
||||||
|
getAccountDao(context).update(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Account> getAll(Context context){
|
||||||
|
QueryBuilder<Account> qb = getAccountDao(context).queryBuilder();
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Account getOne(Context context, String uuid){
|
||||||
|
QueryBuilder<Account> qb = getAccountDao(context).queryBuilder();
|
||||||
|
qb.where(AccountDao.Properties.Uuid_account.eq(uuid));
|
||||||
|
qb.build();
|
||||||
|
|
||||||
|
if ((qb.list() == null) || qb.list().isEmpty()) return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,288 @@
|
||||||
|
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.ErrorLog;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "TR_ERROR_LOG".
|
||||||
|
*/
|
||||||
|
public class ErrorLogDao extends AbstractDao<ErrorLog, String> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "TR_ERROR_LOG";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity ErrorLog.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Uuid_error_log = new Property(0, String.class, "uuid_error_log", true, "UUID_ERROR_LOG");
|
||||||
|
public final static Property Error_description = new Property(1, String.class, "error_description", false, "ERROR_DESCRIPTION");
|
||||||
|
public final static Property Device_name = new Property(2, String.class, "device_name", false, "DEVICE_NAME");
|
||||||
|
public final static Property Dtm_activity = new Property(3, java.util.Date.class, "dtm_activity", false, "DTM_ACTIVITY");
|
||||||
|
public final static Property Uuid_user = new Property(4, String.class, "uuid_user", false, "UUID_USER");
|
||||||
|
public final static Property Task_id = new Property(5, String.class, "task_id", false, "TASK_ID");
|
||||||
|
};
|
||||||
|
|
||||||
|
private DaoSession daoSession;
|
||||||
|
|
||||||
|
private Query<ErrorLog> user_ErrorLogListQuery;
|
||||||
|
private Query<ErrorLog> taskH_ErrorLogListQuery;
|
||||||
|
|
||||||
|
public ErrorLogDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorLogDao(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 + "\"TR_ERROR_LOG\" (" + //
|
||||||
|
"\"UUID_ERROR_LOG\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_error_log
|
||||||
|
"\"ERROR_DESCRIPTION\" TEXT," + // 1: error_description
|
||||||
|
"\"DEVICE_NAME\" TEXT," + // 2: device_name
|
||||||
|
"\"DTM_ACTIVITY\" INTEGER," + // 3: dtm_activity
|
||||||
|
"\"UUID_USER\" TEXT," + // 4: uuid_user
|
||||||
|
"\"TASK_ID\" TEXT);"); // 5: task_id
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_ERROR_LOG\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected void bindValues(DatabaseStatement stmt, ErrorLog entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
stmt.bindString(1, entity.getUuid_error_log());
|
||||||
|
|
||||||
|
String error_description = entity.getError_description();
|
||||||
|
if (error_description != null) {
|
||||||
|
stmt.bindString(2, error_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
String device_name = entity.getDevice_name();
|
||||||
|
if (device_name != null) {
|
||||||
|
stmt.bindString(3, device_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_activity = entity.getDtm_activity();
|
||||||
|
if (dtm_activity != null) {
|
||||||
|
stmt.bindLong(4, dtm_activity.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String uuid_user = entity.getUuid_user();
|
||||||
|
if (uuid_user != null) {
|
||||||
|
stmt.bindString(5, uuid_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
String task_id = entity.getTask_id();
|
||||||
|
if (task_id != null) {
|
||||||
|
stmt.bindString(6, task_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachEntity(ErrorLog entity) {
|
||||||
|
super.attachEntity(entity);
|
||||||
|
entity.__setDaoSession(daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.getString(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public ErrorLog readEntity(Cursor cursor, int offset) {
|
||||||
|
ErrorLog entity = new ErrorLog( //
|
||||||
|
cursor.getString(offset + 0), // uuid_error_log
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // error_description
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // device_name
|
||||||
|
cursor.isNull(offset + 3) ? null : new java.util.Date(cursor.getLong(offset + 3)), // dtm_activity
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // uuid_user
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5) // task_id
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, ErrorLog entity, int offset) {
|
||||||
|
entity.setUuid_error_log(cursor.getString(offset + 0));
|
||||||
|
entity.setError_description(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setDevice_name(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setDtm_activity(cursor.isNull(offset + 3) ? null : new java.util.Date(cursor.getLong(offset + 3)));
|
||||||
|
entity.setUuid_user(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setTask_id(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected String updateKeyAfterInsert(ErrorLog entity, long rowId) {
|
||||||
|
return entity.getUuid_error_log();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String getKey(ErrorLog entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getUuid_error_log();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Internal query to resolve the "errorLogList" to-many relationship of User. */
|
||||||
|
public List<ErrorLog> _queryUser_ErrorLogList(String uuid_user) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (user_ErrorLogListQuery == null) {
|
||||||
|
QueryBuilder<ErrorLog> queryBuilder = queryBuilder();
|
||||||
|
queryBuilder.where(Properties.Uuid_user.eq(null));
|
||||||
|
user_ErrorLogListQuery = queryBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Query<ErrorLog> query = user_ErrorLogListQuery.forCurrentThread();
|
||||||
|
query.setParameter(0, uuid_user);
|
||||||
|
return query.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Internal query to resolve the "errorLogList" to-many relationship of TaskH. */
|
||||||
|
public List<ErrorLog> _queryTaskH_ErrorLogList(String task_id) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (taskH_ErrorLogListQuery == null) {
|
||||||
|
QueryBuilder<ErrorLog> queryBuilder = queryBuilder();
|
||||||
|
queryBuilder.where(Properties.Task_id.eq(null));
|
||||||
|
taskH_ErrorLogListQuery = queryBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Query<ErrorLog> query = taskH_ErrorLogListQuery.forCurrentThread();
|
||||||
|
query.setParameter(0, task_id);
|
||||||
|
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(',');
|
||||||
|
SqlUtils.appendColumns(builder, "T1", daoSession.getTaskHDao().getAllColumns());
|
||||||
|
builder.append(" FROM TR_ERROR_LOG T");
|
||||||
|
builder.append(" LEFT JOIN MS_USER T0 ON T.\"UUID_USER\"=T0.\"UUID_USER\"");
|
||||||
|
builder.append(" LEFT JOIN TR_TASK_H T1 ON T.\"TASK_ID\"=T1.\"UUID_TASK_H\"");
|
||||||
|
builder.append(' ');
|
||||||
|
selectDeep = builder.toString();
|
||||||
|
}
|
||||||
|
return selectDeep;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ErrorLog loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||||
|
ErrorLog entity = loadCurrent(cursor, 0, lock);
|
||||||
|
int offset = getAllColumns().length;
|
||||||
|
|
||||||
|
User user = loadCurrentOther(daoSession.getUserDao(), cursor, offset);
|
||||||
|
entity.setUser(user);
|
||||||
|
offset += daoSession.getUserDao().getAllColumns().length;
|
||||||
|
|
||||||
|
TaskH taskH = loadCurrentOther(daoSession.getTaskHDao(), cursor, offset);
|
||||||
|
entity.setTaskH(taskH);
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorLog 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<ErrorLog> loadAllDeepFromCursor(Cursor cursor) {
|
||||||
|
int count = cursor.getCount();
|
||||||
|
List<ErrorLog> list = new ArrayList<ErrorLog>(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<ErrorLog> 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<ErrorLog> queryDeep(String where, String... selectionArg) {
|
||||||
|
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||||
|
return loadDeepAllAndCloseCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package com.adins.mss.odr.news;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.util.GsonHelper;
|
||||||
|
import com.adins.mss.dao.MobileContentD;
|
||||||
|
import com.adins.mss.dao.MobileContentH;
|
||||||
|
import com.adins.mss.dao.User;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.MobileContentDDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.MobileContentHDataAccess;
|
||||||
|
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||||
|
import com.adins.mss.foundation.http.KeyValue;
|
||||||
|
import com.adins.mss.foundation.http.MssRequestType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class News {
|
||||||
|
private static Context context;
|
||||||
|
private static Activity activity;
|
||||||
|
private static List<MobileContentH> listHeaderSVR;
|
||||||
|
private static List<MobileContentH> listNewsChildSVR;
|
||||||
|
private static List<MobileContentD> listContentSVR;
|
||||||
|
|
||||||
|
private static List<MobileContentH> listNewsParent;
|
||||||
|
private static List<MobileContentH> listNewsChild;
|
||||||
|
private static MobileContentH contentH;
|
||||||
|
private static List<MobileContentD> listContent;
|
||||||
|
// private static String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
// public void getNewsHeaderFromServer() {
|
||||||
|
// try {
|
||||||
|
// listHeaderSVR = getlistNewsParentFromServer();
|
||||||
|
// if(listHeaderSVR!=null || listHeaderSVR.size()>0){
|
||||||
|
//
|
||||||
|
// for(MobileContentH contentP : listHeaderSVR){
|
||||||
|
// contentP.setUser(user);
|
||||||
|
// if(contentP.getUuid_parent_content()==null||
|
||||||
|
// contentP.getUuid_parent_content().equals("")){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// MobileContentHDataAccess.add(context, contentP);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.out.println(e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public News(Activity activity) {
|
||||||
|
News.context = activity;
|
||||||
|
News.activity=activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getCounterNews(Context context) {
|
||||||
|
long counter = 0;
|
||||||
|
try {
|
||||||
|
counter = MobileContentHDataAccess.getParentCounter(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||||
|
// MOMainMenuActivity.mnNews.setCounter(String.valueOf(listNewsParent.size()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getNewsContentFromServer(MobileContentH contentH) {
|
||||||
|
try {
|
||||||
|
String uuid_mobile_content_h = contentH.getUuid_mobile_content_h();
|
||||||
|
listContent = getListContentFromServer(uuid_mobile_content_h);
|
||||||
|
if(listContent!=null || listContent.size()>0){
|
||||||
|
for(MobileContentD contentD : listContent){
|
||||||
|
contentD.setMobileContentH(contentH);
|
||||||
|
MobileContentDDataAccess.add(context, contentD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentH> getlistNewsParent() {
|
||||||
|
listNewsParent = MobileContentHDataAccess.getAllParent(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||||
|
return listNewsParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentH> getAllNews() {
|
||||||
|
List<MobileContentH> listNewsParent = MobileContentHDataAccess.getAll(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||||
|
return listNewsParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentH> getlistNewsChild(String Uuid_mobile_content_h_Parent) {
|
||||||
|
listNewsChild = MobileContentHDataAccess.getAll(context, GlobalData.getSharedGlobalData().getUser().getUuid_user(), Uuid_mobile_content_h_Parent);
|
||||||
|
return listNewsChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentH> getlistNewsChildWithoutDate(String Uuid_mobile_content_h_Parent) {
|
||||||
|
listNewsChild = MobileContentHDataAccess.getAllWithoutDate(context, GlobalData.getSharedGlobalData().getUser().getUuid_user(), Uuid_mobile_content_h_Parent);
|
||||||
|
return listNewsChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobileContentH getContent(String Uuid_mobile_content_h_Parent) {
|
||||||
|
contentH = MobileContentHDataAccess.getOne(context, Uuid_mobile_content_h_Parent);
|
||||||
|
return contentH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentD> getlistContent(String Uuid_mobile_content_h_Child) {
|
||||||
|
listContent = MobileContentDDataAccess.getAll(context, Uuid_mobile_content_h_Child);
|
||||||
|
return listContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentD> getlistContentOnDate(String Uuid_mobile_content_h_Child) {
|
||||||
|
listContent = MobileContentDDataAccess.getAllOnDate(context, Uuid_mobile_content_h_Child);
|
||||||
|
return listContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentD> getlistContentWithoutDate(String Uuid_mobile_content_h_Child) {
|
||||||
|
listContent = MobileContentDDataAccess.getAll(context, Uuid_mobile_content_h_Child);
|
||||||
|
return listContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MobileContentD> getListContentFromServer(
|
||||||
|
String uuid_mobile_content_h) {
|
||||||
|
JsonRequestNews requestType = new JsonRequestNews();
|
||||||
|
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
requestType.addImeiAndroidIdToUnstructured();
|
||||||
|
requestType.setuuid_mobile_content_h(uuid_mobile_content_h);
|
||||||
|
|
||||||
|
String data = GsonHelper.toJson(requestType);
|
||||||
|
|
||||||
|
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||||
|
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||||
|
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||||
|
// HttpConnectionResult result = null;
|
||||||
|
String result = null;
|
||||||
|
JsonResponseNewsContent content = GsonHelper.fromJson(result, JsonResponseNewsContent.class);
|
||||||
|
listContent = content.getListMobileContentD();
|
||||||
|
|
||||||
|
return listContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// private List<MobileContentH> getlistNewsParentFromServer() {
|
||||||
|
// JsonRequestNews requestType = new JsonRequestNews();
|
||||||
|
// requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
// requestType.addItemToUnstructured(imeIvalue, false);
|
||||||
|
//// requestType.setListContentHeader(getlistNewsParent());
|
||||||
|
// Gson gson = new GsonBuilder().setDateFormat("ddMMyyyyHHmmss").create();
|
||||||
|
//
|
||||||
|
// String json = gson.toJson(requestType);
|
||||||
|
// String url = "Global.URL_GET_NEWS";
|
||||||
|
//
|
||||||
|
// HttpCryptedConnection httpConn = new HttpCryptedConnection(Global.ENCRYPT_COMM, Global.DECRYPT_COMM);
|
||||||
|
//
|
||||||
|
// HttpConnectionResult result = null;
|
||||||
|
// try {
|
||||||
|
// result = httpConn.requestHTTPPost(url, json);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String data = result.getResult();
|
||||||
|
// data ="{\"listHeader\":[{\"content_description\":\"Lorem ipsum dolor sit amet.\",\"content_name\":\"YAMAHA\",\"effective_date\":\"25022015101314\",\"uuid_mobile_content_h\":\"c0db330c-47eb-4f1b-bfd8-139d27749789\"},{\"content_description\":\"Lorem ipsum dolor sit amet.\",\"content_name\":\"TOYOTA\",\"effective_date\":\"25022015101314\",\"uuid_mobile_content_h\":\"0bd0210a-91f1-40a3-b2f4-347229fb702a\"},{\"content_description\":\"Lorem ipsum dolor sit amet.\",\"content_name\":\"YAMAHA MX\",\"effective_date\":\"25022015101314\",\"uuid_mobile_content_h\":\"2e635f95-2f8e-4681-8393-bd086426c92a\",\"uuid_parent_content\":\"c0db330c-47eb-4f1b-bfd8-139d27749789\"},{\"content_description\":\"Lorem ipsum dolor sit amet.\",\"content_name\":\"YAMAHA R1000\",\"effective_date\":\"25022015101314\",\"uuid_mobile_content_h\":\"6777a562-6efe-4ebf-b16c-0efd7e280e03\",\"uuid_parent_content\":\"c0db330c-47eb-4f1b-bfd8-139d27749789\"}],\"status\":{\"code\":\"1\"}}";
|
||||||
|
// try {
|
||||||
|
//// result = httpConn.requestHTTPPost(Global.URL_GET_CONTENTNEWS, data);
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// JsonResponseNewsHeader news = gson.fromJson(data, JsonResponseNewsHeader.class);
|
||||||
|
// listNewsParent = news.getListHeader();
|
||||||
|
//// MobileContentHDataAccess.add(context, mobileContentHList);
|
||||||
|
// return listNewsParent;
|
||||||
|
// }
|
||||||
|
|
||||||
|
private List<MobileContentH> getlistNewsChildFromServer(
|
||||||
|
String uuid_mobile_content_h) {
|
||||||
|
// TODO Bikin cara buat dapetin dari server
|
||||||
|
// MobileContentHDataAccess.add(context, mobileContentHList);
|
||||||
|
|
||||||
|
return listNewsChild;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.adins.mss.base.loyalti.mypointdashboard;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssRequestType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class DetailKompetisiRequest extends MssRequestType {
|
||||||
|
|
||||||
|
@SerializedName("LOGIN_ID")
|
||||||
|
protected String LOGIN_ID;
|
||||||
|
|
||||||
|
public String getLOGIN_ID() {
|
||||||
|
return LOGIN_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLOGIN_ID(String LOGIN_ID) {
|
||||||
|
this.LOGIN_ID = LOGIN_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @SerializedName("MEMBERSHIP_PROGRAM_CODE")
|
||||||
|
// protected ArrayList<String> MEMBERSHIP_PROGRAM_CODE;
|
||||||
|
//
|
||||||
|
// public ArrayList<String> getMEMBERSHIP_PROGRAM_CODE() {
|
||||||
|
// return MEMBERSHIP_PROGRAM_CODE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setMEMBERSHIP_PROGRAM_CODE(ArrayList<String> MEMBERSHIP_PROGRAM_CODE) {
|
||||||
|
// this.MEMBERSHIP_PROGRAM_CODE = MEMBERSHIP_PROGRAM_CODE;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"/>
|
||||||
|
</vector>
|
After Width: | Height: | Size: 5.6 KiB |
|
@ -0,0 +1,300 @@
|
||||||
|
package com.adins.mss.foundation.db.dataaccess;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import com.adins.mss.dao.Scheme;
|
||||||
|
import com.adins.mss.dao.SchemeDao;
|
||||||
|
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
|
|
||||||
|
public class SchemeDataAccess {
|
||||||
|
|
||||||
|
private SchemeDataAccess() {
|
||||||
|
//EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* use to generate dao session that you can access modelDao
|
||||||
|
*
|
||||||
|
* @param context --> context from activity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static DaoSession getDaoSession(Context context) {
|
||||||
|
return DaoOpenHelper.getDaoSession(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get scheme dao and you can access the DB
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static SchemeDao getSchemeDao(Context context) {
|
||||||
|
return getDaoSession(context).getSchemeDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear session, close db and set daoOpenHelper to null
|
||||||
|
*/
|
||||||
|
public static void closeAll() {
|
||||||
|
DaoOpenHelper.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add scheme as entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param scheme
|
||||||
|
*/
|
||||||
|
public static void add(Context context, Scheme scheme) {
|
||||||
|
getSchemeDao(context).insertInTx(scheme);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add scheme as list entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param schemeList
|
||||||
|
*/
|
||||||
|
public static void add(Context context, List<Scheme> schemeList) {
|
||||||
|
getSchemeDao(context).insertInTx(schemeList);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all content in table.
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void clean(Context context) {
|
||||||
|
getSchemeDao(context).deleteAll();
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param scheme
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, Scheme scheme) {
|
||||||
|
getSchemeDao(context).delete(scheme);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all record by keyScheme
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, String keyScheme) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Uuid_scheme.eq(keyScheme));
|
||||||
|
qb.build();
|
||||||
|
getSchemeDao(context).deleteInTx(qb.list());
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param scheme
|
||||||
|
*/
|
||||||
|
public static void update(Context context, Scheme scheme) {
|
||||||
|
getSchemeDao(context).update(scheme);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add scheme as entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param scheme
|
||||||
|
*/
|
||||||
|
public static void addOrReplace(Context context, Scheme scheme) {
|
||||||
|
getSchemeDao(context).insertOrReplaceInTx(scheme);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add scheme as list entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param listScheme
|
||||||
|
*/
|
||||||
|
public static void addOrReplace(Context context, List<Scheme> listScheme) {
|
||||||
|
getSchemeDao(context).insertOrReplaceInTx(listScheme);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select * from table where uuid_scheme = param
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param keyScheme
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Scheme getOne(Context context, String keyScheme) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Uuid_scheme.eq(keyScheme));
|
||||||
|
qb.build().forCurrentThread();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select * from table where uuid_scheme = param
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Scheme> getAll(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Scheme> getAllActiveScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Scheme> getAllActivePriorityScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.where(SchemeDao.Properties.Form_type.notEq(Global.FORM_TYPE_SIMULASI));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getOneSchemeName(Context context, String uuid){
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
String SQL_DISTINCT_ENAME = "SELECT "+ SchemeDao.Properties.Scheme_description.columnName+
|
||||||
|
" FROM "+ SchemeDao.TABLENAME+
|
||||||
|
" WHERE "+ SchemeDao.Properties.Is_active.columnName+"='"+Global.TRUE_STRING+"' "+
|
||||||
|
" AND " + SchemeDao.Properties.Uuid_scheme.columnName+"='"+uuid+"' "+
|
||||||
|
" ORDER BY "+
|
||||||
|
SchemeDao.Properties.Scheme_description.columnName+
|
||||||
|
" ASC";
|
||||||
|
Cursor c = getSchemeDao(context).getDatabase().rawQuery(SQL_DISTINCT_ENAME, null);
|
||||||
|
if (c.moveToFirst()) {
|
||||||
|
do {
|
||||||
|
result.add(c.getString(0));
|
||||||
|
} while (c.moveToNext());
|
||||||
|
}
|
||||||
|
c.close();
|
||||||
|
String resultName = "";
|
||||||
|
if(result != null && result.size()>0){
|
||||||
|
resultName = result.get(0);
|
||||||
|
}
|
||||||
|
return resultName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getAllSchemeName(Context context) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
String SQL_DISTINCT_ENAME = "SELECT " + SchemeDao.Properties.Scheme_description.columnName +
|
||||||
|
" FROM " + SchemeDao.TABLENAME +
|
||||||
|
" WHERE " + SchemeDao.Properties.Is_active.columnName + "='" + Global.TRUE_STRING + "' " +
|
||||||
|
" ORDER BY " +
|
||||||
|
SchemeDao.Properties.Scheme_description.columnName +
|
||||||
|
" ASC";
|
||||||
|
Cursor c = getSchemeDao(context).getDatabase().rawQuery(SQL_DISTINCT_ENAME, null);
|
||||||
|
if (c.moveToFirst()) {
|
||||||
|
do {
|
||||||
|
result.add(c.getString(0));
|
||||||
|
} while (c.moveToNext());
|
||||||
|
}
|
||||||
|
c.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get simulasi scheme
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Scheme> getAllSimulateScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_SIMULASI));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Order Scheme
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Scheme> getAllOrderScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.and(qb.or(SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_ORDER),
|
||||||
|
SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_KTP)),
|
||||||
|
SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Collection Scheme
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Scheme> getAllCollectionScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_COLL),
|
||||||
|
SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Survey scheme
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Scheme> getAllSurveyScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(qb.or(SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_SURVEY),
|
||||||
|
SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_KTP)),
|
||||||
|
SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select scheme by last update
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Scheme getOneByLastUpdate(Context context, String keyScheme, java.util.Date scheme_last_update) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Uuid_scheme.eq(keyScheme),
|
||||||
|
SchemeDao.Properties.Scheme_last_update.eq(scheme_last_update));
|
||||||
|
qb.build().forCurrentThread();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Scheme> getAllMarketingScheme(Context context) {
|
||||||
|
QueryBuilder<Scheme> qb = getSchemeDao(context).queryBuilder();
|
||||||
|
qb.where(SchemeDao.Properties.Form_type.eq(Global.FORM_TYPE_MARKETING),
|
||||||
|
SchemeDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.adins.mss.base.loyalti.barchart;
|
||||||
|
|
||||||
|
import com.adins.mss.base.loyalti.model.PointDetail;
|
||||||
|
import com.github.mikephil.charting.data.BarDataSet;
|
||||||
|
import com.github.mikephil.charting.data.BarEntry;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LoyaltyBarDataSet extends BarDataSet {
|
||||||
|
|
||||||
|
List<PointDetail> pointDetailsDataSet = new ArrayList<>();
|
||||||
|
List<PointDetail> pointCategories = new ArrayList<>();
|
||||||
|
|
||||||
|
public LoyaltyBarDataSet(List<PointDetail> pointDetails, List<PointDetail> pointCategories, List<BarEntry> yVals, String label) {
|
||||||
|
super(yVals, label);
|
||||||
|
pointDetailsDataSet = pointDetails;
|
||||||
|
this.pointCategories = pointCategories;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColor(int index) {
|
||||||
|
if(index >= pointDetailsDataSet.size())
|
||||||
|
return pointCategories.get(0).colorValue;
|
||||||
|
|
||||||
|
PointDetail currentPointDetail = pointDetailsDataSet.get(index);
|
||||||
|
int selectedColor = -1;
|
||||||
|
for (PointDetail category:pointCategories) {
|
||||||
|
if(category.rewardProgram.equals(currentPointDetail.rewardProgram)){
|
||||||
|
selectedColor = category.colorValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selectedColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package fr.castorflex.android.smoothprogressbar;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.graphics.drawable.ShapeDrawable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by castorflex on 3/5/14.
|
||||||
|
*/
|
||||||
|
public final class SmoothProgressBarUtils {
|
||||||
|
private SmoothProgressBarUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Drawable generateDrawableWithColors(int[] colors, float strokeWidth) {
|
||||||
|
if (colors == null || colors.length == 0) return null;
|
||||||
|
|
||||||
|
return new ShapeDrawable(new ColorsShape(strokeWidth, colors));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkSpeed(float speed) {
|
||||||
|
if (speed <= 0f)
|
||||||
|
throw new IllegalArgumentException("Speed must be >= 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkColors(int[] colors) {
|
||||||
|
if (colors == null || colors.length == 0)
|
||||||
|
throw new IllegalArgumentException("You must provide at least 1 color");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkAngle(int angle) {
|
||||||
|
if (angle < 0 || angle > 360)
|
||||||
|
throw new IllegalArgumentException(String.format("Illegal angle %d: must be >=0 and <= 360", angle));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkPositiveOrZero(float number, String name) {
|
||||||
|
if (number < 0)
|
||||||
|
throw new IllegalArgumentException(String.format("%s %d must be positive", name, number));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkPositive(int number, String name) {
|
||||||
|
if (number <= 0)
|
||||||
|
throw new IllegalArgumentException(String.format("%s must not be null", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkNotNull(Object o, String name) {
|
||||||
|
if (o == null)
|
||||||
|
throw new IllegalArgumentException(String.format("%s must be not null", name));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.adins.mss.coll.loyalti.pointacquisitiondaily;
|
||||||
|
|
||||||
|
import com.adins.mss.coll.loyalti.pointacquisitionmonthly.contracts.ILoyaltyPointsDataSource;
|
||||||
|
import com.adins.mss.coll.models.loyaltymodels.GroupPointData;
|
||||||
|
import com.adins.mss.coll.models.loyaltymodels.LoyaltyPointsRequest;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DailyPointsLogic {
|
||||||
|
private ILoyaltyPointsDataSource dataSource;
|
||||||
|
private String competitionStartDate;
|
||||||
|
private int displayMonth;
|
||||||
|
private int displayYear;
|
||||||
|
|
||||||
|
public DailyPointsLogic(ILoyaltyPointsDataSource dataSource, String competitionStartDate, int displayMonth, int displayYear) {
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
this.competitionStartDate = competitionStartDate;
|
||||||
|
this.displayMonth = displayMonth;
|
||||||
|
this.displayYear = displayYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DailyPointsLogic(ILoyaltyPointsDataSource dataSource) {
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getDailyPointsData(LoyaltyPointsRequest reqData, ILoyaltyPointsDataSource.ReqPointsListener listener){
|
||||||
|
dataSource.requestPointsData(reqData,listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalPoints(List<GroupPointData> dataSet){
|
||||||
|
if(dataSet == null)
|
||||||
|
return 0;
|
||||||
|
int totalPoints = 0;
|
||||||
|
int[] totalPerIdx = new int[dataSet.size()];
|
||||||
|
int _sum = 0;
|
||||||
|
for(int i=0; i<totalPerIdx.length; i++){
|
||||||
|
_sum = 0;
|
||||||
|
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||||
|
int point = Integer.valueOf(dataSet.get(i).pointDetails.get(stack).point);
|
||||||
|
_sum += point;
|
||||||
|
}
|
||||||
|
totalPerIdx[i] = _sum;
|
||||||
|
totalPoints += totalPerIdx[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAvgPoint(List<GroupPointData> dataSet){
|
||||||
|
if(dataSet == null)
|
||||||
|
return 0;
|
||||||
|
float totalPoints = 0;
|
||||||
|
int avg = 0;
|
||||||
|
int[] totalPerIdx = new int[dataSet.size()];
|
||||||
|
int _sum = 0;
|
||||||
|
for(int i=0; i<totalPerIdx.length; i++){
|
||||||
|
_sum = 0;
|
||||||
|
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||||
|
int point = Integer.valueOf(dataSet.get(i).pointDetails.get(stack).point);
|
||||||
|
_sum += point;
|
||||||
|
}
|
||||||
|
totalPerIdx[i] = _sum;
|
||||||
|
totalPoints += totalPerIdx[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
int divideDays = getTotalDaysMonth();
|
||||||
|
avg = Math.round(totalPoints/divideDays);
|
||||||
|
return avg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getTotalDaysMonth(){
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
|
||||||
|
//current date
|
||||||
|
calendar.setTime(new Date());
|
||||||
|
int currMonth = calendar.get(Calendar.MONTH);
|
||||||
|
int currYear = calendar.get(Calendar.YEAR);
|
||||||
|
int currDay = calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
|
int maxDays = 0;
|
||||||
|
//tentukan tanggal maksimum
|
||||||
|
if(currMonth == displayMonth && currYear == displayYear){
|
||||||
|
//bulan berjalan
|
||||||
|
maxDays = currDay - 1;
|
||||||
|
}else {
|
||||||
|
//sudah lewat
|
||||||
|
calendar.set(Calendar.MONTH,displayMonth);
|
||||||
|
calendar.set(Calendar.YEAR,displayYear);
|
||||||
|
maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
//competition start date
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat(Global.DATE_STR_FORMAT1);
|
||||||
|
Date startCompDate = null;
|
||||||
|
try {
|
||||||
|
startCompDate = dateFormat.parse(competitionStartDate);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startCompDate == null)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
calendar.setTime(startCompDate);
|
||||||
|
int cYear = calendar.get(Calendar.YEAR);
|
||||||
|
int cMonth = calendar.get(Calendar.MONTH);
|
||||||
|
int cDay = calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
|
//hitung tanggal maksimum berdasarkan tanggal kompetisi mulai
|
||||||
|
if(displayYear == cYear && displayMonth == cMonth){
|
||||||
|
maxDays = (maxDays - cDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxPoint(List<GroupPointData> dataSet){
|
||||||
|
if(dataSet == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int max = 0;
|
||||||
|
int[] totalPerIdx = new int[dataSet.size()];
|
||||||
|
int _sum = 0;
|
||||||
|
for(int i=0; i<totalPerIdx.length; i++){
|
||||||
|
_sum = 0;
|
||||||
|
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||||
|
int point = Integer.valueOf(dataSet.get(i).pointDetails.get(stack).point);
|
||||||
|
_sum += point;
|
||||||
|
}
|
||||||
|
totalPerIdx[i] = _sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
Arrays.sort(totalPerIdx);
|
||||||
|
max = totalPerIdx[totalPerIdx.length -1];
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.adins.mss.base.about.activity;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JsonVersionResponse extends MssResponseType {
|
||||||
|
|
||||||
|
@SerializedName("listValue")
|
||||||
|
List<ListValue> listValue;
|
||||||
|
|
||||||
|
public List<ListValue> getListValues() {
|
||||||
|
return this.listValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListValues(List<ListValue> listValue) {
|
||||||
|
this.listValue = listValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ListValue {
|
||||||
|
@SerializedName("key")
|
||||||
|
String key;
|
||||||
|
@SerializedName("value")
|
||||||
|
String value;
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="DrawInsetsFrameLayout">
|
||||||
|
<attr name="insetBackground" format="reference|color"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="PullToRefreshView">
|
||||||
|
|
||||||
|
<!-- The class to use as a View's View Delegate. Can be relative path from app's package name -->
|
||||||
|
<attr name="ptrViewDelegateClass" format="reference|string" />
|
||||||
|
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<!-- The attribute to set in your Application/Activity theme to reference your custom theme -->
|
||||||
|
<attr name="ptrHeaderStyle" format="reference" />
|
||||||
|
|
||||||
|
<declare-styleable name="PullToRefreshHeader">
|
||||||
|
|
||||||
|
<!-- A drawable to use as the background of the Header View -->
|
||||||
|
<attr name="ptrHeaderBackground" format="reference|color" />
|
||||||
|
|
||||||
|
<!-- The height of the Header View -->
|
||||||
|
<attr name="ptrHeaderHeight" format="reference|dimension" />
|
||||||
|
|
||||||
|
<!-- The Text Appearance of the Header View's Title text -->
|
||||||
|
<attr name="ptrHeaderTitleTextAppearance" format="reference" />
|
||||||
|
|
||||||
|
<!-- The color that the Progress Bar should be tinted with -->
|
||||||
|
<attr name="ptrProgressBarColor" format="reference|color" />
|
||||||
|
|
||||||
|
<!-- The style of the Progress Bar -->
|
||||||
|
<attr name="ptrProgressBarStyle">
|
||||||
|
<flag name="inside" value="0x0" />
|
||||||
|
<flag name="outside" value="0x1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<!-- The height of the Progress Bar -->
|
||||||
|
<attr name="ptrProgressBarHeight" format="reference|dimension" />
|
||||||
|
|
||||||
|
<!-- Text to show to prompt the user is pull (or keep pulling) -->
|
||||||
|
<attr name="ptrPullText" format="reference|string" />
|
||||||
|
|
||||||
|
<!-- Text to show to tell the user that a refresh is currently in progress -->
|
||||||
|
<attr name="ptrRefreshingText" format="reference|string" />
|
||||||
|
|
||||||
|
<!-- Text to show to tell the user has scrolled enough to refresh -->
|
||||||
|
<attr name="ptrReleaseText" format="reference|string" />
|
||||||
|
|
||||||
|
<!--indeterminate progressbar style-->
|
||||||
|
<attr name="ptrSmoothProgressBarStyle" format="reference"/>
|
||||||
|
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="SmoothProgressBar">
|
||||||
|
<attr name="spbStyle" format="reference"/>
|
||||||
|
<attr name="spb_color" format="color"/>
|
||||||
|
<attr name="spb_stroke_width" format="dimension"/>
|
||||||
|
<attr name="spb_stroke_separator_length" format="dimension"/>
|
||||||
|
<attr name="spb_sections_count" format="integer"/>
|
||||||
|
<attr name="spb_speed" format="float"/>
|
||||||
|
<attr name="spb_progressiveStart_speed" format="float"/>
|
||||||
|
<attr name="spb_progressiveStop_speed" format="float"/>
|
||||||
|
<attr name="spb_interpolator" format="enum">
|
||||||
|
<enum name="spb_interpolator_accelerate" value="0"/>
|
||||||
|
<enum name="spb_interpolator_linear" value="1"/>
|
||||||
|
<enum name="spb_interpolator_acceleratedecelerate" value="2"/>
|
||||||
|
<enum name="spb_interpolator_decelerate" value="3"/>
|
||||||
|
</attr>
|
||||||
|
<attr name="spb_reversed" format="boolean"/>
|
||||||
|
<attr name="spb_mirror_mode" format="boolean"/>
|
||||||
|
<attr name="spb_colors" format="reference"/>
|
||||||
|
<attr name="spb_progressiveStart_activated" format="boolean"/>
|
||||||
|
<attr name="spb_background" format="reference"/>
|
||||||
|
<attr name="spb_generate_background_with_colors" format="boolean"/>
|
||||||
|
<attr name="spb_gradients" format="boolean"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<attr name="cropImageStyle" format="reference" />
|
||||||
|
|
||||||
|
<declare-styleable name="CropImageView">
|
||||||
|
<attr name="highlightColor" format="reference|color" />
|
||||||
|
<attr name="showThirds" format="boolean" />
|
||||||
|
<attr name="showHandles">
|
||||||
|
<enum name="changing" value="0" />
|
||||||
|
<enum name="always" value="1" />
|
||||||
|
<enum name="never" value="2" />
|
||||||
|
</attr>
|
||||||
|
<attr name="guidelines">
|
||||||
|
<enum name="on" value="2"/>
|
||||||
|
<enum name="onTouch" value="1"/>
|
||||||
|
<enum name="off" value="0"/>
|
||||||
|
</attr>
|
||||||
|
<attr name="fixAspectRatio" format="boolean"/>
|
||||||
|
<attr name="aspectRatioX" format="integer"/>
|
||||||
|
<attr name="aspectRatioY" format= "integer"/>
|
||||||
|
<attr name="imageResource" format="reference"/>
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.adins.mss.odr.followup.api;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.GroupTask;
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by olivia.dg on 11/24/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GetFollowUpResponse extends MssResponseType {
|
||||||
|
@SerializedName("listFollowUp")
|
||||||
|
private List<GroupTask> listFollowUp;
|
||||||
|
|
||||||
|
public List<GroupTask> getListFollowUp() {
|
||||||
|
return listFollowUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListFollowUp(List<GroupTask> listFollowUp) {
|
||||||
|
this.listFollowUp = listFollowUp;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,302 @@
|
||||||
|
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.Comment;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "TR_COMMENT".
|
||||||
|
*/
|
||||||
|
public class CommentDao extends AbstractDao<Comment, String> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "TR_COMMENT";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Comment.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Uuid_comment = new Property(0, String.class, "uuid_comment", true, "UUID_COMMENT");
|
||||||
|
public final static Property Comment = new Property(1, String.class, "comment", false, "COMMENT");
|
||||||
|
public final static Property Dtm_crt_server = new Property(2, java.util.Date.class, "dtm_crt_server", false, "DTM_CRT_SERVER");
|
||||||
|
public final static Property Sender_id = new Property(3, String.class, "sender_id", false, "SENDER_ID");
|
||||||
|
public final static Property Sender_name = new Property(4, String.class, "sender_name", false, "SENDER_NAME");
|
||||||
|
public final static Property Usr_crt = new Property(5, String.class, "usr_crt", false, "USR_CRT");
|
||||||
|
public final static Property Dtm_crt = new Property(6, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||||
|
public final static Property Usr_upd = new Property(7, String.class, "usr_upd", false, "USR_UPD");
|
||||||
|
public final static Property Dtm_upd = new Property(8, java.util.Date.class, "dtm_upd", false, "DTM_UPD");
|
||||||
|
public final static Property Uuid_timeline = new Property(9, String.class, "uuid_timeline", false, "UUID_TIMELINE");
|
||||||
|
};
|
||||||
|
|
||||||
|
private DaoSession daoSession;
|
||||||
|
|
||||||
|
private Query<Comment> timeline_CommentListQuery;
|
||||||
|
|
||||||
|
public CommentDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommentDao(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 + "\"TR_COMMENT\" (" + //
|
||||||
|
"\"UUID_COMMENT\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_comment
|
||||||
|
"\"COMMENT\" TEXT," + // 1: comment
|
||||||
|
"\"DTM_CRT_SERVER\" INTEGER," + // 2: dtm_crt_server
|
||||||
|
"\"SENDER_ID\" TEXT," + // 3: sender_id
|
||||||
|
"\"SENDER_NAME\" TEXT," + // 4: sender_name
|
||||||
|
"\"USR_CRT\" TEXT," + // 5: usr_crt
|
||||||
|
"\"DTM_CRT\" INTEGER," + // 6: dtm_crt
|
||||||
|
"\"USR_UPD\" TEXT," + // 7: usr_upd
|
||||||
|
"\"DTM_UPD\" INTEGER," + // 8: dtm_upd
|
||||||
|
"\"UUID_TIMELINE\" TEXT);"); // 9: uuid_timeline
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_COMMENT\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected void bindValues(DatabaseStatement stmt, Comment entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
stmt.bindString(1, entity.getUuid_comment());
|
||||||
|
|
||||||
|
String comment = entity.getComment();
|
||||||
|
if (comment != null) {
|
||||||
|
stmt.bindString(2, comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_crt_server = entity.getDtm_crt_server();
|
||||||
|
if (dtm_crt_server != null) {
|
||||||
|
stmt.bindLong(3, dtm_crt_server.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String sender_id = entity.getSender_id();
|
||||||
|
if (sender_id != null) {
|
||||||
|
stmt.bindString(4, sender_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sender_name = entity.getSender_name();
|
||||||
|
if (sender_name != null) {
|
||||||
|
stmt.bindString(5, sender_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
String usr_crt = entity.getUsr_crt();
|
||||||
|
if (usr_crt != null) {
|
||||||
|
stmt.bindString(6, usr_crt);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||||
|
if (dtm_crt != null) {
|
||||||
|
stmt.bindLong(7, dtm_crt.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String usr_upd = entity.getUsr_upd();
|
||||||
|
if (usr_upd != null) {
|
||||||
|
stmt.bindString(8, usr_upd);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_upd = entity.getDtm_upd();
|
||||||
|
if (dtm_upd != null) {
|
||||||
|
stmt.bindLong(9, dtm_upd.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String uuid_timeline = entity.getUuid_timeline();
|
||||||
|
if (uuid_timeline != null) {
|
||||||
|
stmt.bindString(10, uuid_timeline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachEntity(Comment entity) {
|
||||||
|
super.attachEntity(entity);
|
||||||
|
entity.__setDaoSession(daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.getString(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public Comment readEntity(Cursor cursor, int offset) {
|
||||||
|
Comment entity = new Comment( //
|
||||||
|
cursor.getString(offset + 0), // uuid_comment
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // comment
|
||||||
|
cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)), // dtm_crt_server
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // sender_id
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // sender_name
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // usr_crt
|
||||||
|
cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)), // dtm_crt
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // usr_upd
|
||||||
|
cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)), // dtm_upd
|
||||||
|
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // uuid_timeline
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Comment entity, int offset) {
|
||||||
|
entity.setUuid_comment(cursor.getString(offset + 0));
|
||||||
|
entity.setComment(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setDtm_crt_server(cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)));
|
||||||
|
entity.setSender_id(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||||
|
entity.setSender_name(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setUsr_crt(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setDtm_crt(cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)));
|
||||||
|
entity.setUsr_upd(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||||
|
entity.setDtm_upd(cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)));
|
||||||
|
entity.setUuid_timeline(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected String updateKeyAfterInsert(Comment entity, long rowId) {
|
||||||
|
return entity.getUuid_comment();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String getKey(Comment entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getUuid_comment();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Internal query to resolve the "commentList" to-many relationship of Timeline. */
|
||||||
|
public List<Comment> _queryTimeline_CommentList(String uuid_timeline) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (timeline_CommentListQuery == null) {
|
||||||
|
QueryBuilder<Comment> queryBuilder = queryBuilder();
|
||||||
|
queryBuilder.where(Properties.Uuid_timeline.eq(null));
|
||||||
|
timeline_CommentListQuery = queryBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Query<Comment> query = timeline_CommentListQuery.forCurrentThread();
|
||||||
|
query.setParameter(0, uuid_timeline);
|
||||||
|
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.getTimelineDao().getAllColumns());
|
||||||
|
builder.append(" FROM TR_COMMENT T");
|
||||||
|
builder.append(" LEFT JOIN TR_TIMELINE T0 ON T.\"UUID_TIMELINE\"=T0.\"UUID_TIMELINE\"");
|
||||||
|
builder.append(' ');
|
||||||
|
selectDeep = builder.toString();
|
||||||
|
}
|
||||||
|
return selectDeep;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Comment loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||||
|
Comment entity = loadCurrent(cursor, 0, lock);
|
||||||
|
int offset = getAllColumns().length;
|
||||||
|
|
||||||
|
Timeline timeline = loadCurrentOther(daoSession.getTimelineDao(), cursor, offset);
|
||||||
|
entity.setTimeline(timeline);
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Comment 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<Comment> loadAllDeepFromCursor(Cursor cursor) {
|
||||||
|
int count = cursor.getCount();
|
||||||
|
List<Comment> list = new ArrayList<Comment>(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<Comment> 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<Comment> queryDeep(String where, String... selectionArg) {
|
||||||
|
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||||
|
return loadDeepAllAndCloseCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
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 20/03/15.
|
||||||
|
*/
|
||||||
|
public class PaymentHistoryResponse extends MssResponseType {
|
||||||
|
@SerializedName("agreementNo")
|
||||||
|
private String agreementNo;
|
||||||
|
@SerializedName("paymentHistoryHList")
|
||||||
|
private List<PaymentHistoryHBean> paymentHistoryHList;
|
||||||
|
|
||||||
|
public String getAgreementNo() {
|
||||||
|
return agreementNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgreementNo(String agreementNo) {
|
||||||
|
this.agreementNo = agreementNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PaymentHistoryHBean> getPaymentHistoryHList() {
|
||||||
|
return paymentHistoryHList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaymentHistoryHList(List<PaymentHistoryHBean> paymentHistoryHList) {
|
||||||
|
this.paymentHistoryHList = paymentHistoryHList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public List<PaymentHistoryResponseHeader> getPaymentHistoryHList() {
|
||||||
|
// return paymentHistoryHList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setPaymentHistoryHList(List<PaymentHistoryResponseHeader> paymentHistoryHList) {
|
||||||
|
// this.paymentHistoryHList = paymentHistoryHList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<PaymentHistoryResponseDetail> getPaymentHistoryDList() {
|
||||||
|
// return paymentHistoryDList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setPaymentHistoryDList(List<PaymentHistoryResponseDetail> paymentHistoryDList) {
|
||||||
|
// this.paymentHistoryDList = paymentHistoryDList;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.adins.mss.foundation.dialog.gitonway.lib;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.BaseEffects;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.FadeIn;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.Fall;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.FlipH;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.FlipV;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.NewsPaper;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.RotateBottom;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.RotateLeft;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.Shake;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.SideFall;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.SlideBottom;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.SlideLeft;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.SlideRight;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.SlideTop;
|
||||||
|
import com.adins.mss.foundation.dialog.gitonway.lib.effects.Slit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2014 litao
|
||||||
|
* https://github.com/sd6352051/NiftyDialogEffects
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
public enum Effectstype {
|
||||||
|
|
||||||
|
Fadein(FadeIn.class),
|
||||||
|
Slideleft(SlideLeft.class),
|
||||||
|
Slidetop(SlideTop.class),
|
||||||
|
SlideBottom(SlideBottom.class),
|
||||||
|
Slideright(SlideRight.class),
|
||||||
|
Fall(Fall.class),
|
||||||
|
Newspager(NewsPaper.class),
|
||||||
|
Fliph(FlipH.class),
|
||||||
|
Flipv(FlipV.class),
|
||||||
|
RotateBottom(RotateBottom.class),
|
||||||
|
RotateLeft(RotateLeft.class),
|
||||||
|
Slit(Slit.class),
|
||||||
|
Shake(Shake.class),
|
||||||
|
Sidefill(SideFall.class);
|
||||||
|
private Class<? extends BaseEffects> effectsClazz;
|
||||||
|
|
||||||
|
private Effectstype(Class<? extends BaseEffects> mclass) {
|
||||||
|
effectsClazz = mclass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseEffects getAnimator() {
|
||||||
|
BaseEffects bEffects = null;
|
||||||
|
try {
|
||||||
|
bEffects = effectsClazz.newInstance();
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
throw new Error("Can not init animatorClazz instance");
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
throw new Error("Can not init animatorClazz instance");
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
throw new Error("Can not init animatorClazz instance");
|
||||||
|
}
|
||||||
|
return bEffects;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.manuelpeinado.fadingactionbar.view.RootLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<include layout="@layout/fab__header_container" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_gravity="top"
|
||||||
|
android:id="@+id/fab__listview_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/background_light" />
|
||||||
|
|
||||||
|
</com.manuelpeinado.fadingactionbar.view.RootLayout>
|
|
@ -0,0 +1,257 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/main_activity"
|
||||||
|
android:background="@color/bgColor">
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:background="@drawable/header"
|
||||||
|
app:titleTextAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:titleTextColor="@color/fontColorWhite"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||||
|
android:fitsSystemWindows="true"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/depositSummaryContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:contentPadding="7dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginTop="@dimen/card_margin"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="70dp"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TableLayout
|
||||||
|
android:id="@+id/tableLayout1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowBatchId"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_batch_id"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtBatchId"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_batch_id"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowTransferBy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_transfer_by"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txttransferBy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_bank"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowCashierName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_cashier_name"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtCashierName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_cashier_name"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowAccountNumber"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_account_number"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtAccountNumber"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/dummy_number"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowBankName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_bank_name"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtBankName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_bank_name"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/rowEvidenceTransfer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/label_transfer_evidence"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgEvidenceTransfer"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:scaleType="fitStart"
|
||||||
|
android:src="@drawable/profile_image" />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TextView />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblTotal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:text="@string/total"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/divider7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:text="@string/divider_colon"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtTotal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25"
|
||||||
|
android:gravity="end"
|
||||||
|
android:text="@string/total"/>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TextView />
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btnPrintDepReport"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:elevation="10dp"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/icon_print" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,167 @@
|
||||||
|
package com.adins.mss.base.receipt;
|
||||||
|
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Loise on 12/04/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menggambar teks pada canvas
|
||||||
|
*/
|
||||||
|
public class DrawText implements IDrawItem {
|
||||||
|
private Paint paint = new Paint();
|
||||||
|
private String text;
|
||||||
|
private boolean newLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* konstruktor
|
||||||
|
* @param text teks yang akan digambar
|
||||||
|
*/
|
||||||
|
public DrawText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menggambarkan teks pada canvas
|
||||||
|
* @param canvas
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void drawOnCanvas(Canvas canvas, float x, float y) {
|
||||||
|
canvas.drawText(text, getX(canvas, x), getY(y), paint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan titik awal pada sumbu y
|
||||||
|
* @param y
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private float getY(float y) {
|
||||||
|
float baseline = -paint.ascent();
|
||||||
|
return baseline + y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan titik awal pada sumbu x
|
||||||
|
* @param canvas
|
||||||
|
* @param x
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private float getX(Canvas canvas, float x) {
|
||||||
|
float xPos = x;
|
||||||
|
if (paint.getTextAlign().equals(Paint.Align.CENTER)) {
|
||||||
|
xPos = ((float)canvas.getWidth() / 2);
|
||||||
|
} else if (paint.getTextAlign().equals(Paint.Align.RIGHT)) {
|
||||||
|
xPos = canvas.getWidth();
|
||||||
|
}
|
||||||
|
return xPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan tinggi objek teks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return (newLine ? (int) getTextSize() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan teks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setter teks
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan warna teks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getColor() {
|
||||||
|
return paint.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengubah warna teks
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
|
public void setColor(int color) {
|
||||||
|
paint.setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan ukuran teks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public float getTextSize() {
|
||||||
|
return paint.getTextSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengubah ukuran teks
|
||||||
|
* @param textSize
|
||||||
|
*/
|
||||||
|
public void setTextSize(float textSize) {
|
||||||
|
paint.setTextSize(textSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan font teks
|
||||||
|
*/
|
||||||
|
public void getTypeface() {
|
||||||
|
paint.getTypeface();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengubah font teks
|
||||||
|
* @param typeface Typeface
|
||||||
|
*/
|
||||||
|
public void setTypeface(Typeface typeface) {
|
||||||
|
paint.setTypeface(typeface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengubah akignment teks
|
||||||
|
* @param align
|
||||||
|
*/
|
||||||
|
public void setAlign(Paint.Align align) {
|
||||||
|
paint.setTextAlign(align);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan alignment teks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Paint.Align getAlign() {
|
||||||
|
return paint.getTextAlign();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menentukan apakah teks akan pindah baris atau tidak
|
||||||
|
* @param newLine
|
||||||
|
*/
|
||||||
|
public void setNewLine(boolean newLine) {
|
||||||
|
this.newLine = newLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mengembalikan status teks pindah baris atau tidak
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getNewLine() {
|
||||||
|
return newLine;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.adins.mss.base.tasklog;
|
||||||
|
|
||||||
|
import com.adins.mss.base.commons.TaskListener;
|
||||||
|
import com.adins.mss.dao.TaskH;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by kusnendi.muhamad on 28/07/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface TaskLogInterface {
|
||||||
|
public List<TaskH> getListTaskLog();
|
||||||
|
|
||||||
|
public void callOnlineLog(TaskListener listener);
|
||||||
|
|
||||||
|
public void cancelOnlineLog();
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Kevin Gaudin
|
||||||
|
*
|
||||||
|
* 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 org.acra.collector;
|
||||||
|
|
||||||
|
import org.acra.ReportField;
|
||||||
|
import org.acra.util.JSONReportBuilder;
|
||||||
|
import org.acra.util.JSONReportBuilder.JSONReportException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores a crash reports data with {@link org.acra.ReportField} enum values as keys.
|
||||||
|
* This is basically the source of {@link Properties} adapted to extend an
|
||||||
|
* EnumMap instead of Hashtable and with a few tweaks to avoid losing crazy
|
||||||
|
* amounts of android time in the generation of a date comment when storing to
|
||||||
|
* file.
|
||||||
|
*/
|
||||||
|
public final class CrashReportData extends EnumMap<ReportField, String> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4112578634029874840L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code Properties} object.
|
||||||
|
*/
|
||||||
|
public CrashReportData() {
|
||||||
|
super(ReportField.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the property with the specified name.
|
||||||
|
*
|
||||||
|
* @param key the name of the property to find.
|
||||||
|
* @return the named property value, or {@code null} if it can't be found.
|
||||||
|
*/
|
||||||
|
public String getProperty(ReportField key) {
|
||||||
|
return super.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject toJSON() throws JSONReportException {
|
||||||
|
return JSONReportBuilder.buildJSONReport(this);
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 2.8 KiB |
|
@ -0,0 +1,227 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/taskListLayout"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:id="@+id/taskItem">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/timelineIcon"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/task_highpriority"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:layout_marginTop="10dp"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/taskHeader"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:contentPadding="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/taskLayout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_weight="1">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="Name"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:drawableLeft="@drawable/ic_person_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskAddress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="Address"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:drawableLeft="@drawable/ic_location_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskPhone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="Phone"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:drawableLeft="@drawable/ic_phone_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskForm"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Form"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:drawableLeft="@drawable/ic_form_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/collectionInfo"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskAgreement"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:text="@string/lblAgreementNo"
|
||||||
|
android:textSize="12dp"
|
||||||
|
android:drawableLeft="@drawable/ic_form_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskAmount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:text="Amount Due"
|
||||||
|
android:textSize="12dp"
|
||||||
|
android:drawableLeft="@drawable/ic_cash_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskOverdue"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:text="Overdue"
|
||||||
|
android:textSize="12dp"
|
||||||
|
android:drawableLeft="@drawable/ic_date_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taskInst"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:text="Installment No"
|
||||||
|
android:textSize="12dp"
|
||||||
|
android:drawableLeft="@drawable/ic_no_color"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtslatime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="TOM 11.45"
|
||||||
|
android:textSize="11dp"
|
||||||
|
android:drawableLeft="@drawable/ic_sla"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:background="@drawable/sla_shape_green"
|
||||||
|
android:visibility="gone" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtSaveDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:text="11.45"
|
||||||
|
android:textSize="11dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:drawableLeft="@drawable/ic_save_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/selectedSequence"
|
||||||
|
android:text="2"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/selectPlanTaskCB"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/noData"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:contentPadding="10dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/data_not_found"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.adins.mss.svy.reassignment;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssRequestType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class JsonRequestDetailOrder extends MssRequestType{
|
||||||
|
/** Property flag */
|
||||||
|
@SerializedName("flag")
|
||||||
|
String flag;
|
||||||
|
|
||||||
|
/** Property nomor_order */
|
||||||
|
@SerializedName("nomor_order")
|
||||||
|
String nomor_order;
|
||||||
|
|
||||||
|
@SerializedName("uuid_task_h")
|
||||||
|
String uuid_task_h;
|
||||||
|
|
||||||
|
/** Property question_id */
|
||||||
|
@SerializedName("question_id")
|
||||||
|
String question_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the uuid_task_h
|
||||||
|
*/
|
||||||
|
public String getUuid_task_h() {
|
||||||
|
return this.uuid_task_h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the uuid_task_h
|
||||||
|
*/
|
||||||
|
public void setUuid_task_h(String value) {
|
||||||
|
this.uuid_task_h = value;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets the flag
|
||||||
|
*/
|
||||||
|
public String getFlag() {
|
||||||
|
return this.flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the flag
|
||||||
|
*/
|
||||||
|
public void setFlag(String value) {
|
||||||
|
this.flag = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the nomor_order
|
||||||
|
*/
|
||||||
|
public String getNomor_order() {
|
||||||
|
return this.nomor_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the nomor_order
|
||||||
|
*/
|
||||||
|
public void setNomor_order(String value) {
|
||||||
|
this.nomor_order = value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.adins.mss.base.depositreport;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.TaskH;
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by angga.permadi on 8/29/2016.
|
||||||
|
*/
|
||||||
|
public class TaskLogResponse extends MssResponseType {
|
||||||
|
|
||||||
|
@SerializedName("listTaskH")
|
||||||
|
private List<TaskH> taskHList;
|
||||||
|
|
||||||
|
public List<TaskH> getTaskHList() {
|
||||||
|
return taskHList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskHList(List<TaskH> taskHList) {
|
||||||
|
this.taskHList = taskHList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/transactionCode"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/postingDate"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/amountPaid"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/amountInstallment"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
</TableRow>
|
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,139 @@
|
||||||
|
package com.adins.mss.foundation.db.dataaccess;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.CollectionHistory;
|
||||||
|
import com.adins.mss.dao.CollectionHistoryDao;
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
|
|
||||||
|
public class CollectionHistoryDataAccess {
|
||||||
|
|
||||||
|
// 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 collectionHistory dao and you can access the DB
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static CollectionHistoryDao getCollectionHistoryDao(Context context) {
|
||||||
|
return getDaoSession(context).getCollectionHistoryDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear session, close db and set daoOpenHelper to null
|
||||||
|
*/
|
||||||
|
public static void closeAll() {
|
||||||
|
/*if(daoOpenHelper!=null){
|
||||||
|
daoOpenHelper.closeAll();
|
||||||
|
daoOpenHelper = null;
|
||||||
|
}*/
|
||||||
|
DaoOpenHelper.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add collectionHistory as entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param collectionHistory
|
||||||
|
*/
|
||||||
|
public static void add(Context context, CollectionHistory collectionHistory) {
|
||||||
|
getCollectionHistoryDao(context).insert(collectionHistory);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add collectionHistory as list entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param collectinoHistoryList
|
||||||
|
*/
|
||||||
|
public static void add(Context context, List<CollectionHistory> collectinoHistoryList) {
|
||||||
|
getCollectionHistoryDao(context).insertInTx(collectinoHistoryList);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all content in table.
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void clean(Context context) {
|
||||||
|
getCollectionHistoryDao(context).deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param collectionHistory
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, CollectionHistory collectionHistory) {
|
||||||
|
getCollectionHistoryDao(context).deleteInTx(collectionHistory);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all record by user
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param uuidUser
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, String uuidUser) {
|
||||||
|
QueryBuilder<CollectionHistory> qb = getCollectionHistoryDao(context).queryBuilder();
|
||||||
|
qb.where(CollectionHistoryDao.Properties.Uuid_user.eq(uuidUser));
|
||||||
|
qb.build();
|
||||||
|
getCollectionHistoryDao(context).deleteInTx(qb.list());
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param collectionHistory
|
||||||
|
*/
|
||||||
|
public static void update(Context context, CollectionHistory collectionHistory) {
|
||||||
|
getCollectionHistoryDao(context).update(collectionHistory);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select * from table where uuid_user = param
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param uuidUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<CollectionHistory> getAll(Context context, String uuidUser) {
|
||||||
|
QueryBuilder<CollectionHistory> qb = getCollectionHistoryDao(context).queryBuilder();
|
||||||
|
qb.where(CollectionHistoryDao.Properties.Uuid_user.eq(uuidUser));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select collectionHistpry per
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,293 @@
|
||||||
|
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.Menu;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "MS_MENU".
|
||||||
|
*/
|
||||||
|
public class MenuDao extends AbstractDao<Menu, String> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "MS_MENU";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Menu.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Uuid_menu = new Property(0, String.class, "uuid_menu", true, "UUID_MENU");
|
||||||
|
public final static Property Menu_id = new Property(1, String.class, "menu_id", false, "MENU_ID");
|
||||||
|
public final static Property Flag_job = new Property(2, String.class, "flag_job", false, "FLAG_JOB");
|
||||||
|
public final static Property Is_visible = new Property(3, String.class, "is_visible", false, "IS_VISIBLE");
|
||||||
|
public final static Property Usr_crt = new Property(4, String.class, "usr_crt", false, "USR_CRT");
|
||||||
|
public final static Property Dtm_crt = new Property(5, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||||
|
public final static Property Usr_upd = new Property(6, String.class, "usr_upd", false, "USR_UPD");
|
||||||
|
public final static Property Dtm_upd = new Property(7, java.util.Date.class, "dtm_upd", false, "DTM_UPD");
|
||||||
|
public final static Property Uuid_user = new Property(8, String.class, "uuid_user", false, "UUID_USER");
|
||||||
|
};
|
||||||
|
|
||||||
|
private DaoSession daoSession;
|
||||||
|
|
||||||
|
private Query<Menu> user_MenuListQuery;
|
||||||
|
|
||||||
|
public MenuDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MenuDao(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_MENU\" (" + //
|
||||||
|
"\"UUID_MENU\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_menu
|
||||||
|
"\"MENU_ID\" TEXT," + // 1: menu_id
|
||||||
|
"\"FLAG_JOB\" TEXT," + // 2: flag_job
|
||||||
|
"\"IS_VISIBLE\" TEXT," + // 3: is_visible
|
||||||
|
"\"USR_CRT\" TEXT," + // 4: usr_crt
|
||||||
|
"\"DTM_CRT\" INTEGER," + // 5: dtm_crt
|
||||||
|
"\"USR_UPD\" TEXT," + // 6: usr_upd
|
||||||
|
"\"DTM_UPD\" INTEGER," + // 7: dtm_upd
|
||||||
|
"\"UUID_USER\" TEXT);"); // 8: uuid_user
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MS_MENU\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected void bindValues(DatabaseStatement stmt, Menu entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
stmt.bindString(1, entity.getUuid_menu());
|
||||||
|
|
||||||
|
String menu_id = entity.getMenu_id();
|
||||||
|
if (menu_id != null) {
|
||||||
|
stmt.bindString(2, menu_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String flag_job = entity.getFlag_job();
|
||||||
|
if (flag_job != null) {
|
||||||
|
stmt.bindString(3, flag_job);
|
||||||
|
}
|
||||||
|
|
||||||
|
String is_visible = entity.getIs_visible();
|
||||||
|
if (is_visible != null) {
|
||||||
|
stmt.bindString(4, is_visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
String usr_crt = entity.getUsr_crt();
|
||||||
|
if (usr_crt != null) {
|
||||||
|
stmt.bindString(5, usr_crt);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||||
|
if (dtm_crt != null) {
|
||||||
|
stmt.bindLong(6, dtm_crt.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String usr_upd = entity.getUsr_upd();
|
||||||
|
if (usr_upd != null) {
|
||||||
|
stmt.bindString(7, usr_upd);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_upd = entity.getDtm_upd();
|
||||||
|
if (dtm_upd != null) {
|
||||||
|
stmt.bindLong(8, dtm_upd.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String uuid_user = entity.getUuid_user();
|
||||||
|
if (uuid_user != null) {
|
||||||
|
stmt.bindString(9, uuid_user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachEntity(Menu entity) {
|
||||||
|
super.attachEntity(entity);
|
||||||
|
entity.__setDaoSession(daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.getString(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public Menu readEntity(Cursor cursor, int offset) {
|
||||||
|
Menu entity = new Menu( //
|
||||||
|
cursor.getString(offset + 0), // uuid_menu
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // menu_id
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // flag_job
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // is_visible
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // usr_crt
|
||||||
|
cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)), // dtm_crt
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // usr_upd
|
||||||
|
cursor.isNull(offset + 7) ? null : new java.util.Date(cursor.getLong(offset + 7)), // dtm_upd
|
||||||
|
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // uuid_user
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Menu entity, int offset) {
|
||||||
|
entity.setUuid_menu(cursor.getString(offset + 0));
|
||||||
|
entity.setMenu_id(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setFlag_job(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setIs_visible(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||||
|
entity.setUsr_crt(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setDtm_crt(cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)));
|
||||||
|
entity.setUsr_upd(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||||
|
entity.setDtm_upd(cursor.isNull(offset + 7) ? null : new java.util.Date(cursor.getLong(offset + 7)));
|
||||||
|
entity.setUuid_user(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected String updateKeyAfterInsert(Menu entity, long rowId) {
|
||||||
|
return entity.getUuid_menu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String getKey(Menu entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getUuid_menu();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Internal query to resolve the "menuList" to-many relationship of User. */
|
||||||
|
public List<Menu> _queryUser_MenuList(String uuid_user) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (user_MenuListQuery == null) {
|
||||||
|
QueryBuilder<Menu> queryBuilder = queryBuilder();
|
||||||
|
queryBuilder.where(Properties.Uuid_user.eq(null));
|
||||||
|
user_MenuListQuery = queryBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Query<Menu> query = user_MenuListQuery.forCurrentThread();
|
||||||
|
query.setParameter(0, uuid_user);
|
||||||
|
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_MENU T");
|
||||||
|
builder.append(" LEFT JOIN MS_USER T0 ON T.\"UUID_USER\"=T0.\"UUID_USER\"");
|
||||||
|
builder.append(' ');
|
||||||
|
selectDeep = builder.toString();
|
||||||
|
}
|
||||||
|
return selectDeep;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Menu loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||||
|
Menu entity = loadCurrent(cursor, 0, lock);
|
||||||
|
int offset = getAllColumns().length;
|
||||||
|
|
||||||
|
User user = loadCurrentOther(daoSession.getUserDao(), cursor, offset);
|
||||||
|
entity.setUser(user);
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Menu 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<Menu> loadAllDeepFromCursor(Cursor cursor) {
|
||||||
|
int count = cursor.getCount();
|
||||||
|
List<Menu> list = new ArrayList<Menu>(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<Menu> 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<Menu> queryDeep(String where, String... selectionArg) {
|
||||||
|
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||||
|
return loadDeepAllAndCloseCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?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"
|
||||||
|
android:background="@drawable/bg_grayscale"
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
android:id="@+id/actionbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@drawable/actionbar_background" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/mapIn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
class="com.google.android.gms.maps.SupportMapFragment"
|
||||||
|
android:tag="mapin" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btnRefreshCIn"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@drawable/circle_button"
|
||||||
|
android:src="@drawable/ic_refresh_maps" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/DescLayoutIn"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/lowpriority_background">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/addressImage"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_absent"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textLocalIn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textAddressIn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- <Button -->
|
||||||
|
<!-- android:id="@+id/btnRefreshCIn" -->
|
||||||
|
<!-- android:layout_width="wrap_content" -->
|
||||||
|
<!-- android:layout_height="wrap_content" -->
|
||||||
|
<!-- android:layout_marginRight="5dp" -->
|
||||||
|
<!-- android:layout_marginTop="5dp" -->
|
||||||
|
<!-- android:text="Refresh" -->
|
||||||
|
<!-- android:layout_gravity="right" /> -->
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,148 @@
|
||||||
|
package com.adins.mss.coll.models;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adityapurwa on 20/03/15.
|
||||||
|
*/
|
||||||
|
public class PaymentHistoryResponseHeader extends MssResponseType {
|
||||||
|
|
||||||
|
private String uuidTaskId;
|
||||||
|
|
||||||
|
private java.util.Date dtmCrt;
|
||||||
|
|
||||||
|
private String usrCrt;
|
||||||
|
|
||||||
|
private java.util.Date dtmUpd;
|
||||||
|
private String usrUpd;
|
||||||
|
private String agreementNo;
|
||||||
|
private String branchCode;
|
||||||
|
private String receiptNo;
|
||||||
|
private String valueDate;
|
||||||
|
private java.util.Date postingDate;
|
||||||
|
private String paymentAmount;
|
||||||
|
private String installmentAmount;
|
||||||
|
private String installmentNumber;
|
||||||
|
private String transactionType;
|
||||||
|
private String wopCode;
|
||||||
|
|
||||||
|
public String getUuidTaskId() {
|
||||||
|
return uuidTaskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuidTaskId(String uuidTaskId) {
|
||||||
|
this.uuidTaskId = uuidTaskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getDtmCrt() {
|
||||||
|
return dtmCrt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtmCrt(java.util.Date dtmCrt) {
|
||||||
|
this.dtmCrt = dtmCrt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsrCrt() {
|
||||||
|
return usrCrt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsrCrt(String usrCrt) {
|
||||||
|
this.usrCrt = usrCrt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getDtmUpd() {
|
||||||
|
return dtmUpd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtmUpd(java.util.Date dtmUpd) {
|
||||||
|
this.dtmUpd = dtmUpd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsrUpd() {
|
||||||
|
return usrUpd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsrUpd(String usrUpd) {
|
||||||
|
this.usrUpd = usrUpd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAgreementNo() {
|
||||||
|
return agreementNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgreementNo(String agreementNo) {
|
||||||
|
this.agreementNo = agreementNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBranchCode() {
|
||||||
|
return branchCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBranchCode(String branchCode) {
|
||||||
|
this.branchCode = branchCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReceiptNo() {
|
||||||
|
return receiptNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceiptNo(String receiptNo) {
|
||||||
|
this.receiptNo = receiptNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValueDate() {
|
||||||
|
return valueDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueDate(String valueDate) {
|
||||||
|
this.valueDate = valueDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getPostingDate() {
|
||||||
|
return postingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostingDate(java.util.Date postingDate) {
|
||||||
|
this.postingDate = postingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPaymentAmount() {
|
||||||
|
return paymentAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaymentAmount(String paymentAmount) {
|
||||||
|
this.paymentAmount = paymentAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstallmentAmount() {
|
||||||
|
return installmentAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstallmentAmount(String installmentAmount) {
|
||||||
|
this.installmentAmount = installmentAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstallmentNumber() {
|
||||||
|
return installmentNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstallmentNumber(String installmentNumber) {
|
||||||
|
this.installmentNumber = installmentNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransactionType() {
|
||||||
|
return transactionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionType(String transactionType) {
|
||||||
|
this.transactionType = transactionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWopCode() {
|
||||||
|
return wopCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWopCode(String wopCode) {
|
||||||
|
this.wopCode = wopCode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.adins.mss.base.models;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssRequestType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by eric.sn on 4/5/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CheckResubmitRequest extends MssRequestType {
|
||||||
|
@SerializedName("uuid_task_h")
|
||||||
|
public String uuidTaskH;
|
||||||
|
|
||||||
|
public String getUuidTaskH() {
|
||||||
|
return uuidTaskH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuidTaskH(String uuidTaskH) {
|
||||||
|
this.uuidTaskH = uuidTaskH;
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 2.6 KiB |
|
@ -0,0 +1,601 @@
|
||||||
|
package com.adins.mss.svy;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import com.adins.mss.base.ChangePasswordFragment;
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
import com.adins.mss.base.about.activity.AboutActivity;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||||
|
import com.adins.mss.base.mainmenu.MainMenuHelper;
|
||||||
|
import com.adins.mss.base.tasklog.TaskLogImpl;
|
||||||
|
import com.adins.mss.base.timeline.MenuAdapter;
|
||||||
|
import com.adins.mss.base.timeline.MenuModel;
|
||||||
|
import com.adins.mss.base.todo.form.GetSchemeTask;
|
||||||
|
import com.adins.mss.base.todolist.ToDoList;
|
||||||
|
import com.adins.mss.base.todolist.form.StatusTabFragment;
|
||||||
|
import com.adins.mss.base.todolist.form.TaskListFragment_new;
|
||||||
|
import com.adins.mss.base.todolist.form.TaskListTask;
|
||||||
|
import com.adins.mss.base.todolist.form.TaskList_Fragment;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.MenuDataAccess;
|
||||||
|
import com.adins.mss.svy.assignment.OrderAssignmentActivity;
|
||||||
|
import com.adins.mss.svy.assignment.OrderAssignmentTask;
|
||||||
|
import com.adins.mss.svy.fragments.SurveyApprovalByBranchFragment;
|
||||||
|
import com.adins.mss.svy.fragments.SurveyApprovalFragment;
|
||||||
|
import com.adins.mss.svy.fragments.SurveyPerformanceFragment;
|
||||||
|
import com.adins.mss.svy.fragments.SurveyVerificationByBranchFragment;
|
||||||
|
import com.adins.mss.svy.fragments.SurveyVerificationFragment;
|
||||||
|
import com.adins.mss.svy.reassignment.OrderFilterActivity;
|
||||||
|
import com.adins.mss.svy.tool.Constants;
|
||||||
|
import com.services.FirebaseMessagingService;
|
||||||
|
import com.services.NotificationThread;
|
||||||
|
import com.services.SurveyApprovalService;
|
||||||
|
import com.services.SurveyApprovalThread;
|
||||||
|
import com.services.SurveyAssignmentThread;
|
||||||
|
import com.services.SurveyVerificationService;
|
||||||
|
import com.services.SurveyVerificationThread;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MSMainMenuActivity extends com.adins.mss.base.mainmenu.MainMenuActivity{
|
||||||
|
|
||||||
|
public static MenuModel mnTimeline;
|
||||||
|
public static MenuModel mnNewTask;
|
||||||
|
// public static MenuModel mnTaskList;
|
||||||
|
// public static MenuModel mnLog;
|
||||||
|
public static MenuModel mnSVYPerformance;
|
||||||
|
// public static MenuModel mnSVYVerifyByBranch;
|
||||||
|
// public static MenuModel mnSVYApprovalByBranch;
|
||||||
|
public static MenuModel mnAbsentI;
|
||||||
|
public static MenuModel mnOrderAssignment;
|
||||||
|
public static MenuModel mnOrderReassignment;
|
||||||
|
public static MenuModel mnExit;
|
||||||
|
public static MenuModel mnAbout;
|
||||||
|
public static MenuModel mnSynchronize;
|
||||||
|
public static MenuModel mnChangePassword;
|
||||||
|
public static int flag_edit=0;
|
||||||
|
public static boolean inAbsent=false;
|
||||||
|
public static SurveyVerificationThread verificationThread;
|
||||||
|
public static SurveyApprovalThread approvalThread;
|
||||||
|
Fragment fragment;
|
||||||
|
ChangePasswordFragment fragmentChgPwd;
|
||||||
|
private DrawerLayout mDrawerLayout;
|
||||||
|
private ListView mDrawerListLeft;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ArrayList<MenuModel> getModels() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
ArrayList<MenuModel> models = new ArrayList<MenuModel>();
|
||||||
|
MenuModel titleGroup1 = new MenuModel(getString(R.string.title_mn_main_menu));
|
||||||
|
titleGroup1.isGroupHeader();
|
||||||
|
MenuModel titleGroup2 = new MenuModel(getString(R.string.title_mn_other));
|
||||||
|
titleGroup2.isGroupHeader();
|
||||||
|
|
||||||
|
mnTimeline = new MenuModel(R.drawable.ic_home, getString(R.string.title_mn_home), null);
|
||||||
|
models.add(titleGroup1);
|
||||||
|
models.add(mnTimeline);
|
||||||
|
List<String> mainMenuTitle = getMainMenuTitle();
|
||||||
|
List<Integer> mainMenuIcon = getMainMenuIcon();
|
||||||
|
for(int i=0; i<mainMenuTitle.size();i++){
|
||||||
|
if(mainMenuTitle.get(i).equalsIgnoreCase(getString(R.string.title_mn_tasklist))){
|
||||||
|
mnTaskList = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnTaskList);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_log))){
|
||||||
|
mnLog = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnLog);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_surveyverification))){
|
||||||
|
mnSVYVerify = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnSVYVerify);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_surveyapproval))){
|
||||||
|
mnSVYApproval = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnSVYApproval);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_verification_bybranch))){
|
||||||
|
mnSVYVerifyByBranch = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnSVYVerifyByBranch);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_approval_bybranch))){
|
||||||
|
mnSVYApprovalByBranch = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||||
|
models.add(mnSVYApprovalByBranch);
|
||||||
|
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_surveyassign))) {
|
||||||
|
mnSVYAssignment = new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), "0");
|
||||||
|
models.add(mnSVYAssignment);
|
||||||
|
}else{
|
||||||
|
models.add(new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* MenuModel mnSVYVerifybr = new MenuModel(R.drawable.ic_verification,getString(R.string.title_mn_verification_bybranch), null);
|
||||||
|
models.add(mnSVYVerifybr);
|
||||||
|
MenuModel mnSVYApprovalbr=new MenuModel(R.drawable.ic_approval,getString(R.string.title_mn_approval_bybranch), null);
|
||||||
|
models.add(mnSVYApprovalbr);
|
||||||
|
mnSVYApproval = new MenuModel(R.drawable.ic_approval,getString(R.string.title_mn_surveyapproval),"0");
|
||||||
|
models.add(mnSVYApproval);*/
|
||||||
|
|
||||||
|
models.add(titleGroup2);
|
||||||
|
List<String> otherMenuTitle = getOtherMenuTitle();
|
||||||
|
List<Integer> otherMenuIcon = getOtherMenuIcon();
|
||||||
|
// mnChangePassword = new MenuModel(R.drawable.ic_changepassword,getString(R.string.title_mn_changepassword), null);
|
||||||
|
// models.add(mnChangePassword);
|
||||||
|
for(int i=0; i<otherMenuTitle.size();i++){
|
||||||
|
models.add(new MenuModel(otherMenuIcon.get(i),otherMenuTitle.get(i),null));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0 ; i<models.size(); i++){
|
||||||
|
this.allMenu.add(models.get(i).getTitle());
|
||||||
|
}
|
||||||
|
Global.FEATURE_RESCHEDULE_SURVEY = MenuDataAccess.isHaveRescheduleMenu(getApplicationContext());
|
||||||
|
Global.VERIFICATION_BRANCH = MenuDataAccess.isHaveVerificationBranchMenu(getApplicationContext());
|
||||||
|
Global.APPROVAL_BRANCH = MenuDataAccess.isHaveApprovalBranchMenu(getApplicationContext());
|
||||||
|
this.models=models;
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTitleGroup() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "Survey";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoAbout() {
|
||||||
|
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 2);
|
||||||
|
super.gotoAbout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
MainMenuActivity.setMss(this.getClass());
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 2);
|
||||||
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
mDrawerListLeft = (ListView) findViewById(R.id.left_drawer);
|
||||||
|
|
||||||
|
menuAdapter = new MenuAdapter(this, getModels(), R.drawable.activated_background_indicator);
|
||||||
|
mDrawerListLeft.setAdapter(menuAdapter);
|
||||||
|
mDrawerListLeft.setOnItemClickListener(this);
|
||||||
|
|
||||||
|
//setcounter
|
||||||
|
try {
|
||||||
|
if(MSMainMenuActivity.mnLog!=null)
|
||||||
|
MSMainMenuActivity.mnLog.setCounter(String.valueOf(TaskLogImpl.getCounterLog(this)));
|
||||||
|
if(MSMainMenuActivity.mnTaskList!=null)
|
||||||
|
MSMainMenuActivity.mnTaskList.setCounter(String.valueOf(ToDoList.getCounterTaskList(this)));
|
||||||
|
if (MSMainMenuActivity.mnSVYVerify != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerify.setCounter(String.valueOf(Constants.getCounterVerificationTask(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYApproval!= null)
|
||||||
|
MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYVerifyByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerifyByBranch.setCounter(String.valueOf(Constants.getCounterVerificationTaskByBranch(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYApprovalByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYApprovalByBranch.setCounter(String.valueOf(Constants.getCounterApprovalTaskByBranch(getApplicationContext())));
|
||||||
|
} catch (Exception e) { FireCrash.log(e);
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
goTimeline(1);
|
||||||
|
Global.positionStack.push(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM03_ASIN").getGs_value().equals("0")){
|
||||||
|
if (mnSVYVerify != null || mnSVYVerifyByBranch!=null) {
|
||||||
|
verificationThread = new SurveyVerificationThread(this);
|
||||||
|
Global.verifyNotivIntent = new Intent(this,SurveyVerificationService.class);
|
||||||
|
startService(Global.verifyNotivIntent);
|
||||||
|
}
|
||||||
|
if (mnSVYApproval != null || mnSVYApprovalByBranch!=null) {
|
||||||
|
approvalThread = new SurveyApprovalThread(this);
|
||||||
|
Global.approvalNotivIntent = new Intent(this,SurveyApprovalService.class);
|
||||||
|
startService(Global.approvalNotivIntent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainMenuActivity.setApprovalFragment(new SurveyApprovalFragment());
|
||||||
|
MainMenuActivity.setVerificationFragment(new SurveyVerificationFragment());
|
||||||
|
MainMenuActivity.setApprovalFragmentByBranch(new SurveyApprovalByBranchFragment());
|
||||||
|
MainMenuActivity.setVerificationFragmentByBranch(new SurveyVerificationByBranchFragment());
|
||||||
|
MainMenuActivity.setAssignmentFragment(new OrderAssignmentActivity());
|
||||||
|
MainMenuActivity.setStatusFragment(new StatusTabFragment());
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
if (MSMainMenuActivity.mnSVYVerify != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerify.setCounter(String.valueOf(Constants.getCounterVerificationTask(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYApproval!= null)
|
||||||
|
MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYVerifyByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerifyByBranch.setCounter(String.valueOf(Constants.getCounterVerificationTaskByBranch(getApplicationContext())));
|
||||||
|
if (MSMainMenuActivity.mnSVYApprovalByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYApprovalByBranch.setCounter(String.valueOf(Constants.getCounterApprovalTaskByBranch(getApplicationContext())));
|
||||||
|
if (MainMenuActivity.menuAdapter != null)
|
||||||
|
MainMenuActivity.menuAdapter.notifyDataSetChanged();
|
||||||
|
} catch (Exception e) { FireCrash.log(e);
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 500);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String action = intent.getAction().toUpperCase();
|
||||||
|
|
||||||
|
if (action != null) {
|
||||||
|
if (action.equalsIgnoreCase("TASKLISTNOTIFICATION")) {
|
||||||
|
Bundle argument = new Bundle();
|
||||||
|
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, false);
|
||||||
|
Fragment fragment1 = new TaskListFragment_new();//TaskList_Fragment();
|
||||||
|
fragment1.setArguments(argument);
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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);
|
||||||
|
try {
|
||||||
|
transaction.commit();
|
||||||
|
} catch (Exception e) { FireCrash.log(e);
|
||||||
|
transaction.commitAllowingStateLoss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(Global.IS_DEV)
|
||||||
|
System.out.println("Intent was null");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
actionFromNotif(getIntent());
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionFromNotif(Intent intent){
|
||||||
|
try {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if(action!=null){
|
||||||
|
if(action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)){
|
||||||
|
Bundle argument = new Bundle();
|
||||||
|
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, false);
|
||||||
|
Fragment fragment1 = new TaskListFragment_new();//TaskList_Fragment();
|
||||||
|
fragment1.setArguments(argument);
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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();
|
||||||
|
}
|
||||||
|
else if(action.equals(SurveyVerificationThread.VERIFICATIONLIST_NOTIFICATION_KEY)){
|
||||||
|
gotoSurveyVerification(0);
|
||||||
|
}else if(action.equals(SurveyVerificationThread.VERIFICATIONBRANCHLIST_NOTIFICATION_KEY)){
|
||||||
|
gotoSurveyVerificationByBranch(0);
|
||||||
|
}else if(action.equals(SurveyApprovalThread.APPROVALBRANCHLIST_NOTIFICATION_KEY)){
|
||||||
|
gotoSurveyApprovalByBranch(0);
|
||||||
|
}else if(action.equals(SurveyApprovalThread.APPROVALLIST_NOTIFICATION_KEY)){
|
||||||
|
gotoSurveyApproval(0);
|
||||||
|
}else if(action.equals(SurveyAssignmentThread.ASSIGNMENT_NOTIFICATION_KEY)) {
|
||||||
|
gotoSurveyAssignment(0);
|
||||||
|
} else if (action.equals(Global.MAINMENU_NOTIFICATION_KEY)){
|
||||||
|
goTimeline(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
actionFromNotif(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
Global.syncIntent = new Intent(getApplicationContext(), MSSynchronizeActivity.class);
|
||||||
|
if(MainMenuActivity.getMss()==null) {
|
||||||
|
MainMenuActivity.setMss(this.getClass());
|
||||||
|
// NotificationService.mss = mss;
|
||||||
|
|
||||||
|
}
|
||||||
|
MainMenuActivity.setMainMenuClass(MSMainMenuActivity.class);
|
||||||
|
getActionBar().removeAllTabs();
|
||||||
|
Global.VerificationActivityClass = SurveyVerificationActionActivity.class;
|
||||||
|
// TimelineModel.taskList_Fragment=new TaskList_Fragment();
|
||||||
|
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
|
long taskListCounter = Constants.getCounterVerificationTask(getApplicationContext());
|
||||||
|
try {
|
||||||
|
if (MSMainMenuActivity.mnSVYVerify != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerify.setCounter(String.valueOf(Constants.getCounterVerificationTask(getApplicationContext())));
|
||||||
|
else if(MSMainMenuActivity.mnSVYVerifyByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYVerifyByBranch.setCounter(String.valueOf(Constants.getCounterVerificationTaskByBranch(getApplicationContext())));
|
||||||
|
else{
|
||||||
|
try {
|
||||||
|
stopService(Global.verifyNotivIntent);
|
||||||
|
} catch (Exception e) { FireCrash.log(e);
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MSMainMenuActivity.mnSVYApproval!= null)
|
||||||
|
MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getApplicationContext())));
|
||||||
|
else if (MSMainMenuActivity.mnSVYApprovalByBranch != null)
|
||||||
|
MSMainMenuActivity.mnSVYApprovalByBranch.setCounter(String.valueOf(Constants.getCounterApprovalTaskByBranch(getApplicationContext())));
|
||||||
|
else{
|
||||||
|
try {
|
||||||
|
stopService(Global.approvalNotivIntent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if(isFromSetting) {
|
||||||
|
menuAdapter = new MenuAdapter(getApplicationContext(), getModels(), R.drawable.activated_background_indicator);
|
||||||
|
mDrawerListLeft.setAdapter(menuAdapter);
|
||||||
|
mDrawerListLeft.notifyAll();
|
||||||
|
isFromSetting=false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(){
|
||||||
|
super.onDestroy();
|
||||||
|
if (verificationThread != null) {
|
||||||
|
verificationThread.requestStop();
|
||||||
|
verificationThread = null;
|
||||||
|
}
|
||||||
|
if (approvalThread != null) {
|
||||||
|
approvalThread.requestStop();
|
||||||
|
approvalThread = null;
|
||||||
|
}
|
||||||
|
MainMenuActivity.mnTaskList = null;
|
||||||
|
MainMenuActivity.mnSVYApproval = null;
|
||||||
|
MainMenuActivity.mnSVYVerify = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, final int position,
|
||||||
|
long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onItemClick(parent, view, position, id);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(getString(R.string.title_mn_changepassword).equalsIgnoreCase(allMenu.get(position))){
|
||||||
|
gotoChangePassword();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
//bong 10 apr 15 - menjaga saat change password tidak dapat lihat menu
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
|
if(fragmentChgPwd!=null){
|
||||||
|
if(fragmentChgPwd.isVisible()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//bong 7 apr 15 disabled onBackpressed on fragment
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// if(fragmentChgPwd!=null && fragmentChgPwd.isVisible()){
|
||||||
|
// if(GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")){
|
||||||
|
// fragmentChgPwd.onBackPressed();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gotoChangePassword() {
|
||||||
|
fragment = new ChangePasswordFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putBoolean(ChangePasswordFragment.AS_ACTIVITY, false);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
if(GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")){
|
||||||
|
fragmentChgPwd = (ChangePasswordFragment) fragment;
|
||||||
|
fragmentChgPwd.setArguments(args);
|
||||||
|
}
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Intent getIntentSynchronize() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new Intent(this, MSSynchronizeActivity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Fragment getChgPassFragment() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return fragmentChgPwd;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void goTimeline(int position) {
|
||||||
|
// TimelineModel.taskList_Fragment=new TaskList_Fragment();
|
||||||
|
super.goTimeline(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoNewTask(int position) {
|
||||||
|
GetSchemeTask task = new GetSchemeTask(this, new MSNewTaskActivity(), true);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoCheckOrder(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoCreditSimulation(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoCancelOrder(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoTaskList(int position) {
|
||||||
|
TaskListTask task = new TaskListTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoTaskList), R.id.content_frame);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoPromo(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoNews(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyPerformance(int position) {
|
||||||
|
fragment = new SurveyPerformanceFragment();
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyVerification(int position) {
|
||||||
|
fragment = new SurveyVerificationFragment();
|
||||||
|
SurveyVerificationListTask task = new SurveyVerificationListTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoVerification),null);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyApproval(int position) {
|
||||||
|
fragment = new SurveyApprovalFragment();
|
||||||
|
SurveyApprovalListTask task = new SurveyApprovalListTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoApproval),null);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoOrderAssignment(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void gotoOrderReassignment(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyAssignment(int position) {
|
||||||
|
OrderAssignmentTask task = new OrderAssignmentTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoList),R.id.content_frame);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyReassignment(int position) {
|
||||||
|
fragment = new OrderFilterActivity();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_ORDER_REASSIGNMENT);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoReportSummary(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoDepositReport(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoPaymentHistory(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoInstallmentSchedule(int position) {
|
||||||
|
showNotAvailableMenu(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoClosingTask(int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showNotAvailableMenu(int position){
|
||||||
|
MainMenuHelper.showNotAvailableMenuDialog(MSMainMenuActivity.this, allMenu.get(position));
|
||||||
|
Global.positionStack.pop();
|
||||||
|
mDrawerListLeft.setItemChecked(Global.positionStack.lastElement(), true);
|
||||||
|
setTitle(models.get(Global.positionStack.lastElement()).getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyVerificationByBranch(int position) {
|
||||||
|
fragment = new SurveyVerificationFragment();
|
||||||
|
SurveyVerificationListTask task = new SurveyVerificationListTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoVerification), SurveyVerificationListTask.KEY_BRANCH);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gotoSurveyApprovalByBranch(int position) {
|
||||||
|
fragment = new SurveyApprovalFragment();
|
||||||
|
SurveyApprovalListTask task = new SurveyApprovalListTask(this, getString(R.string.progressWait),
|
||||||
|
getString(R.string.msgNoApproval), SurveyApprovalListTask.KEY_BRANCH);
|
||||||
|
task.execute();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.adins.mss.base.dynamicform;
|
||||||
|
|
||||||
|
import com.adins.mss.base.dynamicform.form.models.PhotoDocumentBean;
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JsonResponseLuOnlineView extends MssResponseType implements Serializable {
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
private List<PhotoDocumentBean> data;
|
||||||
|
|
||||||
|
public List<PhotoDocumentBean> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<PhotoDocumentBean> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:clickable="true">
|
||||||
|
<TextView android:id="@+id/textView1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:textColor="#46F"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="normal"/>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#555555"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.adins.mss.coll.api;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.base.util.GsonHelper;
|
||||||
|
import com.adins.mss.base.util.Utility;
|
||||||
|
import com.adins.mss.coll.models.InstallmentScheduleRequest;
|
||||||
|
import com.adins.mss.coll.models.InstallmentScheduleResponse;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||||
|
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||||
|
import com.google.firebase.perf.FirebasePerformance;
|
||||||
|
import com.google.firebase.perf.metrics.HttpMetric;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adityapurwa on 06/05/15.
|
||||||
|
*/
|
||||||
|
public class InstallmentScheduleApi {
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
public InstallmentScheduleApi(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InstallmentScheduleResponse request(String taskId) throws IOException {
|
||||||
|
InstallmentScheduleRequest request = new InstallmentScheduleRequest();
|
||||||
|
request.setTaskId(taskId);
|
||||||
|
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
|
||||||
|
String requestJson = GsonHelper.toJson(request);
|
||||||
|
|
||||||
|
//HttpClient client = new HttpClient(context);
|
||||||
|
String url = GlobalData.getSharedGlobalData().getURL_GET_INSTALLMENTSCHEDULE();
|
||||||
|
// Request httpRequest = client.request(url)
|
||||||
|
// .post(RequestBody.create(MediaType.parse("application/json"), requestJson))
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// Response response = client.execute(httpRequest);
|
||||||
|
// String responseJson = response.body().string();
|
||||||
|
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||||
|
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||||
|
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||||
|
HttpConnectionResult serverResult = null;
|
||||||
|
|
||||||
|
HttpMetric networkMetric =
|
||||||
|
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||||
|
Utility.metricStart(networkMetric, requestJson);
|
||||||
|
|
||||||
|
try {
|
||||||
|
serverResult = httpConn.requestToServer(url, requestJson, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||||
|
Utility.metricStop(networkMetric, serverResult);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String responseJson ="" ;
|
||||||
|
if(serverResult!=null && serverResult.isOK()){
|
||||||
|
try {
|
||||||
|
responseJson = serverResult.getResult();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// bong 21 mei 15 - add or replace to local database
|
||||||
|
InstallmentScheduleResponse installmentSchedResp = GsonHelper.fromJson(responseJson, InstallmentScheduleResponse.class);
|
||||||
|
// if(installmentSchedResp!=null){
|
||||||
|
// List<InstallmentSchedule> installmentScheduleList = installmentSchedResp.getInstallmentScheduleList();
|
||||||
|
// if(installmentScheduleList!=null && installmentScheduleList.size()>0){
|
||||||
|
// List<InstallmentSchedule> installmentScheduleLocalList = null;
|
||||||
|
// TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
|
||||||
|
// for(InstallmentSchedule installmentSchedule : installmentScheduleList){
|
||||||
|
// String agreementNo = installmentSchedule.getAgreement_no();
|
||||||
|
// if(agreementNo!=null && agreementNo.length()>0){
|
||||||
|
// installmentScheduleLocalList = InstallmentScheduleDataAccess.getAll(context, agreementNo);
|
||||||
|
// InstallmentScheduleDataAccess.delete(context, installmentSchedule.getUuid_task_h());
|
||||||
|
// taskH.setAppl_no(agreementNo);
|
||||||
|
// TaskHDataAccess.addOrReplace(context, taskH);
|
||||||
|
// }
|
||||||
|
// if(installmentSchedule.getUuid_installment_schedule()==null){
|
||||||
|
// installmentSchedule.setUuid_installment_schedule(Tool.getUUID());
|
||||||
|
// }
|
||||||
|
// InstallmentScheduleDataAccess.add(context, installmentSchedule);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//return gson.fromJson(responseJson, InstallmentScheduleResponse.class);
|
||||||
|
return installmentSchedResp;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.adins.mss.base.dukcapil;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class ImageDkcpBean {
|
||||||
|
@SerializedName("status")
|
||||||
|
String generatedStatus;
|
||||||
|
|
||||||
|
@SerializedName("read")
|
||||||
|
HashMap<String, String> read;
|
||||||
|
|
||||||
|
public HashMap<String, String> getValue() {
|
||||||
|
return read;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(HashMap<String, String> value) {
|
||||||
|
this.read = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeneratedStatus() {
|
||||||
|
return generatedStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeneratedStatus(String generatedStatus) {
|
||||||
|
this.generatedStatus = generatedStatus;
|
||||||
|
}
|
||||||
|
public String getValueRead(String key){
|
||||||
|
return read.get(key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.adins.mss.foundation.questiongenerator.form.QuestionView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/questionLocationLayout">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/questionLocationLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0. Label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_margin="5dp">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSetLocation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center|center_vertical"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnGPS"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgLocationAnswer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_absent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.6"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/questionLocationAnswer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:textSize="10dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</com.adins.mss.foundation.questiongenerator.form.QuestionView>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<translate android:fromXDelta="0%"
|
||||||
|
android:toXDelta="100%"
|
||||||
|
android:duration="@android:integer/config_shortAnimTime" />
|
||||||
|
</set>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.adins.mss.odr.news;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class NewsReceiver extends BroadcastReceiver{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="3dp"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:cardElevation="5dp"
|
||||||
|
app:contentPadding="5dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/productPicture"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/ic_back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productNameText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="Name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productPriceText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="Desc" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.adins.mss.coll.loyalti.pointacquisitionmonthly.contracts;
|
||||||
|
|
||||||
|
import com.adins.mss.coll.models.loyaltymodels.LoyaltyPointsRequest;
|
||||||
|
import com.adins.mss.coll.models.loyaltymodels.LoyaltyPointsResponse;
|
||||||
|
import com.adins.mss.dao.GeneralParameter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ILoyaltyPointsDataSource {
|
||||||
|
void requestPointsData(LoyaltyPointsRequest reqData, ReqPointsListener listener);
|
||||||
|
List<GeneralParameter> getJobsGenParam(List<String> jobs);
|
||||||
|
interface ReqPointsListener {
|
||||||
|
void onSuccess(LoyaltyPointsResponse loyaltyPoints);
|
||||||
|
void onFailed(String message);
|
||||||
|
}
|
||||||
|
|
||||||
|
//add more here...
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<gradient
|
||||||
|
android:startColor="#f06a4d"
|
||||||
|
android:endColor="#ab2002"
|
||||||
|
android:angle="270" />
|
||||||
|
<corners
|
||||||
|
android:radius="0dp" />
|
||||||
|
<!-- <padding -->
|
||||||
|
<!-- android:left="10dp" -->
|
||||||
|
<!-- android:top="10dp" -->
|
||||||
|
<!-- android:right="10dp" -->
|
||||||
|
<!-- android:bottom="10dp" /> -->
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,146 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/bgColor">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:background="@drawable/header"
|
||||||
|
app:titleTextAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:titleTextColor="@color/fontColorWhite"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||||
|
app:layout_collapseMode="pin"
|
||||||
|
android:fitsSystemWindows="true" />
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/detailContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:contentPadding="10dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_transaction_code_2"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:id="@+id/transactionCode"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1">
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:id="@+id/horizontalScrollView1"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fillViewport="true">
|
||||||
|
<TableLayout android:layout_width="match_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:stretchColumns="4"
|
||||||
|
android:id="@+id/tableCollectionDetail">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:text="@string/label_no"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/label_field"
|
||||||
|
android:minWidth="120dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/label_value"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/timelineLine"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/timelineLine"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/timelineLine"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/timelineLine"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/timelineLine"/>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp">
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp" />
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp" />
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/timelineLine" />
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp" />
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
</HorizontalScrollView>
|
||||||
|
</ScrollView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.adins.mss.odr.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by winy.firdasari on 20/01/2015.
|
||||||
|
*/
|
||||||
|
public class Order {
|
||||||
|
public String orderNo;
|
||||||
|
public String customerName;
|
||||||
|
public List<StatusOrder> statusOrder;
|
||||||
|
|
||||||
|
|
||||||
|
public Order(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderNo() {
|
||||||
|
return orderNo;
|
||||||
|
}
|
||||||
|
public void setOrderNo(String orderNo) {
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
}
|
||||||
|
public String getCustomerName() {
|
||||||
|
return customerName;
|
||||||
|
}
|
||||||
|
public void setCustomerName(String customerName) {
|
||||||
|
this.customerName = customerName;
|
||||||
|
}
|
||||||
|
public List<StatusOrder> getStatusOrder() {
|
||||||
|
return statusOrder;
|
||||||
|
}
|
||||||
|
public void setStatusOrder(List<StatusOrder> statusOrder) {
|
||||||
|
this.statusOrder = statusOrder;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.adins.mss.coll.closingtask;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.coll.R;
|
||||||
|
import com.adins.mss.coll.closingtask.models.ClosingTaskRequest;
|
||||||
|
import com.adins.mss.coll.closingtask.models.ClosingTaskResponse;
|
||||||
|
import com.adins.mss.coll.closingtask.senders.ClosingTaskListener;
|
||||||
|
import com.adins.mss.coll.closingtask.senders.ClosingTaskSender;
|
||||||
|
import com.adins.mss.coll.dummy.ClosingTaskDummyAdapter;
|
||||||
|
import com.adins.mss.coll.dummy.UserHelpCOLDummy;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||||
|
import com.androidquery.AQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by angga.permadi on 6/6/2016.
|
||||||
|
*/
|
||||||
|
public class ClosingTaskFragment extends Fragment implements ClosingTaskListener {
|
||||||
|
private AQuery query;
|
||||||
|
private static boolean showDummy = true;
|
||||||
|
public static ClosingTaskFragment newInstance() {
|
||||||
|
return new ClosingTaskFragment();
|
||||||
|
}
|
||||||
|
private ListView listView;
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.new_fragment_closing_task, container, false);
|
||||||
|
query = new AQuery(getActivity(), view);
|
||||||
|
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||||
|
getActivity().setTitle(R.string.title_mn_closing_task);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
super.onAttach(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
listView = (ListView) query.id(R.id.listClosingTask).getView();
|
||||||
|
if(Global.ENABLE_USER_HELP &&
|
||||||
|
showDummy &&
|
||||||
|
Global.userHelpDummyGuide.get(ClosingTaskFragment.this.getClass().getSimpleName()) != null &&
|
||||||
|
Global.userHelpDummyGuide.get(ClosingTaskFragment.this.getClass().getSimpleName()).size()>0){
|
||||||
|
listView.setAdapter(ClosingTaskDummyAdapter.getInstance());
|
||||||
|
showDummy=false;
|
||||||
|
UserHelpCOLDummy userHelpCOLDummy = new UserHelpCOLDummy();
|
||||||
|
userHelpCOLDummy.showDummyClosing(ClosingTaskFragment.this.getActivity(),ClosingTaskFragment.this.getClass().getSimpleName(),listView,ClosingTaskAdapter.getInstance());
|
||||||
|
} else {
|
||||||
|
listView.setAdapter(ClosingTaskAdapter.getInstance());
|
||||||
|
}
|
||||||
|
updateCount();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||||
|
getActivity().setTitle(R.string.title_mn_closing_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
query = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if(item.getItemId() == R.id.mnGuide){
|
||||||
|
if(!Global.BACKPRESS_RESTRICTION) {
|
||||||
|
listView.setAdapter(ClosingTaskDummyAdapter.getInstance());
|
||||||
|
showDummy = false;
|
||||||
|
UserHelpCOLDummy userHelpCOLDummy = new UserHelpCOLDummy();
|
||||||
|
userHelpCOLDummy.showDummyClosing(ClosingTaskFragment.this.getActivity(), ClosingTaskFragment.this.getClass().getSimpleName(), listView, ClosingTaskAdapter.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClosingTaskSuccess() {
|
||||||
|
ClosingTaskAdapter.getInstance().clear();
|
||||||
|
ClosingTaskAdapter.getInstance().notifyDataSetChanged();
|
||||||
|
updateCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCount() {
|
||||||
|
query.id(R.id.btnClosingTask).clicked(this, "closingTask").text(
|
||||||
|
getString(R.string.title_mn_closing_task) + " (" +
|
||||||
|
ClosingTaskAdapter.getInstance().getCount() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep // subcribe
|
||||||
|
public void closingTask() {
|
||||||
|
if (GlobalData.getSharedGlobalData().getUser() != null) {
|
||||||
|
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||||
|
boolean isDraft = TaskHDataAccess.getAllTaskByStatus(getActivity(), uuidUser, TaskHDataAccess.STATUS_SEND_SAVEDRAFT).size() != 0;
|
||||||
|
boolean isPending = TaskHDataAccess.getAllTaskByStatus(getActivity(), uuidUser, TaskHDataAccess.STATUS_SEND_PENDING).size() != 0;
|
||||||
|
|
||||||
|
/*boolean isRvPending = TaskHDataAccess.getOneTaskByStatusRV(getActivity(), uuidUser, TaskHDataAccess.STATUS_RV_PENDING) != null;
|
||||||
|
*/
|
||||||
|
if (Global.isIsUploading() || isDraft || isPending) { /*|| isRvPending) {*/
|
||||||
|
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
dialogBuilder.withTitle(getString(R.string.title_mn_closing_task))
|
||||||
|
.withMessage(getString(R.string.msg_still_uploading_closing_task))
|
||||||
|
.withButton1Text(getString(R.string.btnCancel))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.isCancelable(false)
|
||||||
|
.isCancelableOnTouchOutside(true)
|
||||||
|
.show();
|
||||||
|
} else {
|
||||||
|
ClosingTaskRequest request = new ClosingTaskRequest();
|
||||||
|
request.setFlag(ClosingTaskRequest.CLOSING_TASK);
|
||||||
|
|
||||||
|
ClosingTaskSender<ClosingTaskResponse> sender = new ClosingTaskSender<>(
|
||||||
|
getActivity(), request, ClosingTaskResponse.class);
|
||||||
|
sender.setListener(this);
|
||||||
|
sender.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/contentComment"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_toRightOf="@+id/txt_usrCrt"
|
||||||
|
android:minLines="2"
|
||||||
|
android:text="@string/comment"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_usrCrt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@+id/txt_timeCrt"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/comment_item_name"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_timeCrt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_below="@+id/contentComment"
|
||||||
|
android:text="@string/comment_item_date"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="#aaaaaa"/>
|
||||||
|
|
||||||
|
<!-- <View -->
|
||||||
|
<!-- android:layout_width="2dp" -->
|
||||||
|
<!-- android:id="@+id/divider" -->
|
||||||
|
<!-- android:layout_height="match_parent" -->
|
||||||
|
<!-- android:layout_marginLeft="5dp" -->
|
||||||
|
<!-- android:layout_alignBottom="@+id/contentComment" -->
|
||||||
|
<!-- android:layout_toRightOf="@+id/txt_usrCrt" -->
|
||||||
|
<!-- android:layout_alignParentTop="true" -->
|
||||||
|
<!-- android:background="#aaaaaa" /> -->
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,155 @@
|
||||||
|
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.PaymentChannel;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "MS_PAYMENTCHANNEL".
|
||||||
|
*/
|
||||||
|
public class PaymentChannelDao extends AbstractDao<PaymentChannel, String> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "MS_PAYMENTCHANNEL";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity PaymentChannel.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Uuid_paymentchannel = new Property(0, String.class, "uuid_paymentchannel", true, "UUID_PAYMENTCHANNEL");
|
||||||
|
public final static Property Usr_crt = new Property(1, String.class, "usr_crt", false, "USR_CRT");
|
||||||
|
public final static Property Dtm_crt = new Property(2, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||||
|
public final static Property Is_active = new Property(3, String.class, "is_active", false, "IS_ACTIVE");
|
||||||
|
public final static Property Code = new Property(4, String.class, "code", false, "CODE");
|
||||||
|
public final static Property Description = new Property(5, String.class, "description", false, "DESCRIPTION");
|
||||||
|
public final static Property Payment_limit = new Property(6, Double.class, "payment_limit", false, "PAYMENT_LIMIT");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public PaymentChannelDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaymentChannelDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, 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_PAYMENTCHANNEL\" (" + //
|
||||||
|
"\"UUID_PAYMENTCHANNEL\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_paymentchannel
|
||||||
|
"\"USR_CRT\" TEXT," + // 1: usr_crt
|
||||||
|
"\"DTM_CRT\" INTEGER," + // 2: dtm_crt
|
||||||
|
"\"IS_ACTIVE\" TEXT," + // 3: is_active
|
||||||
|
"\"CODE\" TEXT," + // 4: code
|
||||||
|
"\"DESCRIPTION\" TEXT," + // 5: description
|
||||||
|
"\"PAYMENT_LIMIT\" REAL);"); // 6: payment_limit
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MS_PAYMENTCHANNEL\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected void bindValues(DatabaseStatement stmt, PaymentChannel entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
stmt.bindString(1, entity.getUuid_paymentchannel());
|
||||||
|
|
||||||
|
String usr_crt = entity.getUsr_crt();
|
||||||
|
if (usr_crt != null) {
|
||||||
|
stmt.bindString(2, usr_crt);
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||||
|
if (dtm_crt != null) {
|
||||||
|
stmt.bindLong(3, dtm_crt.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
String is_active = entity.getIs_active();
|
||||||
|
if (is_active != null) {
|
||||||
|
stmt.bindString(4, is_active);
|
||||||
|
}
|
||||||
|
|
||||||
|
String code = entity.getCode();
|
||||||
|
if (code != null) {
|
||||||
|
stmt.bindString(5, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
String description = entity.getDescription();
|
||||||
|
if (description != null) {
|
||||||
|
stmt.bindString(6, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double payment_limit = entity.getPayment_limit();
|
||||||
|
if (payment_limit != null) {
|
||||||
|
stmt.bindDouble(7, payment_limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.getString(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public PaymentChannel readEntity(Cursor cursor, int offset) {
|
||||||
|
PaymentChannel entity = new PaymentChannel( //
|
||||||
|
cursor.getString(offset + 0), // uuid_paymentchannel
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // usr_crt
|
||||||
|
cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)), // dtm_crt
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // is_active
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // code
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // description
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getDouble(offset + 6) // payment_limit
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, PaymentChannel entity, int offset) {
|
||||||
|
entity.setUuid_paymentchannel(cursor.getString(offset + 0));
|
||||||
|
entity.setUsr_crt(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setDtm_crt(cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)));
|
||||||
|
entity.setIs_active(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||||
|
entity.setCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setDescription(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setPayment_limit(cursor.isNull(offset + 6) ? null : cursor.getDouble(offset + 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected String updateKeyAfterInsert(PaymentChannel entity, long rowId) {
|
||||||
|
return entity.getUuid_paymentchannel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
public String getKey(PaymentChannel entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getUuid_paymentchannel();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
@Override
|
||||||
|
protected boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.adins.mss.base.dynamicform;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssRequestType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class JsonRequestLuOnlineView extends MssRequestType implements Serializable {
|
||||||
|
|
||||||
|
@SerializedName("AgrNo")
|
||||||
|
private String agrNo;
|
||||||
|
@SerializedName("RefId")
|
||||||
|
private String refId;
|
||||||
|
|
||||||
|
public String getAgrNo() {
|
||||||
|
return agrNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgrNo(String agrNo) {
|
||||||
|
this.agrNo = agrNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefId() {
|
||||||
|
return refId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefId(String refId) {
|
||||||
|
this.refId = refId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,182 @@
|
||||||
|
package com.adins.mss.foundation.db.dataaccess;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import com.adins.mss.dao.DepositReportD;
|
||||||
|
import com.adins.mss.dao.DepositReportDDao;
|
||||||
|
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
|
|
||||||
|
public class DepositReportDDataAccess {
|
||||||
|
|
||||||
|
// 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 depositReportD dao and you can access the DB
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static DepositReportDDao getDepositReportDDao(Context context) {
|
||||||
|
return getDaoSession(context).getDepositReportDDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear session, close db and set daoOpenHelper to null
|
||||||
|
*/
|
||||||
|
public static void closeAll() {
|
||||||
|
/*if(daoOpenHelper!=null){
|
||||||
|
daoOpenHelper.closeAll();
|
||||||
|
daoOpenHelper = null;
|
||||||
|
}*/
|
||||||
|
DaoOpenHelper.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add depositReportD as entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param depositReportD
|
||||||
|
*/
|
||||||
|
public static void add(Context context, DepositReportD depositReportD) {
|
||||||
|
getDepositReportDDao(context).insertInTx(depositReportD);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add depositReportD as list entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param depositReportDList
|
||||||
|
*/
|
||||||
|
public static void add(Context context, List<DepositReportD> depositReportDList) {
|
||||||
|
getDepositReportDDao(context).insertInTx(depositReportDList);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all content in table.
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void clean(Context context) {
|
||||||
|
getDepositReportDDao(context).deleteAll();
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param depositReportD
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, DepositReportD depositReportD) {
|
||||||
|
getDepositReportDDao(context).deleteInTx(depositReportD);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all record by keyDepositReportH
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param keyDepositReportH
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, String keyDepositReportH) {
|
||||||
|
QueryBuilder<DepositReportD> qb = getDepositReportDDao(context).queryBuilder();
|
||||||
|
qb.where(DepositReportDDao.Properties.Uuid_deposit_report_h.eq(keyDepositReportH));
|
||||||
|
qb.build();
|
||||||
|
getDepositReportDDao(context).deleteInTx(qb.list());
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deleteDummy(Context context) {
|
||||||
|
QueryBuilder<DepositReportD> qb = getDepositReportDDao(context).queryBuilder();
|
||||||
|
qb.where(DepositReportDDao.Properties.Is_sent.eq("10"));
|
||||||
|
qb.build();
|
||||||
|
getDepositReportDDao(context).deleteInTx(qb.list());
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param depositReportD
|
||||||
|
*/
|
||||||
|
public static void update(Context context, DepositReportD depositReportD) {
|
||||||
|
getDepositReportDDao(context).update(depositReportD);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select * from table where uuid_depositReportD = param
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param keyDepositReportH
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<DepositReportD> getAll(Context context, String keyDepositReportH) {
|
||||||
|
QueryBuilder<DepositReportD> qb = getDepositReportDDao(context).queryBuilder();
|
||||||
|
qb.where(DepositReportDDao.Properties.Uuid_deposit_report_h.eq(keyDepositReportH));
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get all rows from deposit report D
|
||||||
|
* select * from DepositReportD
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<DepositReportD> getAll(Context context) {
|
||||||
|
QueryBuilder<DepositReportD> qb = getDepositReportDDao(context).queryBuilder();
|
||||||
|
qb.build();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select depositReportD per
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select * from table where uuid_user = param
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getAllUuid(Context context) {
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
|
QueryBuilder<DepositReportD> qb = getDepositReportDDao(context).queryBuilder();
|
||||||
|
qb.build();
|
||||||
|
|
||||||
|
for (int i = 0; i < qb.list().size(); i++) {
|
||||||
|
result.add(qb.list().get(i).getUuid_task_h());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 361 B |
|
@ -0,0 +1,36 @@
|
||||||
|
package com.adins.mss.base.plugins;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Aditya Purwa on 1/5/2015.
|
||||||
|
* Plugin for activity context.
|
||||||
|
*/
|
||||||
|
public abstract class ActivityPlugin extends Plugin {
|
||||||
|
/**
|
||||||
|
* Initialize a new instance of plugin.
|
||||||
|
*
|
||||||
|
* @param context Context for the plugin. Must be an activity.
|
||||||
|
*/
|
||||||
|
protected ActivityPlugin(Context context) {
|
||||||
|
super(context);
|
||||||
|
if (!(context instanceof Activity)) {
|
||||||
|
throw new IllegalArgumentException(getContext().getString(R.string.plugin_required));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the context as an activity.
|
||||||
|
*
|
||||||
|
* @return Context as activity.
|
||||||
|
*/
|
||||||
|
public Activity getContextAsActivity() {
|
||||||
|
if (!(this.getContext() instanceof Activity)) {
|
||||||
|
throw new IllegalArgumentException(getContext().getString(R.string.plugin_required));
|
||||||
|
}
|
||||||
|
return (Activity) getContext();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,467 @@
|
||||||
|
package com.adins.mss.svy.fragments;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.appcompat.widget.AppCompatSpinner;
|
||||||
|
import androidx.cardview.widget.CardView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.DatePicker;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.adins.mss.base.commons.TaskListener;
|
||||||
|
import com.adins.mss.base.util.Utility;
|
||||||
|
import com.adins.mss.foundation.UserHelp.UserHelp;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
import com.adins.mss.foundation.http.KeyValue;
|
||||||
|
import com.adins.mss.svy.R;
|
||||||
|
import com.adins.mss.svy.models.SurveyorSearchRequest;
|
||||||
|
import com.adins.mss.svy.models.SurveyorSearchResponse;
|
||||||
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.adins.mss.constant.Global.SHOW_USERHELP_DELAY_DEFAULT;
|
||||||
|
|
||||||
|
class DateClickListener implements View.OnClickListener {
|
||||||
|
private final EditText mTarget;
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
|
public DateClickListener(Context context, EditText target) {
|
||||||
|
mContext = context;
|
||||||
|
mTarget = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
DatePickerDialog dialog = new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||||
|
mTarget.setText(dayOfMonth + "/" +Tool.appendZeroForDateTime(monthOfYear, true) + "/" + year);
|
||||||
|
}
|
||||||
|
}, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Aditya Purwa on 1/27/2015.
|
||||||
|
*/
|
||||||
|
public class SurveyPerformanceFragment extends Fragment {
|
||||||
|
|
||||||
|
ImageButton buttonSelectDate;
|
||||||
|
EditText editDate;
|
||||||
|
AppCompatSpinner spinnerCategory;
|
||||||
|
private EditText editStartDate;
|
||||||
|
private EditText editEndDate;
|
||||||
|
private EditText editMonthYear;
|
||||||
|
private ImageButton buttonSelectStartDate;
|
||||||
|
private ImageButton buttonSelectEndDate;
|
||||||
|
private Button buttonSearch;
|
||||||
|
private int activeSearchMode;
|
||||||
|
private ListView listResult;
|
||||||
|
private String[] cbSearchBy;
|
||||||
|
private CardView layout;
|
||||||
|
private SurveyActivityInterface iSurveyActivity;
|
||||||
|
private ImageButton butonMonthYear;
|
||||||
|
private Calendar calendar;
|
||||||
|
private int bulan;
|
||||||
|
private int tahun;
|
||||||
|
private FirebaseAnalytics screenName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
iSurveyActivity = new SurveyActivityImpl(getContext());
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||||
|
return inflater.inflate(R.layout.new_fragment_survey_performance, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
layout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Utility.freeMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
//Set Firebase screen name
|
||||||
|
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_survey_performance), null);
|
||||||
|
|
||||||
|
// olivia : set toolbar
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||||
|
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||||
|
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_surveyperformance));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
calendar = Calendar.getInstance();
|
||||||
|
bulan = 0; // Antisipasi null
|
||||||
|
tahun = 0; // Antisipasi null
|
||||||
|
|
||||||
|
listResult = (ListView) view.findViewById(R.id.resultListView);
|
||||||
|
layout = (CardView) view.findViewById(R.id.resultLayout);
|
||||||
|
|
||||||
|
buttonSelectDate = (ImageButton) view.findViewById(R.id.btnDate);
|
||||||
|
buttonSelectStartDate = (ImageButton) view.findViewById(R.id.btnStartDate);
|
||||||
|
buttonSelectEndDate = (ImageButton) view.findViewById(R.id.btnEndDate);
|
||||||
|
buttonSearch = (Button) view.findViewById(R.id.btnSearchOrder);
|
||||||
|
butonMonthYear = view.findViewById(R.id.btnMonthYear);
|
||||||
|
|
||||||
|
editDate = (EditText) view.findViewById(R.id.txtDateDay);
|
||||||
|
editStartDate = (EditText) view.findViewById(R.id.txtStartDate);
|
||||||
|
editEndDate = (EditText) view.findViewById(R.id.txtEndDate);
|
||||||
|
editMonthYear = view.findViewById(R.id.txtDateAndYear);
|
||||||
|
|
||||||
|
spinnerCategory = (AppCompatSpinner) view.findViewById(R.id.cbSearchBy);
|
||||||
|
|
||||||
|
cbSearchBy = this.getResources().getStringArray(R.array.cbSearchBy);
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), R.layout.spinner_search_layout, R.id.text_spin, getResources().getStringArray(R.array.cbSearchBy));
|
||||||
|
adapter.setDropDownViewResource(R.layout.spinner_style);
|
||||||
|
|
||||||
|
spinnerCategory.setAdapter(adapter);
|
||||||
|
|
||||||
|
spinnerCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
invalidateForm(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
//Nothing selected
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inisiasi awal
|
||||||
|
final String[] months = getActivity().getResources().getStringArray(R.array.cbSearchByMonth);
|
||||||
|
final DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), AlertDialog.THEME_HOLO_LIGHT,
|
||||||
|
new DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
|
||||||
|
bulan = month;
|
||||||
|
tahun = year;
|
||||||
|
String data = months[month] + "-" + String.valueOf(year);
|
||||||
|
editMonthYear.setText(data);
|
||||||
|
}
|
||||||
|
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
|
||||||
|
datePickerDialog.getDatePicker().findViewById(Resources.getSystem().getIdentifier("day", "id", "android")).setVisibility(View.GONE);
|
||||||
|
Calendar minMonthYear = Calendar.getInstance();
|
||||||
|
minMonthYear.set(calendar.get(Calendar.YEAR)-2, 0, 1);
|
||||||
|
datePickerDialog.getDatePicker().setMaxDate(new Date().getTime());
|
||||||
|
datePickerDialog.getDatePicker().setMinDate(minMonthYear.getTimeInMillis());
|
||||||
|
|
||||||
|
buttonSelectDate.setOnClickListener(new DateClickListener(getActivity(), editDate));
|
||||||
|
buttonSelectStartDate.setOnClickListener(new DateClickListener(getActivity(), editStartDate));
|
||||||
|
buttonSelectEndDate.setOnClickListener(new DateClickListener(getActivity(), editEndDate));
|
||||||
|
butonMonthYear.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
datePickerDialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SurveyorSearchRequest request = new SurveyorSearchRequest();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (Tool.isInternetconnected(getActivity())) {
|
||||||
|
iSurveyActivity.executeSearch(listener, request, editDate.getText().toString(), tahun, bulan, // Ambil bulan dan tahun
|
||||||
|
editStartDate.getText().toString(), editEndDate.getText().toString(), activeSearchMode);
|
||||||
|
} else {
|
||||||
|
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
builder.withTitle(getString(R.string.info_capital))
|
||||||
|
.withMessage(getString(R.string.no_internet_connection))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
Handler handler = new Handler();
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!UserHelp.isActive) {
|
||||||
|
UserHelp.showAllUserHelp(SurveyPerformanceFragment.this.getActivity(),
|
||||||
|
SurveyPerformanceFragment.this.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if(item.getItemId() == R.id.mnGuide){
|
||||||
|
|
||||||
|
Handler handler = new Handler();
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
UserHelp.showAllUserHelp(SurveyPerformanceFragment.this.getActivity(),
|
||||||
|
SurveyPerformanceFragment.this.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||||
|
layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
if(!UserHelp.isActive)
|
||||||
|
UserHelp.showAllUserHelp(SurveyPerformanceFragment.this.getActivity(),
|
||||||
|
SurveyPerformanceFragment.this.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskListener listener = new TaskListener() {
|
||||||
|
@Override
|
||||||
|
public void onCompleteTask(Object result) {
|
||||||
|
SurveyorSearchResponse serverResponse = (SurveyorSearchResponse) result;
|
||||||
|
updateResult(serverResponse.getListKeyValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelTask(boolean value) {
|
||||||
|
//on cancel task
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocalData(Object result) {
|
||||||
|
//on local data
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void updateResult(final KeyValue[] result) {
|
||||||
|
layout.setVisibility(View.VISIBLE);
|
||||||
|
SurveyPerformanceFragment.this.getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
listResult.setAdapter(new SearchResultListAdapter(getActivity(), result));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private void executeSearch(SurveyorSearchRequest request, final String date, final int month, final String startDate, final String endDate) throws ParseException, IOException {
|
||||||
|
// new AsyncTask<Void, Void, SurveyorSearchResponse>(){
|
||||||
|
// final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||||
|
// String errMessage;
|
||||||
|
// @Override
|
||||||
|
// protected void onPreExecute() {
|
||||||
|
// super.onPreExecute();
|
||||||
|
// progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||||
|
// progress.show();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected SurveyorSearchResponse doInBackground(Void... params) {
|
||||||
|
// try {
|
||||||
|
// SurveyorSearchRequest searchRequest = new SurveyorSearchRequest();
|
||||||
|
// searchRequest.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// if (activeSearchMode == 0) {
|
||||||
|
// SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||||
|
// Date date1 = f.parse(date);
|
||||||
|
// searchRequest.setDate1(date1);
|
||||||
|
// }
|
||||||
|
// if (activeSearchMode == 1) {
|
||||||
|
// SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||||
|
// Date sDate, eDate;
|
||||||
|
// long sLong = 0;
|
||||||
|
// long eLong = 0;
|
||||||
|
// try {
|
||||||
|
// sDate = f.parse(startDate);
|
||||||
|
// searchRequest.setDate1(sDate);
|
||||||
|
// eDate = f.parse(endDate);
|
||||||
|
// eDate.setHours(23);
|
||||||
|
// eDate.setMinutes(59);
|
||||||
|
// eDate.setSeconds(59);
|
||||||
|
// searchRequest.setDate2(eDate);
|
||||||
|
// sLong = sDate.getTime();
|
||||||
|
// eLong = eDate.getTime();
|
||||||
|
// } catch (ParseException e) {
|
||||||
|
// errMessage = getActivity().getString(R.string.enter_valid_date);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// long milisecond = eLong - sLong;
|
||||||
|
// if (milisecond > 604799000) {
|
||||||
|
// errMessage = getActivity().getString(R.string.data_range_not_allowed);
|
||||||
|
// return null;
|
||||||
|
// } else if (milisecond < 0) {
|
||||||
|
// errMessage = getActivity().getString(R.string.input_not_valid);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// if (activeSearchMode == 2) {
|
||||||
|
// searchRequest.setMonth(String.valueOf(month + 1));
|
||||||
|
// }
|
||||||
|
// } catch (ParseException parseEx) {
|
||||||
|
// errMessage = getActivity().getString(R.string.enter_valid_date);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String json = GsonHelper.toJson(searchRequest);
|
||||||
|
//
|
||||||
|
// String url = GlobalData.getSharedGlobalData().getURL_GET_SVYPERFORMANCE();
|
||||||
|
// boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||||
|
// boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||||
|
// HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||||
|
// HttpConnectionResult serverResult = null;
|
||||||
|
// try {
|
||||||
|
// serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||||
|
// } catch (Exception e) { FireCrash.log(e);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// SurveyorSearchResponse serverResponse = null;
|
||||||
|
// if (serverResult != null && serverResult.isOK()) {
|
||||||
|
// try {
|
||||||
|
// String responseBody = serverResult.getResult();
|
||||||
|
// serverResponse = GsonHelper.fromJson(responseBody, SurveyorSearchResponse.class);
|
||||||
|
//
|
||||||
|
// } catch (Exception e) { FireCrash.log(e);
|
||||||
|
// if(Global.IS_DEV) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// errMessage=e.getMessage();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// errMessage = getActivity().getString(R.string.server_down);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return serverResponse;
|
||||||
|
// } catch (Exception e) { FireCrash.log(e);
|
||||||
|
// errMessage = e.getMessage();
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected void onPostExecute(final SurveyorSearchResponse serverResponse) {
|
||||||
|
// super.onPostExecute(serverResponse);
|
||||||
|
// if(getActivity()!=null) {
|
||||||
|
// if (progress != null && progress.isShowing()) {
|
||||||
|
// progress.dismiss();
|
||||||
|
// }
|
||||||
|
// if (errMessage != null) {
|
||||||
|
// Toaster.error(getActivity(), errMessage);
|
||||||
|
// } else if (serverResponse != null && serverResponse.getListKeyValue() != null) {
|
||||||
|
// layout.setVisibility(View.VISIBLE);
|
||||||
|
// SurveyPerformanceFragment.this.getActivity().runOnUiThread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// listResult.setAdapter(new SearchResultListAdapter(getActivity(), serverResponse.getListKeyValue()));
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }.execute();
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void invalidateForm(int position) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
showSearchForm(R.id.byDay);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
showSearchForm(R.id.byMonth);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
showSearchForm(R.id.byEstimatedDate);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.activeSearchMode = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSearchForm(int id) {
|
||||||
|
View byDay = getView().findViewById(R.id.byDay);
|
||||||
|
View byRange = getView().findViewById(R.id.byEstimatedDate);
|
||||||
|
View byMonth = getView().findViewById(R.id.byMonth);
|
||||||
|
|
||||||
|
byDay.setVisibility(View.GONE);
|
||||||
|
byRange.setVisibility(View.GONE);
|
||||||
|
byMonth.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
View active = getView().findViewById(id);
|
||||||
|
active.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SearchResultListAdapter extends ArrayAdapter<KeyValue> {
|
||||||
|
|
||||||
|
public SearchResultListAdapter(Context context) {
|
||||||
|
super(context, R.layout.view_surveyor_search_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SearchResultListAdapter(Context context, KeyValue[] values) {
|
||||||
|
super(context, R.layout.view_surveyor_search_result, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.view_surveyor_search_result, parent, false);
|
||||||
|
}
|
||||||
|
TextView label = (TextView) convertView.findViewById(R.id.taskLabel);
|
||||||
|
TextView value = (TextView) convertView.findViewById(R.id.taskValue);
|
||||||
|
|
||||||
|
KeyValue item = getItem(position);
|
||||||
|
label.setText(item.getKey());
|
||||||
|
value.setText(item.getValue());
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
package com.adins.mss.foundation.db.dataaccess;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import com.adins.mss.dao.Holiday;
|
||||||
|
import com.adins.mss.dao.HolidayDao;
|
||||||
|
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
|
|
||||||
|
public class HolidayDataAccess {
|
||||||
|
private HolidayDataAccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* use to generate dao session that you can access modelDao
|
||||||
|
*
|
||||||
|
* @param context --> context from activity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static DaoSession getDaoSession(Context context) {
|
||||||
|
return DaoOpenHelper.getDaoSession(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Holiday dao and you can access the DB
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static HolidayDao getHolidayDao(Context context) {
|
||||||
|
return getDaoSession(context).getHolidayDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear session, close db and set daoOpenHelper to null
|
||||||
|
*/
|
||||||
|
public static void closeAll() {
|
||||||
|
DaoOpenHelper.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add holiday as entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param holiday
|
||||||
|
*/
|
||||||
|
public static void add(Context context, Holiday holiday) {
|
||||||
|
getHolidayDao(context).insert(holiday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add holiday as list entity
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param listHoliday
|
||||||
|
*/
|
||||||
|
public static void add(Context context, List<Holiday> listHoliday) {
|
||||||
|
getHolidayDao(context).insertInTx(listHoliday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all content in table.
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void clean(Context context) {
|
||||||
|
getHolidayDao(context).deleteAll();
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param holiday
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, Holiday holiday) {
|
||||||
|
getHolidayDao(context).deleteInTx(holiday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param holiday
|
||||||
|
*/
|
||||||
|
public static void update(Context context, Holiday holiday) {
|
||||||
|
getHolidayDao(context).update(holiday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add or replace data taskH
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param holiday
|
||||||
|
*/
|
||||||
|
public static void addOrReplace(Context context, Holiday holiday) {
|
||||||
|
getHolidayDao(context).insertOrReplaceInTx(holiday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addOrReplace(Context context, List<Holiday> holiday) {
|
||||||
|
getHolidayDao(context).insertOrReplaceInTx(holiday);
|
||||||
|
getDaoSession(context).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Holiday getOne(Context context, String uuid_holiday) {
|
||||||
|
QueryBuilder<Holiday> qb = getHolidayDao(context).queryBuilder();
|
||||||
|
qb.where(HolidayDao.Properties.Uuid_holiday.eq(uuid_holiday));
|
||||||
|
qb.build();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Holiday getOneByDate(Context context, Date date) {
|
||||||
|
QueryBuilder<Holiday> qb = getHolidayDao(context).queryBuilder();
|
||||||
|
qb.where(HolidayDao.Properties.H_date.eq(date));
|
||||||
|
qb.build();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Holiday getLastUpated(Context context) {
|
||||||
|
QueryBuilder<Holiday> qb = getHolidayDao(context).queryBuilder();
|
||||||
|
qb.orderDesc(HolidayDao.Properties.Dtm_upd);
|
||||||
|
qb.limit(1);
|
||||||
|
qb.build();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Holiday> getAllHolidays(Context context) {
|
||||||
|
QueryBuilder<Holiday> qb = getHolidayDao(context).queryBuilder();
|
||||||
|
qb.where(HolidayDao.Properties.Flag_holiday.eq("1"));
|
||||||
|
qb.build();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return Collections.emptyList();
|
||||||
|
return qb.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Holiday getDay(Context context, Date date) {
|
||||||
|
|
||||||
|
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(date);
|
||||||
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
|
cal.set(Calendar.SECOND, 0);
|
||||||
|
cal.set(Calendar.MINUTE, 0);
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
|
||||||
|
QueryBuilder<Holiday> qb = getHolidayDao(context).queryBuilder();
|
||||||
|
qb.where(HolidayDao.Properties.H_date.ge(cal.getTime()));
|
||||||
|
qb.orderAsc(HolidayDao.Properties.H_date);
|
||||||
|
qb.limit(1);
|
||||||
|
qb.build();
|
||||||
|
if (qb.list().isEmpty())
|
||||||
|
return null;
|
||||||
|
return qb.list().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<!-- background -->
|
||||||
|
<solid android:color="#00ffffff" />
|
||||||
|
<!-- border -->
|
||||||
|
<stroke android:width="2dp" android:color="#B22222" />
|
||||||
|
|
||||||
|
<!-- corner roundness -->
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
|
@ -0,0 +1,545 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="com.adins.mss.foundation.formatter.Formatter"
|
||||||
|
alias="fmt" />
|
||||||
|
<import type="com.adins.mss.constant.Global"
|
||||||
|
alias="const" />
|
||||||
|
<variable
|
||||||
|
name="is_processed"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="status"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="surveyHeader"
|
||||||
|
type="com.adins.mss.base.dynamicform.SurveyHeaderBean" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/bgColor">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="60dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/customer_fragment_form"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerNameLayout">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblCustomerName"
|
||||||
|
android:drawableLeft="@drawable/ic_person_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="text"
|
||||||
|
android:maxLength="60"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerPhoneLayout">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerPhone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblCustomerPhone"
|
||||||
|
android:drawableLeft="@drawable/ic_phone_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/customerPhoneContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerPhone"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="20"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/callPhoneNumber"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.8" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/callPhoneNumber"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/call_button_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Call"
|
||||||
|
android:textColor="#ffff"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerAddressLayout">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerAddress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblCustomerAddress"
|
||||||
|
android:drawableLeft="@drawable/ic_location_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerAddress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:maxLength="120"
|
||||||
|
android:minLines="2"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/surveyLocationLayout">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtSurveyLocationTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/survey_location"
|
||||||
|
android:drawableLeft="@drawable/ic_location_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtSurveyLocation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:maxLength="120"
|
||||||
|
android:minLines="2"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerAgreementLayout"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblAgreement"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblAgreementNo"
|
||||||
|
android:drawableLeft="@drawable/ic_cash_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtAgreement"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:enabled="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerOSAmountLayout"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerOSAmount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblAmountDue"
|
||||||
|
android:drawableLeft="@drawable/ic_cash_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerOSAmount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:enabled="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerODLayout"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerOD"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblOverdue"
|
||||||
|
android:drawableLeft="@drawable/ic_date_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerOD"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:enabled="false"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerInstallmentNoLayout"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblCustomerInstallmentNo"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblInstallment"
|
||||||
|
android:drawableLeft="@drawable/ic_no_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtCustomerInstallmentNo"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:enabled="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/customerNotesLayout">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblNotes"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/lblNotes"
|
||||||
|
android:drawableLeft="@drawable/ic_form_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtNotes"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@drawable/edit_text_selector"
|
||||||
|
android:minLines="3"
|
||||||
|
android:maxLength="2048"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_marginLeft="@dimen/card_margin"
|
||||||
|
android:layout_marginRight="@dimen/card_margin"
|
||||||
|
android:layout_marginBottom="@dimen/card_margin"
|
||||||
|
android:id="@+id/ptsLayout"
|
||||||
|
android:visibility="gone">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:id="@+id/ptsDateLayout">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblPtsDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/ptsDate"
|
||||||
|
android:drawableLeft="@drawable/ic_date_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtPtsDate"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/buttons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnPts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnReschedule"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnReset"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnReset"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnStartSurvey"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnStart"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnRevisit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnRevisit"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnViewTask"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnView"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnPrint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnPrint"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnChangePlan"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/button_background"
|
||||||
|
android:text="@string/btnChangePlan"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</layout>
|
|
@ -0,0 +1,217 @@
|
||||||
|
package com.adins.mss.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.adins.mss.dao.DaoSession;
|
||||||
|
import de.greenrobot.dao.DaoException;
|
||||||
|
|
||||||
|
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_MESSAGE".
|
||||||
|
*/
|
||||||
|
public class Message {
|
||||||
|
|
||||||
|
/** Not-null value. */
|
||||||
|
@SerializedName("uuid_message")
|
||||||
|
private String uuid_message;
|
||||||
|
@SerializedName("message")
|
||||||
|
private String message;
|
||||||
|
@SerializedName("sender_id")
|
||||||
|
private String sender_id;
|
||||||
|
@SerializedName("sender_name")
|
||||||
|
private String sender_name;
|
||||||
|
@SerializedName("dtm_crt_server")
|
||||||
|
private java.util.Date dtm_crt_server;
|
||||||
|
@SerializedName("time_read")
|
||||||
|
private java.util.Date time_read;
|
||||||
|
@SerializedName("usr_crt")
|
||||||
|
private String usr_crt;
|
||||||
|
@SerializedName("dtm_crt")
|
||||||
|
private java.util.Date dtm_crt;
|
||||||
|
@SerializedName("uuid_user")
|
||||||
|
private String uuid_user;
|
||||||
|
|
||||||
|
/** Used to resolve relations */
|
||||||
|
private transient DaoSession daoSession;
|
||||||
|
|
||||||
|
/** Used for active entity operations. */
|
||||||
|
private transient MessageDao myDao;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
private String user__resolvedKey;
|
||||||
|
|
||||||
|
private List<Timeline> timelineList;
|
||||||
|
|
||||||
|
public Message() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message(String uuid_message) {
|
||||||
|
this.uuid_message = uuid_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message(String uuid_message, String message, String sender_id, String sender_name, java.util.Date dtm_crt_server, java.util.Date time_read, String usr_crt, java.util.Date dtm_crt, String uuid_user) {
|
||||||
|
this.uuid_message = uuid_message;
|
||||||
|
this.message = message;
|
||||||
|
this.sender_id = sender_id;
|
||||||
|
this.sender_name = sender_name;
|
||||||
|
this.dtm_crt_server = dtm_crt_server;
|
||||||
|
this.time_read = time_read;
|
||||||
|
this.usr_crt = usr_crt;
|
||||||
|
this.dtm_crt = dtm_crt;
|
||||||
|
this.uuid_user = uuid_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** called by internal mechanisms, do not call yourself. */
|
||||||
|
public void __setDaoSession(DaoSession daoSession) {
|
||||||
|
this.daoSession = daoSession;
|
||||||
|
myDao = daoSession != null ? daoSession.getMessageDao() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Not-null value. */
|
||||||
|
public String getUuid_message() {
|
||||||
|
return uuid_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||||
|
public void setUuid_message(String uuid_message) {
|
||||||
|
this.uuid_message = uuid_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender_id() {
|
||||||
|
return sender_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender_id(String sender_id) {
|
||||||
|
this.sender_id = sender_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender_name() {
|
||||||
|
return sender_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender_name(String sender_name) {
|
||||||
|
this.sender_name = sender_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getDtm_crt_server() {
|
||||||
|
return dtm_crt_server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtm_crt_server(java.util.Date dtm_crt_server) {
|
||||||
|
this.dtm_crt_server = dtm_crt_server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getTime_read() {
|
||||||
|
return time_read;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime_read(java.util.Date time_read) {
|
||||||
|
this.time_read = time_read;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsr_crt() {
|
||||||
|
return usr_crt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsr_crt(String usr_crt) {
|
||||||
|
this.usr_crt = usr_crt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.Date getDtm_crt() {
|
||||||
|
return dtm_crt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtm_crt(java.util.Date dtm_crt) {
|
||||||
|
this.dtm_crt = dtm_crt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid_user() {
|
||||||
|
return uuid_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid_user(String uuid_user) {
|
||||||
|
this.uuid_user = uuid_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To-one relationship, resolved on first access. */
|
||||||
|
public User getUser() {
|
||||||
|
String __key = this.uuid_user;
|
||||||
|
if (user__resolvedKey == null || user__resolvedKey != __key) {
|
||||||
|
if (daoSession == null) {
|
||||||
|
throw new DaoException("Entity is detached from DAO context");
|
||||||
|
}
|
||||||
|
UserDao targetDao = daoSession.getUserDao();
|
||||||
|
User userNew = targetDao.load(__key);
|
||||||
|
synchronized (this) {
|
||||||
|
user = userNew;
|
||||||
|
user__resolvedKey = __key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
synchronized (this) {
|
||||||
|
this.user = user;
|
||||||
|
uuid_user = user == null ? null : user.getUuid_user();
|
||||||
|
user__resolvedKey = uuid_user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
|
||||||
|
public List<Timeline> getTimelineList() {
|
||||||
|
if (timelineList == null) {
|
||||||
|
if (daoSession == null) {
|
||||||
|
throw new DaoException("Entity is detached from DAO context");
|
||||||
|
}
|
||||||
|
TimelineDao targetDao = daoSession.getTimelineDao();
|
||||||
|
List<Timeline> timelineListNew = targetDao._queryMessage_TimelineList(uuid_message);
|
||||||
|
synchronized (this) {
|
||||||
|
if(timelineList == null) {
|
||||||
|
timelineList = timelineListNew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timelineList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Resets a to-many relationship, making the next get call to query for a fresh result. */
|
||||||
|
public synchronized void resetTimelineList() {
|
||||||
|
timelineList = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||||
|
public void delete() {
|
||||||
|
if (myDao == null) {
|
||||||
|
throw new DaoException("Entity is detached from DAO context");
|
||||||
|
}
|
||||||
|
myDao.delete(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||||
|
public void update() {
|
||||||
|
if (myDao == null) {
|
||||||
|
throw new DaoException("Entity is detached from DAO context");
|
||||||
|
}
|
||||||
|
myDao.update(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||||
|
public void refresh() {
|
||||||
|
if (myDao == null) {
|
||||||
|
throw new DaoException("Entity is detached from DAO context");
|
||||||
|
}
|
||||||
|
myDao.refresh(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layoutView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_grayscale"
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
android:id="@+id/actionbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@drawable/actionbar_background" />
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/gridLog"
|
||||||
|
android:layout_below="@+id/actionbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:numColumns="3"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:horizontalSpacing="4dp"
|
||||||
|
android:verticalSpacing="4dp">
|
||||||
|
|
||||||
|
</GridView>
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btnRefresh"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_margin="@dimen/padding_large"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:src="@drawable/ic_menu_refresh_white"
|
||||||
|
android:background="@drawable/button_background_round"/>
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,210 @@
|
||||||
|
package com.adins.mss.odr.accounts;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.AnimationUtils;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.Account;
|
||||||
|
import com.adins.mss.dao.GeneralParameter;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||||
|
import com.adins.mss.foundation.location.LocationTrackingManager;
|
||||||
|
import com.adins.mss.foundation.location.UpdateMenuIcon;
|
||||||
|
import com.adins.mss.odr.R;
|
||||||
|
import com.github.jjobes.slidedatetimepicker.SlidingTabLayout;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by olivia.dg on 11/17/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AccountResultActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ViewPager mViewPager;
|
||||||
|
private ViewPagerAdapter mViewPagerAdapter;
|
||||||
|
private SlidingTabLayout mSlidingTabLayout;
|
||||||
|
private Account account;
|
||||||
|
private ArrayList<String> productContact;
|
||||||
|
public LocationTrackingManager manager;
|
||||||
|
public static FragmentManager fragmentManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater menuInflater = getMenuInflater();
|
||||||
|
menuInflater.inflate(R.menu.main_menu, menu);
|
||||||
|
mainMenu = menu;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
updateMenuIcon(Global.isGPS);
|
||||||
|
|
||||||
|
return super.onPrepareOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateMenuIcon(boolean isGPS) {
|
||||||
|
UpdateMenuIcon uItem = new UpdateMenuIcon();
|
||||||
|
uItem.updateGPSIcon(mainMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Menu mainMenu;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == com.adins.mss.base.R.id.mnGPS) {
|
||||||
|
if (Global.LTM != null) {
|
||||||
|
if (Global.LTM.getIsConnected()) {
|
||||||
|
Global.LTM.removeLocationListener();
|
||||||
|
Global.LTM.connectLocationClient();
|
||||||
|
} else {
|
||||||
|
StartLocationTracking();
|
||||||
|
}
|
||||||
|
Animation a = AnimationUtils.loadAnimation(this, com.adins.mss.base.R.anim.gps_rotate);
|
||||||
|
findViewById(com.adins.mss.base.R.id.mnGPS).startAnimation(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
String uuidAccount = bundle.getString(Global.BUND_KEY_ACCOUNT_ID);
|
||||||
|
account = AccountDataAccess.getOne(getApplicationContext(), uuidAccount);
|
||||||
|
productContact = bundle.getStringArrayList(Global.BUND_KEY_PRODUCT_ID);
|
||||||
|
|
||||||
|
setContentView(R.layout.account_result_activity);
|
||||||
|
|
||||||
|
fragmentManager = getSupportFragmentManager();
|
||||||
|
|
||||||
|
setupViews();
|
||||||
|
initViewPager();
|
||||||
|
initTabs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(com.adins.mss.base.R.id.toolbar);
|
||||||
|
toolbar.setTitle(getString(com.adins.mss.base.R.string.title_mn_account));
|
||||||
|
toolbar.setTitleTextColor(getResources().getColor(com.adins.mss.base.R.color.fontColorWhite));
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTabs() {
|
||||||
|
mSlidingTabLayout.setTabText(0, getResources().getString(R.string.tabDetail));
|
||||||
|
mSlidingTabLayout.setTabText(1, getResources().getString(R.string.tabContact));
|
||||||
|
mSlidingTabLayout.setTabText(2, getResources().getString(R.string.tabOppor));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViewPager() {
|
||||||
|
mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||||
|
mViewPager.setAdapter(mViewPagerAdapter);
|
||||||
|
|
||||||
|
mSlidingTabLayout.setCustomTabView(R.layout.custom_tab_tasklist, R.id.tabTextTaskList);
|
||||||
|
mSlidingTabLayout.setSelectedIndicatorColors(ContextCompat.getColor(this, R.color.tv_white),
|
||||||
|
ContextCompat.getColor(this, R.color.tv_white));
|
||||||
|
mSlidingTabLayout.setDividerColors(ContextCompat.getColor(this, R.color.tv_white),
|
||||||
|
ContextCompat.getColor(this, R.color.tv_white));
|
||||||
|
mSlidingTabLayout.setViewPager(mViewPager);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupViews() {
|
||||||
|
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||||
|
mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.slidingTabLayout);
|
||||||
|
mViewPager.setCurrentItem(0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ViewPagerAdapter extends FragmentPagerAdapter {
|
||||||
|
|
||||||
|
public ViewPagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
Fragment fragment = null;
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
fragment = new AccountDetailTabFragment(AccountResultActivity.this, account);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
fragment = new ContactTabFragment(AccountResultActivity.this, account, productContact);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
fragment = new OpportunityTabFragment(AccountResultActivity.this, account);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartLocationTracking() {
|
||||||
|
try {
|
||||||
|
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
GeneralParameter gp_distance = GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), Global.GS_DISTANCE_TRACKING);
|
||||||
|
try {
|
||||||
|
if (gp_distance != null) {
|
||||||
|
int distanceTracking = Integer.parseInt(gp_distance.getGs_value());
|
||||||
|
if (distanceTracking != 0) {
|
||||||
|
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||||
|
manager.setMinimalDistanceChangeLocation(Integer.parseInt(GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM13_DIST").getGs_value()));
|
||||||
|
manager.setMinimalTimeChangeLocation(5);
|
||||||
|
manager.applyLocationListener(getApplicationContext());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||||
|
manager.setMinimalDistanceChangeLocation(50);
|
||||||
|
manager.setMinimalTimeChangeLocation(5);
|
||||||
|
manager.applyLocationListener(getApplicationContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.LTM == null) {
|
||||||
|
Global.LTM = manager;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Global.LTM = null;
|
||||||
|
Global.LTM = manager;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/synchronize_activity"
|
||||||
|
android:background="@drawable/bg_sync_survey">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/include1"
|
||||||
|
layout="@layout/footer" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="150dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ring2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/icon_loading_ring2"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ring1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/icon_loading_ring" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progressLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0%"
|
||||||
|
android:textSize="24dp"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:layout_marginTop="85dp"
|
||||||
|
android:gravity="center"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/syncLabel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/synchronizing"
|
||||||
|
android:textSize="16dp"
|
||||||
|
android:textColor="@color/fontColorWhite"
|
||||||
|
android:shadowColor="@color/fontColor"
|
||||||
|
android:shadowDx="2"
|
||||||
|
android:shadowDy="2"
|
||||||
|
android:shadowRadius="5"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="30dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/bgGridLog"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/spinner_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="3dp" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtTaskId"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dummy_task_id"
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:textSize="10dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/indicatorLamp"
|
||||||
|
android:layout_width="8dp"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:src="@drawable/light_red" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/logIcon"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_verification_log" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_margin="7dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtName"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:text="@string/customer_name"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textColor="@color/tv_white" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtScheme"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minLines="2"
|
||||||
|
android:text="@string/dummy_form_id"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:textSize="12dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtDivider"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:text="@string/divider_dash"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:textSize="8dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtTimeSend"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dummy_date_time"
|
||||||
|
android:textColor="@color/tv_white"
|
||||||
|
android:textSize="10dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.adins.mss.foundation.questiongenerator.form.QuestionView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/questionLocationLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/questionLocationLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0. label" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="1">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSetLocation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/btnGPS" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgLocationAnswer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/ic_absent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/questionLocationAnswer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.adins.mss.foundation.questiongenerator.form.QuestionView>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.services.models;
|
||||||
|
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class JsonResponseLastSync extends MssResponseType {
|
||||||
|
@SerializedName("dtm_lastsync")
|
||||||
|
private String dtm_lastSync;
|
||||||
|
|
||||||
|
public String getDtm_lastSync() {
|
||||||
|
return dtm_lastSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtm_lastSync(String dtm_lastSync) {
|
||||||
|
this.dtm_lastSync = dtm_lastSync;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="#2c2d31">
|
||||||
|
|
||||||
|
<!-- title -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/header"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:text="@string/lblHeader"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="18dp" />
|
||||||
|
<!-- divider -->
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="1dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:background="#DADADA" >
|
||||||
|
</View>
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,115 @@
|
||||||
|
package com.adins.mss.base.loyalti.mypointdashboard;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.util.Base64;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
import com.adins.mss.base.util.GsonHelper;
|
||||||
|
import com.adins.mss.base.util.Utility;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||||
|
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||||
|
import com.google.firebase.perf.FirebasePerformance;
|
||||||
|
import com.google.firebase.perf.metrics.HttpMetric;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
public class GetLogoKompetisi extends AsyncTask<Void, Void, String> {
|
||||||
|
private Context context;
|
||||||
|
String errMsg = "";
|
||||||
|
public GetLogoKompetisiResponse logoKompetisiResponse;
|
||||||
|
String memberCode;
|
||||||
|
ImageView imageLogo;
|
||||||
|
|
||||||
|
|
||||||
|
public GetLogoKompetisi(Context mContext, String membership_program_code, ImageView logoKompetisi) {
|
||||||
|
context = mContext;
|
||||||
|
memberCode = membership_program_code;
|
||||||
|
imageLogo = logoKompetisi;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(Void... voids) {
|
||||||
|
if (Tool.isInternetconnected(context)) {
|
||||||
|
|
||||||
|
Gson gson = new GsonBuilder().setDateFormat("ddMMyyyyHHmmss").registerTypeHierarchyAdapter(byte[].class,
|
||||||
|
new GsonHelper.ByteArrayToBase64TypeAdapter()).create();
|
||||||
|
String result;
|
||||||
|
GetLogoRequest requestType = new GetLogoRequest();
|
||||||
|
// ArrayList<String> data = null;
|
||||||
|
// data = new ArrayList<>();
|
||||||
|
// for(int i = 0 ; i < dataKompetisireq.size() ; i++){
|
||||||
|
// data.add(dataKompetisireq.get(i).getMembershipProgramCode());
|
||||||
|
// }
|
||||||
|
requestType.setMEMBERSHIP_PROGRAM_CODE(memberCode);
|
||||||
|
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
// requestType.addItemToUnstructured(new KeyValue("imei", GlobalData.getSharedGlobalData().getImei()), false);
|
||||||
|
|
||||||
|
String json = GsonHelper.toJson(requestType);
|
||||||
|
String url = GlobalData.getSharedGlobalData().getURL_GET_LOGOKOMPETISI();
|
||||||
|
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||||
|
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||||
|
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, 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) {
|
||||||
|
e.printStackTrace();
|
||||||
|
errMsg = e.getMessage();
|
||||||
|
return errMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(serverResult != null && serverResult.getStatusCode() == 200){
|
||||||
|
try {
|
||||||
|
logoKompetisiResponse = gson.fromJson(serverResult.getResult(), GetLogoKompetisiResponse.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
errMsg = context.getString(R.string.failed_get_data_try_again);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errMsg;
|
||||||
|
} else {
|
||||||
|
errMsg = context.getString(R.string.no_internet_connection);
|
||||||
|
return errMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String s) {
|
||||||
|
super.onPostExecute(s);
|
||||||
|
if (errMsg.length() > 0) {
|
||||||
|
Toast.makeText(context, errMsg, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String base64Logo = logoKompetisiResponse.getLOGO();
|
||||||
|
if(base64Logo != null && !base64Logo.equals("")){
|
||||||
|
byte[] decodedString = Base64.decode(base64Logo, Base64.DEFAULT );
|
||||||
|
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
||||||
|
imageLogo.setImageBitmap(decodedByte);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.adins.mss.svy.tool;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
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.TaskD;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||||
|
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.image.JsonResponseImage;
|
||||||
|
import com.adins.mss.svy.R;
|
||||||
|
import com.adins.mss.svy.assignment.OrderAssignmentResult;
|
||||||
|
import com.adins.mss.svy.reassignment.JsonRequestImage;
|
||||||
|
import com.google.firebase.perf.FirebasePerformance;
|
||||||
|
import com.google.firebase.perf.metrics.HttpMetric;
|
||||||
|
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class getImageTask extends AsyncTask<Void, Void, byte[]> {
|
||||||
|
private ProgressDialog progressDialog;
|
||||||
|
private String errMessage = null;
|
||||||
|
private WeakReference<Activity> activity;
|
||||||
|
static byte[] imagebyte =null;
|
||||||
|
List<NameValuePair> params;
|
||||||
|
|
||||||
|
public getImageTask(Activity activity, List<NameValuePair> params){
|
||||||
|
this.activity = new WeakReference<Activity>(activity);
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
progressDialog = ProgressDialog.show(activity.get(),
|
||||||
|
"", activity.get().getString(R.string.progressWait), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected byte[] doInBackground(Void... arg0) {
|
||||||
|
byte[] imageResult =null;
|
||||||
|
JsonRequestImage request = new JsonRequestImage();
|
||||||
|
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||||
|
request.setUuid_task_h(params.get(0).getValue());
|
||||||
|
request.setQuestion_id(params.get(1).getValue());
|
||||||
|
|
||||||
|
String json = GsonHelper.toJson(request);
|
||||||
|
String url = GlobalData.getSharedGlobalData().getURL_GET_IMAGE();
|
||||||
|
|
||||||
|
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||||
|
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||||
|
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity.get(), encrypt, decrypt);
|
||||||
|
HttpConnectionResult serverResult = null;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = serverResult.getResult();
|
||||||
|
|
||||||
|
JsonResponseImage resultServer = null;
|
||||||
|
try {
|
||||||
|
resultServer = GsonHelper.fromJson(result, JsonResponseImage.class);
|
||||||
|
if(resultServer.getStatus().getCode()==0){
|
||||||
|
List<TaskD> taskDs = resultServer.getImg();
|
||||||
|
TaskD d = taskDs.get(0);
|
||||||
|
imageResult = d.getImage();
|
||||||
|
}else{
|
||||||
|
errMessage = resultServer.getStatus().getMessage();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
errMessage = e.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(byte[] result){
|
||||||
|
if (progressDialog.isShowing()){
|
||||||
|
try {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(errMessage!=null){
|
||||||
|
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity.get());
|
||||||
|
dialogBuilder.withTitle(activity.get().getString(R.string.error_capital))
|
||||||
|
.withMessage(errMessage)
|
||||||
|
.show();
|
||||||
|
}else{
|
||||||
|
if(null==result){
|
||||||
|
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity.get());
|
||||||
|
dialogBuilder.withTitle(activity.get().getString(R.string.info_capital))
|
||||||
|
.withMessage(activity.get().getString(R.string.no_image))
|
||||||
|
.show();
|
||||||
|
}else{
|
||||||
|
try {
|
||||||
|
OrderAssignmentResult.targetThumbnail.setResultImg(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.adins.mss.foundation.print.paymentchannel;
|
||||||
|
|
||||||
|
import com.adins.mss.dao.PaymentChannel;
|
||||||
|
import com.adins.mss.foundation.http.MssResponseType;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by angga.permadi on 5/10/2016.
|
||||||
|
*/
|
||||||
|
public class SyncChannelResponse extends MssResponseType {
|
||||||
|
@SerializedName("errorMessage")
|
||||||
|
private String errorMessage;
|
||||||
|
@SerializedName("listPaymentChannel")
|
||||||
|
private List<PaymentChannel> listPaymentChannel;
|
||||||
|
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PaymentChannel> getListPaymentChannel() {
|
||||||
|
return listPaymentChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListPaymentChannelr(List<PaymentChannel> listPaymentChannel) {
|
||||||
|
this.listPaymentChannel = listPaymentChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 3.1 KiB |
|
@ -0,0 +1,118 @@
|
||||||
|
package com.adins.mss.base.dynamicform;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.base.util.ExcludeFromGson;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.Scheme;
|
||||||
|
import com.adins.mss.dao.TaskH;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SurveyHeaderBean extends TaskH implements Serializable, Cloneable {
|
||||||
|
@ExcludeFromGson
|
||||||
|
private FormBean form;
|
||||||
|
@ExcludeFromGson
|
||||||
|
private int imageLeft;
|
||||||
|
|
||||||
|
public SurveyHeaderBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SurveyHeaderBean(TaskH taskH) {
|
||||||
|
if (taskH == null)
|
||||||
|
throw new IllegalArgumentException("taskH is null!");
|
||||||
|
setUuid_task_h(taskH.getUuid_task_h());
|
||||||
|
setTask_id(taskH.getTask_id());
|
||||||
|
setStatus(taskH.getStatus());
|
||||||
|
setIs_printable(taskH.getIs_printable());
|
||||||
|
setCustomer_name(taskH.getCustomer_name());
|
||||||
|
setCustomer_phone(taskH.getCustomer_phone());
|
||||||
|
setCustomer_address(taskH.getCustomer_address());
|
||||||
|
setNotes(taskH.getNotes());
|
||||||
|
setSubmit_date(taskH.getSubmit_date());
|
||||||
|
setSubmit_duration(taskH.getSubmit_duration());
|
||||||
|
setSubmit_size(taskH.getSubmit_size());
|
||||||
|
setSubmit_result(taskH.getSubmit_result());
|
||||||
|
setAssignment_date(taskH.getAssignment_date());
|
||||||
|
setPrint_count(taskH.getPrint_count());
|
||||||
|
setDraft_date(taskH.getDraft_date());
|
||||||
|
setUsr_crt(taskH.getUsr_crt());
|
||||||
|
setDtm_crt(taskH.getDtm_crt());
|
||||||
|
setPriority(taskH.getPriority());
|
||||||
|
setLatitude(taskH.getLatitude());
|
||||||
|
setLongitude(taskH.getLongitude());
|
||||||
|
setScheme_last_update(taskH.getScheme_last_update());
|
||||||
|
setIs_verification(taskH.getIs_verification());
|
||||||
|
setIs_preview_server(taskH.getIs_preview_server());
|
||||||
|
setUuid_user(taskH.getUuid_user());
|
||||||
|
setVoice_note(taskH.getVoice_note());
|
||||||
|
setUuid_scheme(taskH.getUuid_scheme());
|
||||||
|
setZip_code(taskH.getZip_code());
|
||||||
|
setScheme(taskH.getScheme());
|
||||||
|
setStart_date(taskH.getStart_date());
|
||||||
|
setOpen_date(taskH.getOpen_date());
|
||||||
|
setLast_saved_question(taskH.getLast_saved_question());
|
||||||
|
setAppl_no(taskH.getAppl_no());
|
||||||
|
setIs_prepocessed(taskH.getIs_prepocessed());
|
||||||
|
setIs_reconciled(taskH.getIs_reconciled());
|
||||||
|
setPts_date(taskH.getPts_date());
|
||||||
|
setAccess_mode(taskH.getAccess_mode());
|
||||||
|
setRv_number(taskH.getRv_number());
|
||||||
|
setStatus_rv(taskH.getStatus_rv());
|
||||||
|
setFlag(taskH.getFlag());
|
||||||
|
setForm_version(taskH.getForm_version());
|
||||||
|
setAmt_due(taskH.getAmt_due());
|
||||||
|
setOd(taskH.getOd());
|
||||||
|
setInst_no(taskH.getInst_no());
|
||||||
|
setSurvey_location(taskH.getSurvey_location());
|
||||||
|
String schemeIsPrintable = Global.FALSE_STRING;
|
||||||
|
try {
|
||||||
|
schemeIsPrintable = taskH.getIs_printable();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String schemeId = taskH.getUuid_scheme();
|
||||||
|
this.form = new FormBean(schemeId, getScheme_last_update(), schemeIsPrintable);
|
||||||
|
|
||||||
|
try {
|
||||||
|
String previewServer = taskH.getIs_preview_server();
|
||||||
|
if (getForm() != null) {
|
||||||
|
getForm().setPreviewServer(previewServer);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
String previewServer = Global.FALSE_STRING;
|
||||||
|
if (getForm() != null) {
|
||||||
|
getForm().setPreviewServer(previewServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskH getTaskH() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormBean getForm() {
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForm(FormBean form) {
|
||||||
|
this.form = form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageLeft(int imageLeft) {
|
||||||
|
this.imageLeft = imageLeft;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
package com.adins.mss.foundation.questiongenerator.form;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.adins.mss.base.dynamicform.QuestionGroup;
|
||||||
|
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
||||||
|
public class QuestionView extends LinearLayout {
|
||||||
|
|
||||||
|
protected QuestionBean questionBean;
|
||||||
|
protected QuestionGroup questionGroup;
|
||||||
|
protected QuestionViewListener listener;
|
||||||
|
protected TextView label;
|
||||||
|
//Glen 10 Oct 2014
|
||||||
|
protected LayoutParams defLayout = new LayoutParams(
|
||||||
|
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
||||||
|
protected String QuestionId;
|
||||||
|
protected HashMap<String, Object> hashMap;
|
||||||
|
protected int sequence = 0;
|
||||||
|
protected boolean isChanged = false;
|
||||||
|
//ini dikarenakan kasus :
|
||||||
|
//saat buat onselecttecItem, listener sudah kepanggil pada saat dropdown kebentuk
|
||||||
|
//padahal seharusnya belum boleh
|
||||||
|
//segingga di kasih flag dulu
|
||||||
|
//bangkit 15 des 14
|
||||||
|
protected int isCanSetFlag = 0;
|
||||||
|
protected boolean titleOnly;
|
||||||
|
protected boolean expanded;
|
||||||
|
|
||||||
|
public QuestionView(Context context) {
|
||||||
|
super(context);
|
||||||
|
// setExpanded(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestionView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestionView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public QuestionView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Glen 14 Oct 2014, enforce to initiate with bean
|
||||||
|
//bangkit 16 des temporary not used, concern to memory usage
|
||||||
|
public QuestionView(Context context, QuestionBean bean) {
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
setOrientation(VERTICAL);
|
||||||
|
|
||||||
|
//moved from subclass
|
||||||
|
label = new TextView(context);
|
||||||
|
// label.setTextColor(Color.parseColor("#0b5d66"));
|
||||||
|
this.addView(label, defLayout);
|
||||||
|
|
||||||
|
this.questionBean = bean;
|
||||||
|
// setExpanded(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestionGroup getQuestionGroup() {
|
||||||
|
return questionGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuestionGroup(QuestionGroup questionGroup) {
|
||||||
|
this.questionGroup = questionGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTitleOnly() {
|
||||||
|
return titleOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleOnly(boolean titleOnly) {
|
||||||
|
this.titleOnly = titleOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextView getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(TextView label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuestionId() {
|
||||||
|
return QuestionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuestionId(String questionId) {
|
||||||
|
QuestionId = questionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Object> getHashMap() {
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHashMap(HashMap<String, Object> hashMap) {
|
||||||
|
this.hashMap = hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSequence() {
|
||||||
|
return sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSequence(int sequence) {
|
||||||
|
this.sequence = sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChanged() {
|
||||||
|
return isChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChanged(boolean isChanged) {
|
||||||
|
if (isCanSetFlag >= 1) {
|
||||||
|
this.isChanged = isChanged;
|
||||||
|
} else {
|
||||||
|
isCanSetFlag++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIsCanSetFlag() {
|
||||||
|
return isCanSetFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsCanSetFlag(int isCanSetFlag) {
|
||||||
|
this.isCanSetFlag = isCanSetFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=== Getter & Setter ===//
|
||||||
|
|
||||||
|
public QuestionBean getQuestionBean() {
|
||||||
|
return questionBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuestionBean(QuestionBean questionBean) {
|
||||||
|
this.questionBean = questionBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestionViewListener getListener() {
|
||||||
|
return listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(QuestionViewListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabelText() {
|
||||||
|
return label.getText().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabelText(String text) {
|
||||||
|
label.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Use this method to change visibility, as it usually needed in QuestionViewGenerator
|
||||||
|
//not to confuse with View.setVisibility. this.setVisible(true) is the same as setVisibility(VISIBLE), and false as GONE
|
||||||
|
public void setVisible(boolean isVisible) {
|
||||||
|
if (isVisible) {
|
||||||
|
this.setVisibility(VISIBLE);
|
||||||
|
} else {
|
||||||
|
this.setVisibility(GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExpanded() {
|
||||||
|
return expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpanded(boolean expanded) {
|
||||||
|
this.expanded = expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface QuestionViewListener {
|
||||||
|
void onFinishEdit(QuestionView questionView, QuestionBean questionBean);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.github.jjobes.slidedatetimepicker;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.DatePicker;
|
||||||
|
import android.widget.NumberPicker;
|
||||||
|
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A subclass of {@link DatePicker} that uses
|
||||||
|
* reflection to allow for customization of the default blue
|
||||||
|
* dividers.
|
||||||
|
*
|
||||||
|
* @author jjobes
|
||||||
|
*/
|
||||||
|
public class CustomDatePicker extends DatePicker {
|
||||||
|
private static final String TAG = "CustomDatePicker";
|
||||||
|
|
||||||
|
public CustomDatePicker(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
Class<?> idClass = null;
|
||||||
|
Class<?> numberPickerClass = null;
|
||||||
|
Field selectionDividerField = null;
|
||||||
|
Field monthField = null;
|
||||||
|
Field dayField = null;
|
||||||
|
Field yearField = null;
|
||||||
|
NumberPicker monthNumberPicker = null;
|
||||||
|
NumberPicker dayNumberPicker = null;
|
||||||
|
NumberPicker yearNumberPicker = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Create an instance of the id class
|
||||||
|
idClass = Class.forName("com.android.internal.R$id");
|
||||||
|
|
||||||
|
// Get the fields that store the resource IDs for the month, day and year NumberPickers
|
||||||
|
monthField = idClass.getField("month");
|
||||||
|
dayField = idClass.getField("day");
|
||||||
|
yearField = idClass.getField("year");
|
||||||
|
|
||||||
|
// Use the resource IDs to get references to the month, day and year NumberPickers
|
||||||
|
monthNumberPicker = (NumberPicker) findViewById(monthField.getInt(null));
|
||||||
|
dayNumberPicker = (NumberPicker) findViewById(dayField.getInt(null));
|
||||||
|
yearNumberPicker = (NumberPicker) findViewById(yearField.getInt(null));
|
||||||
|
|
||||||
|
numberPickerClass = Class.forName("android.widget.NumberPicker");
|
||||||
|
|
||||||
|
// Set the value of the mSelectionDivider field in the month, day and year NumberPickers
|
||||||
|
// to refer to our custom drawables
|
||||||
|
selectionDividerField = numberPickerClass.getDeclaredField("mSelectionDivider");
|
||||||
|
selectionDividerField.setAccessible(true);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
selectionDividerField.set(monthNumberPicker, getResources().getDrawable(R.drawable.selection_divider, getContext().getTheme()));
|
||||||
|
selectionDividerField.set(dayNumberPicker, getResources().getDrawable(R.drawable.selection_divider, getContext().getTheme()));
|
||||||
|
selectionDividerField.set(yearNumberPicker, getResources().getDrawable(R.drawable.selection_divider, getContext().getTheme()));
|
||||||
|
} else {
|
||||||
|
selectionDividerField.set(monthNumberPicker, getResources().getDrawable(R.drawable.selection_divider));
|
||||||
|
selectionDividerField.set(dayNumberPicker, getResources().getDrawable(R.drawable.selection_divider));
|
||||||
|
selectionDividerField.set(yearNumberPicker, getResources().getDrawable(R.drawable.selection_divider));
|
||||||
|
}
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
Logger.e(TAG, "ClassNotFoundException in CustomDatePicker", e);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
Logger.e(TAG, "NoSuchFieldException in CustomDatePicker", e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
Logger.e(TAG, "IllegalAccessException in CustomDatePicker", e);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
Logger.e(TAG, "IllegalArgumentException in CustomDatePicker", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,308 @@
|
||||||
|
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.InputFilter;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
import com.adins.mss.foundation.questiongenerator.OptionAnswerBean;
|
||||||
|
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||||
|
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.ConcurrentModificationException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by gigin.ginanjar on 01/09/2016.
|
||||||
|
*/
|
||||||
|
public class MultipleQuestionViewHolder extends RecyclerView.ViewHolder implements TextWatcher {
|
||||||
|
public QuestionView mView;
|
||||||
|
public TextView mQuestionLabel;
|
||||||
|
public TextView mMultipleEmpty;
|
||||||
|
public LinearLayout mMultipleLayout;
|
||||||
|
public EditText mDescription;
|
||||||
|
public QuestionBean bean;
|
||||||
|
public FragmentActivity mActivity;
|
||||||
|
protected List<OptionAnswerBean> options;
|
||||||
|
protected LinearLayout.LayoutParams defLayout = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
private List<CheckBox> listCheckBox;
|
||||||
|
private List<EditText> listDescription;
|
||||||
|
private List<OptionAnswerBean> selectedOptionAnswers;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public MultipleQuestionViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
mView = (QuestionView) itemView.findViewById(R.id.questionMultipleLayout);
|
||||||
|
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionMultipleLabel);
|
||||||
|
mMultipleEmpty = (TextView) itemView.findViewById(R.id.questionMultipleEmpty);
|
||||||
|
mMultipleLayout = (LinearLayout) itemView.findViewById(R.id.multipleQuestionListLayout);
|
||||||
|
mDescription = (EditText) itemView.findViewById(R.id.questionMultipleDescription);
|
||||||
|
listCheckBox = new ArrayList<>();
|
||||||
|
listDescription = new ArrayList<>();
|
||||||
|
selectedOptionAnswers = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultipleQuestionViewHolder(View itemView, FragmentActivity activity) {
|
||||||
|
super(itemView);
|
||||||
|
mView = (QuestionView) itemView.findViewById(R.id.questionMultipleLayout);
|
||||||
|
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionMultipleLabel);
|
||||||
|
mMultipleEmpty = (TextView) itemView.findViewById(R.id.questionMultipleEmpty);
|
||||||
|
mMultipleLayout = (LinearLayout) itemView.findViewById(R.id.multipleQuestionListLayout);
|
||||||
|
mDescription = (EditText) itemView.findViewById(R.id.questionMultipleDescription);
|
||||||
|
mActivity = activity;
|
||||||
|
listCheckBox = new ArrayList<>();
|
||||||
|
listDescription = new ArrayList<>();
|
||||||
|
selectedOptionAnswers = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bind(final QuestionBean item, int number) {
|
||||||
|
selectedOptionAnswers = new ArrayList<>();
|
||||||
|
bean = item;
|
||||||
|
options = bean.getOptionAnswers();
|
||||||
|
String answerType = bean.getAnswer_type();
|
||||||
|
|
||||||
|
boolean withDescription = false;
|
||||||
|
boolean withOneDescription = false;
|
||||||
|
if (Global.AT_MULTIPLE_W_DESCRIPTION.equals(answerType)) {
|
||||||
|
withDescription = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.AT_MULTIPLE_ONE_DESCRIPTION.equals(answerType)) {
|
||||||
|
withOneDescription = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String qLabel = number + ". " + bean.getQuestion_label();
|
||||||
|
mQuestionLabel.setText(qLabel);
|
||||||
|
mMultipleLayout.removeAllViews();
|
||||||
|
listCheckBox.clear();
|
||||||
|
listDescription.clear();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
String[] arrSelectedAnswer = null;
|
||||||
|
List<OptionAnswerBean> optSelectedBean = null;
|
||||||
|
try {
|
||||||
|
arrSelectedAnswer= Tool.split(bean.getAnswer(), Global.DELIMETER_DATA);
|
||||||
|
optSelectedBean=bean.getSelectedOptionAnswers();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
arrSelectedAnswer = new String[0];
|
||||||
|
optSelectedBean = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (options != null && !options.isEmpty()) {
|
||||||
|
for (OptionAnswerBean optBean : options) {
|
||||||
|
CheckBox chk = new CheckBox(mActivity);
|
||||||
|
chk.setText(optBean.getValue());
|
||||||
|
chk.setChecked(optBean.isSelected());
|
||||||
|
mMultipleLayout.addView(chk);
|
||||||
|
listCheckBox.add(chk);
|
||||||
|
if (bean.isReadOnly()) {
|
||||||
|
chk.setClickable(false);
|
||||||
|
chk.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
chk.setClickable(true);
|
||||||
|
chk.setEnabled(true);
|
||||||
|
}
|
||||||
|
String optBeanId = optBean.getUuid_lookup();
|
||||||
|
if (withDescription) {
|
||||||
|
mDescription.setEnabled(false);
|
||||||
|
EditText desc = new EditText(mActivity);
|
||||||
|
if (null != bean.getMax_length() ) {
|
||||||
|
InputFilter[] inputFilters = {new InputFilter.LengthFilter(
|
||||||
|
bean.getMax_length() == 0 ? Global.DEFAULT_MAX_LENGTH : bean.getMax_length())};
|
||||||
|
desc.setFilters(inputFilters);
|
||||||
|
}
|
||||||
|
qloop:
|
||||||
|
for (OptionAnswerBean nOptBean : optSelectedBean) {
|
||||||
|
String nOptBeanId = nOptBean.getUuid_lookup();
|
||||||
|
if (optBeanId.equals(nOptBeanId) && nOptBean.isSelected()) {
|
||||||
|
if (i < arrSelectedAnswer.length)
|
||||||
|
desc.setText(arrSelectedAnswer[i]);
|
||||||
|
i++;
|
||||||
|
break qloop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
desc.addTextChangedListener(this);
|
||||||
|
mMultipleLayout.addView(desc, defLayout);
|
||||||
|
listDescription.add(desc);
|
||||||
|
}
|
||||||
|
chk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
saveSelectedOptionToBean();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (withOneDescription) {
|
||||||
|
enableDescription(true);
|
||||||
|
try {
|
||||||
|
mDescription.setText(bean.getAnswer());
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
mDescription.setText("");
|
||||||
|
}
|
||||||
|
mDescription.addTextChangedListener(this);
|
||||||
|
} else {
|
||||||
|
enableDescription(false);
|
||||||
|
}
|
||||||
|
mMultipleEmpty.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
mMultipleEmpty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectSavedOptionsFromBeans();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectSavedOptionsFromBeans() {
|
||||||
|
List<OptionAnswerBean> beans = new ArrayList<>();
|
||||||
|
for (int i = 0; i < bean.getSelectedOptionAnswers().size(); i++) {
|
||||||
|
beans.add(bean.getSelectedOptionAnswers().get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (OptionAnswerBean optAnsBean : beans) {
|
||||||
|
String lovCode = optAnsBean.getCode();
|
||||||
|
String description = null;
|
||||||
|
if (Global.AT_MULTIPLE_W_DESCRIPTION.equals(bean.getAnswer_type()) ||
|
||||||
|
Global.AT_MULTIPLE_ONE_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||||
|
description = bean.getAnswer();
|
||||||
|
}
|
||||||
|
selectOption(lovCode, description);
|
||||||
|
}
|
||||||
|
} catch (ConcurrentModificationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectOption(String lovCode, String description) {
|
||||||
|
int indexOfOption = -1;
|
||||||
|
int i = 0;
|
||||||
|
for (OptionAnswerBean optAnsBean : options) {
|
||||||
|
if (lovCode.equals(optAnsBean.getCode())) {
|
||||||
|
indexOfOption = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (indexOfOption > -1) {
|
||||||
|
if (listCheckBox != null && listCheckBox.size() > i) {
|
||||||
|
listCheckBox.get(i).setChecked(true);
|
||||||
|
}
|
||||||
|
if (description != null) {
|
||||||
|
if (Global.AT_MULTIPLE_W_DESCRIPTION.equals(bean.getAnswer_type())
|
||||||
|
|| Global.AT_MULTIPLE_ONE_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||||
|
enableDescription(true);
|
||||||
|
mDescription.setText(description);
|
||||||
|
} else {
|
||||||
|
enableDescription(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//added from danu
|
||||||
|
saveSelectedOptionToBean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableDescription(boolean enable) {
|
||||||
|
if (enable) {
|
||||||
|
if (null != bean.getMax_length() ) {
|
||||||
|
if (bean.getAnswer_type().equals(Global.AT_MULTIPLE_W_DESCRIPTION)) {
|
||||||
|
InputFilter[] inputFilters = {new InputFilter.LengthFilter(
|
||||||
|
bean.getMax_length() == 0 ? Global.DEFAULT_MAX_LENGTH :
|
||||||
|
(bean.getMax_length() * options.size()) + bean.getMax_length())};
|
||||||
|
mDescription.setFilters(inputFilters);
|
||||||
|
} else {
|
||||||
|
InputFilter[] inputFilters = {new InputFilter.LengthFilter(
|
||||||
|
bean.getMax_length() == 0 ? Global.DEFAULT_MAX_LENGTH : bean.getMax_length())};
|
||||||
|
mDescription.setFilters(inputFilters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDescription.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mDescription.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveSelectedOptionToBean() {
|
||||||
|
selectedOptionAnswers.clear();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
boolean withDescription = false;
|
||||||
|
boolean withOneDescription = false;
|
||||||
|
if (Global.AT_MULTIPLE_W_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||||
|
withDescription = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.AT_MULTIPLE_ONE_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||||
|
withOneDescription = true;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < listCheckBox.size(); i++) {
|
||||||
|
CheckBox chk = listCheckBox.get(i);
|
||||||
|
if (chk.isChecked()) {
|
||||||
|
OptionAnswerBean optAnsBean = options.get(i); //assume checkbox is the same order as options
|
||||||
|
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(Global.DELIMETER_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (withDescription) {
|
||||||
|
EditText txtDescription = listDescription.get(i);
|
||||||
|
String description = txtDescription.getText().toString();
|
||||||
|
if (description.isEmpty()) {
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
sb.append(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
optAnsBean.setSelected(true);
|
||||||
|
|
||||||
|
selectedOptionAnswers.add(optAnsBean);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
options.get(i).setSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bean.setAnswer(sb.toString());
|
||||||
|
|
||||||
|
if (Global.AT_MULTIPLE_W_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||||
|
//added by danu
|
||||||
|
enableDescription(true);
|
||||||
|
mDescription.setText(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (withOneDescription) {
|
||||||
|
String description = mDescription.getText().toString().trim();
|
||||||
|
bean.setAnswer(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
bean.setLovCode(sb.toString());
|
||||||
|
bean.setSelectedOptionAnswers(selectedOptionAnswers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
//EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
saveSelectedOptionToBean();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,454 @@
|
||||||
|
package com.adins.mss.base.todolist.form;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.adins.mss.base.Backup;
|
||||||
|
import com.adins.mss.base.GlobalData;
|
||||||
|
import com.adins.mss.base.R;
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
import com.adins.mss.base.dynamicform.CustomerFragment;
|
||||||
|
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
|
||||||
|
import com.adins.mss.base.dynamicform.TaskManager;
|
||||||
|
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||||
|
import com.adins.mss.base.todolist.ToDoList;
|
||||||
|
import com.adins.mss.constant.Global;
|
||||||
|
import com.adins.mss.dao.Scheme;
|
||||||
|
import com.adins.mss.dao.TaskD;
|
||||||
|
import com.adins.mss.dao.TaskH;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
|
||||||
|
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||||
|
import com.adins.mss.foundation.dialog.NiftyDialogBuilder_PL;
|
||||||
|
import com.adins.mss.foundation.formatter.Tool;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A fragment representing a list of Items.
|
||||||
|
* <p/>
|
||||||
|
*/
|
||||||
|
public class StatusTabFragment extends Fragment implements OnTaskListClickListener, TasklistListener {
|
||||||
|
|
||||||
|
private static final String ARG_COLUMN_COUNT = "column-count";
|
||||||
|
public static ListHandler handler;
|
||||||
|
private static boolean isStatusOpen = false;
|
||||||
|
public List<TaskH> listTaskH;
|
||||||
|
public ToDoList toDoList;
|
||||||
|
private int mColumnCount = 3;
|
||||||
|
private StatusViewAdapter viewAdapter;
|
||||||
|
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
private TasklistInterface iTasklist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
|
* fragment (e.g. upon screen orientation changes).
|
||||||
|
*/
|
||||||
|
public StatusTabFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static StatusTabFragment newInstance(int columnCount) {
|
||||||
|
StatusTabFragment fragment = new StatusTabFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(ARG_COLUMN_COUNT, columnCount);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
isStatusOpen = true;
|
||||||
|
try {
|
||||||
|
if (Global.APPLICATION_ORDER.equalsIgnoreCase(GlobalData.getSharedGlobalData().getAuditData().getApplication())) {
|
||||||
|
getActivity().getActionBar().setTitle(getActivity().getString(R.string.title_mn_tasklist));
|
||||||
|
} else if (Global.APPLICATION_SURVEY.equalsIgnoreCase(GlobalData.getSharedGlobalData().getAuditData().getApplication())) {
|
||||||
|
if (MainMenuActivity.mnTaskList == null) {
|
||||||
|
getActivity().getActionBar().setTitle("Status Task");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
MainMenuActivity.setDrawerCounter();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
if (listTaskH != null) iTasklist.initiateRefresh("status");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
iTasklist = new TasklistImpl(this, this);
|
||||||
|
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
toDoList = iTasklist.getTodoList();
|
||||||
|
listTaskH = toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, "");
|
||||||
|
handler = new ListHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
isStatusOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
isStatusOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
View view = inflater.inflate(R.layout.fragment__status_list, container, false);
|
||||||
|
|
||||||
|
// Set the adapter
|
||||||
|
if (view instanceof RelativeLayout) {
|
||||||
|
Context context = view.getContext();
|
||||||
|
|
||||||
|
View view2 = view.findViewById(R.id.actionbar);
|
||||||
|
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||||
|
if (Global.APPLICATION_ORDER.equalsIgnoreCase(application)) {
|
||||||
|
view2.setVisibility(View.VISIBLE);
|
||||||
|
RelativeLayout mainLayout = (RelativeLayout) view.findViewById(R.id.mainLayout);
|
||||||
|
mainLayout.setBackgroundResource(R.drawable.bg_grayscale);
|
||||||
|
} else if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application)) {
|
||||||
|
if (MainMenuActivity.mnTaskList != null)
|
||||||
|
view2.setVisibility(View.GONE);
|
||||||
|
else {
|
||||||
|
view2.setVisibility(View.VISIBLE);
|
||||||
|
RelativeLayout mainLayout = (RelativeLayout) view.findViewById(R.id.mainLayout);
|
||||||
|
mainLayout.setBackgroundResource(R.drawable.bg_grayscale);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
view2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.listStatus);
|
||||||
|
if (mColumnCount <= 1) {
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
} else {
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
|
||||||
|
}
|
||||||
|
viewAdapter = new StatusViewAdapter(listTaskH, this);
|
||||||
|
recyclerView.setAdapter(viewAdapter);
|
||||||
|
|
||||||
|
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);
|
||||||
|
|
||||||
|
// BEGIN_INCLUDE (change_colors)
|
||||||
|
// Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
|
||||||
|
mSwipeRefreshLayout.setColorSchemeColors(
|
||||||
|
getResources().getColor(R.color.tv_light), getResources().getColor(R.color.tv_normal),
|
||||||
|
getResources().getColor(R.color.tv_dark), getResources().getColor(R.color.tv_darker));
|
||||||
|
|
||||||
|
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
iTasklist.initiateRefresh("status");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshBackgroundCancelled(boolean value) {
|
||||||
|
dismissSwiperRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshBackgroundComplete(List<TaskH> result) {
|
||||||
|
onRefreshComplete(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickListener(TaskH item, int position) {
|
||||||
|
try {
|
||||||
|
Scheme scheme = null;
|
||||||
|
scheme = item.getScheme();
|
||||||
|
if (scheme == null) {
|
||||||
|
if (item.getUuid_scheme() != null) {
|
||||||
|
scheme = SchemeDataAccess.getOne(getActivity(),
|
||||||
|
item.getUuid_scheme());
|
||||||
|
if (scheme != null)
|
||||||
|
item.setScheme(scheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scheme == null) {
|
||||||
|
Toast.makeText(getActivity(),
|
||||||
|
getActivity().getString(R.string.task_cant_seen2),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
SurveyHeaderBean header = new SurveyHeaderBean(item);
|
||||||
|
CustomerFragment fragment = CustomerFragment.create(header);
|
||||||
|
FragmentTransaction transaction = MainMenuActivity.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, fragment);
|
||||||
|
transaction.addToBackStack(null);
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
Toast.makeText(
|
||||||
|
getActivity(),
|
||||||
|
getActivity().getString(R.string.scheme_gone)
|
||||||
|
+ e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClickListener(final TaskH item, int position) {
|
||||||
|
try {
|
||||||
|
if (item.getStatus().equals(TaskHDataAccess.STATUS_SEND_UPLOADING)) {
|
||||||
|
try {
|
||||||
|
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
dialogBuilder.withTitle(getActivity().getString(R.string.info_capital))
|
||||||
|
.withMessage(getActivity().getString(R.string.confirm_upload) + " " + item.getCustomer_name() + " ?")
|
||||||
|
.withButton1Text(getActivity().getString(R.string.btnYes))
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnCancel))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
if (Tool.isInternetconnected(getActivity())) {
|
||||||
|
String message = null;
|
||||||
|
List<TaskD> taskd = TaskDDataAccess.getUnsentImageByTaskH(getActivity(), item.getUuid_user(), item.getUuid_task_h());
|
||||||
|
|
||||||
|
if (Global.isIsUploading() || Global.isIsManualUploading()) {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.upload_on_queue), Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
TaskManager.ManualUploadImage(getActivity(), taskd);
|
||||||
|
for (int i = 1; i < getActivity().getSupportFragmentManager().getBackStackEntryCount(); i++)
|
||||||
|
getActivity().getSupportFragmentManager().popBackStack();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
message = getActivity().getString(R.string.request_error);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if(taskd.isEmpty()){
|
||||||
|
List<TaskD> taskDList = TaskDDataAccess.getAll(getActivity(), item.getUuid_task_h(), TaskDDataAccess.IMAGE_ONLY);
|
||||||
|
if(!taskDList.isEmpty()){
|
||||||
|
List<TaskD> taskDetail = new ArrayList();
|
||||||
|
taskDetail.add(taskDList.get(0));
|
||||||
|
TaskManager.ManualUploadImage(getActivity(), taskDetail);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.request_error), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
if (StatusTabFragment.handler != null)
|
||||||
|
StatusTabFragment.handler.sendEmptyMessage(0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (item.getStatus().equals(TaskHDataAccess.STATUS_SEND_PENDING)) {
|
||||||
|
String btnText1 = getActivity().getString(R.string.btnSend);
|
||||||
|
if (item.getIs_prepocessed() != null && item.getIs_prepocessed().equals(Global.FORM_TYPE_VERIFICATION))
|
||||||
|
btnText1 = "Verify";
|
||||||
|
final NiftyDialogBuilder_PL dialogBuilder = NiftyDialogBuilder_PL.getInstance(getActivity());
|
||||||
|
dialogBuilder.withNoTitle()
|
||||||
|
.withNoMessage()
|
||||||
|
.withButton1Text(btnText1)
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnDelete))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
if (Tool.isInternetconnected(getActivity())) {
|
||||||
|
if (item.getTask_id() != null) {
|
||||||
|
new TaskManager().saveAndSendTaskOnBackground(getActivity(), item.getTask_id(), false, false);
|
||||||
|
|
||||||
|
for (int i = 1; i < getActivity().getSupportFragmentManager().getBackStackEntryCount(); i++)
|
||||||
|
getActivity().getSupportFragmentManager().popBackStack();
|
||||||
|
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
MainMenuActivity.setDrawerCounter();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH.addAll(toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, ""));
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), getActivity().getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
TaskHDataAccess.deleteWithRelation(getActivity(), item);
|
||||||
|
if (item.getTask_id() != null)
|
||||||
|
ToDoList.removeSurveyFromList(item.getTask_id());
|
||||||
|
if (StatusTabFragment.handler != null)
|
||||||
|
StatusTabFragment.handler.sendEmptyMessage(0);
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH.addAll(toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, ""));
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
MainMenuActivity.setDrawerCounter();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
} else {
|
||||||
|
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||||
|
dialogBuilder.withTitle(getActivity().getString(R.string.info_capital))
|
||||||
|
.withMessage(getActivity().getString(R.string.confirm_delete) + " " + item.getCustomer_name() + " ?")
|
||||||
|
.withButton1Text(getActivity().getString(R.string.btnYes))
|
||||||
|
.withButton2Text(getActivity().getString(R.string.btnCancel))
|
||||||
|
.setButton1Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
TaskHDataAccess.deleteWithRelation(getActivity(), item);
|
||||||
|
ToDoList.removeSurveyFromList(item.getTask_id());
|
||||||
|
Backup backup = new Backup(getContext());
|
||||||
|
List<TaskH> taskHList = new ArrayList<>();
|
||||||
|
taskHList.add(item);
|
||||||
|
backup.removeTask(new ArrayList<TaskH>(taskHList));
|
||||||
|
if (StatusTabFragment.handler != null)
|
||||||
|
StatusTabFragment.handler.sendEmptyMessage(0);
|
||||||
|
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH.addAll(toDoList.getListTaskInStatus(ToDoList.SEARCH_BY_ALL, ""));
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
MainMenuActivity.setDrawerCounter();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setButton2Click(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialogBuilder.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onRefreshComplete(List<TaskH> result) {
|
||||||
|
//Reset List Item Collection in Adapter
|
||||||
|
listTaskH.clear();
|
||||||
|
listTaskH.addAll(result);
|
||||||
|
viewAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
// Stop the refreshing indicator
|
||||||
|
dismissSwiperRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dismissSwiperRefresh() {
|
||||||
|
if (mSwipeRefreshLayout != null && mSwipeRefreshLayout.isRefreshing())
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
iTasklist.cancelRefreshTask();
|
||||||
|
isStatusOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ListHandler extends Handler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
if (isStatusOpen) {
|
||||||
|
try {
|
||||||
|
if (listTaskH != null) iTasklist.initiateRefresh("status");
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSubmit2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="allTask"
|
||||||
|
android:text="@string/submit_all_task"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSubmit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="taskCollection"
|
||||||
|
android:text="@string/submit_task_collection"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
<FrameLayout android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/content_frame">
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.adins.mss.coll.loyalti.barchart.ranklegends;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.adins.mss.coll.R;
|
||||||
|
import com.adins.mss.coll.models.loyaltymodels.RankDetail;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RankLegendsAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private List<RankDetail> dataset = new ArrayList<>();
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public RankLegendsAdapter(Context context,List<RankDetail> dataset) {
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
|
for(int i=dataset.size()-1; i>=0; i--){
|
||||||
|
this.dataset.add(dataset.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return dataset.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return dataset.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
if(convertView == null){
|
||||||
|
convertView = LayoutInflater.from(context).inflate(R.layout.rank_legend_item,parent,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
RankDetail item = dataset.get(position);
|
||||||
|
TextView legendText = convertView.findViewById(R.id.legendText);
|
||||||
|
legendText.setTextColor(item.colorValue);
|
||||||
|
legendText.setText(item.level);
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".dynamicform.form.FragmentQuestion"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:contentPadding="5dp"
|
||||||
|
android:background="@color/fontColorWhite">
|
||||||
|
<com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView
|
||||||
|
android:id="@+id/questionList"
|
||||||
|
android:name="com.adins.mss.base.dynamicform.form.QuestionFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
app:layoutManager="LinearLayoutManager" />
|
||||||
|
<com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView
|
||||||
|
android:id="@+id/reviewList"
|
||||||
|
android:name="com.adins.mss.base.dynamicform.form.QuestionFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layoutManager="LinearLayoutManager" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
<View
|
||||||
|
android:id="@+id/actionbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@drawable/actionbar_background" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/contentComment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_margin="6dp"
|
||||||
|
android:text="Change Profile Picture" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout1"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginRight="6dp" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/profilePicture"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_margin="6dp"
|
||||||
|
android:layout_marginLeft="32dp"
|
||||||
|
android:src="@drawable/profile_image" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnChangeProfile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="31dp"
|
||||||
|
android:text="Change" />
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="6dp"
|
||||||
|
android:text="Change Header Picture"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout2"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginRight="6dp" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/headerPicture"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/dummy" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnChangeHeader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:text="change" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/bgColor"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/deviceInfoContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_margin="@dimen/card_margin"
|
||||||
|
app:cardBackgroundColor="@color/fontColorWhite"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:cardElevation="@dimen/card_shadow"
|
||||||
|
app:contentPadding="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtAppVer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_mobile"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/appVer"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtOsVer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_android"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/androidVersion"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtBattery"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_battery"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/batteryPercen"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtDataUsage"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_app_storage"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/appStorage"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtMobileDataUsage"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_data_usage_color"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/dataUsage"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtMemoryAvailable"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_storage"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/deviceStorage"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtAndroidId"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_android"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/androidID"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:visibility="visible"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/fontColorWhite"
|
||||||
|
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,171 @@
|
||||||
|
package com.adins.mss.foundation.phone;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
|
import com.adins.mss.base.crashlytics.FireCrash;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by gigin.ginanjar on 14/09/2016.
|
||||||
|
*/
|
||||||
|
public class TelephonyInfo {
|
||||||
|
private static TelephonyInfo telephonyInfo;
|
||||||
|
private String imsiSIM1;
|
||||||
|
private String imsiSIM2;
|
||||||
|
|
||||||
|
private TelephonyInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TelephonyInfo getInstance(Context context) {
|
||||||
|
|
||||||
|
if (telephonyInfo == null) {
|
||||||
|
|
||||||
|
telephonyInfo = new TelephonyInfo();
|
||||||
|
|
||||||
|
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
|
||||||
|
if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED
|
||||||
|
&& Build.VERSION.SDK_INT <= 28) {
|
||||||
|
|
||||||
|
telephonyInfo.imsiSIM1 = telephonyManager.getDeviceId();
|
||||||
|
telephonyInfo.imsiSIM2 = null;
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
|
||||||
|
if (telephonyManager.getPhoneCount() >= 2) { //Check is phone has 2 or more sim card
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
telephonyInfo.imsiSIM1 = telephonyManager.getImei(0);
|
||||||
|
telephonyInfo.imsiSIM2 = telephonyManager.getImei(1);
|
||||||
|
} else {
|
||||||
|
telephonyInfo.imsiSIM1 = telephonyManager.getDeviceId(0);
|
||||||
|
telephonyInfo.imsiSIM2 = telephonyManager.getDeviceId(1);
|
||||||
|
}
|
||||||
|
} else { //Phone only has single sim card
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
telephonyInfo.imsiSIM1 = telephonyManager.getImei();
|
||||||
|
telephonyInfo.imsiSIM2 = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceIdGemini", 0);
|
||||||
|
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceIdGemini", 1);
|
||||||
|
} catch (GeminiMethodNotFoundException e) {
|
||||||
|
try {
|
||||||
|
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceId", 0);
|
||||||
|
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceId", 1);
|
||||||
|
} catch (GeminiMethodNotFoundException e1) {
|
||||||
|
try {
|
||||||
|
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceIdDs", 0);
|
||||||
|
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceIdDs", 1);
|
||||||
|
} catch (GeminiMethodNotFoundException e2) {
|
||||||
|
try {
|
||||||
|
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getSimSerialNumberGemini", 0);
|
||||||
|
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getSimSerialNumberGemini", 1);
|
||||||
|
} catch (GeminiMethodNotFoundException e3) {
|
||||||
|
//Call here for next manufacturer's predicted method name if you wish
|
||||||
|
e3.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
telephonyInfo.imsiSIM1 = UUID.randomUUID().toString();
|
||||||
|
telephonyInfo.imsiSIM2 = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return telephonyInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getDeviceIdBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
|
||||||
|
|
||||||
|
String imsi = null;
|
||||||
|
|
||||||
|
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
|
||||||
|
|
||||||
|
Class<?>[] parameter = new Class[1];
|
||||||
|
parameter[0] = int.class;
|
||||||
|
Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter);
|
||||||
|
|
||||||
|
Object[] obParameter = new Object[1];
|
||||||
|
obParameter[0] = slotID;
|
||||||
|
Object ob_phone = getSimID.invoke(telephony, obParameter);
|
||||||
|
|
||||||
|
if (ob_phone != null) {
|
||||||
|
imsi = ob_phone.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new GeminiMethodNotFoundException(predictedMethodName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return imsi;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean getSIMStateBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
|
||||||
|
|
||||||
|
boolean isReady = false;
|
||||||
|
|
||||||
|
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
|
||||||
|
|
||||||
|
Class<?>[] parameter = new Class[1];
|
||||||
|
parameter[0] = int.class;
|
||||||
|
Method getSimStateGemini = telephonyClass.getMethod(predictedMethodName, parameter);
|
||||||
|
|
||||||
|
Object[] obParameter = new Object[1];
|
||||||
|
obParameter[0] = slotID;
|
||||||
|
Object ob_phone = getSimStateGemini.invoke(telephony, obParameter);
|
||||||
|
|
||||||
|
if (ob_phone != null) {
|
||||||
|
int simState = Integer.parseInt(ob_phone.toString());
|
||||||
|
if (simState == TelephonyManager.SIM_STATE_READY) {
|
||||||
|
isReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FireCrash.log(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new GeminiMethodNotFoundException(predictedMethodName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImeiSIM1() {
|
||||||
|
return imsiSIM1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImeiSIM2() {
|
||||||
|
return imsiSIM2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDualSIM() {
|
||||||
|
return imsiSIM2 != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class GeminiMethodNotFoundException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -996812356902545308L;
|
||||||
|
|
||||||
|
public GeminiMethodNotFoundException(String info) {
|
||||||
|
super(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.adins.mss.base.loyalti.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class RankDetail {
|
||||||
|
@SerializedName("LEVEL")
|
||||||
|
public String level;
|
||||||
|
@SerializedName("RANK")
|
||||||
|
public String rank;
|
||||||
|
public transient int colorValue;
|
||||||
|
|
||||||
|
public RankDetail(String level, String rank, int colorValue) {
|
||||||
|
this.level = level;
|
||||||
|
this.rank = rank;
|
||||||
|
this.colorValue = colorValue;
|
||||||
|
}
|
||||||
|
}
|