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,37 @@
package com.adins.mss.svy.models;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.gson.annotations.SerializedName;
public class JsonRequestRejectedVerificationTask extends MssRequestType {
@SerializedName("uuid_task_h")
String uuid_task_h;
@SerializedName("flag")
String flag;
@SerializedName("notes")
String notes;
public String getNotes() {
return this.notes;
}
public void setNotes(String value) {
this.notes = value;
}
public String getUuid_task_h() {
return this.uuid_task_h;
}
public void setUuid_task_h(String value) {
this.uuid_task_h = value;
}
public String getFlag() {
return this.flag;
}
public void setFlag(String value) {
this.flag = value;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

View file

@ -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="#37b248"
android:endColor="#057214"
android:angle="270" />
<corners
android:radius="0dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>

View file

@ -0,0 +1,44 @@
package com.mikepenz.aboutlibraries.detector;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import com.mikepenz.aboutlibraries.entity.Library;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mikepenz on 08.09.14.
* Original concept of detecting libraries with their classPath by Michael Carrano
* More details can be found here: https://github.com/michaelcarrano/detective-droid
*/
public class Detect {
public static List<Library> detect(Context mCtx, List<Library> libraries) {
ArrayList<Library> foundLibraries = new ArrayList<Library>();
// Loop through known libraries
for (Library library : libraries) {
if (!TextUtils.isEmpty(library.getClassPath())) {
try {
Context ctx = mCtx.createPackageContext(mCtx.getPackageName(),
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
Class<?> clazz = Class.forName(library.getClassPath(), false, ctx.getClassLoader());
// Detected a library!!!
if (clazz != null) {
foundLibraries.add(library);
}
} catch (ClassNotFoundException e) {
//e.printStackTrace();
} catch (PackageManager.NameNotFoundException e) {
//e.printStackTrace();
}
}
}
// Only return AppSource if app has a library
//return libraries.size() > 0 ? new AppSource(pkg, libraries) : null;
return foundLibraries;
}
}

View file

@ -0,0 +1,492 @@
package com.adins.mss.svy.fragments;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.commons.TaskListener;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.timeline.TimelineManager;
import com.adins.mss.base.todolist.ToDoList;
import com.adins.mss.base.todolist.form.JsonResponseTaskList;
import com.adins.mss.base.todolist.form.TasklistListener;
import com.adins.mss.base.util.GsonHelper;
import com.adins.mss.base.util.Utility;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.Scheme;
import com.adins.mss.dao.TaskH;
import com.adins.mss.dao.User;
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.db.dataaccess.TimelineDataAccess;
import com.adins.mss.foundation.db.dataaccess.TimelineTypeDataAccess;
import com.adins.mss.foundation.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.http.MssRequestType;
import com.adins.mss.svy.R;
import com.adins.mss.svy.assignment.OrderAssignmentResult;
import com.adins.mss.svy.common.Toaster;
import com.adins.mss.svy.models.SurveyorSearchRequest;
import com.adins.mss.svy.models.SurveyorSearchResponse;
import com.adins.mss.svy.reassignment.JsonRequestCheckOrder;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import org.apache.http.NameValuePair;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by olivia.dg on 1/30/2018.
*/
public class SurveyActivityImpl implements SurveyActivityInterface {
private static Context context;
private RefreshBackgroundTask refreshTask;
private ResultOrderTask resultOrderTask;
public SurveyActivityImpl(Context context) {
this.context = context;
}
@Override
public void executeSearch(final TaskListener listener, SurveyorSearchRequest request, final String date, final int year, final int month, final String startDate,
final String endDate, final int position) throws ParseException, IOException {
new AsyncTask<Void, Void, SurveyorSearchResponse>(){
final ProgressDialog progress = new ProgressDialog(context);
String errMessage;
@Override
protected void onPreExecute() {
super.onPreExecute();
progress.setMessage(context.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 (position == 0) {
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
Date date1 = f.parse(date);
searchRequest.setDate1(date1);
Date today = Tool.getSystemDate();
if(date1.after(today)) {
errMessage = context.getString(R.string.date_greater_than_today);
return null;
}
}
if (position == 2) {
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 = context.getString(R.string.enter_valid_date);
return null;
}
long milisecond = eLong - sLong;
if (milisecond > 604799000) {
errMessage = context.getString(R.string.data_range_not_allowed);
return null;
} else if (milisecond < 0) {
errMessage = context.getString(R.string.input_not_valid);
return null;
}
}
if (position == 1) {
if (month == 0 && year == 0){
errMessage = context.getString(R.string.enter_valid_date);
return null;
}
searchRequest.setMonth(String.valueOf(month + 1));
searchRequest.setYear(String.valueOf(year));
}
} catch (ParseException parseEx) {
errMessage = context.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(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) { 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 = serverResult.getResult();
}
return serverResponse;
} catch (Exception e) { FireCrash.log(e);
errMessage = context.getString(R.string.jsonParseFailed);
return null;
}
}
@Override
protected void onPostExecute(SurveyorSearchResponse serverResponse) {
super.onPostExecute(serverResponse);
if(context != null) {
if (progress != null && progress.isShowing()) {
progress.dismiss();
}
if (GlobalData.isRequireRelogin()) {
} else if (errMessage != null) {
Toaster.error(context, 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()));
// }
// });
listener.onCompleteTask(serverResponse);
}
}
}
}.execute();
}
@Override
public void getBackgroundTask(TasklistListener listener, boolean isVerification, boolean isBranch) {
refreshTask = new RefreshBackgroundTask(listener, isVerification, isBranch);
refreshTask.execute();
}
@SuppressLint({"NewApi"})
private class RefreshBackgroundTask extends AsyncTask<Void, Void, List<TaskH>> {
static final int TASK_DURATION = 2000;
String errMessage;
boolean isVerification = false;
boolean isBranch = false;
private TasklistListener listener;
private RefreshBackgroundTask(TasklistListener listener, boolean isVerification, boolean isBranch) {
this.listener = listener;
this.isVerification = isVerification;
this.isBranch = isBranch;
}
protected List<TaskH> doInBackground(Void... params) {
List<TaskH> result = null;
User user = GlobalData.getSharedGlobalData().getUser();
if (Tool.isInternetconnected(context)) {
MssRequestType requestType = new MssRequestType();
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
requestType.addImeiAndroidIdToUnstructured();
String json = GsonHelper.toJson(requestType);
String url;
if (isVerification)
url = GlobalData.getSharedGlobalData().getURL_GET_LIST_VERIFICATION();
else
url = GlobalData.getSharedGlobalData().getURL_GET_LIST_APPROVAL();
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 {
if (isVerification) {
if (isBranch)
result = TaskHDataAccess.getAllVerifiedForBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
else
result = TaskHDataAccess.getAllVerifiedForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} else {
if (isBranch)
result = TaskHDataAccess.getAllApprovalForBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
else
result = TaskHDataAccess.getAllApprovalForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
}
if (result != null && result.size() > 0)
serverResult = httpConn.requestToServer(url, json, Global.SORTCONNECTIONTIMEOUT);
else
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
Utility.metricStop(networkMetric, serverResult);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
errMessage = context.getString(R.string.jsonParseFailed);
}
String stringResult = serverResult.getResult();
try {
JsonResponseTaskList taskList = GsonHelper.fromJson(stringResult, JsonResponseTaskList.class);
if (taskList.getStatus().getCode() == 0) {
List<TaskH> listTaskH = taskList.getListTaskList();
if (listTaskH != null && listTaskH.size() > 0) {
String uuid_timelineType;
if (isVerification) {
uuid_timelineType = TimelineTypeDataAccess.getTimelineTypebyType(context, Global.TIMELINE_TYPE_VERIFICATION).getUuid_timeline_type();
} else {
uuid_timelineType = TimelineTypeDataAccess.getTimelineTypebyType(context, Global.TIMELINE_TYPE_APPROVAL).getUuid_timeline_type();
}
for (TaskH taskHLocal : result) {
boolean wasDeleted = true;
for (TaskH taskH : listTaskH) {
if (taskH.getUuid_task_h().equals(taskHLocal.getUuid_task_h()))
wasDeleted = false;
}
if (wasDeleted) {
TaskHDataAccess.delete(context, taskHLocal);
}
}
for (TaskH taskH : listTaskH) {
taskH.setUser(user);
taskH.setIs_verification(Global.TRUE_STRING);
String uuid_scheme = taskH.getUuid_scheme();
Scheme scheme = SchemeDataAccess.getOne(context, uuid_scheme);
if (scheme != null) {
taskH.setScheme(scheme);
TaskH h = TaskHDataAccess.getOneHeader(context, taskH.getUuid_task_h());
boolean wasInTimeline = TimelineDataAccess.getOneTimelineByTaskH(context, user.getUuid_user(), taskH.getUuid_task_h(), uuid_timelineType) != null;
if (h != null && h.getStatus() != null) {
if (!ToDoList.isOldTask(h)) {
TaskHDataAccess.addOrReplace(context, taskH);
if (!wasInTimeline)
TimelineManager.insertTimeline(context, taskH);
}
} else {
TaskHDataAccess.addOrReplace(context, taskH);
if (!wasInTimeline)
TimelineManager.insertTimeline(context, taskH);
}
} else {
errMessage = context.getString(com.adins.mss.base.R.string.scheme_not_found);
}
}
} else {
errMessage = context.getString(R.string.no_data_from_server);
}
} else {
errMessage = stringResult;
}
} catch (Exception e) {
FireCrash.log(e);
errMessage = context.getString(R.string.jsonParseFailed);
}
} else {
errMessage = context.getString(R.string.no_internet_connection);
}
return result;
}
protected void onPostExecute(List<TaskH> result) {
super.onPostExecute(result);
if (GlobalData.isRequireRelogin()) {
} else if (errMessage != null && !errMessage.equals("")) {
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(context);
builder.withTitle("INFO")
.withMessage(errMessage)
.show();
}
listener.onRefreshBackgroundComplete(result);
}
}
public void gotoDetailData(int taskType, String nomorOrder, String uuid_task_h, String formName){
Intent intent = null;
switch (taskType) {
case Global.TASK_ORDER_ASSIGNMENT:
// intent = new Intent(this, OrderAssignmentActivity.class);
break;
case Global.TASK_ORDER_REASSIGNMENT:
intent = new Intent(context, OrderAssignmentResult.class);
intent.putExtra(Global.BUND_KEY_ORDERNO, nomorOrder);
intent.putExtra(Global.BUND_KEY_FORM_NAME, formName);
break;
default:
// intent = new Intent(this, OrderAssignmentActivity.class);
break;
}
intent.putExtra(Global.BUND_KEY_TASK_TYPE, taskType);
intent.putExtra(Global.BUND_KEY_ORDERNO, nomorOrder);
intent.putExtra(Global.BUND_KEY_UUID_TASKH, uuid_task_h);
context.startActivity(intent);
}
public void getResultTask(TaskListener listener, List<NameValuePair> param) {
resultOrderTask = new ResultOrderTask(listener, param);
resultOrderTask.execute();
}
public String getDataFromURL(String url, List<NameValuePair> param) throws IOException {
String resp = null;
try {
JsonRequestCheckOrder requestCheckOrder = new JsonRequestCheckOrder();
requestCheckOrder.setAudit(GlobalData.getSharedGlobalData().getAuditData());
if(param.get(3).getValue().equals(Global.FLAG_BY_DATE)){
requestCheckOrder.setStartDate(param.get(0).getValue());
requestCheckOrder.setEndDate(param.get(1).getValue());
}
else if(param.get(3).getValue().equals(Global.FLAG_BY_ORDERNUMBER)){
requestCheckOrder.setOrderNumber(param.get(2).getValue());
}
else if(param.get(3).getValue().equals(Global.FLAG_FOR_CANCELORDER)){
if(param.get(2).getValue().equals("1")){
requestCheckOrder.setStartDate(param.get(0).getValue());
requestCheckOrder.setEndDate(param.get(1).getValue());
}else{
requestCheckOrder.setOrderNumber(param.get(2).getValue());
}
}
else if(param.get(3).getValue().equals(Global.FLAG_FOR_ORDERREASSIGNMENT)){
if(param.get(2).getValue().equals("1")){
requestCheckOrder.setStartDate(param.get(0).getValue());
requestCheckOrder.setEndDate(param.get(1).getValue());
}else{
requestCheckOrder.setOrderNumber(param.get(2).getValue());
}
requestCheckOrder.setFlag(param.get(3).getValue());
}
String json = GsonHelper.toJson(requestCheckOrder);
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) {
FireCrash.log(e);
e.printStackTrace();
}
resp = serverResult.getResult();
} catch (Exception e) {
FireCrash.log(e);
resp = e.getMessage();
}
return resp;
}
private class ResultOrderTask extends AsyncTask<String, Void, String> {
private ProgressDialog progressDialog;
private String errMessage;
private TaskListener listener;
private List<NameValuePair> param;
private ResultOrderTask(TaskListener listener, List<NameValuePair> param) {
this.listener = listener;
this.param = param;
}
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(context, "", context.getString(R.string.progressWait), true);
}
@Override
protected String doInBackground(String... arg0) {
String result = null;
if(Tool.isInternetconnected(context)){
try {
result = getDataFromURL(GlobalData.getSharedGlobalData().getURL_CHECKORDER(), param);
} catch (IOException ioe) {
ioe.printStackTrace();
try {
progressDialog.dismiss();
} catch (Exception e) { FireCrash.log(e);}
errMessage = ioe.getMessage();
}
} else {
result = context.getString(R.string.no_internet_connection);
}
return result;
}
@Override
protected void onPostExecute(String result) {
if (progressDialog!=null&&progressDialog.isShowing()){
try {
progressDialog.dismiss();
} catch (Exception e) { FireCrash.log(e);
}
}
if (context.getString(R.string.no_internet_connection).equals(result)) {
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(context);
builder.withTitle("INFO")
.withMessage(context.getString(R.string.no_internet_connection))
.show();
}else{
listener.onCompleteTask(result);
}
}
}
}

View file

@ -0,0 +1,126 @@
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_THEME".
*/
public class Theme {
/** Not-null value. */
@SerializedName("uuid_theme")
private String uuid_theme;
/** Not-null value. */
@SerializedName("application_type")
private String application_type;
@SerializedName("version")
private String version;
/** Used to resolve relations */
private transient DaoSession daoSession;
/** Used for active entity operations. */
private transient ThemeDao myDao;
private List<ThemeItem> themeItemList;
public Theme() {
}
public Theme(String uuid_theme) {
this.uuid_theme = uuid_theme;
}
public Theme(String uuid_theme, String application_type, String version) {
this.uuid_theme = uuid_theme;
this.application_type = application_type;
this.version = version;
}
/** called by internal mechanisms, do not call yourself. */
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getThemeDao() : null;
}
/** Not-null value. */
public String getUuid_theme() {
return uuid_theme;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setUuid_theme(String uuid_theme) {
this.uuid_theme = uuid_theme;
}
/** Not-null value. */
public String getApplication_type() {
return application_type;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setApplication_type(String application_type) {
this.application_type = application_type;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
/** 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<ThemeItem> getThemeItemList() {
if (themeItemList == null) {
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
ThemeItemDao targetDao = daoSession.getThemeItemDao();
List<ThemeItem> themeItemListNew = targetDao._queryTheme_ThemeItemList(uuid_theme);
synchronized (this) {
if(themeItemList == null) {
themeItemList = themeItemListNew;
}
}
}
return themeItemList;
}
/** Resets a to-many relationship, making the next get call to query for a fresh result. */
public synchronized void resetThemeItemList() {
themeItemList = 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);
}
}

View file

@ -0,0 +1,294 @@
package com.adins.mss.base.dynamicform.form.questions.viewholder;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.*;
import androidx.recyclerview.widget.RecyclerView;
import android.text.InputType;
import android.view.View;
import com.adins.mss.base.AppContext;
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.form.questions.OnQuestionClickListener;
import com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter;
import com.adins.mss.base.timeline.MapsViewer;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.formatter.Formatter;
import com.adins.mss.foundation.formatter.Tool;
import com.adins.mss.foundation.questiongenerator.OptionAnswerBean;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
import com.pax.utils.log;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import static com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter.IsRvMobileQuestion;
import static com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter.isTextOnlineQuestion;
/**
* Created by gigin.ginanjar on 06/09/2016.
*/
public class ReviewTextViewHolder extends RecyclerView.ViewHolder {
public RelativeLayout layout;
public TextView mLabelNo;
public TextView mQuestionLabel;
public TextView mQuestionAnswer;
public ImageView mCheckLocation;
private Button mCallButton;
public QuestionBean bean;
public OnQuestionClickListener listener;
private Activity mActivity;
@Deprecated
public ReviewTextViewHolder(View itemView) {
super(itemView);
layout = (RelativeLayout) itemView.findViewById(R.id.textReviewLayout);
mLabelNo = (TextView) itemView.findViewById(R.id.questionNoLabel);
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionTextLabel);
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionTextAnswer);
mCheckLocation = (ImageView) itemView.findViewById(R.id.imgLocationAnswer);
mCallButton = itemView.findViewById(R.id.callPhoneNumber);
}
public ReviewTextViewHolder(View itemView, OnQuestionClickListener listener) {
super(itemView);
layout = (RelativeLayout) itemView.findViewById(R.id.textReviewLayout);
mLabelNo = (TextView) itemView.findViewById(R.id.questionNoLabel);
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionTextLabel);
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionTextAnswer);
mCheckLocation = (ImageView) itemView.findViewById(R.id.imgLocationAnswer);
this.listener = listener;
}
public ReviewTextViewHolder(Activity activity, View itemView, OnQuestionClickListener listener) {
super(itemView);
mActivity = activity;
layout = (RelativeLayout) itemView.findViewById(R.id.textReviewLayout);
mLabelNo = (TextView) itemView.findViewById(R.id.questionNoLabel);
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionTextLabel);
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionTextAnswer);
mCheckLocation = (ImageView) itemView.findViewById(R.id.imgLocationAnswer);
mCallButton = itemView.findViewById(R.id.callPhoneNumber);
this.listener = listener;
}
public void bind(final QuestionBean item, final int group, final int number) {
bean = item;
mLabelNo.setText(number + ".");
String qLabel = bean.getQuestion_label();
mQuestionLabel.setText(qLabel);
String answerType = bean.getAnswer_type();
String qAnswer = getFinalAnswer(answerType);
if (qAnswer != null && !qAnswer.isEmpty()) {
if (answerType.equals(Global.AT_CURRENCY))
showCurrencyView(qAnswer);
else
mQuestionAnswer.setText(qAnswer);
} else {
mQuestionAnswer.setText(mActivity.getString(R.string.no_answer_found));
}
layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null)
listener.onReviewClickListener(bean, group, number - 1);
}
});
if (QuestionViewAdapter.IsLocationQuestion(Integer.valueOf(answerType)) && mActivity != null) {
mCheckLocation.setVisibility(View.VISIBLE);
mCheckLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bean.getAnswer() != null && bean.getAnswer().length() > 0) {
try {
String lat = bean.getLocationInfo().getLatitude();
String lng = bean.getLocationInfo().getLongitude();
int acc = bean.getLocationInfo().getAccuracy();
Intent intent = new Intent(mActivity, MapsViewer.class);
intent.putExtra("latitude", lat);
intent.putExtra("longitude", lng);
intent.putExtra("accuracy", acc);
mActivity.startActivity(intent);
} catch (Exception e) {
FireCrash.log(e);
String lat = bean.getLatitude();
String lng = bean.getLongitude();
Intent intent = new Intent(mActivity, MapsViewer.class);
intent.putExtra("latitude", lat);
intent.putExtra("longitude", lng);
mActivity.startActivity(intent);
}
} else {
Toast.makeText(mActivity, mActivity.getString(R.string.set_location),
Toast.LENGTH_LONG).show();
}
}
});
} else {
mCheckLocation.setVisibility(View.GONE);
}
if (null != item.getTag() && item.getTag().equalsIgnoreCase("CUSTOMER PHONE") &&
!Global.APPLICATION_COLLECTION.equalsIgnoreCase(GlobalData.getSharedGlobalData().getAuditData().getApplication())) {
setCallButton(item);
}
}
private String getFinalAnswer(String answerType) {
int viewType = Integer.valueOf(answerType);
if (QuestionViewAdapter.IsTextQuestion(viewType)) {
return bean.getAnswer();
} else if (QuestionViewAdapter.IsDropdownQuestion(viewType)) {
return getOptionAnswer();
} else if (QuestionViewAdapter.IsMultipleQuestion(viewType)) {
return getOptionAnswer();
} else if (QuestionViewAdapter.IsRadioQuestion(viewType)) {
return getOptionAnswer();
} else if (QuestionViewAdapter.IsLocationQuestion(viewType)) {
return bean.getAnswer();
} else if (QuestionViewAdapter.IsDateTimeQuestion(viewType)) {
return getDateTimeAnswer();
} else if (QuestionViewAdapter.IsTextWithSuggestionQuestion(viewType)) {
return bean.getAnswer();
} else if (QuestionViewAdapter.IsLookupQuestion(viewType)) {
return bean.getAnswer();
} else if (QuestionViewAdapter.IsValidationQuestion(viewType)) {
return bean.getAnswer();
} else if (IsRvMobileQuestion(viewType)) {
return bean.getAnswer();
} else if (isTextOnlineQuestion(viewType)) {
return bean.getAnswer();
} else if(QuestionViewAdapter.IsButtonViewUrlQuestion(viewType)){
return bean.getAnswer();
} else {
return null;
}
}
private String getDateTimeAnswer() {
String finalformat = null;
Date date = null;
String finalAnswer = "";
String answer = bean.getAnswer();
String answerType = bean.getAnswer_type();
try {
if (Global.AT_DATE.equals(answerType)) {
finalformat = Global.DATE_STR_FORMAT;
if (answer.matches(Global.DATE_REGEX)){
date = Formatter.parseDate(answer, finalformat);
}else {
String format = Global.DATE_STR_FORMAT_GSON;
date = Formatter.parseDate(answer, format);
}
} else if (Global.AT_TIME.equals(answerType)) {
finalformat = Global.TIME_STR_FORMAT;
if (answer.matches(Global.TIME_REGEX)){
date = Formatter.parseDate(answer,finalformat);
}else {
String format = Global.TIME_STR_FORMAT2;
date = Formatter.parseDate(answer, format);
}
} else if (Global.AT_DATE_TIME.equals(answerType)) {
finalformat = Global.DATE_TIME_STR_FORMAT;
if (answer.length()>=19){
answer = answer.substring(0,16);
}
if (answer.matches(Global.DATETIME_REGEX)){
date = Formatter.parseDate(answer, finalformat);
}else {
String format = Global.DATE_STR_FORMAT_GSON;
date = Formatter.parseDate(answer, format);
}
}
finalAnswer = Formatter.formatDate(date, finalformat);
}
catch (ParseException ex){
Log.w("Exception","Cannot get date time answer in : " + getClass().getSimpleName(), ex);
}
catch (Exception e){
FireCrash.log(e);
try{
finalAnswer = answer;
} catch (Exception e1) {
if (Global.IS_DEV) {
Log.w("Exception","Cannot get answer in : " + getClass().getSimpleName(), e1);
}
}
}
return finalAnswer;
}
private String getOptionAnswer() {
List<OptionAnswerBean> listOptions = bean.getSelectedOptionAnswers();
int i = 0;
String[] arrSelectedAnswer = null;
try {
arrSelectedAnswer= Tool.split(bean.getAnswer(), Global.DELIMETER_DATA);
} catch (Exception e) {
FireCrash.log(e);
arrSelectedAnswer = new String[0];
}
StringBuilder sb = new StringBuilder();
for (OptionAnswerBean optBean : listOptions) {
if (optBean.isSelected()) {
if (Tool.isOptionsWithDescription(bean.getAnswer_type())) {
if (i < arrSelectedAnswer.length)
sb.append(optBean.getValue() + " - " + arrSelectedAnswer[i] + "; ");
else
sb.append(optBean.getValue() + " - ; ");
} else {
if (i > 0)
sb.append("\n");
sb.append(optBean.getValue());
}
if (Global.AT_MULTIPLE_ONE_DESCRIPTION.equals(bean.getAnswer_type()) ||
Global.AT_DROPDOWN_W_DESCRIPTION.equals(bean.getAnswer_type()) &&
i == listOptions.size() - 1) {
sb.append("\nDesc : " + bean.getAnswer());
}
} else {
sb.append(AppContext.getAppContext().getString(R.string.no_selected_field));
}
i++;
}
if (listOptions == null || listOptions.isEmpty()) {
sb.append(AppContext.getAppContext().getString(R.string.no_selected_field));
}
return sb.toString();
}
public void showCurrencyView(String answer) {
mQuestionAnswer.setInputType(InputType.TYPE_CLASS_TEXT);
String currencyView = Tool.separateThousand(answer);
if (currencyView == null) currencyView = "";
mQuestionAnswer.setText(currencyView);
}
private void setCallButton(final QuestionBean item){
mCallButton.setVisibility(View.VISIBLE);
mCallButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int button = v.getId();
if (button == R.id.callPhoneNumber){
try{
Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:"+item.getAnswer()));
mActivity.startActivity(dialIntent);
}catch (NullPointerException ex){
Log.w("Exception","Cannot set call button answer in : " + getClass().getSimpleName(), ex);
}
}
}
});
}
}

View file

@ -0,0 +1,340 @@
package com.adins.mss.coll.dummy;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import com.adins.mss.base.util.Utility;
import com.adins.mss.coll.closingtask.ClosingTaskAdapter;
import com.adins.mss.coll.fragments.MyDashBoardItemRecyclerViewAdapter;
import com.adins.mss.coll.fragments.view.DepositReportRecapitulateView;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.UserHelp.Bean.Dummy.UserHelpIconDummy;
import com.adins.mss.foundation.UserHelp.Bean.Dummy.UserHelpViewDummy;
import com.adins.mss.foundation.UserHelp.Bean.UserHelpView;
import com.adins.mss.foundation.UserHelp.UserHelp;
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
import com.google.gson.Gson;
import java.util.ArrayList;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;
import static com.adins.mss.constant.Global.userHelpGuide;
import static com.adins.mss.constant.Global.userHelpDummyGuide;
public class UserHelpCOLDummy {
private int counter = 0;
private int iconCounter = 0;
public void showDummyClosing(final Activity activity, final String idSequence, final ListView listView, final ClosingTaskAdapter closingTaskAdapter){
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ArrayList<UserHelpViewDummy> tempTooltip = new ArrayList<>();
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(0);
config.setFadeDuration(100);
final MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(activity);
sequence.setConfig(config);
try {
for(UserHelpViewDummy userHelpViewDummy : Global.userHelpDummyGuide.get(idSequence)){
View idView = listView.getChildAt(0).findViewById(
Utility.getViewById(activity, userHelpViewDummy.getViewid())
);
for(UserHelpIconDummy userHelpIconDummy: userHelpViewDummy.getIconid()){
UserHelp.addSequenceUserHelpDummy(activity, sequence, userHelpIconDummy,userHelpViewDummy, idView, tempTooltip);
}
}
sequence.setOnItemSkippedListener(new MaterialShowcaseSequence.OnSequenceItemSkippedListener() {
@Override
public void onSkip() {
counter+=1;
listView.setAdapter(closingTaskAdapter);
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
try {
counter+=1;
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
userHelpGuide.put(idSequence, new ArrayList<UserHelpView>());
sharedPrefEditor.putString("LAST_TOOLTIP", gson.toJson(userHelpGuide)).apply();
} catch (Exception e){}
}
});
sequence.setOnItemDismissedListener(new MaterialShowcaseSequence.OnSequenceItemDismissedListener() {
@Override
public void onDismiss(MaterialShowcaseView materialShowcaseView, int i) {
listView.setAdapter(closingTaskAdapter);
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
counter+=1;
Handler handler1 = new Handler();
handler1.postDelayed(new Runnable() {
@Override
public void run() {
if(counter < userHelpDummyGuide.size())
UserHelp.showAllUserHelp(activity,idSequence);
}
},100);
} catch (Exception e){}
}
});
sequence.start();
} catch (Exception e){}
}
},0);
}
public static void showDummyDepositReport(final Activity activity, final String idSequence, final DepositReportRecapitulateView view){
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ArrayList<UserHelpViewDummy> tempTooltip = new ArrayList<>();
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(0);
config.setFadeDuration(100);
final MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(activity);
sequence.setConfig(config);
try {
for(UserHelpViewDummy userHelpViewDummy : Global.userHelpDummyGuide.get(idSequence)){
for(UserHelpIconDummy userHelpIconDummy: userHelpViewDummy.getIconid()){
view.containerDummy();
View idView = activity.findViewById(
Utility.getViewById(activity, userHelpViewDummy.getViewid())
);
UserHelp.addSequenceUserHelpDummy(activity, sequence, userHelpIconDummy,userHelpViewDummy, idView, tempTooltip);
}
}
sequence.setOnItemSkippedListener(new MaterialShowcaseSequence.OnSequenceItemSkippedListener() {
@Override
public void onSkip() {
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
userHelpGuide.put(idSequence,new ArrayList<UserHelpView>());
view.containerInit();
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
userHelpGuide.put(idSequence, new ArrayList<UserHelpView>());
sharedPrefEditor.putString("LAST_TOOLTIP", gson.toJson(userHelpGuide)).apply();
} catch (Exception e){}
}
});
sequence.setOnItemDismissedListener(new MaterialShowcaseSequence.OnSequenceItemDismissedListener() {
@Override
public void onDismiss(MaterialShowcaseView materialShowcaseView, int i) {
UserHelp.showAllUserHelp(activity,idSequence);
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
view.containerInit();
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
} catch (Exception e){}
}
});
sequence.start();
} catch (Exception e){}
}
},0);
}
public void showDashboardLoyalty(final Activity activity, final String idSequence, final RecyclerView recyclerView, final MyDashBoardItemRecyclerViewAdapter adapter){
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ArrayList<UserHelpViewDummy> tempTooltip = new ArrayList<>();
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(0);
config.setFadeDuration(100);
final MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(activity);
sequence.setConfig(config);
try {
for(UserHelpViewDummy userHelpViewDummy : Global.userHelpDummyGuide.get(idSequence)){
for(UserHelpIconDummy userHelpIconDummy: userHelpViewDummy.getIconid()){
View idView = activity.findViewById(
Utility.getViewById(activity, userHelpViewDummy.getViewid())
);
UserHelp.addSequenceUserHelpDummy(activity, sequence, userHelpIconDummy,userHelpViewDummy, idView, tempTooltip);
}
}
sequence.setOnItemSkippedListener(new MaterialShowcaseSequence.OnSequenceItemSkippedListener() {
@Override
public void onSkip() {
Global.BACKPRESS_RESTRICTION = false;
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
userHelpGuide.put(idSequence,new ArrayList<UserHelpView>());
recyclerView.setAdapter(adapter);
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
userHelpGuide.put(idSequence, new ArrayList<UserHelpView>());
sharedPrefEditor.putString("LAST_TOOLTIP", gson.toJson(userHelpGuide)).apply();
} catch (Exception e){}
}
});
sequence.setOnItemDismissedListener(new MaterialShowcaseSequence.OnSequenceItemDismissedListener() {
@Override
public void onDismiss(MaterialShowcaseView materialShowcaseView, int i) {
counter++;
if(counter >= userHelpDummyGuide.get(idSequence).size()){
Global.BACKPRESS_RESTRICTION = false;
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
recyclerView.setAdapter(adapter);
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
} catch (Exception e){}
} else{
try {
UserHelpViewDummy userHelpViewDummy = userHelpDummyGuide.get(idSequence).get(counter);
ImageView imageView = recyclerView.findViewHolderForLayoutPosition(0).
itemView.findViewById(Utility.getViewById(activity, userHelpViewDummy.getViewid()));
imageView.setImageDrawable(activity.getResources().getDrawable(
Utility.getDrawableById(activity, userHelpViewDummy.getIconid().get(iconCounter).getIcon()))
);
iconCounter++;
// if there is more than 1 icon, hold adding counter
if(iconCounter < userHelpViewDummy.getIconid().size()) {
counter -= 1;
} else{
iconCounter = 0;
}
}catch (Exception e){}
}
}
});
sequence.start();
} catch (Exception e){}
}
},0);
}
public interface OnDashboardTabSelected{
void onNextTab(int counter);
}
public void showDashboardColl(final Activity activity, final String idSequence, final UserHelp.OnShowSequenceFinish finishCallback,
final UserHelpCOLDummy.OnDashboardTabSelected onDashboardTabSelected){
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ArrayList<UserHelpViewDummy> tempTooltip = new ArrayList<>();
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(0);
config.setFadeDuration(100);
final MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(activity);
sequence.setConfig(config);
try {
for(UserHelpViewDummy userHelpViewDummy : Global.userHelpDummyGuide.get(idSequence)){
for(UserHelpIconDummy userHelpIconDummy: userHelpViewDummy.getIconid()){
View idView = activity.findViewById(
Utility.getViewById(activity, userHelpViewDummy.getViewid())
);
UserHelp.addSequenceUserHelpDummy(activity, sequence, userHelpIconDummy,userHelpViewDummy, idView, tempTooltip);
}
}
sequence.setOnItemSkippedListener(new MaterialShowcaseSequence.OnSequenceItemSkippedListener() {
@Override
public void onSkip() {
Global.BACKPRESS_RESTRICTION = false;
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
userHelpGuide.put(idSequence,new ArrayList<UserHelpView>());
if(finishCallback != null){
finishCallback.onSequenceFinish();
}
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
userHelpGuide.put(idSequence, new ArrayList<UserHelpView>());
sharedPrefEditor.putString("LAST_TOOLTIP", gson.toJson(userHelpGuide)).apply();
} catch (Exception e){}
}
});
sequence.setOnItemDismissedListener(new MaterialShowcaseSequence.OnSequenceItemDismissedListener() {
@Override
public void onDismiss(MaterialShowcaseView materialShowcaseView, int i) {
counter++;
if(counter >= userHelpDummyGuide.get(idSequence).size()){
Global.BACKPRESS_RESTRICTION = false;
userHelpDummyGuide.put(idSequence,new ArrayList<UserHelpViewDummy>());
if(finishCallback != null){
finishCallback.onSequenceFinish();
}
try {
ObscuredSharedPreferences sharedPref =
ObscuredSharedPreferences.getPrefs(activity.getApplicationContext(), "GlobalData", Context.MODE_PRIVATE);
ObscuredSharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
Gson gson = new Gson();
sharedPrefEditor.putString("LAST_TOOLTIP_DUMMY", gson.toJson(userHelpDummyGuide)).apply();
} catch (Exception e){}
}
else{
try {
UserHelpViewDummy userHelpViewDummy = userHelpDummyGuide.get(idSequence).get(counter);
//Tab automatically load next, when user help showing collection result detail
if(userHelpViewDummy.getIconid().size()>1 && userHelpViewDummy.getViewid().equalsIgnoreCase("dummyCollResDetail"))
onDashboardTabSelected.onNextTab(iconCounter);
iconCounter++;
// if there is more than 1 icon, hold adding counter
if(iconCounter < userHelpViewDummy.getIconid().size()) {
counter -= 1;
} else{
iconCounter = 0;
}
}catch (Exception e){}
}
}
});
sequence.start();
} catch (Exception e){}
}
},0);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true"
android:repeatCount="infinite"
android:duration="1000">
<scale
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="3"
android:toYScale="3"
android:repeatCount="infinite" />
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:repeatCount="infinite"/>
</set>

View file

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="gigin.ginanjar" />
</component>

View file

@ -0,0 +1,78 @@
package com.adins.mss.odr.opportunities;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.adins.mss.dao.GroupTask;
import com.adins.mss.odr.R;
import java.util.List;
import java.util.Map;
/**
* Created by muhammad.aap on 11/30/2018.
*/
public class OpportunityMenuListAdapter extends RecyclerView.Adapter<OpportunityMenuListAdapter.OpportunityListViewHolder> {
private FragmentActivity activity;
private List<Map<Integer,List<GroupTask>>> groupTasks;
private List<GroupTask> listGroupTasks;
public OpportunityMenuListAdapter(FragmentActivity activity, List<Map<Integer,List<GroupTask>>> groupTasks) {
this.activity = activity;
this.groupTasks = groupTasks;
}
public class OpportunityListViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView txtId;
public final TextView txtStatus;
public final TextView txtProduct;
public OpportunityListViewHolder(View itemView) {
super(itemView);
mView = itemView;
txtId = (TextView) itemView.findViewById(R.id.txtId);
txtStatus = (TextView) itemView.findViewById(R.id.txtStatus);
txtProduct = (TextView) itemView.findViewById(R.id.txtProduct);
}
public void bind(List<Map<Integer,List<GroupTask>>> groupTask, final int position) {
// txtId.setText(groupTask.get(position).get(); getGroup_task_id());
// txtStatus.setText(groupTask.getLast_status());
// txtProduct.setText(groupTask.getProduct_name());
}
}
@Override
public OpportunityMenuListAdapter.OpportunityListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.mn_opportunity_list_item, parent, false);
OpportunityMenuListAdapter.OpportunityListViewHolder viewHolder = new OpportunityMenuListAdapter.OpportunityListViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(OpportunityMenuListAdapter.OpportunityListViewHolder holder, final int position) {
holder.bind(groupTasks,position);
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// LoadOpportunityDetail request = new LoadOpportunityDetail(activity, groupTasks.get(position));
// request.execute();
}
});
}
@Override
public int getItemCount() {
if (groupTasks == null || groupTasks.size() == 0)
return 0;
else
return groupTasks.size();
}
}