add project adins

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

View file

@ -0,0 +1,57 @@
package com.adins.mss.svy.reassignment;
import com.adins.mss.foundation.http.KeyValue;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class JsonResponseServer extends MssResponseType{
@SerializedName("listResponseServer")
List<ResponseServer> listResponseServer;
public List<ResponseServer> getListResponseServer() {
return listResponseServer;
}
public void setListResponseServer(List<ResponseServer> listResponseServer) {
this.listResponseServer = listResponseServer;
}
public class ResponseServer extends KeyValue {
@SerializedName("flag")
String flag;
@SerializedName("subListResponseServer")
List<ResponseServer> subListResponseServer;
@SerializedName("formName")
String formName;
public ResponseServer(String key, String value) {
super(key, value);
}
public String getFormName() {
return this.formName;
}
public void setFormName(String value) {
this.formName = value;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public List<ResponseServer> getSubListResponseServer() {
return subListResponseServer;
}
public void setSubListResponseServer(List<ResponseServer> subListResponseServer) {
this.subListResponseServer = subListResponseServer;
}
}
}

View file

@ -0,0 +1,71 @@
package com.adins.mss.foundation.db.dataaccess;
import android.content.Context;
import com.adins.mss.dao.DaoSession;
import com.adins.mss.dao.LogoPrint;
import com.adins.mss.dao.LogoPrintDao;
import com.adins.mss.foundation.db.DaoOpenHelper;
import java.util.List;
import de.greenrobot.dao.query.QueryBuilder;
public class LogoPrintDataAccess {
protected static DaoSession getDaoSession(Context context) {
return DaoOpenHelper.getDaoSession(context);
}
protected static LogoPrintDao getLogoPrintDao(Context context) {
return getDaoSession(context).getLogoPrintDao();
}
public static void add(Context context, LogoPrint logoPrint) {
getLogoPrintDao(context).insert(logoPrint);
getDaoSession(context).clear();
}
public static void add(Context context, List<LogoPrint> logoPrintList) {
getLogoPrintDao(context).insertInTx(logoPrintList);
getDaoSession(context).clear();
}
public static void addOrReplace(Context context, LogoPrint logoPrint) {
getLogoPrintDao(context).insertOrReplaceInTx(logoPrint);
getDaoSession(context).clear();
}
public static void addOrReplace(Context context, List<LogoPrint> logoPrintList) {
getLogoPrintDao(context).insertOrReplaceInTx(logoPrintList);
getDaoSession(context).clear();
}
public static void clean(Context context) {
getLogoPrintDao(context).deleteAll();
}
public static void delete(Context context, LogoPrint logoPrint) {
getLogoPrintDao(context).delete(logoPrint);
getDaoSession(context).clear();
}
public static void update(Context context, LogoPrint logoPrint) {
getLogoPrintDao(context).update(logoPrint);
}
public static LogoPrint getOne(Context context, String tenant) {
QueryBuilder<LogoPrint> qb = getLogoPrintDao(context).queryBuilder();
qb.where(LogoPrintDao.Properties.Tenant.eq(tenant));
qb.build().forCurrentThread();
if (qb.list().size() == 0)
return null;
return qb.list().get(0);
}
public static List<LogoPrint> getAll(Context context) {
QueryBuilder<LogoPrint> qb = getLogoPrintDao(context).queryBuilder();
qb.build();
return qb.list();
}
}

View file

@ -0,0 +1,74 @@
/*
* Class copied from the Android Developers Blog:
* http://android-developers.blogspot.com/2011/03/identifying-app-installations.html
*/
package org.acra.util;
import android.content.Context;
import org.acra.ACRA;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.UUID;
import static org.acra.ACRA.LOG_TAG;
/**
* <p>
* Creates a file storing a UUID on the first application start. This UUID can then be used as a identifier of this
* specific application installation.
* </p>
* <p>
* <p>
* This was taken from <a href="http://android-developers.blogspot.com/2011/03/identifying-app-installations.html"> the
* android developers blog.</a>
* </p>
*/
public class Installation {
private static final String INSTALLATION = "ACRA-INSTALLATION";
private static String sID;
public synchronized static String id(Context context) {
if (sID == null) {
final File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists()) {
writeInstallationFile(installation);
}
sID = readInstallationFile(installation);
} catch (IOException e) {
ACRA.log.w(LOG_TAG, "Couldn't retrieve InstallationId for " + context.getPackageName(), e);
return "Couldn't retrieve InstallationId";
} catch (RuntimeException e) {
ACRA.log.w(LOG_TAG, "Couldn't retrieve InstallationId for " + context.getPackageName(), e);
return "Couldn't retrieve InstallationId";
}
}
return sID;
}
private static String readInstallationFile(File installation) throws IOException {
final RandomAccessFile f = new RandomAccessFile(installation, "r");
final byte[] bytes = new byte[(int) f.length()];
try {
f.readFully(bytes);
} finally {
f.close();
}
return new String(bytes);
}
private static void writeInstallationFile(File installation) throws IOException {
final FileOutputStream out = new FileOutputStream(installation);
try {
final String id = UUID.randomUUID().toString();
out.write(id.getBytes());
} finally {
out.close();
}
}
}

View file

@ -0,0 +1,413 @@
package com.adins.mss.base.dynamicform.form.questions;
import android.content.res.ColorStateList;
import android.graphics.Color;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ButtonTextUrlViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.DateTimeQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.DigitalReceiptQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.DrawingQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.DropdownQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ImageQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.LocationQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.LookupDukcapilQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.LookupQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.LuOnlineQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.MultipleQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.QuestionGroupViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.RadioQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.TextOnlineViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.TextQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.TextWithSuggestionQuestionViewHolder;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ValidationQuestionViewHolder;
import com.adins.mss.base.dynamictheme.DynamicTheme;
import com.adins.mss.base.dynamictheme.ThemeLoader;
import com.adins.mss.base.dynamictheme.ThemeUtility;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.util.LinkedHashMap;
import java.util.List;
/**
* Created by gigin.ginanjar on 03/09/2016.
*/
public class QuestionViewAdapter extends ExpandableRecyclerView.Adapter<RecyclerView.ViewHolder, QuestionGroupViewHolder, QuestionBean, String> implements ThemeLoader.ColorSetLoaderCallback {
private static final int FADE_DURATION = 750; // in milliseconds
private final LinkedHashMap<String, List<QuestionBean>> mValues;
private final List<String> mGroups;
private final FragmentActivity mActivity;
private final int VIEW_TYPE_LOADING = 999;
public ScrollingLinearLayoutManager linearLayoutManager;
public ExpandableRecyclerView mRecyclerView;
private OnQuestionClickListener mListener;
private int lastPosition = -1;
//Edittext colorstatelist object
public static ColorStateList etBorderColorStateList;
public QuestionViewAdapter(FragmentActivity activity, ExpandableRecyclerView recyclerView, List<String> groups, LinkedHashMap<String, List<QuestionBean>> items, OnQuestionClickListener listener) {
mActivity = activity;
mValues = items;
mListener = listener;
mGroups = groups;
mRecyclerView = recyclerView;
loadSavedTheme();
}
private void loadSavedTheme(){
ThemeLoader themeLoader = new ThemeLoader(mActivity);
themeLoader.loadSavedColorSet(this);
}
public static boolean IsTextQuestion(String answerType) {
return answerType.equals(Global.AT_TEXT) ||
answerType.equals(Global.AT_TEXT_MULTILINE) ||
answerType.equals(Global.AT_CURRENCY) ||
answerType.equals(Global.AT_NUMERIC) ||
answerType.equals(Global.AT_DECIMAL) ||
answerType.equals(Global.AT_PDF);
}
public static boolean IsDropdownQuestion(String answerType) {
return answerType.equals(Global.AT_DROPDOWN) ||
answerType.equals(Global.AT_DROPDOWN_W_DESCRIPTION);
}
public static boolean IsMultipleQuestion(String answerType) {
return answerType.equals(Global.AT_MULTIPLE) ||
answerType.equals(Global.AT_MULTIPLE_ONE_DESCRIPTION) ||
answerType.equals(Global.AT_MULTIPLE_W_DESCRIPTION);
}
public static boolean IsRadioQuestion(String answerType) {
return answerType.equals(Global.AT_RADIO) ||
answerType.equals(Global.AT_RADIO_W_DESCRIPTION);
}
public static boolean IsImageQuestion(String answerType) {
return answerType.equals(Global.AT_IMAGE) ||
answerType.equals(Global.AT_IMAGE_W_GPS_ONLY) ||
answerType.equals(Global.AT_IMAGE_W_LOCATION) ||
answerType.equals(Global.AT_ID_CARD_PHOTO);
}
public static boolean IsLookupQuestion(String answerType) {
return answerType.equals(Global.AT_LOV) ||
answerType.equals(Global.AT_LOV_W_FILTER) ||
answerType.equals(Global.AT_LOOKUP) ||
answerType.equals(Global.AT_LOOKUP_DUKCAPIL);
}
public static boolean IsTextQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_TEXT) ||
answerType == Integer.valueOf(Global.AT_TEXT_MULTILINE) ||
answerType == Integer.valueOf(Global.AT_CURRENCY) ||
answerType == Integer.valueOf(Global.AT_NUMERIC) ||
answerType == Integer.valueOf(Global.AT_DECIMAL) ||
answerType == Integer.valueOf(Global.AT_PDF);
}
public static boolean IsDropdownQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_DROPDOWN) ||
answerType == Integer.valueOf(Global.AT_DROPDOWN_W_DESCRIPTION);
}
public static boolean IsMultipleQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_MULTIPLE) ||
answerType == Integer.valueOf(Global.AT_MULTIPLE_ONE_DESCRIPTION) ||
answerType == Integer.valueOf(Global.AT_MULTIPLE_W_DESCRIPTION);
}
public static boolean IsRadioQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_RADIO) ||
answerType == Integer.valueOf(Global.AT_RADIO_W_DESCRIPTION);
}
public static boolean IsImageQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_IMAGE) ||
answerType == Integer.valueOf(Global.AT_IMAGE_W_GPS_ONLY) ||
answerType == Integer.valueOf(Global.AT_IMAGE_W_LOCATION) ||
answerType == Integer.valueOf(Global.AT_ID_CARD_PHOTO);
}
public static boolean IsDateTimeQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_DATE) ||
answerType == Integer.valueOf(Global.AT_DATE_TIME) ||
answerType == Integer.valueOf(Global.AT_TIME);
}
public static boolean IsLocationQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_LOCATION);
}
public static boolean IsDrawingQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_DRAWING);
}
public static boolean IsTextWithSuggestionQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_TEXT_WITH_SUGGESTION);
}
public static boolean IsLookupQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_LOV) ||
answerType == Integer.valueOf(Global.AT_LOV_W_FILTER) ||
answerType == Integer.valueOf(Global.AT_LOOKUP) ||
answerType == Integer.valueOf(Global.AT_LOOKUP_DUKCAPIL);
}
@Override
public int getGroupItemCount() {
return mGroups.size() - 1;
}
@Override
public int getChildItemCount(int group) {
return mValues.get(mGroups.get(group)).size();
}
@Override
public String getGroupItem(int position) {
return mGroups.get(position);
}
@Override
public QuestionBean getChildItem(int group, int position) {
return mValues.get(getGroupItem(group)).get(position);
}
@Override
protected QuestionGroupViewHolder onCreateGroupViewHolder(ViewGroup parent) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_group_layout, parent, false);
return new QuestionGroupViewHolder(view);
}
@Override
public void onBindGroupViewHolder(QuestionGroupViewHolder holder, int group) {
super.onBindGroupViewHolder(holder, group);
String qGroup = "";
try {
qGroup = getGroupItem(group);
} catch (Exception e) {
FireCrash.log(e);
}
holder.bind(qGroup);
setFadeAnimation2(holder.itemView);
}
@Override
protected RecyclerView.ViewHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
if (IsTextQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_text_layout, parent, false);
return new TextQuestionViewHolder(mActivity, view, mRecyclerView);
} else if (IsDropdownQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_dropdown_layout, parent, false);
return new DropdownQuestionViewHolder(view, mActivity);
} else if (IsMultipleQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_multiple_layout, parent, false);
return new MultipleQuestionViewHolder(view, mActivity);
} else if (IsImageQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_image_layout, parent, false);
return new ImageQuestionViewHolder(view, mActivity, mListener);
} else if (IsRadioQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_radio_layout, parent, false);
return new RadioQuestionViewHolder(view, mActivity);
} else if (IsLocationQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_location_layout, parent, false);
return new LocationQuestionViewHolder(view, mActivity, mListener);
} else if (IsDrawingQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_drawing_layout, parent, false);
return new DrawingQuestionViewHolder(view, mActivity, mListener);
} else if (IsDateTimeQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_datetime_layout, parent, false);
return new DateTimeQuestionViewHolder(mActivity, view);
} else if (IsTextWithSuggestionQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_textwithsuggestion_layout, parent, false);
return new TextWithSuggestionQuestionViewHolder(view, mActivity);
} else if (IsLookupQuestion(viewType)) {
if(viewType == Integer.valueOf(Global.AT_LOOKUP_DUKCAPIL)){
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_lookup_dukcapil_layout, parent, false);
return new LookupDukcapilQuestionViewHolder(view, mActivity, mListener);
} else{
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_lookup_layout, parent, false);
return new LookupQuestionViewHolder(view, mActivity, mListener);
}
} else if (IsValidationQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_validation_layout, parent, false);
return new ValidationQuestionViewHolder(view, mActivity);
} else if (IsRvMobileQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_digitalreceipt_layout, parent, false);
return new DigitalReceiptQuestionViewHolder(view, mActivity);
} else if (isTextOnlineQuestion(viewType)){
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_text_online_layout, parent, false);
return new TextOnlineViewHolder(view, mActivity);
} else if (IsLuOnlineQuestion(viewType)) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_lu_online_layout, parent, false);
return new LuOnlineQuestionViewHolder(view, mActivity);
}
else if(IsButtonViewUrlQuestion(viewType)){
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_button_text_url_layout, parent, false);
return new ButtonTextUrlViewHolder(view, mActivity);
}
return null;
}
@Override
public int getChildItemViewType(int group, int position) {
int viewType = Integer.valueOf(getChildItem(group, position).getAnswer_type());
return getChildItem(group, position) == null ? VIEW_TYPE_LOADING : viewType;
}
@Override
public void onBindChildViewHolder(RecyclerView.ViewHolder mHolder, int group, int position) {
super.onBindChildViewHolder(mHolder, group, position);
if (mHolder instanceof TextQuestionViewHolder) {
final TextQuestionViewHolder holder = (TextQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position),position + 1);
} else if (mHolder instanceof DropdownQuestionViewHolder) {
final DropdownQuestionViewHolder holder = (DropdownQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof RadioQuestionViewHolder) {
final RadioQuestionViewHolder holder = (RadioQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof MultipleQuestionViewHolder) {
final MultipleQuestionViewHolder holder = (MultipleQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof LocationQuestionViewHolder) {
final LocationQuestionViewHolder holder = (LocationQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), group, position + 1);
} else if (mHolder instanceof ImageQuestionViewHolder) {
final ImageQuestionViewHolder holder = (ImageQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), group, position + 1);
} else if (mHolder instanceof DrawingQuestionViewHolder) {
final DrawingQuestionViewHolder holder = (DrawingQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), group, position + 1);
} else if (mHolder instanceof TextWithSuggestionQuestionViewHolder) {
final TextWithSuggestionQuestionViewHolder holder = (TextWithSuggestionQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof DateTimeQuestionViewHolder) {
final DateTimeQuestionViewHolder holder = (DateTimeQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof LookupQuestionViewHolder) {
final LookupQuestionViewHolder holder = (LookupQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), group, position + 1);
}else if (mHolder instanceof LookupDukcapilQuestionViewHolder) {
final LookupDukcapilQuestionViewHolder holder = (LookupDukcapilQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), group, position + 1);
} else if (mHolder instanceof ValidationQuestionViewHolder) {
final ValidationQuestionViewHolder holder = (ValidationQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if(mHolder instanceof DigitalReceiptQuestionViewHolder) {
final DigitalReceiptQuestionViewHolder holder = (DigitalReceiptQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof TextOnlineViewHolder) {
final TextOnlineViewHolder holder = (TextOnlineViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
} else if (mHolder instanceof LuOnlineQuestionViewHolder) {
final LuOnlineQuestionViewHolder holder = (LuOnlineQuestionViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
}
else if(mHolder instanceof ButtonTextUrlViewHolder) {
final ButtonTextUrlViewHolder holder = (ButtonTextUrlViewHolder) mHolder;
holder.bind(getChildItem(group, position), position + 1);
}
setFadeAnimation(mHolder.itemView, position);
}
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
super.onViewDetachedFromWindow(holder);
holder.itemView.clearAnimation();
}
private void setFadeAnimation(View view, int position) {
if (position > lastPosition) {
lastPosition = position;
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
} else if (lastPosition > getItemCount() - 1) {
lastPosition = getItemCount() - 1;
} else {
// setScaleAnimation(view);
setFadeAnimation2(view);
}
}
private void setFadeAnimation2(View view) {
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(FADE_DURATION / 2);
view.startAnimation(anim);
}
private void setScaleAnimation(View view) {
ScaleAnimation anim = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setDuration(150);
view.startAnimation(anim);
}
private void createEditTextBorderColorStateList(DynamicTheme dynamicTheme){
if(dynamicTheme == null){
return;
}
int etBorderFocusedColor = Color.parseColor(ThemeUtility.getColorItemValue(dynamicTheme,"et_border_focused"));
int etBorderDisabledColor = Color.parseColor(ThemeUtility.getColorItemValue(dynamicTheme,"et_border_disabled"));
int etBorderNormalColor = Color.parseColor(ThemeUtility.getColorItemValue(dynamicTheme,"et_border_normal"));
int[][] states = new int[][] {
new int[] { android.R.attr.state_focused}, // focused
new int[] {-android.R.attr.state_enabled}, //disabled
new int[] {} // normal
};
int[] etbordercolorlist = new int[]{
etBorderFocusedColor,etBorderDisabledColor,etBorderNormalColor
};
etBorderColorStateList = new ColorStateList(states,etbordercolorlist);
}
@Override
public void onHasLoaded(DynamicTheme dynamicTheme) {
if(dynamicTheme != null && dynamicTheme.getThemeItemList().size() > 0){
createEditTextBorderColorStateList(dynamicTheme);
}
}
@Override
public void onHasLoaded(DynamicTheme dynamicTheme, boolean needUpdate) {
}
public static boolean IsValidationQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_VALIDATION);
}
public static boolean IsRvMobileQuestion(int answerType) {
return answerType == Integer.valueOf(Global.AT_RV_MOBILE);
}
public static boolean isTextOnlineQuestion(int answerType){
return answerType == Integer.valueOf(Global.AT_TEXT_ONLINE);
}
public static boolean IsButtonViewUrlQuestion(int answerType){
return answerType == Integer.valueOf(Global.AT_BUTTON_VIEW_URL);
}
public static boolean IsLuOnlineQuestion(int answerTYpe) {
return answerTYpe == Integer.valueOf(Global.AT_LOOKUP_ONLINE);
}
}

View file

@ -0,0 +1,205 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\gigin.ginanjar\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-optimizationpasses 5
#When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
-dontusemixedcaseclassnames
#Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
-dontskipnonpubliclibraryclasses
#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
-dontpreverify
#Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
-verbose
#The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
#To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
#To repackage classes on a single package
-repackageclasses ''
#Uncomment if using annotations to keep them.
-keepattributes *Annotation*, Override
-keepattributes Signature
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-dontwarn javax.script.**
-dontwarn org.apache.commons.logging.**
-dontwarn java.beans.**
-dontwarn okio.**
-dontwarn com.androidquery.auth.TwitterHandle
-dontwarn org.bouncycastle.**
-keep class javax.** {*;}
-keep class org.apache.commons.logging.** {*;}
-keep class java.beans.** {*;}
-keep class org.apache.commons.jexl2.** {*;}
-keep class org.bouncycastle.** {*;}
-keep class okio.** {*;}
-keep class oauth.signpost.** {*;}
-keep class org.apache.log4j.Logger {*;}
-keep class java.nio.** {*;}
-keep class junit..** {*;}
-keep class oauth.signpost.commonshttp.** {*;}
-keep class net.sqlcipher.** {
*;
}
#Keep classes that are referenced on the AndroidManifest
#-keep public class * extends androidx.fragment.app.Fragment
-keep public class * extends androidx.appcompat.app.AppCompatActivity
-keep public class * extends com.adins.mss.base.MssFragmentActivity
-keep public class * extends androidx.fragment.app.Fragment
-keep public class * extends androidx.fragment.app.FragmentActivity
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends com.adins.mss.foundation.http.MssRequestType
-keep public class * extends com.adins.mss.foundation.http.MssResponseType
-keep public class com.android.vending.licensing.ILicensingService
-keep class com.adins.**.*Request
-keep class com.adins.**.*Response
-keep class android.** { *; }
-keep class com.google.** { *; }
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** e(...);
public static *** i(...);
}
#To avoid changing names of methods invoked on layout's onClick.
# Uncomment and add specific method names if using onClick on layouts
-keepclassmembers class * {
public void onClickButton(android.view.View);
}
#Maintain java native methods
-keepclasseswithmembernames class * {
native <methods>;
}
#To maintain custom components names that are used on layouts XML.
#Uncomment if having any problem with the approach below
#-keep public class custom.components.package.and.name.**
#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
#Maintain enums
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
#Keep the R
-keepclassmembers class **.R$* {
public static <fields>;
}
#Keep Interface
-keep interface * {*;}
-keep class sun.misc.Unsafe { *; }
###### ADDITIONAL OPTIONS NOT USED NORMALLY
#To keep callback calls. Uncomment if using any
#http://proguard.sourceforge.net/index.html#/manual/examples.html#callback
#-keep class mypackage.MyCallbackClass {
# void myCallbackMethod(java.lang.String);
#}
#Uncomment if using Serializable
-keepclassmembers class * implements java.io.Serializable {
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
-keep class * implements java.io.Serializable {
public protected <fields>;
}
#Keep fields for Gson transactions
-keep public class * extends com.adins.mss.foundation.http.MssRequestType{
<fields>;
}
-keep public class * extends com.adins.mss.foundation.http.MssResponseType{
<fields>;
}
-keep public class * extends com.adins.mss.foundation.http.KeyValue{
<fields>;
}
-ignorewarnings
#Keep Class For MSS
-keep class com.adins.mss.dao.** {*;}
-keep class com.adins.mss.base.login.DefaultLoginModel
-keep public class com.gadberry.** {*;}
-keep public class com.adins.mss.base.authentication.AuthenticationResultBean{
<fields>;
}
-keep public class com.adins.mss.foundation.formatter.DateFormatter{
public <methods>;
}
-keep public class com.adins.mss.logger.Logger{
public <methods>;
}
-keep class com.androidquery.AQuery {
public protected <methods>;
public protected <fields>;
}
-keep class com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences {*;}
-keep public class com.adins.mss.foundation.UserHelp.** {*;}

View file

@ -0,0 +1,48 @@
package com.adins.mss.base.syncfile;
import android.content.Context;
import com.adins.mss.dao.MobileDataFile;
/**
* Created by loise on 10/18/2017.
*/
/**
* class for holding parameters to pass in asynctask for db import process
*/
public class ImportDbParams {
public static Context context;
MobileDataFile metadata;
String message;
public ImportDbParams(Context context, String message, MobileDataFile metadata) {
this.context = context;
this.metadata = metadata;
this.message = message;
}
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
public MobileDataFile getMetadata() {
return metadata;
}
public void setMetadata(MobileDataFile metadata) {
this.metadata = metadata;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View file

@ -0,0 +1,121 @@
package com.adins.mss.base.syncfile;
import android.util.Log;
import com.adins.mss.base.crashlytics.FireCrash;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
/**
* Created by shaladin on 9/2/17.
*/
/**
* class untuk compress dan extract file zip
*/
public class ArchiveManager {
private String ext = ".zip";
/**
* Method for archiving file
*
* @param _files ArrayList source file to be archived
* @param archiveName Destination File without extension (path + filename)
*/
public void archive(ArrayList<String> _files, String archiveName) {
try (FileOutputStream dest = new FileOutputStream(new File(archiveName + ext));
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest))) {
byte[] data = new byte[8192];
for (int i = 0; i < _files.size(); i++) {
try (FileInputStream fin = new FileInputStream(_files.get(i));
BufferedInputStream origin = new BufferedInputStream(fin, 8192)) {
Log.i("ArchiveManager","Adding: " + _files.get(i));
ZipEntry zen = new ZipEntry(new File(_files.get(i)).getName());
out.putNextEntry(zen);
int count;
while ((count = origin.read(data, 0, 8192)) != -1) {
out.write(data, 0, count);
}
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
}
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
}
/**
* Method for extracting archive
*
* @param archiveFile source archive file to be extracted
* @param targetLocation target location extracted file
*/
public void extract(String archiveFile, String targetLocation) {
File sourceArchiveFile = new File(archiveFile);
try (ZipFile zipFile = new ZipFile(sourceArchiveFile, ZipFile.OPEN_READ)){
int BUFFER = 2048;
List<String> zipFiles = new ArrayList<>();
File destinationPath = new File(targetLocation);
Enumeration zipFileEntries = zipFile.entries();
String sourceCanonicalName = sourceArchiveFile.getCanonicalPath();
if (!sourceCanonicalName.startsWith(archiveFile)){
SecurityException securityException= new SecurityException("Kesalahan Security Terkait Tranversal ZIP");
throw securityException;
}else {
while (zipFileEntries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) zipFileEntries.nextElement();
String currentEntry = entry.getName();
File destFile = new File(destinationPath, currentEntry);
if (currentEntry.endsWith(".zip")) {
zipFiles.add(destFile.getAbsolutePath());
}
File destinationParent = destFile.getParentFile();
destinationParent.mkdirs();
try (FileOutputStream fos = new FileOutputStream(destFile);
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER)) {
if (!entry.isDirectory()) {
BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry));
int currentByte;
byte[] data = new byte[BUFFER];
while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
dest.write(data, 0, currentByte);
}
dest.flush();
is.close();
}
} catch (IOException io) {
io.printStackTrace();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,87 @@
package com.adins.mss.base.dynamicform;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.util.List;
/**
* Temporary Data for Dynamic Question Form
*/
public class DataForDynamicQuestion {
/**
* Property selectedForm
*/
FormBean selectedForm;
/**
* Property listOfQuestion
*/
List<QuestionBean> listOfQuestion;
/**
* Property selectedHeader
*/
SurveyHeaderBean selectedHeader;
/**
* Property mode
*/
int mode;
/**
* Gets the selectedForm
*/
public FormBean getSelectedForm() {
return this.selectedForm;
}
/**
* Sets the selectedForm
*/
public void setSelectedForm(FormBean value) {
this.selectedForm = value;
}
/**
* Gets the listOfQuestion
*/
public List<QuestionBean> getListOfQuestion() {
return this.listOfQuestion;
}
/**
* Sets the listOfQuestion
*/
public void setListOfQuestion(List<QuestionBean> value) {
this.listOfQuestion = value;
}
/**
* Gets the selectedHeader
*/
public SurveyHeaderBean getSelectedHeader() {
return this.selectedHeader;
}
/**
* Sets the selectedHeader
*/
public void setSelectedHeader(SurveyHeaderBean value) {
this.selectedHeader = value;
}
/**
* Gets the mode
*/
public int getMode() {
return this.mode;
}
/**
* Sets the mode
*/
public void setMode(int value) {
this.mode = value;
}
}

View file

@ -0,0 +1,353 @@
/*
* Copyright 2010 Emmanuel Astier & 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;
import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;
import com.adins.mss.base.crashlytics.FireCrash;
import org.acra.annotation.ReportsCrashes;
import org.acra.log.ACRALog;
import org.acra.log.AndroidLogDelegate;
/**
* Use this class to initialize the crash reporting feature using
* {@link #init(Application)} as soon as possible in your {@link Application}
* subclass {@link Application#onCreate()} method. Configuration items must have
* been set by using {@link ReportsCrashes} above the declaration of your
* {@link Application} subclass.
*
* @author Kevin Gaudin
*/
public class ACRA {
public static final boolean DEV_LOGGING = false; // Should be false for
// release.
public static final String LOG_TAG = ACRA.class.getSimpleName();
/**
* The key of the application default SharedPreference where you can put a
* 'true' Boolean value to disable ACRA.
*/
public static final String PREF_DISABLE_ACRA = "acra.disable";
/**
* Alternatively, you can use this key if you prefer your users to have the
* checkbox ticked to enable crash reports. If both acra.disable and
* acra.enable are set, the value of acra.disable takes over the other.
*/
public static final String PREF_ENABLE_ACRA = "acra.enable";
/**
* The key of the SharedPreference allowing the user to disable sending
* content of logcat/dropbox. System logs collection is also dependent of
* the READ_LOGS permission.
*/
public static final String PREF_ENABLE_SYSTEM_LOGS = "acra.syslog.enable";
/**
* The key of the SharedPreference allowing the user to disable sending his
* device id. Device ID collection is also dependent of the READ_PHONE_STATE
* permission.
*/
public static final String PREF_ENABLE_DEVICE_ID = "acra.deviceid.enable";
/**
* The key of the SharedPreference allowing the user to always include his
* email address.
*/
public static final String PREF_USER_EMAIL_ADDRESS = "acra.user.email";
/**
* The key of the SharedPreference allowing the user to automatically accept
* sending reports.
*/
public static final String PREF_ALWAYS_ACCEPT = "acra.alwaysaccept";
/**
* The version number of the application the last time ACRA was started.
* This is used to determine whether unsent reports should be discarded
* because they are old and out of date.
*/
public static final String PREF_LAST_VERSION_NR = "acra.lastVersionNr";
public static ACRALog log = new AndroidLogDelegate();
private static Application mApplication;
// Accessible via ACRA#getErrorReporter().
private static ErrorReporter errorReporterSingleton;
// NB don't convert to a local field because then it could be garbage
// collected and then we would have no PreferenceListener.
private static OnSharedPreferenceChangeListener mPrefListener;
private static ACRAConfiguration configProxy;
/**
* <p>
* Initialize ACRA for a given Application. The call to this method should
* be placed as soon as possible in the {@link Application#onCreate()}
* method.
* </p>
*
* @param app Your Application class.
* @throws IllegalStateException if it is called more than once.
*/
public static void init(Application app) {
final ReportsCrashes reportsCrashes = app.getClass().getAnnotation(ReportsCrashes.class);
if (reportsCrashes == null) {
log.e(LOG_TAG,
"ACRA#init called but no ReportsCrashes annotation on Application " + app.getPackageName());
return;
}
init(app, new ACRAConfiguration(reportsCrashes));
}
/**
* <p>
* Initialize ACRA for a given Application. The call to this method should
* be placed as soon as possible in the {@link Application#onCreate()}
* method.
* </p>
*
* @param app Your Application class.
* @param config ACRAConfiguration to manually set up ACRA configuration.
* @throws IllegalStateException if it is called more than once.
*/
public static void init(Application app, ACRAConfiguration config) {
init(app, config, true);
}
/**
* <p>
* Initialize ACRA for a given Application. The call to this method should
* be placed as soon as possible in the {@link Application#onCreate()}
* method.
* </p>
*
* @param app Your Application class.
* @param config ACRAConfiguration to manually set up ACRA configuration.
* @param checkReportsOnApplicationStart Whether to invoke
* ErrorReporter.checkReportsOnApplicationStart(). Apps which adjust the
* ReportSenders should set this to false and call
* checkReportsOnApplicationStart() themselves to prevent a potential
* race with the SendWorker and list of ReportSenders.
* @throws IllegalStateException if it is called more than once.
*/
public static void init(Application app, ACRAConfiguration config, boolean checkReportsOnApplicationStart) {
if (mApplication != null) {
log.w(LOG_TAG, "ACRA#init called more than once. Won't do anything more.");
return;
}
mApplication = app;
if (config == null) {
log.e(LOG_TAG, "ACRA#init called but no ACRAConfiguration provided");
return;
}
setConfig(config);
final SharedPreferences prefs = getACRASharedPreferences();
try {
checkCrashResources(config);
log.d(LOG_TAG, "ACRA is enabled for " + mApplication.getPackageName() + ", initializing...");
// Initialize ErrorReporter with all required data
final boolean enableAcra = !shouldDisableACRA(prefs);
final ErrorReporter errorReporter = new ErrorReporter(mApplication, prefs, enableAcra);
// Append ReportSenders.
errorReporter.setDefaultReportSenders();
errorReporterSingleton = errorReporter;
// Check for pending reports
if (checkReportsOnApplicationStart) {
errorReporter.checkReportsOnApplicationStart();
}
} catch (ACRAConfigurationException e) {
log.w(LOG_TAG, "Error : ", e);
}
// We HAVE to keep a reference otherwise the listener could be garbage
// collected:
// http://stackoverflow.com/questions/2542938/sharedpreferences-onsharedpreferencechangelistener-not-being-called-consistently/3104265#3104265
mPrefListener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (PREF_DISABLE_ACRA.equals(key) || PREF_ENABLE_ACRA.equals(key)) {
final boolean enableAcra = !shouldDisableACRA(sharedPreferences);
getErrorReporter().setEnabled(enableAcra);
}
}
};
// This listener has to be set after initAcra is called to avoid a
// NPE in ErrorReporter.disable() because
// the context could be null at this moment.
prefs.registerOnSharedPreferenceChangeListener(mPrefListener);
}
/**
* @return the current instance of ErrorReporter.
* @throws IllegalStateException if {@link ACRA#init(android.app.Application)} has not yet
* been called.
*/
public static ErrorReporter getErrorReporter() {
if (errorReporterSingleton == null) {
throw new IllegalStateException("Cannot access ErrorReporter before ACRA#init");
}
return errorReporterSingleton;
}
/**
* Check if the application default shared preferences contains true for the
* key "acra.disable", do not activate ACRA. Also checks the alternative
* opposite setting "acra.enable" if "acra.disable" is not found.
*
* @param prefs SharedPreferences to check to see whether ACRA should be
* disabled.
* @return true if prefs indicate that ACRA should be disabled.
*/
private static boolean shouldDisableACRA(SharedPreferences prefs) {
boolean disableAcra = false;
try {
final boolean enableAcra = prefs.getBoolean(PREF_ENABLE_ACRA, true);
disableAcra = prefs.getBoolean(PREF_DISABLE_ACRA, !enableAcra);
} catch (Exception e) {
FireCrash.log(e);
// In case of a ClassCastException
}
return disableAcra;
}
/**
* Checks that mandatory configuration items have been provided.
*
* @throws ACRAConfigurationException if required values are missing.
*/
static void checkCrashResources(ReportsCrashes conf) throws ACRAConfigurationException {
switch (conf.mode()) {
case TOAST:
if (conf.resToastText() == 0) {
throw new ACRAConfigurationException(
"TOAST mode: you have to define the resToastText parameter in your application @ReportsCrashes() annotation.");
}
break;
case NOTIFICATION:
if (conf.resNotifTickerText() == 0 || conf.resNotifTitle() == 0 || conf.resNotifText() == 0) {
throw new ACRAConfigurationException(
"NOTIFICATION mode: you have to define at least the resNotifTickerText, resNotifTitle, resNotifText parameters in your application @ReportsCrashes() annotation.");
}
if (CrashReportDialog.class.equals(conf.reportDialogClass()) && conf.resDialogText() == 0) {
throw new ACRAConfigurationException(
"NOTIFICATION mode: using the (default) CrashReportDialog requires you have to define the resDialogText parameter in your application @ReportsCrashes() annotation.");
}
break;
case DIALOG:
if (CrashReportDialog.class.equals(conf.reportDialogClass()) && conf.resDialogText() == 0) {
throw new ACRAConfigurationException(
"DIALOG mode: using the (default) CrashReportDialog requires you to define the resDialogText parameter in your application @ReportsCrashes() annotation.");
}
break;
default:
break;
}
}
/**
* Retrieves the {@link SharedPreferences} instance where user adjustable
* settings for ACRA are stored. Default are the Application default
* SharedPreferences, but you can provide another SharedPreferences name
* with {@link ReportsCrashes#sharedPreferencesName()}.
*
* @return The Shared Preferences where ACRA will retrieve its user
* adjustable setting.
*/
public static SharedPreferences getACRASharedPreferences() {
ReportsCrashes conf = getConfig();
if (!"".equals(conf.sharedPreferencesName())) {
return mApplication.getSharedPreferences(conf.sharedPreferencesName(), conf.sharedPreferencesMode());
} else {
return PreferenceManager.getDefaultSharedPreferences(mApplication);
}
}
/**
* Provides the current ACRA configuration.
*
* @return Current ACRA {@link ReportsCrashes} configuration instance.
*/
public static ACRAConfiguration getConfig() {
if (configProxy == null) {
if (mApplication == null) {
log.w(LOG_TAG,
"Calling ACRA.getConfig() before ACRA.init() gives you an empty configuration instance. You might prefer calling ACRA.getNewDefaultConfig(Application) to get an instance with default values taken from a @ReportsCrashes annotation.");
}
configProxy = getNewDefaultConfig(mApplication);
}
return configProxy;
}
/**
* Sets the whole ACRA configuration.
*
* @param conf ACRAConfiguration to use as a proxy for config info.
*/
public static void setConfig(ACRAConfiguration conf) {
configProxy = conf;
}
/**
* @param app Your Application class.
* @return new {@link ACRAConfiguration} instance with values initialized
* from the {@link ReportsCrashes} annotation.
*/
public static ACRAConfiguration getNewDefaultConfig(Application app) {
if (app != null) {
return new ACRAConfiguration(app.getClass().getAnnotation(ReportsCrashes.class));
} else {
return new ACRAConfiguration(null);
}
}
/**
* Returns true if the application is debuggable.
*
* @return true if the application is debuggable.
*/
static boolean isDebuggable() {
PackageManager pm = mApplication.getPackageManager();
try {
return ((pm.getApplicationInfo(mApplication.getPackageName(), 0).flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0);
} catch (NameNotFoundException e) {
return false;
}
}
static Application getApplication() {
return mApplication;
}
public static void setLog(ACRALog log) {
if (log == null) {
throw new NullPointerException("ACRALog cannot be null");
}
ACRA.log = log;
}
}

View file

@ -0,0 +1,5 @@
<vector android:height="36dp" android:tint="?attr/colorControlNormal"
android:viewportHeight="24" android:viewportWidth="24"
android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
</vector>

View file

@ -0,0 +1,38 @@
package com.adins.mss.coll.loyalti.barchart;
import com.adins.mss.coll.models.loyaltymodels.GroupPointData;
import com.adins.mss.coll.models.loyaltymodels.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;
}
}