mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,288 @@
|
|||
package lib.gegemobile.gddlibrary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
public class GoogleDistanceMatrix {
|
||||
|
||||
private boolean isLogging = false;
|
||||
private OnDistanceResponseListener mDistanceListener = null;
|
||||
private Context mContext = null;
|
||||
|
||||
public GoogleDistanceMatrix(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public String request(LatLng start, LatLng end, String mode, boolean isAvoidTools) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("https://maps.googleapis.com/maps/api/distancematrix/json?"
|
||||
+ "origins=" + start.latitude + "," + start.longitude
|
||||
+ "&destinations=" + end.latitude + "," + end.longitude);
|
||||
|
||||
if (isAvoidTools)
|
||||
sb.append("&avoid=tolls");
|
||||
|
||||
sb.append("&mode=" + mode);
|
||||
final String url = sb.toString();
|
||||
if (isLogging)
|
||||
Log.i("GoogleDirection", "URL : " + url);
|
||||
new RequestTask().execute(url);
|
||||
return url;
|
||||
}
|
||||
|
||||
public String request(List<LatLng> starts, LatLng destinations,
|
||||
String mode, boolean isAvoidTools) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("https://maps.googleapis.com/maps/api/distancematrix/json?");
|
||||
|
||||
if (starts.size() > 0) {
|
||||
sb.append("origins=");
|
||||
StringBuffer sbwpoint = new StringBuffer();
|
||||
for (int i = 0; i < starts.size(); i++) {
|
||||
LatLng ltg = starts.get(i);
|
||||
sbwpoint.append(ltg.latitude + "," + ltg.longitude);
|
||||
if (i != starts.size() - 1)
|
||||
sbwpoint.append("|");
|
||||
}
|
||||
try {
|
||||
sb.append(URLEncoder.encode(sbwpoint.toString(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("&destinations=" + destinations.latitude + "," + destinations.longitude);
|
||||
|
||||
if (isAvoidTools)
|
||||
sb.append("&avoid=tolls");
|
||||
|
||||
sb.append("&mode=" + mode);
|
||||
final String url = sb.toString();
|
||||
|
||||
if (isLogging)
|
||||
Log.i("GoogleDirection", "URL : " + url);
|
||||
new RequestTask().execute(url);
|
||||
return url;
|
||||
}
|
||||
|
||||
public String request(List<LatLng> starts, List<LatLng> destinations,
|
||||
String mode, boolean isAvoidTools) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("https://maps.googleapis.com/maps/api/distancematrix/json?");
|
||||
|
||||
if (starts.size() > 0) {
|
||||
sb.append("origins=");
|
||||
StringBuffer sbwpoint = new StringBuffer();
|
||||
for (int i = 0; i < starts.size(); i++) {
|
||||
LatLng ltg = starts.get(i);
|
||||
sbwpoint.append(ltg.latitude + "," + ltg.longitude);
|
||||
if (i != starts.size() - 1)
|
||||
sbwpoint.append("|");
|
||||
}
|
||||
try {
|
||||
sb.append(URLEncoder.encode(sbwpoint.toString(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (destinations.size() > 0) {
|
||||
sb.append("&destinations=");
|
||||
StringBuffer sbwpoint = new StringBuffer();
|
||||
for (int i = 0; i < destinations.size(); i++) {
|
||||
LatLng ltg = destinations.get(i);
|
||||
sbwpoint.append(ltg.latitude + "," + ltg.longitude);
|
||||
if (i != destinations.size() - 1)
|
||||
sbwpoint.append("|");
|
||||
}
|
||||
try {
|
||||
sb.append(URLEncoder.encode(sbwpoint.toString(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (isAvoidTools)
|
||||
sb.append("&avoid=tolls");
|
||||
|
||||
sb.append("&mode=" + mode);
|
||||
final String url = sb.toString();
|
||||
|
||||
if (isLogging)
|
||||
Log.i("GoogleDirection", "URL : " + url);
|
||||
new RequestTask().execute(url);
|
||||
return url;
|
||||
}
|
||||
|
||||
public String request(LatLng start, List<LatLng> destinations,
|
||||
String mode, boolean isAvoidTools) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("https://maps.googleapis.com/maps/api/distancematrix/json?"
|
||||
+ "origins=" + start.latitude + "," + start.longitude);
|
||||
|
||||
if (destinations.size() > 0) {
|
||||
sb.append("&destinations=");
|
||||
StringBuffer sbwpoint = new StringBuffer();
|
||||
for (int i = 0; i < destinations.size(); i++) {
|
||||
LatLng ltg = destinations.get(i);
|
||||
sbwpoint.append(ltg.latitude + "," + ltg.longitude);
|
||||
if (i != destinations.size() - 1)
|
||||
sbwpoint.append("|");
|
||||
}
|
||||
try {
|
||||
sb.append(URLEncoder.encode(sbwpoint.toString(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (isAvoidTools)
|
||||
sb.append("&avoid=tolls");
|
||||
|
||||
sb.append("&mode=" + mode);
|
||||
final String url = sb.toString();
|
||||
|
||||
if (isLogging)
|
||||
Log.i("GoogleDirection", "URL : " + url);
|
||||
new RequestTask().execute(url);
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getDistanceText(DistanceResponseJson json, int startIndex, int endIndex) {
|
||||
String distance = "";
|
||||
|
||||
Row row = json.rows.get(startIndex);
|
||||
Element element = row.elements.get(endIndex);
|
||||
distance = element.distance.text;
|
||||
return distance;
|
||||
}
|
||||
|
||||
public int getDistanceValue(DistanceResponseJson json, int startIndex, int endIndex) {
|
||||
int distance = 0;
|
||||
|
||||
Row row = json.rows.get(startIndex);
|
||||
Element element = row.elements.get(endIndex);
|
||||
distance = element.distance.value;
|
||||
return distance;
|
||||
}
|
||||
|
||||
public String getDurationText(DistanceResponseJson json, int startIndex, int endIndex) {
|
||||
String distance = "";
|
||||
|
||||
Row row = json.rows.get(startIndex);
|
||||
Element element = row.elements.get(endIndex);
|
||||
distance = element.duration.text;
|
||||
return distance;
|
||||
}
|
||||
|
||||
public int getDurationValue(DistanceResponseJson json, int startIndex, int endIndex) {
|
||||
int distance = 0;
|
||||
|
||||
Row row = json.rows.get(startIndex);
|
||||
Element element = row.elements.get(endIndex);
|
||||
distance = element.duration.value;
|
||||
return distance;
|
||||
}
|
||||
|
||||
public List<Row> getRowsElement(DistanceResponseJson json) {
|
||||
return json.rows;
|
||||
}
|
||||
|
||||
public void setLogging(boolean state) {
|
||||
isLogging = state;
|
||||
}
|
||||
|
||||
public void setOnDistanceResponseListener(OnDistanceResponseListener listener) {
|
||||
mDistanceListener = listener;
|
||||
}
|
||||
|
||||
public interface OnDistanceResponseListener {
|
||||
void onResponse(String status, DistanceResponseJson json, GoogleDistanceMatrix gd);
|
||||
}
|
||||
|
||||
private class RequestTask extends AsyncTask<String, Void, DistanceResponseJson> {
|
||||
protected DistanceResponseJson doInBackground(String... url) {
|
||||
HttpConnectionResult resultServer = null;
|
||||
String result = "";
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(encrypt, decrypt);
|
||||
try {
|
||||
resultServer = httpConn.requestToServer(url[0], "", Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
// HttpClient httpClient = new DefaultHttpClient();
|
||||
// HttpContext localContext = new BasicHttpContext();
|
||||
// HttpPost httpPost = new HttpPost(url[0]);
|
||||
// HttpResponse response = httpClient.execute(httpPost, localContext);
|
||||
// result = EntityUtils.toString(response.getEntity());
|
||||
result = resultServer.getResult();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
DistanceResponseJson response = null;
|
||||
try {
|
||||
response = GsonHelper.fromJson(result, DistanceResponseJson.class);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
protected void onPostExecute(DistanceResponseJson json) {
|
||||
super.onPostExecute(json);
|
||||
if (mDistanceListener != null)
|
||||
mDistanceListener.onResponse(json.status, json, GoogleDistanceMatrix.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Distance {
|
||||
public String text;
|
||||
public int value;
|
||||
}
|
||||
|
||||
public class Duration {
|
||||
public String text;
|
||||
public int value;
|
||||
}
|
||||
|
||||
public class Element {
|
||||
public Distance distance;
|
||||
public Duration duration;
|
||||
public String status;
|
||||
}
|
||||
|
||||
public class Row {
|
||||
public List<Element> elements;
|
||||
}
|
||||
|
||||
public class DistanceResponseJson {
|
||||
public List<String> destination_addresses;
|
||||
public List<String> origin_addresses;
|
||||
public List<Row> rows;
|
||||
public String status;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.adins.mss.base.dynamicform;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubmitTaskApi {
|
||||
private Context context;
|
||||
private TaskH taskH;
|
||||
private JsonRequestSubmitTask task;
|
||||
|
||||
public SubmitTaskApi(Context context, JsonRequestSubmitTask task, TaskH taskH) {
|
||||
this.context = context;
|
||||
this.taskH = taskH;
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public HttpConnectionResult request() {
|
||||
String json = GsonHelper.toJson(task);
|
||||
String url;
|
||||
|
||||
if (taskH.getIs_prepocessed() != null && taskH.getIs_prepocessed().equals(Global.FORM_TYPE_VERIFICATION)) {
|
||||
url = GlobalData.getSharedGlobalData().getURL_SUBMITVERIFICATIONTASK();
|
||||
} else {
|
||||
url = GlobalData.getSharedGlobalData().getURL_SUBMITTASK();
|
||||
}
|
||||
|
||||
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);
|
||||
return serverResult;
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,191 @@
|
|||
package com.adins.mss.coll.models;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.fragments.PdfRendererFragment;
|
||||
import com.adins.mss.coll.models.loyaltymodels.DocumentListDetail;
|
||||
import com.adins.mss.coll.models.loyaltymodels.GuidelineFaqResponse;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class GuidelineAdapter extends RecyclerView.Adapter<GuidelineAdapter.GuidelineViewHolder> {
|
||||
|
||||
private List<DocumentListDetail> documentList;
|
||||
private Context context;
|
||||
private String documentNameTitle;
|
||||
|
||||
public GuidelineAdapter(List<DocumentListDetail> documentList, Context context) {
|
||||
this.documentList = documentList;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GuidelineViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_guideline, parent, false);
|
||||
return new GuidelineViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GuidelineViewHolder holder, int position) {
|
||||
final DocumentListDetail document = documentList.get(position);
|
||||
holder.documentName.setText(position + 1 + ". " + document.getNamaDocument());
|
||||
holder.documentViewBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
documentNameTitle = document.getNamaDocument();
|
||||
new GetDocumentPdf().execute(document.getUuidGuideline());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return documentList.size();
|
||||
}
|
||||
|
||||
public class GuidelineViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView documentName;
|
||||
Button documentViewBtn;
|
||||
|
||||
public GuidelineViewHolder(View view) {
|
||||
super(view);
|
||||
documentName = itemView.findViewById(R.id.documentName);
|
||||
documentViewBtn = itemView.findViewById(R.id.documentViewBtn);
|
||||
}
|
||||
}
|
||||
|
||||
public class GetDocumentPdf extends AsyncTask<String, Void, String>{
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(context, "",context.getString(R.string.progressWait), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... uuidGuidelines) {
|
||||
try {
|
||||
if(Tool.isInternetconnected(context.getApplicationContext())){
|
||||
String result = " ";
|
||||
String uuidGuideline = uuidGuidelines[0];
|
||||
GuidelineFaqRequest guidelineFaqRequest = new GuidelineFaqRequest();
|
||||
guidelineFaqRequest.setUuidGudeline(uuidGuideline);
|
||||
guidelineFaqRequest.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(guidelineFaqRequest);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DOCUMENT_LIST();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context.getApplicationContext(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
// Firebase Performance Trace Network Request
|
||||
HttpMetric networkMetric = FirebasePerformance.getInstance().newHttpMetric(
|
||||
url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
|
||||
if(serverResult != null){
|
||||
if(serverResult .isOK()){
|
||||
try {
|
||||
result = serverResult.getResult();
|
||||
GuidelineFaqResponse response = GsonHelper.fromJson(result, GuidelineFaqResponse.class);
|
||||
return response.getBase64pdf();
|
||||
}catch (Exception e){
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if(progressDialog != null & progressDialog.isShowing()){
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
if(result != null){
|
||||
if(!result.isEmpty()){
|
||||
try{
|
||||
byte[] pdfAsBytes = Base64.decode(result, Base64.DEFAULT);
|
||||
String fileName = "DocumentPdf.pdf";
|
||||
File pdfFile = saveToPdfFile(pdfAsBytes, fileName);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("URL_FILE", pdfFile.getAbsolutePath());
|
||||
bundle.putString("documentName", documentNameTitle);
|
||||
|
||||
PdfRendererFragment fragment = new PdfRendererFragment();
|
||||
fragment.setArguments(bundle);
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}catch (Exception e){
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private File saveToPdfFile(byte[] pdfAsBytes, String fileName) throws IOException {
|
||||
File pdfFile = new File(context.getFilesDir().getPath(), fileName);
|
||||
try (FileOutputStream fos = new FileOutputStream(pdfFile)) {
|
||||
fos.write(pdfAsBytes);
|
||||
fos.flush();
|
||||
if(fos != null){
|
||||
try {
|
||||
fos.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return pdfFile;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.adins.mss.coll.dashboardcollection.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DashboardData {
|
||||
private double targetAmount,collectedAmount;
|
||||
private double outstandingAmount;
|
||||
private int outstandingNum;
|
||||
private List<CollResultDetail> collectDetails;
|
||||
private List<CollResultDetail> ptpDetails;
|
||||
private List<CollResultDetail> failedDetails;
|
||||
|
||||
public double getTargetAmount() {
|
||||
return targetAmount;
|
||||
}
|
||||
|
||||
public void setTargetAmount(double targetAmount) {
|
||||
this.targetAmount = targetAmount;
|
||||
}
|
||||
|
||||
public double getCollectedAmount() {
|
||||
return collectedAmount;
|
||||
}
|
||||
|
||||
public void setCollectedAmount(double collectedAmount) {
|
||||
this.collectedAmount = collectedAmount;
|
||||
}
|
||||
|
||||
public double getOutstandingAmount() {
|
||||
return outstandingAmount;
|
||||
}
|
||||
|
||||
public void setOutstandingAmount(double outstandingAmount) {
|
||||
this.outstandingAmount = outstandingAmount;
|
||||
}
|
||||
|
||||
public int getOutstandingNum() {
|
||||
return outstandingNum;
|
||||
}
|
||||
|
||||
public void setOutstandingNum(int outstandingNum) {
|
||||
this.outstandingNum = outstandingNum;
|
||||
}
|
||||
|
||||
public List<CollResultDetail> getCollectDetails() {
|
||||
return collectDetails;
|
||||
}
|
||||
|
||||
public void setCollectDetails(List<CollResultDetail> collectDetails) {
|
||||
this.collectDetails = collectDetails;
|
||||
}
|
||||
|
||||
public List<CollResultDetail> getPtpDetails() {
|
||||
return ptpDetails;
|
||||
}
|
||||
|
||||
public void setPtpDetails(List<CollResultDetail> ptpDetails) {
|
||||
this.ptpDetails = ptpDetails;
|
||||
}
|
||||
|
||||
public List<CollResultDetail> getFailedDetails() {
|
||||
return failedDetails;
|
||||
}
|
||||
|
||||
public void setFailedDetails(List<CollResultDetail> failedDetails) {
|
||||
this.failedDetails = failedDetails;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.adins.mss.base.todolist.todayplanrepository;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PlanTaskSequence{
|
||||
@SerializedName("uuid_task_h")
|
||||
private String uuidTaskH;
|
||||
@SerializedName("task_seqno")
|
||||
private String taskSeqNo;
|
||||
|
||||
public PlanTaskSequence() {
|
||||
}
|
||||
|
||||
public PlanTaskSequence(String uuidTaskH, String taskSeqNo) {
|
||||
this.uuidTaskH = uuidTaskH;
|
||||
this.taskSeqNo = taskSeqNo;
|
||||
}
|
||||
|
||||
public String getUuidTaskH() {
|
||||
return uuidTaskH;
|
||||
}
|
||||
|
||||
public void setUuidTaskH(String uuidTaskH) {
|
||||
this.uuidTaskH = uuidTaskH;
|
||||
}
|
||||
|
||||
public String getTaskSeqNo() {
|
||||
return taskSeqNo;
|
||||
}
|
||||
|
||||
public void setTaskSeqNo(String taskSeqNo) {
|
||||
this.taskSeqNo = taskSeqNo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" >
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#90908e"/>
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/bgColor" ></stroke>
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#FAFAFA"/>
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/bgColor" ></stroke>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,30 @@
|
|||
package com.adins.mss.base.dynamicform.form.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PhotoDocumentBean implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
@SerializedName("Content")
|
||||
private String content;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
package com.adins.mss.base.todolist.form.todaysplan;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.todo.Task;
|
||||
import com.adins.mss.base.todolist.form.OnTaskListClickListener;
|
||||
import com.adins.mss.base.todolist.form.PriorityViewAdapter;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.PlanTask;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TodayPlanAdapter extends PriorityViewAdapter {
|
||||
|
||||
private HashMap<String,Boolean> selectedFlags = new HashMap<>();
|
||||
private String highlightColor = "#DEC0C0C0";
|
||||
private float highlightElevation = 8f;
|
||||
private OnPlanDeletedListener deletedListener;
|
||||
|
||||
public TodayPlanAdapter(Context context, List<TaskH> items, OnTaskListClickListener listener,OnPlanDeletedListener deletedListener, String param) {
|
||||
super(context, items, listener, param);
|
||||
mValues = items;
|
||||
this.deletedListener = deletedListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_task_list_item, parent, false);
|
||||
return new TodayPlanViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
|
||||
if (mValues.size() == 0) {
|
||||
holder.noData.setVisibility(View.VISIBLE);
|
||||
holder.taskItem.setVisibility(View.GONE);
|
||||
} else {
|
||||
final TaskH taskH = mValues.get(position);
|
||||
holder.noData.setVisibility(View.GONE);
|
||||
holder.taskItem.setVisibility(View.VISIBLE);
|
||||
|
||||
holder.mItem = taskH;
|
||||
holder.bind(taskH);
|
||||
|
||||
//check selected
|
||||
final Boolean selected = selectedFlags.get(taskH.getUuid_task_h());
|
||||
if(selected != null && selected){
|
||||
holder.taskHeader.setCardBackgroundColor(Color.parseColor(highlightColor));
|
||||
holder.taskHeader.setCardElevation(highlightElevation);
|
||||
}
|
||||
else {
|
||||
holder.taskHeader.setCardBackgroundColor(Color.parseColor("#FFFFFF"));
|
||||
holder.taskHeader.setCardElevation(5f);
|
||||
}
|
||||
|
||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != mListener) {
|
||||
// Notify the active callbacks interface (the activity, if the
|
||||
// fragment is attached to one) that an item has been selected.
|
||||
mListener.onItemClickListener(taskH, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.mView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (null != mListener) {
|
||||
//prevent multiple select item
|
||||
if(Global.isPlanStarted()){
|
||||
mListener.onItemLongClickListener(taskH, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(checkNumSelectedItem() > 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
selectedFlags.put(taskH.getUuid_task_h(),true);
|
||||
holder.taskHeader.setCardBackgroundColor(Color.parseColor(highlightColor));
|
||||
holder.taskHeader.setCardElevation(highlightElevation);
|
||||
mListener.onItemLongClickListener(taskH, position);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
((TodayPlanViewHolder)holder).deletePlanBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(deletedListener != null){
|
||||
deletedListener.onPlanDeleted(taskH,position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private int checkNumSelectedItem(){
|
||||
int numSelected = 0;
|
||||
for(Map.Entry flag :selectedFlags.entrySet()){
|
||||
Boolean flagValue = (Boolean) flag.getValue();
|
||||
if(flagValue){
|
||||
numSelected += 1;
|
||||
}
|
||||
}
|
||||
return numSelected;
|
||||
}
|
||||
|
||||
public void changeDataset(List<TaskH> dataset){
|
||||
mValues = dataset;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void deselectItem(String uuidTaskh,int position){
|
||||
if(selectedFlags.get(uuidTaskh) != null){
|
||||
selectedFlags.put(uuidTaskh,false);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
}
|
||||
|
||||
public void addQueueItem(TaskH data){
|
||||
if(mValues.contains(data)){
|
||||
return;
|
||||
}
|
||||
mValues.add(data);
|
||||
notifyItemInserted(mValues.size()-1);
|
||||
}
|
||||
|
||||
public int moveItemFromTo(int from,int to){
|
||||
if(to < 0 || to >= mValues.size())
|
||||
return from;
|
||||
|
||||
if(from == to)
|
||||
return from;
|
||||
|
||||
TaskH targetSwap = mValues.get(to);
|
||||
TaskH swapped = mValues.get(from);
|
||||
mValues.set(to,swapped);
|
||||
mValues.set(from,targetSwap);
|
||||
notifyItemMoved(from,to);
|
||||
notifyItemChanged(from);
|
||||
notifyItemChanged(to);
|
||||
return to;
|
||||
}
|
||||
|
||||
public int moveItemToTop(int from){
|
||||
if(from < 0 || from >= mValues.size())
|
||||
return from;
|
||||
//copy and add to head
|
||||
mValues.add(0,mValues.get(from));
|
||||
mValues.remove(from + 1);
|
||||
notifyItemMoved(from,0);
|
||||
notifyDataSetChanged();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int moveItemToBottom(int from){
|
||||
if(from < 0 || from >= mValues.size())
|
||||
return from;
|
||||
//add to tail
|
||||
mValues.add(mValues.get(from));
|
||||
mValues.remove(from);
|
||||
notifyItemMoved(from,mValues.size()-1);
|
||||
notifyDataSetChanged();
|
||||
return mValues.size()-1;
|
||||
}
|
||||
|
||||
public interface OnPlanDeletedListener{
|
||||
void onPlanDeleted(TaskH taskH,int position);
|
||||
}
|
||||
|
||||
public class TodayPlanViewHolder extends PriorityViewAdapter.ViewHolder{
|
||||
|
||||
LinearLayout deletePlanBtnCont;
|
||||
ImageView deletePlanBtn;
|
||||
|
||||
public TodayPlanViewHolder(View view) {
|
||||
super(view);
|
||||
deletePlanBtnCont = view.findViewById(R.id.deletePlanBtnCont);
|
||||
deletePlanBtn = view.findViewById(R.id.deletePlanBtn);
|
||||
DrawableCompat.setTint(
|
||||
DrawableCompat.wrap(deletePlanBtn.getDrawable()),
|
||||
ContextCompat.getColor(mContext, R.color.gradient_end)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(final TaskH taskH) {
|
||||
super.bind(taskH);
|
||||
deletePlanBtn.setOnClickListener(null);
|
||||
if(Global.isPlanStarted()){
|
||||
deletePlanBtnCont.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
deletePlanBtnCont.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 996 B |
|
@ -0,0 +1,85 @@
|
|||
package com.adins.mss.base.receipt;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
/**
|
||||
* Created by Loise on 12/04/2018.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Menggambar image bitmap
|
||||
*/
|
||||
public class DrawImage implements IDrawItem {
|
||||
private Paint paint = new Paint();
|
||||
private Bitmap bitmap;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param bitmap bitmap yang akan digambar
|
||||
*/
|
||||
public DrawImage(Bitmap bitmap) {
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mengatur aligment gambar
|
||||
* @param align alignment gambar
|
||||
*/
|
||||
public void setAlign(Paint.Align align) {
|
||||
paint.setTextAlign(align);
|
||||
}
|
||||
/**
|
||||
* Mengambil aligment gambar
|
||||
* @return alignment gambar
|
||||
*/
|
||||
public Paint.Align getAlign() {
|
||||
return paint.getTextAlign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Menggambar bitmap pada canvas
|
||||
* @param canvas objek canvas
|
||||
* @param x titik x awal
|
||||
* @param y titik y awal
|
||||
*/
|
||||
@Override
|
||||
public void drawOnCanvas(Canvas canvas, float x, float y) {
|
||||
canvas.drawBitmap(bitmap, getX(canvas, x), getY(y), paint);
|
||||
}
|
||||
|
||||
/**
|
||||
* titik koordinat terakhir pada gambar koordinat Y
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
private float getY(float y) {
|
||||
float baseline = -paint.ascent();
|
||||
return baseline + y;
|
||||
}
|
||||
/**
|
||||
* titik koordinat terakhir pada gambar koordinat x
|
||||
* @param x
|
||||
* @param canvas
|
||||
* @return
|
||||
*/
|
||||
private float getX(Canvas canvas, float x) {
|
||||
float xPos = x;
|
||||
if (paint.getTextAlign().equals(Paint.Align.CENTER)) {
|
||||
xPos += (float)(canvas.getWidth() - bitmap.getWidth()) / 2;
|
||||
} else if (paint.getTextAlign().equals(Paint.Align.RIGHT)) {
|
||||
xPos += canvas.getWidth() - bitmap.getWidth();
|
||||
}
|
||||
return xPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mengambil tinggi gambar
|
||||
* @return tinggi bitmap
|
||||
*/
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return bitmap.getHeight();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue