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
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/gradient_end"
|
||||
android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,103 @@
|
|||
package com.adins.mss.coll.interfaces;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.commons.TaskListener;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.api.ReportSummaryApi;
|
||||
import com.adins.mss.coll.models.ReportSummaryResponse;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by kusnendi.muhamad on 28/07/2017.
|
||||
*/
|
||||
|
||||
public class ReportSummaryImpl implements ReportSummaryInterface {
|
||||
private Context context;
|
||||
private ReportSummaryResponse reportSummary;
|
||||
private TaskListener listener;
|
||||
|
||||
public ReportSummaryImpl(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getReportSummary(TaskListener taskListener) {
|
||||
GetReportSummaryTask task = new GetReportSummaryTask(taskListener);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
private class GetReportSummaryTask extends AsyncTask<Void, Void, ReportSummaryResponse> {
|
||||
ProgressDialog dialog;
|
||||
|
||||
public GetReportSummaryTask(TaskListener taskListener) {
|
||||
listener = taskListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
dialog = new ProgressDialog(context);
|
||||
dialog.setMessage(context.getString(R.string.progressWait));
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReportSummaryResponse doInBackground(Void... args) {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
//
|
||||
}
|
||||
|
||||
ReportSummaryApi api = new ReportSummaryApi(context);
|
||||
return api.request();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ReportSummaryResponse reportSummaryResponse) {
|
||||
super.onPostExecute(reportSummaryResponse);
|
||||
if(dialog.isShowing()) dialog.dismiss();
|
||||
|
||||
if (GlobalData.isRequireRelogin()) {
|
||||
|
||||
} else if(reportSummaryResponse != null && reportSummaryResponse.getTotal_received() != null) {
|
||||
// perbaikan baru set text pada asyntask karena server mengirimkan total paid dan total to be collected,
|
||||
// namun jumlah task.size kosong. jadi tidak ke onComplete
|
||||
if (null != reportSummaryResponse.getTotal_to_be_paid() && reportSummaryResponse.getTotal_to_be_paid() >= 0){
|
||||
TextView totalToBeCollected = (TextView)((Activity)context).findViewById(R.id.txtCollected);
|
||||
totalToBeCollected.setText(Tool.separateThousand(String.format(Locale.US, "%.0f",reportSummaryResponse.getTotal_to_be_paid())));
|
||||
}
|
||||
if (null != reportSummaryResponse.getTotal_received() && reportSummaryResponse.getTotal_received() >= 0){
|
||||
TextView totalPaid = (TextView)((Activity)context).findViewById(R.id.txtPaid);
|
||||
totalPaid.setText(Tool.separateThousand(String.format(Locale.US, "%.0f",reportSummaryResponse.getTotal_received())));
|
||||
}
|
||||
if(reportSummaryResponse.getList_task().size() == 0) {
|
||||
NiftyDialogBuilder.getInstance(context)
|
||||
.withTitle("INFO")
|
||||
.withMessage(context.getString(R.string.data_not_found))
|
||||
.show();
|
||||
} else {
|
||||
listener.onCompleteTask(reportSummaryResponse);
|
||||
}
|
||||
} else {
|
||||
NiftyDialogBuilder.getInstance(context)
|
||||
.withMessage(context.getString(R.string.empty_data))
|
||||
.withTitle(context.getString(R.string.data_not_found))
|
||||
.isCancelable(true)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue