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,274 @@
|
|||
package com.adins.mss.coll.dashboardcollection.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.dashboardcollection.model.CollResultDetail;
|
||||
import com.adins.mss.coll.dummy.UserHelpCOLDummy;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.UserHelp.UserHelp;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.github.mikephil.charting.charts.PieChart;
|
||||
import com.github.mikephil.charting.data.PieData;
|
||||
import com.github.mikephil.charting.data.PieDataSet;
|
||||
import com.github.mikephil.charting.data.PieEntry;
|
||||
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DummyDashboardCollView extends Fragment implements TabLayout.BaseOnTabSelectedListener {
|
||||
|
||||
private ConstraintLayout contentLayout;
|
||||
private ProgressBar targetProgress;
|
||||
private TextView outstandingTv, collectAmountProgress, percentageTv, outstandingAmountTv;
|
||||
private PieChart collResultPie;
|
||||
private TabLayout tabLayout;
|
||||
private ViewPager viewPager;
|
||||
private ValueFormatter valueFormatter;
|
||||
|
||||
//data holder
|
||||
private int collNum, ptpNum, failNum;
|
||||
private List<CollResultDetail> collectDetails;
|
||||
private List<CollResultDetail> ptpDetails;
|
||||
private List<CollResultDetail> failedDetails;
|
||||
private CollResultPagerAdapter tabAdapter;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_dummy_dashboard_coll_view, container, false);
|
||||
contentLayout = view.findViewById(R.id.dummyDashContentLayout);
|
||||
targetProgress = view.findViewById(R.id.dummyDashTargetProgress);
|
||||
collResultPie = view.findViewById(R.id.dummyDashCollResultPie);
|
||||
tabLayout = view.findViewById(R.id.dummyDashDetailTab);
|
||||
viewPager = view.findViewById(R.id.dummyDashViewPager);
|
||||
collectAmountProgress = view.findViewById(R.id.dummyDashProgressValue);
|
||||
percentageTv = view.findViewById(R.id.dummyDashProgressPercent);
|
||||
outstandingTv = view.findViewById(R.id.dummyDashOutstandingValue);
|
||||
outstandingAmountTv = view.findViewById(R.id.dummyDashOutstandingAmount);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
getActivity().setTitle("Sample " + getString(R.string.collector_dashboard));
|
||||
Global.positionStack.push(1);
|
||||
|
||||
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||
|
||||
tabAdapter = new CollResultPagerAdapter(this.getChildFragmentManager(), tabLayout.getTabCount());
|
||||
viewPager.setAdapter(tabAdapter);
|
||||
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||
tabLayout.addOnTabSelectedListener(this);
|
||||
|
||||
initDummyData();
|
||||
|
||||
UserHelpCOLDummy userHelpCOLDummy = new UserHelpCOLDummy();
|
||||
userHelpCOLDummy.showDashboardColl(getActivity(), DummyDashboardCollView.class.getSimpleName(), finishCallback, onDashboardTabSelected);
|
||||
}
|
||||
|
||||
private void initDummyData() {
|
||||
|
||||
setProgressBarValue(5000000, 20000000);
|
||||
setTotalOutstandingTask(7);
|
||||
setOutstandingAmount(10000000);
|
||||
setTaskCollectedNum(1);
|
||||
setTaskPTPNum(1);
|
||||
setTaskFailedNum(1);
|
||||
setTaskCollectedDetails();
|
||||
setTaskPTPDetails();
|
||||
setTaskFailedDetails();
|
||||
|
||||
//finish setup data, draw dummy pie chart
|
||||
drawCollResultChart();
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onTabSelected(tabLayout.getTabAt(0));
|
||||
}
|
||||
},1000);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
private void setProgressBarValue(double collectedAmount, double targetAmount) {
|
||||
//set percentage from target
|
||||
double percentage = collectedAmount / targetAmount;
|
||||
int finPercentage = (int) (percentage * 100);
|
||||
targetProgress.setProgress(finPercentage);
|
||||
targetProgress.setMax(100);
|
||||
|
||||
if (percentage >= 100f) {
|
||||
Drawable drawable = targetProgress.getIndeterminateDrawable().mutate();
|
||||
drawable.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
|
||||
targetProgress.setIndeterminateDrawable(drawable);
|
||||
percentageTv.setTextColor(Color.GREEN);
|
||||
}
|
||||
|
||||
percentageTv.setText(finPercentage + " %");
|
||||
|
||||
String finCollectAmount, finTargetAmount;
|
||||
finCollectAmount = Tool.formatToCurrency(collectedAmount);
|
||||
finTargetAmount = Tool.formatToCurrency(targetAmount);
|
||||
collectAmountProgress.setText(finCollectAmount + " / " + finTargetAmount + " IDR");
|
||||
}
|
||||
|
||||
private void setTotalOutstandingTask(int outstandingTask) {
|
||||
outstandingTv.setText(outstandingTask + "");
|
||||
}
|
||||
|
||||
private void setOutstandingAmount(double outstandingAmount) {
|
||||
String finToCollectAmount = Tool.formatToCurrency(outstandingAmount);
|
||||
outstandingAmountTv.setText(finToCollectAmount + " IDR");
|
||||
}
|
||||
|
||||
private void setTaskCollectedNum(int collectedNum) {
|
||||
this.collNum = collectedNum;
|
||||
}
|
||||
|
||||
private void setTaskPTPNum(int ptpNum) {
|
||||
this.ptpNum = ptpNum;
|
||||
}
|
||||
|
||||
private void setTaskFailedNum(int failedNum) {
|
||||
this.failNum = failedNum;
|
||||
}
|
||||
|
||||
private void setTaskCollectedDetails() {
|
||||
List<CollResultDetail> temp = new ArrayList<>();
|
||||
temp.add(new CollResultDetail(0, "OJK0001", "Customer 1", "5000000"));
|
||||
this.collectDetails = temp;
|
||||
}
|
||||
|
||||
private void setTaskPTPDetails() {
|
||||
List<CollResultDetail> temp = new ArrayList<>();
|
||||
temp.add(new CollResultDetail(1, "OJK0002", "Customer 2", "01-01-20"));
|
||||
this.ptpDetails = temp;
|
||||
}
|
||||
|
||||
private void setTaskFailedDetails() {
|
||||
List<CollResultDetail> temp = new ArrayList<>();
|
||||
temp.add(new CollResultDetail(2, "OJK0003", "Customer 3", "Tidak Bertemu Konsumen"));
|
||||
this.failedDetails = temp;
|
||||
}
|
||||
|
||||
private void drawCollResultChart() {
|
||||
//init value formatter
|
||||
valueFormatter = new ValueFormatter() {
|
||||
@Override
|
||||
public String getFormattedValue(float value) {
|
||||
return value == 0 ? "" : (int) value + "";
|
||||
}
|
||||
};
|
||||
|
||||
List<PieEntry> pieEntries = new ArrayList<>();
|
||||
|
||||
PieData pieData;
|
||||
if (ptpNum == 0 && failNum == 0 && collNum == 0) {
|
||||
pieEntries.add(new PieEntry(1, ""));
|
||||
PieDataSet dataSet = new PieDataSet(pieEntries, "");
|
||||
dataSet.setColors(Color.parseColor("#A9A9AA"));
|
||||
dataSet.setDrawValues(false);
|
||||
pieData = new PieData(dataSet);
|
||||
} else {
|
||||
PieEntry pieEntry1 = new PieEntry(ptpNum, "PTP");
|
||||
pieEntries.add(pieEntry1);
|
||||
|
||||
PieEntry pieEntry2 = new PieEntry(collNum, "Collected");
|
||||
pieEntries.add(pieEntry2);
|
||||
|
||||
PieEntry pieEntry3 = new PieEntry(failNum, "Failed");
|
||||
pieEntries.add(pieEntry3);
|
||||
|
||||
PieDataSet dataSet = new PieDataSet(pieEntries, "");
|
||||
int[] colors = {Color.parseColor("#EA9431"), Color.parseColor("#008000"), Color.RED};
|
||||
dataSet.setColors(colors);
|
||||
dataSet.setValueTextColor(Color.WHITE);
|
||||
dataSet.setValueTextSize(12f);
|
||||
dataSet.setValueFormatter(valueFormatter);
|
||||
pieData = new PieData(dataSet);
|
||||
}
|
||||
|
||||
collResultPie.getLegend().setEnabled(false);
|
||||
collResultPie.setDrawEntryLabels(false);
|
||||
collResultPie.setDrawHoleEnabled(true);
|
||||
collResultPie.setHoleColor(Color.parseColor("#00000000"));
|
||||
collResultPie.setTransparentCircleAlpha(0);
|
||||
collResultPie.setDescription(null);
|
||||
collResultPie.setHoleRadius(40f);
|
||||
collResultPie.setData(pieData);
|
||||
collResultPie.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
viewPager.setCurrentItem(tab.getPosition());
|
||||
//send data coll result details
|
||||
int idx = tab.getPosition();
|
||||
switch (idx) {
|
||||
case 0:
|
||||
tabAdapter.setDataToPage(tab.getPosition(), collectDetails);
|
||||
break;
|
||||
case 1:
|
||||
tabAdapter.setDataToPage(tab.getPosition(), ptpDetails);
|
||||
break;
|
||||
case 2:
|
||||
tabAdapter.setDataToPage(tab.getPosition(), failedDetails);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
protected UserHelp.OnShowSequenceFinish finishCallback = new UserHelp.OnShowSequenceFinish() {
|
||||
@Override
|
||||
public void onSequenceFinish() {
|
||||
Global.positionStack.pop();
|
||||
getActivity().getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
};
|
||||
|
||||
protected UserHelpCOLDummy.OnDashboardTabSelected onDashboardTabSelected = new UserHelpCOLDummy.OnDashboardTabSelected() {
|
||||
@Override
|
||||
public void onNextTab(int counter) {
|
||||
onTabSelected(tabLayout.getTabAt(counter));
|
||||
}
|
||||
};
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -0,0 +1,544 @@
|
|||
package com.adins.mss.base.syncfile;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.dao.Lookup;
|
||||
import com.adins.mss.dao.MobileDataFile;
|
||||
import com.adins.mss.dao.Sync;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
import com.adins.mss.foundation.db.dataaccess.LookupDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.SyncDataAccess;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.greenrobot.dao.database.Database;
|
||||
|
||||
/**
|
||||
* Created by loise on 10/9/2017.
|
||||
*/
|
||||
|
||||
/**
|
||||
* class contining data to update dialog interface data
|
||||
*/
|
||||
class ImportDbTaskProgress {
|
||||
final int progress;
|
||||
final String message;
|
||||
final int max;
|
||||
|
||||
/**
|
||||
* constructor for data container class
|
||||
*
|
||||
* @param progress current progress count
|
||||
* @param message message string to display
|
||||
* @param max maximum progress count
|
||||
*/
|
||||
ImportDbTaskProgress(int progress, String message, int max) {
|
||||
this.progress = progress;
|
||||
this.message = message;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains methods for importing MS_LOOKUP table from external file
|
||||
*/
|
||||
public class ImportDbFromCsv extends AsyncTask<ImportDbParams, ImportDbTaskProgress, String> {
|
||||
|
||||
private WeakReference<Context> mContext;
|
||||
|
||||
public ImportDbFromCsv() {
|
||||
}
|
||||
|
||||
public ImportDbFromCsv(Context context) {
|
||||
mContext = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
// Progress dialog type (0 - for Horizontal progress bar)
|
||||
public static final int progress_bar_type = 0;
|
||||
/**
|
||||
* Variable to track current row number when reading from BufferedReader
|
||||
*/
|
||||
public static int rownum = 0;
|
||||
/**
|
||||
* Background Async Task to download file
|
||||
*/
|
||||
ProgressDialog dialog;
|
||||
ImportDbTaskProgress progress;
|
||||
// Progress Dialog
|
||||
private ProgressDialog pDialog;
|
||||
|
||||
/**
|
||||
* Method to measure performance of importing a table from a separate database file
|
||||
*
|
||||
* @param context current activity context
|
||||
* @return total execution time of this method in milliseconds
|
||||
*/
|
||||
public static Long getImportTime(Context context) {
|
||||
Long start;
|
||||
String path = "";
|
||||
start = System.currentTimeMillis();
|
||||
try {
|
||||
path = context.getExternalFilesDir(null).toString();
|
||||
path = path + "/testdb";
|
||||
Database db = DaoOpenHelper.getDb(context);
|
||||
db.execSQL("ATTACH '" + path + "' AS EXTDB");
|
||||
db.execSQL("INSERT OR REPLACE INTO MS_LOOKUP select * from EXTDB.MS_LOOKUP");
|
||||
db.execSQL("DETACH 'EXTDB'");
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
Log.e("unknown", path, e);
|
||||
}
|
||||
return System.currentTimeMillis() - start;
|
||||
}
|
||||
|
||||
/**
|
||||
* method to get public decryption key from assets
|
||||
* <p>
|
||||
* IMPORTANT : jangan lupa taruh file public.der yang berisi public key pada folder assets
|
||||
*
|
||||
* @param context activity context
|
||||
* @return
|
||||
*/
|
||||
private String getPublicKey(Context context) {
|
||||
File f = new File(context.getCacheDir() + "/public.der");
|
||||
if (!f.exists())
|
||||
try (FileOutputStream fos = new FileOutputStream(f);
|
||||
InputStream is = context.getAssets().open("public.der")){
|
||||
int size = is.available();
|
||||
byte[] buffer = new byte[size];
|
||||
is.read(buffer);
|
||||
fos.write(buffer);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return f.getAbsolutePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* method to show progress dialog
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected ProgressDialog showImportDbDialog(Context context) {
|
||||
|
||||
pDialog = new ProgressDialog(context);
|
||||
pDialog.setMessage("Processing file...");
|
||||
pDialog.setIndeterminate(false);
|
||||
pDialog.setMax(1);
|
||||
pDialog.setProgressNumberFormat("%1d/%2d Rows");
|
||||
pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
pDialog.setCancelable(false);
|
||||
pDialog.show();
|
||||
return pDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Before starting background thread
|
||||
* Show Progress Bar Dialog
|
||||
*/
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
dialog = showImportDbDialog(mContext.get());
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(ImportDbParams... params) {
|
||||
//ambil path menuju public key untuk decryption
|
||||
String keyPath = getPublicKey(mContext.get());
|
||||
String info;
|
||||
//ambil message untuk ditampilkan
|
||||
String message = params[0].getMessage();
|
||||
//tampung objek mobiledatafile yang akan diproses
|
||||
MobileDataFile metadata = params[0].getMetadata();
|
||||
//ambil lokasi file yang akan di decrypt, unzip dan insert
|
||||
File in = new File(params[0].getMetadata().getDownloaded_file_path());
|
||||
//ambil nama file tanpa extension
|
||||
String fileNameWithOutExt = FilenameUtils.removeExtension(in.getName());
|
||||
//file output zip
|
||||
File out = new File(GlobalData.getSharedGlobalData().getSavePath() + fileNameWithOutExt + ".zip");
|
||||
String outputzip = GlobalData.getSharedGlobalData().getSavePath();
|
||||
//file output csv
|
||||
String outputcsv = GlobalData.getSharedGlobalData().getSavePath() + fileNameWithOutExt + ".csv";
|
||||
int result = -99;
|
||||
//update dialog message
|
||||
info = message + " (Decrypting file...)";
|
||||
progress = new ImportDbTaskProgress(0, info, 1);
|
||||
publishProgress(progress);
|
||||
//decrypt file yang sudah di download
|
||||
try {
|
||||
FileEncryption fe = new FileEncryption();
|
||||
fe.publicKey = keyPath;
|
||||
fe.decrypt(in, out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//unzip file
|
||||
info = message + " (Unzipping file...)";
|
||||
progress = new ImportDbTaskProgress(0, info, 1);
|
||||
publishProgress(progress);
|
||||
ArchiveManager am = new ArchiveManager();
|
||||
try{
|
||||
am.extract(out.getPath(), outputzip);
|
||||
//delete zip file
|
||||
boolean deleteResult = out.delete();
|
||||
if(!deleteResult){
|
||||
Toast.makeText(mContext.get(), "Failed to delete file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//update message dialog
|
||||
info = message + " (Importing file...)";
|
||||
progress = new ImportDbTaskProgress(0, info, 1);
|
||||
publishProgress(progress);
|
||||
//import file to ms_lookup
|
||||
|
||||
/*
|
||||
NOTE : untuk support lebih dari satu table, ambil nama table dari filename dan buat
|
||||
switch case didalam proses berikut, lalu buat method terpisah untuk mengimport csv ke table lain
|
||||
*/
|
||||
try {
|
||||
result = importLookup(mContext.get(), outputcsv, message);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
Log.i("Result Code : ", String.valueOf(result));
|
||||
if (result == 1) {
|
||||
//beri flag agar dapat diketahui bila file dudah diinsert dan tidak diinsert ulang
|
||||
metadata.setImport_flag(false);
|
||||
MobileDataFileDataAccess.addOrReplace(FileSyncHelper.instance, metadata);
|
||||
deleteResult = new File(outputcsv).delete();
|
||||
if(!deleteResult){
|
||||
Toast.makeText(mContext.get(), "Failed to delete file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
//delete zip file
|
||||
boolean deleteResult = out.delete();
|
||||
if(!deleteResult){
|
||||
Toast.makeText(mContext.get(), "Failed to delete file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return e.getMessage();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updating progress bar
|
||||
*/
|
||||
@Override
|
||||
protected void onProgressUpdate(ImportDbTaskProgress... progress) {
|
||||
// setting progress progress
|
||||
pDialog.setProgress(progress[0].progress);
|
||||
pDialog.setMessage(progress[0].message);
|
||||
pDialog.setMax(progress[0].max);
|
||||
}
|
||||
|
||||
/**
|
||||
* After completing background task
|
||||
* Dismiss the progress dialog
|
||||
**/
|
||||
@Override
|
||||
protected void onPostExecute(String string) {
|
||||
Message msg;
|
||||
Bundle bundle;
|
||||
// dismiss the dialog after the file was downloaded
|
||||
if (dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (string!=null){
|
||||
Toast.makeText(FileSyncHelper.instance, FileSyncHelper.instance.getResources().getString(R.string.import_from_csv_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//cek apakah masih ada file yang harus diinsert, bila ya maka panggil ulang task ini
|
||||
if (FileSyncHelper.currentidx < FileSyncHelper.activeData.size() - 1) {
|
||||
FileSyncHelper.importFiles();
|
||||
} else {
|
||||
Toast.makeText(FileSyncHelper.instance, FileSyncHelper.instance.getResources().getString(R.string.database_has_been_updated), Toast.LENGTH_SHORT).show();
|
||||
FileSyncHelper.synchronizeCallback();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for importing MS_LOOKUP table from a specified CSV file in internal storage and updating MS_SYNC table CSV File format : Line 1 Separator, Line 2 Table Name [separator] total row count, line 3+ data
|
||||
*
|
||||
* @param context current activity context
|
||||
* @param filePath file path relative to internal storage root
|
||||
* @return
|
||||
*/
|
||||
public Integer importLookup(Context context, String filePath, String message) throws InterruptedException {
|
||||
rownum = 0;
|
||||
ImportDbTaskProgress progress;
|
||||
Database db = DaoOpenHelper.getDb(context);
|
||||
//query berikut bertujuan untuk mengenerate data untuk
|
||||
//diinsert ke table MS_SYNC dengan dtm_upd yang sesuai dengan keadaan di table MS_LOOKUP
|
||||
String queryUpdateSync = "select b.UUID_SYNC ,TABEL_NAME as TABEL_NAME,a.LOV_GROUP, \n" +
|
||||
" max(IFNULL(a.dtm_upd, a.dtm_crt)) as DTM_UPD, \n" +
|
||||
" FLAG as FLAG \n" +
|
||||
" from MS_LOOKUP a \n" +
|
||||
" LEFT join MS_SYNC b on a.LOV_GROUP = b.LOV_GROUP group by a.LOV_GROUP";
|
||||
String path = filePath;
|
||||
FileReader file;
|
||||
//membaca file dari path
|
||||
try {
|
||||
file = new FileReader(path);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("FileNotFoundException", path, e);
|
||||
return -1;
|
||||
}
|
||||
//inisialisasi variable
|
||||
|
||||
String line = "";
|
||||
List<Lookup> transaction = new ArrayList<>();
|
||||
String info;
|
||||
String totalRows = "1", tableName;
|
||||
try(BufferedReader buffer = new BufferedReader(file)){
|
||||
//mengambil separator pada line pertama di csv
|
||||
final String separator1 = buffer.readLine();
|
||||
//mengambil separator pada line kedua di csv
|
||||
final String separator2 = buffer.readLine();
|
||||
//mengambil data nama tabel dan jumlah record pada line ketiga di csv
|
||||
if(separator2.equalsIgnoreCase(""))
|
||||
line=buffer.readLine();
|
||||
else
|
||||
line = separator2;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyHHmmss");
|
||||
//mengambil metadata file pada row kedua di csv (bisa dimodifikasi sesuai kebutuhan
|
||||
//data apa saja yang dibutuhkan
|
||||
String[] str = line.split(separator1);
|
||||
StringBuilder gabung = new StringBuilder();
|
||||
for (int i = 0; i < str.length; i++) {
|
||||
gabung.append(str[i]);
|
||||
}
|
||||
line = gabung.toString();
|
||||
str = line.split("\\|");
|
||||
//mengambil nama table diurutan pertama
|
||||
tableName = str[0];
|
||||
Log.i("Table Name:", tableName);
|
||||
//mengambil jumlah row yang akan diinsert dari urutan kedua
|
||||
totalRows = str[1];
|
||||
Log.i("Total Rows:", totalRows);
|
||||
line = buffer.readLine();
|
||||
//membaca semua data
|
||||
while ((line = buffer.readLine()) != null) {
|
||||
if (line.isEmpty()) {
|
||||
Log.i("ImportDbFromCsv","Line Kosong");
|
||||
} else {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Lookup lookup = new Lookup();
|
||||
str = line.split(separator1);
|
||||
gabung = new StringBuilder();
|
||||
for (int i = 0; i < str.length; i++) {
|
||||
gabung.append(str[i]);
|
||||
}
|
||||
line = gabung.toString();
|
||||
str = line.split("\\|");
|
||||
if (!line.equalsIgnoreCase("")) {
|
||||
try {
|
||||
lookup.setUuid_lookup(str[0]);
|
||||
lookup.setOption_id(str[1]);
|
||||
lookup.setCode(str[2]);
|
||||
lookup.setValue(str[3]);
|
||||
lookup.setFilter1(str[4]);
|
||||
lookup.setFilter2(str[5]);
|
||||
lookup.setFilter3(str[6]);
|
||||
lookup.setFilter4(str[7]);
|
||||
lookup.setFilter5(str[8]);
|
||||
if (str[9].isEmpty()) {
|
||||
lookup.setSequence(null);
|
||||
} else {
|
||||
try {
|
||||
lookup.setSequence(Integer.parseInt(str[9].replace("\"","")));
|
||||
} catch (NumberFormatException e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
Log.e("NumberFormatException", line, e);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
lookup.setUsr_crt(str[10]);
|
||||
if (str[11].isEmpty()) {
|
||||
lookup.setDtm_crt(null);
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
cal.setTime(sdf.parse(str[11]));
|
||||
} catch (ParseException e) {
|
||||
cal.setTimeInMillis(System.currentTimeMillis());
|
||||
}
|
||||
lookup.setDtm_crt(cal.getTime());
|
||||
} catch (NumberFormatException e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
Log.e("NumberFormatException", line, e);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
lookup.setUsr_crt(str[12]);
|
||||
if (str[13].isEmpty()) {
|
||||
lookup.setDtm_upd(null);
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
cal.setTime(sdf.parse(str[13]));
|
||||
} catch (ParseException e) {
|
||||
cal.setTimeInMillis(System.currentTimeMillis());
|
||||
}
|
||||
lookup.setDtm_upd(cal.getTime());
|
||||
} catch (NumberFormatException e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
Log.e("ERROR", line, e);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
lookup.setUuid_question_set(str[14]);
|
||||
lookup.setLov_group(str[15]);
|
||||
lookup.setIs_active(str[16]);
|
||||
lookup.setIs_deleted(str[17]);
|
||||
transaction.add(lookup);
|
||||
|
||||
rownum++;
|
||||
} catch (Exception e){
|
||||
Log.e("Exception", line, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Mengupdate dialog dengan progress membaca line
|
||||
if (rownum % 1000 == 0) {
|
||||
info = message + " (Reading values from file...)";
|
||||
progress = new ImportDbTaskProgress(rownum, info, Integer.parseInt(totalRows));
|
||||
publishProgress(progress);
|
||||
}
|
||||
//data diinsert dengan ukuran list transaksi 25000 row
|
||||
if (transaction.size() >= 25000) {
|
||||
Log.i("Info", "Loop : " + rownum);
|
||||
try {
|
||||
//mengupdate dialog dengan progress sedang insert ke database
|
||||
info = message + " (Inserting values to database...)";
|
||||
progress = new ImportDbTaskProgress(rownum, info, Integer.parseInt(totalRows));
|
||||
publishProgress(progress);
|
||||
LookupDataAccess.addOrUpdateAll(context, transaction);
|
||||
transaction.clear();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
Log.e("Insert Error", line, e);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//insert sisa row bila lebih kecil dari 25000 row
|
||||
if (!transaction.isEmpty()) {
|
||||
rownum++;
|
||||
Log.i("Info", "Loop : " + rownum);
|
||||
info = message + " (Inserting values to database...)";
|
||||
progress = new ImportDbTaskProgress(rownum, info, Integer.parseInt(totalRows));
|
||||
publishProgress(progress);
|
||||
LookupDataAccess.addOrUpdateAll(context, transaction);
|
||||
transaction.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("IOException", line, e);
|
||||
return -3;
|
||||
} finally {
|
||||
try {
|
||||
//proses update table ms_sync
|
||||
Calendar cal2 = Calendar.getInstance();
|
||||
Cursor c = db.rawQuery(queryUpdateSync, null);
|
||||
if (c.moveToFirst()) {
|
||||
do {
|
||||
cal2.setTimeInMillis(System.currentTimeMillis());
|
||||
Sync s = new Sync();
|
||||
String insertQuery = null;
|
||||
//assigning values
|
||||
s.setUuid_sync(c.getString(0));
|
||||
if (s.getUuid_sync() == null || s.getUuid_sync().isEmpty())
|
||||
s.setUuid_sync(UUID.randomUUID().toString());
|
||||
s.setTabel_name("");
|
||||
s.setLov_group(c.getString(2));
|
||||
String dtmUpd = c.getString(3);
|
||||
if (dtmUpd == null || dtmUpd.isEmpty()) {
|
||||
s.setDtm_upd(null);
|
||||
} else {
|
||||
Date dtm;
|
||||
try {
|
||||
try {
|
||||
dtm = new Date(Long.parseLong(dtmUpd));
|
||||
} catch (NumberFormatException e) {
|
||||
FireCrash.log(e);
|
||||
dtm = new Date(null);
|
||||
}
|
||||
cal2.setTime(dtm);
|
||||
s.setDtm_upd(cal2.getTime());
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("NumberFormatException", s.getDtm_upd().toString(), e);
|
||||
}
|
||||
s.setFlag(null);
|
||||
SyncDataAccess.addOrReplace(context, s);
|
||||
}
|
||||
}
|
||||
while (c.moveToNext());
|
||||
}
|
||||
c.close();
|
||||
//menutup semua objek dan update dialog
|
||||
transaction.clear();
|
||||
info = message + " (Import complete...)";
|
||||
progress = new ImportDbTaskProgress(rownum, info, Integer.parseInt(totalRows));
|
||||
publishProgress(progress);
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch (SQLiteException e) {
|
||||
info = message + " (Import failed, error updating db...)";
|
||||
progress = new ImportDbTaskProgress(rownum, info, Integer.parseInt(totalRows));
|
||||
publishProgress(progress);
|
||||
Thread.sleep(1500);
|
||||
e.printStackTrace();
|
||||
Log.e("SQLiteException", "MS_SYNC update failed!", e);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.LastSync;
|
||||
import com.adins.mss.dao.LastSyncDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class LastSyncDataAccess {
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
// if (daoOpenHelper == null) {
|
||||
// if (daoOpenHelper.getDaoSession() == null)
|
||||
// daoOpenHelper = new DaoOpenHelper(context);
|
||||
// }
|
||||
// DaoSession daoSeesion = daoOpenHelper.getDaoSession();
|
||||
// return daoSeesion;
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get menuDao dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static LastSyncDao getMenuDao(Context context) {
|
||||
return getDaoSession(context).getLastSyncDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
/*if(daoOpenHelper!=null){
|
||||
daoOpenHelper.closeAll();
|
||||
daoOpenHelper = null;
|
||||
}*/
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
public static void add(Context context, List<LastSync> lastSyncList) {
|
||||
getMenuDao(context).insertInTx(lastSyncList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, LastSync lastSync) {
|
||||
/*if(getOne(context, menu.getUuid_menu())==null)
|
||||
add(context, menu);
|
||||
else update(context, menu);*/
|
||||
getMenuDao(context).insertOrReplaceInTx(lastSync);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, List<LastSync> lastSyncList) {
|
||||
/*for(Menu menu : menuList){
|
||||
if(getOne(context, menu.getUuid_menu())==null)
|
||||
add(context, menu);
|
||||
else update(context, menu);
|
||||
}*/
|
||||
getMenuDao(context).insertOrReplaceInTx(lastSyncList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getMenuDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastSync
|
||||
* @param context
|
||||
*/
|
||||
public static void delete(Context context, LastSync lastSync) {
|
||||
getMenuDao(context).deleteInTx(lastSync);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by lastSync
|
||||
*
|
||||
* @param context
|
||||
* @param uuidLastSync
|
||||
*/
|
||||
public static void delete(Context context, String uuidLastSync) {
|
||||
QueryBuilder<LastSync> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(LastSyncDao.Properties.Uuid_last_sync.eq(uuidLastSync));
|
||||
qb.build();
|
||||
getMenuDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastSync
|
||||
* @param context
|
||||
*/
|
||||
public static void update(Context context, LastSync lastSync) {
|
||||
getMenuDao(context).updateInTx(lastSync);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_last_sync = param
|
||||
*
|
||||
* @param uuidLastSync
|
||||
* @return
|
||||
*/
|
||||
public static List<LastSync> getAll(Context context, String uuidLastSync) {
|
||||
QueryBuilder<LastSync> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(LastSyncDao.Properties.Uuid_last_sync.eq(uuidLastSync));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* get one menu by menu uuid_last_sync
|
||||
*
|
||||
* @param context
|
||||
* @param uuidLastSync
|
||||
* @return
|
||||
*/
|
||||
public static LastSync getOne(Context context, String uuidLastSync) {
|
||||
QueryBuilder<LastSync> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(LastSyncDao.Properties.Uuid_last_sync.eq(uuidLastSync));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
if (!qb.list().isEmpty()) {
|
||||
return qb.list().get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<LastSync> getAllBySentStatus(Context context, int status) {
|
||||
QueryBuilder<LastSync> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(LastSyncDao.Properties.Is_send.eq(status));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.adins.mss.base.loyalti.mypointdashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.loyalti.userhelpdummy.DashboardMyPointItemDummyAdapter;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
|
||||
|
||||
public class GetDetailListKompetisi extends AsyncTask<Void, Void, String> {
|
||||
private Activity context;
|
||||
private ProgressDialog progressDialog;
|
||||
public DetailKompetisiResponse dataDetail;
|
||||
String errMsg = "";
|
||||
RecyclerView recyclerViewDashBoard;
|
||||
DashboardMyPointItemRecyclerViewAdapter adapter;
|
||||
String className;
|
||||
|
||||
public GetDetailListKompetisi(RecyclerView recyclerView, DashboardMyPointItemRecyclerViewAdapter adapter, FragmentActivity activity) {
|
||||
recyclerViewDashBoard = recyclerView;
|
||||
context = activity;
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(context, "", context.getString(R.string.please_wait_dialog), true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... voids) {
|
||||
if (Tool.isInternetconnected(context)) {
|
||||
|
||||
Gson gson = new GsonBuilder().setDateFormat("ddMMyyyyHHmmss").registerTypeHierarchyAdapter(byte[].class,
|
||||
new GsonHelper.ByteArrayToBase64TypeAdapter()).create();
|
||||
DetailKompetisiRequest requestType = new DetailKompetisiRequest();
|
||||
String loginId = GlobalData.getSharedGlobalData().getUser().getLogin_id();
|
||||
|
||||
if(loginId.contains("@")){
|
||||
String[] separated = loginId.split("@");
|
||||
requestType.setLOGIN_ID(separated[0]);
|
||||
}else {
|
||||
requestType.setLOGIN_ID(loginId);
|
||||
}
|
||||
|
||||
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
String json = GsonHelper.toJson(requestType);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DETAILKOMPETISI();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errMsg = e.getMessage();
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
if(serverResult != null && serverResult.getStatusCode() == 200){
|
||||
try {
|
||||
dataDetail = gson.fromJson(serverResult.getResult(), DetailKompetisiResponse.class);
|
||||
} catch (Exception e) {
|
||||
return e.getMessage();
|
||||
}
|
||||
}else {
|
||||
errMsg = context.getString(R.string.failed_get_data_try_again);
|
||||
}
|
||||
|
||||
return errMsg;
|
||||
} else {
|
||||
errMsg = context.getString(R.string.no_internet_connection);
|
||||
return errMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String s) {
|
||||
super.onPostExecute(s);
|
||||
progressDialog.dismiss();
|
||||
|
||||
if (errMsg.length() > 0) {
|
||||
Toast.makeText(context, errMsg, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if(dataDetail == null || dataDetail.getResultList() == null
|
||||
|| dataDetail.getResultList().isEmpty() || dataDetail.getResultList().get(0).getTEAM_MEMBER() == null){
|
||||
Toast.makeText(context, context.getString(R.string.failed_get_data_try_again), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
adapter.setDataDetailKompetisi(dataDetail);
|
||||
if (Global.userHelpDummyGuide.get(className) !=null &&
|
||||
Global.userHelpDummyGuide.size()>0 &&
|
||||
!Global.userHelpDummyGuide.get(className).isEmpty() &&
|
||||
Global.ENABLE_USER_HELP) {
|
||||
DashboardMyPointItemDummyAdapter dummyAdapter = new DashboardMyPointItemDummyAdapter(context,recyclerViewDashBoard,adapter);
|
||||
recyclerViewDashBoard.setAdapter(dummyAdapter);
|
||||
}else {
|
||||
adapter.notifyDataSetChanged();
|
||||
recyclerViewDashBoard.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector
|
||||
android:name="vector"
|
||||
android:width="84dp"
|
||||
android:height="60dp"
|
||||
android:viewportWidth="84"
|
||||
android:viewportHeight="60">
|
||||
<path
|
||||
android:name="path_1"
|
||||
android:pathData="M 3.536 27.097 L 30.258 53.819 L 80.541 3.536"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeWidth="10"
|
||||
android:trimPathEnd="0"/>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
<target android:name="path_1">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="trimPathEnd"
|
||||
android:duration="500"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
|
@ -0,0 +1,164 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#f2f1ed"
|
||||
android:clipToPadding="false"
|
||||
tools:context=".loyalti.monthlypointacquisition.MonthlyPointsChartView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/chartHeader"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintLeft_toRightOf="@id/guideline1"
|
||||
app:layout_constraintRight_toLeftOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/dummyCardTotalPoin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currentMonthPointText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/current_month_point"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currentMonthPoint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="64"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rataTotalPoints"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:textColor="@color/blazingRed"
|
||||
android:text="-26"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.05"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.95"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/guideline1"
|
||||
app:layout_constraintRight_toLeftOf="@id/guideline2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chartHeader">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyChartContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/yAxisTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/daily_points"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.github.mikephil.charting.charts.BarChart
|
||||
android:id="@+id/dummyMonthlyChart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/yAxisTitle"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyLegendsContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyMonthlyChart">
|
||||
|
||||
<com.adins.mss.base.loyalti.barchart.NonScrollListView
|
||||
android:id="@+id/dummyLegendPoints"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.65" />
|
||||
|
||||
<com.adins.mss.base.loyalti.barchart.NonScrollListView
|
||||
android:id="@+id/dummyLegendRanks"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.35" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -0,0 +1,334 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/taskStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/taskStatusItem0"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/timelineLine" />
|
||||
<ImageView
|
||||
android:id="@+id/taskStatusIcon0"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/task_submitted"
|
||||
android:padding="3dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="10dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtStatus0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/txtTime0"
|
||||
android:text="Title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/txtDesc0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtStatus0"
|
||||
android:text="Description"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/txtTime0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="Time"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="10dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/taskStatusItem1"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/timelineLine" />
|
||||
<ImageView
|
||||
android:id="@+id/taskStatusIcon1"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/task_submitted"
|
||||
android:padding="3dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="10dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtStatus1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/txtTime1"
|
||||
android:text="Title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/txtDesc1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtStatus1"
|
||||
android:text="Description"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/txtTime1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="Time"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="10dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/taskStatusItem2"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/timelineLine" />
|
||||
<ImageView
|
||||
android:id="@+id/taskStatusIcon2"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/task_submitted"
|
||||
android:padding="3dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="10dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtStatus2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/txtTime"
|
||||
android:text="Title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/txtDesc2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtStatus2"
|
||||
android:text="Description"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/txtTime2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="Time"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="10dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/taskStatusItem3"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/timelineLine" />
|
||||
<ImageView
|
||||
android:id="@+id/taskStatusIcon3"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/task_submitted"
|
||||
android:padding="3dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="10dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtStatus3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/txtTime3"
|
||||
android:text="Title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/txtDesc3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtStatus3"
|
||||
android:text="Description"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/txtTime3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="Time"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="10dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/taskStatusItem4"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/timelineLine" />
|
||||
<ImageView
|
||||
android:id="@+id/taskStatusIcon4"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/task_submitted"
|
||||
android:padding="3dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="10dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtStatus4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/txtTime4"
|
||||
android:text="Title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/txtDesc4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtStatus4"
|
||||
android:text="Description"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/txtTime4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="Time"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="10dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,53 @@
|
|||
package com.adins.mss.base.util;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
|
||||
/**
|
||||
* Modification of GenericAsyncTask which will display progress dialog when executing background process
|
||||
*
|
||||
* @author glen.iglesias
|
||||
*/
|
||||
public class LoadingTask extends GenericAsyncTask {
|
||||
private ProgressDialog progressDialog;
|
||||
private Context context;
|
||||
private String loadingMessage = "Loading";
|
||||
|
||||
public LoadingTask(Context context, GenericTaskInterface delegate, String loadingMessage) {
|
||||
super(delegate);
|
||||
this.context = context;
|
||||
if (loadingMessage != null) {
|
||||
this.loadingMessage = loadingMessage;
|
||||
}
|
||||
}
|
||||
|
||||
public LoadingTask(Context context, String loadingMessage) {
|
||||
super(null);
|
||||
this.context = context;
|
||||
if (loadingMessage != null) {
|
||||
this.loadingMessage = loadingMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(context,
|
||||
"", loadingMessage, true);
|
||||
super.onPreExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
super.onPostExecute(result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:background="@drawable/header"
|
||||
app:titleTextAppearance="?android:attr/textAppearanceSmall"
|
||||
android:titleTextColor="@color/fontColorWhite"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||
android:fitsSystemWindows="true"/>
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/printerName"
|
||||
android:textColor="#0b5d66" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" : "
|
||||
android:textColor="#0b5d66" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConnectedDeviceName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="-"
|
||||
android:textColor="#0b5d66"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="10dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_status"
|
||||
android:textColor="#0b5d66"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView16"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" : "
|
||||
android:textColor="#0b5d66"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConnectionStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/not_connected"
|
||||
android:textColor="#0b5d66"
|
||||
android:textStyle="bold" />
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_scan_connect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/connect"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/button_background"
|
||||
android:textColor="@color/fontColorWhite"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/disconnect"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:background="@drawable/button_background"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="3dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_prtbmp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btnPrint"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:background="@drawable/button_background"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="3dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,40 @@
|
|||
package com.adins.mss.base.dynamictheme;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by intishar.fa on 04/09/2018.
|
||||
*/
|
||||
|
||||
public class ThemeItem {
|
||||
|
||||
private String item_id;
|
||||
@SerializedName("itemName")
|
||||
private String itemName;
|
||||
@SerializedName("value")
|
||||
private String value;
|
||||
|
||||
public String getItem_id() {
|
||||
return item_id;
|
||||
}
|
||||
|
||||
public void setItem_id(String item_id) {
|
||||
this.item_id = item_id;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String colorName) {
|
||||
this.itemName = colorName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.acra.util;
|
||||
|
||||
/**
|
||||
* Helps to construct objects via reflection.
|
||||
*/
|
||||
public final class ReflectionHelper {
|
||||
|
||||
public Object create(String className) throws ReflectionException {
|
||||
try {
|
||||
final Class clazz = Class.forName(className);
|
||||
return clazz.newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new ReflectionException("Could not find class : " + className, e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new ReflectionException("Could not instantiate class : " + className, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new ReflectionException("Could not access class : " + className, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.adins.mss.coll.models;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by adityapurwa on 20/03/15.
|
||||
*/
|
||||
public class PaymentHistoryRequest extends MssRequestType {
|
||||
@SerializedName("taskId")
|
||||
public String taskId;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTask_id(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue