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,810 @@
|
|||
package com.adins.mss.coll.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.dynamicform.CustomerFragment;
|
||||
import com.adins.mss.base.dynamicform.DynamicFormActivity;
|
||||
import com.adins.mss.base.dynamicform.form.questions.ImageViewerActivity;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ImageQuestionViewHolder;
|
||||
import com.adins.mss.base.timeline.Constants;
|
||||
import com.adins.mss.base.todolist.form.CashOnHandResponse;
|
||||
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.commons.Toaster;
|
||||
import com.adins.mss.coll.models.DepositReportRequest;
|
||||
import com.adins.mss.coll.models.DepositReportResponse;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.DepositReportD;
|
||||
import com.adins.mss.dao.DepositReportH;
|
||||
import com.adins.mss.dao.Lookup;
|
||||
import com.adins.mss.dao.PrintItem;
|
||||
import com.adins.mss.dao.PrintResult;
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.camerainapp.CameraActivity;
|
||||
import com.adins.mss.foundation.db.dataaccess.DepositReportDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.DepositReportHDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.LookupDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.PrintItemDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.PrintResultDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.UserDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
import com.soundcloud.android.crop.Crop;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DepositReportTransferFragmentNew extends Fragment {
|
||||
|
||||
public static final String uuidLookupDummy = "lookupDummy";
|
||||
private static byte[] byteImage = null;
|
||||
private static Bitmap image = null;
|
||||
private static Bitmap tempImage = null;
|
||||
private View view;
|
||||
private View asBank;
|
||||
private EditText editNamaKasir;
|
||||
private ImageView imageBukti;
|
||||
private Button buttonSelectPhoto;
|
||||
private Button buttonSend;
|
||||
private BankAccountAdapter bankAccountAdapter;
|
||||
private List<Lookup> bankAccountList;
|
||||
private String selectedBank, selectedbankName, selectedBankAccount;
|
||||
private String total = "";
|
||||
private String batchId = "";
|
||||
private String formName = "";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
bankAccountList = new ArrayList<>();
|
||||
bankAccountList.clear();
|
||||
setDummyBankAccountSpinner();
|
||||
String schemeFlag;
|
||||
if (DepositReportRecapitulateFragmentNew.selectedDepositSchemeName.contains("Konven")) {
|
||||
schemeFlag = "KONVEN";
|
||||
} else {
|
||||
schemeFlag = "SYARIAH";
|
||||
}
|
||||
|
||||
bankAccountList.addAll(LookupDataAccess.getAllByLovGroup(getActivity(), "BANK_NAME", GlobalData.getSharedGlobalData().getUser().getBranch_id(), schemeFlag));
|
||||
|
||||
String branchId = DepositReportRecapitulateFragmentNew.selectedDepositUserObject.getBranch_id();
|
||||
if (Global.IS_DEV) {
|
||||
System.out.print(branchId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.fragment_deposit_report_transfer_new, container, false);
|
||||
AppCompatSpinner spinnerBankAccount = (AppCompatSpinner) view.findViewById(R.id.spinnerBankAccount);
|
||||
bankAccountAdapter = new BankAccountAdapter(getActivity(), R.layout.spinner_style, R.id.text_spin, bankAccountList);
|
||||
bankAccountAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||
|
||||
spinnerBankAccount.setAdapter(bankAccountAdapter);
|
||||
spinnerBankAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (position == 0) {
|
||||
selectedBank = bankAccountAdapter.getItem(position).getValue();
|
||||
selectedbankName = "";
|
||||
selectedBankAccount = "";
|
||||
} else {
|
||||
selectedBank = bankAccountAdapter.getItem(position).getValue();
|
||||
selectedBank = selectedBank.replace(" ", "");
|
||||
String[] answers = Tool.split(selectedBank, "|");
|
||||
selectedbankName = answers[0];
|
||||
selectedBankAccount = answers[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setLabel() {
|
||||
if (view != null) {
|
||||
TextView txtNamaKasir = (TextView) view.findViewById(R.id.txtCashierName);
|
||||
TextView txtBuktiTransfer = (TextView) view.findViewById(R.id.txtBuktiTransfer);
|
||||
|
||||
txtNamaKasir.setText(getActivity().getString(R.string.label_cashier_name_2));
|
||||
txtBuktiTransfer.setText(getActivity().getString(R.string.label_transfer_evidence_2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
total = getArguments().getString("TOTAL_DEPOSIT");
|
||||
batchId = getArguments().getString("BATCHID");
|
||||
formName = getArguments().getString("FORM");
|
||||
asBank = view.findViewById(R.id.transferAsBank);
|
||||
View asCashier = view.findViewById(R.id.transferAsCashier);
|
||||
|
||||
asCashier.setVisibility(View.GONE);
|
||||
asBank.setVisibility(View.VISIBLE);
|
||||
|
||||
editNamaKasir = (EditText) view.findViewById(R.id.editNamaKasir);
|
||||
imageBukti = (ImageView) view.findViewById(R.id.imageBukti);
|
||||
buttonSelectPhoto = (Button) view.findViewById(R.id.buttonSelectPhoto);
|
||||
buttonSend = (Button) view.findViewById(R.id.buttonSend);
|
||||
|
||||
setLabel();
|
||||
imageBukti.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View paramView) {
|
||||
if (imageBukti.getDrawable() != null && image != null) {
|
||||
if (byteImage == null)
|
||||
byteImage = Utils.bitmapToByte(tempImage);
|
||||
imageBukti.setDrawingCacheEnabled(true);
|
||||
imageBukti.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
|
||||
imageBukti.buildDrawingCache();
|
||||
image = Bitmap.createBitmap(imageBukti.getDrawingCache(true));
|
||||
Global.isViewer = true;
|
||||
|
||||
Global.isViewer = true;
|
||||
Bundle extras = new Bundle();
|
||||
extras.putByteArray(ImageViewerActivity.BUND_KEY_IMAGE, byteImage);
|
||||
extras.putInt(ImageViewerActivity.BUND_KEY_IMAGE_QUALITY, Utils.picQuality);
|
||||
extras.putBoolean(ImageViewerActivity.BUND_KEY_IMAGE_ISVIEWER, Global.isViewer);
|
||||
Intent intent = new Intent(getActivity(), ImageViewerActivity.class);
|
||||
intent.putExtras(extras);
|
||||
imageBukti.setDrawingCacheEnabled(false);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttonSelectPhoto.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Constants.flag_edit = 2;
|
||||
openCameraApp(getActivity());
|
||||
}
|
||||
});
|
||||
|
||||
buttonSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
buttonSend.setClickable(false);
|
||||
buttonSelectPhoto.setClickable(false);
|
||||
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
new SendDepositReportTask(getActivity()).
|
||||
execute(selectedBankAccount,
|
||||
selectedbankName,
|
||||
editNamaKasir.getText().toString().trim(),
|
||||
String.valueOf(asBank.getVisibility()));
|
||||
} else {
|
||||
Toaster.warning(getActivity(), getActivity().getString(R.string.failed_send_data));
|
||||
buttonSend.setClickable(true);
|
||||
buttonSelectPhoto.setClickable(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
menu.findItem(R.id.menuMore).setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == Utils.REQUEST_IN_APP_CAMERA && resultCode == Activity.RESULT_OK) {
|
||||
Bundle bundle = data.getExtras();
|
||||
if (bundle != null) {
|
||||
Uri uri = Uri.parse(bundle.getString(CameraActivity.PICTURE_URI));
|
||||
File file = new File(uri.getPath());
|
||||
image = Utils.pathToBitmapWithRotation(file);
|
||||
tempImage = Utils.pathToBitmapWithRotation(file);
|
||||
byteImage = Utils.pathBitmapToByteWithRotation(file);
|
||||
imageBukti.setImageBitmap(image);
|
||||
}
|
||||
} else if (requestCode == Utils.REQUEST_CAMERA && resultCode == Activity.RESULT_OK) {
|
||||
Uri uri = Uri.parse(DynamicFormActivity.mCurrentPhotoPath);
|
||||
File file = new File(uri.getPath());
|
||||
image = Utils.pathToBitmapWithRotation(file);
|
||||
byteImage = Utils.pathBitmapToByteWithRotation(file);
|
||||
tempImage = Utils.pathToBitmapWithRotation(file);
|
||||
imageBukti.setImageBitmap(image);
|
||||
} else if (requestCode == Crop.REQUEST_PICK && resultCode == Activity.RESULT_OK) {
|
||||
Uri outputUri = data.getData();
|
||||
try {
|
||||
image = BitmapFactory.decodeStream(getActivity().getContentResolver().openInputStream(outputUri));
|
||||
tempImage = BitmapFactory.decodeStream(getActivity().getContentResolver().openInputStream(outputUri));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
imageBukti.setImageBitmap(image);
|
||||
}
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
private void openCameraApp(FragmentActivity mActivity) {
|
||||
if (GlobalData.getSharedGlobalData().isUseOwnCamera()) {
|
||||
int quality = Utils.picQuality;
|
||||
int thumbHeight = Utils.picHeight;
|
||||
int thumbWidht = Utils.picWidth;
|
||||
|
||||
Intent intent = new Intent(mActivity, CameraActivity.class);
|
||||
intent.putExtra(CameraActivity.PICTURE_WIDTH, thumbWidht);
|
||||
intent.putExtra(CameraActivity.PICTURE_HEIGHT, thumbHeight);
|
||||
intent.putExtra(CameraActivity.PICTURE_QUALITY, quality);
|
||||
|
||||
startActivityForResult(intent, Utils.REQUEST_IN_APP_CAMERA);
|
||||
} else {
|
||||
try {
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
if (intent.resolveActivity(mActivity.getPackageManager()) != null) {
|
||||
File photoFile = null;
|
||||
try {
|
||||
photoFile = ImageQuestionViewHolder.createImageFile(getActivity());
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (photoFile != null) {
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intent, Utils.REQUEST_CAMERA);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void generatePrintResultDepReport(Activity activity, String cashierName, DepositReportH report) {
|
||||
List<PrintItem> printItemList = PrintItemDataAccess.getAll(activity, "DUMYUUIDSCHEMEFORDEPOSITREPORT");
|
||||
|
||||
//delete dulu yang ada di database, karena generate printResult dengan jawaban yang baru
|
||||
List<PrintResult> printResultByTaskH = PrintResultDataAccess.getAll(activity, report.getBatch_id());
|
||||
if (printResultByTaskH.size() > 0) {
|
||||
PrintResultDataAccess.delete(activity, report.getBatch_id());
|
||||
}
|
||||
PrintResult PRtransferBy = new PrintResult(Tool.getUUID());
|
||||
PRtransferBy.setPrint_type_id(Global.PRINT_ANSWER);
|
||||
PRtransferBy.setUser(GlobalData.getSharedGlobalData().getUser());
|
||||
PRtransferBy.setUuid_task_h(report.getBatch_id());
|
||||
for (PrintItem bean : printItemList) {
|
||||
PrintResult printResult = new PrintResult(Tool.getUUID());
|
||||
printResult.setPrint_type_id(bean.getPrint_type_id());
|
||||
printResult.setUser(GlobalData.getSharedGlobalData().getUser());
|
||||
printResult.setUuid_task_h(report.getBatch_id());
|
||||
|
||||
if (bean.getPrint_type_id().equals(Global.PRINT_ANSWER)) {
|
||||
String label = bean.getPrint_item_label();
|
||||
if (label.equals("Batch ID")) {
|
||||
printResult.setLabel(label);
|
||||
printResult.setValue(report.getBatch_id());
|
||||
} else if (label.equals("Transfer By")) {
|
||||
printResult.setLabel(label);
|
||||
if (cashierName != null && cashierName.length() > 0) {
|
||||
printResult.setValue("Cashier");
|
||||
PRtransferBy.setLabel(label);
|
||||
PRtransferBy.setValue("Cashier");
|
||||
} else {
|
||||
printResult.setValue("Bank");
|
||||
PRtransferBy.setLabel(label);
|
||||
PRtransferBy.setValue("Bank");
|
||||
}
|
||||
} else if (label.equals("Cashier Name")) {
|
||||
if (PRtransferBy.getValue().equals("Cashier")) {
|
||||
printResult.setLabel(label);
|
||||
printResult.setValue(report.getCashier_name());
|
||||
}
|
||||
} else if (label.equals("Account No")) {
|
||||
if (PRtransferBy.getValue().equals("Bank")) {
|
||||
printResult.setLabel(label);
|
||||
printResult.setValue(report.getBank_account());
|
||||
}
|
||||
} else if (label.equals("Bank Name")) {
|
||||
if (PRtransferBy.getValue().equals("Bank")) {
|
||||
printResult.setLabel(label);
|
||||
printResult.setValue(report.getBank_name());
|
||||
}
|
||||
} else if (label.contains("Agreement No")) {
|
||||
int no = Integer.valueOf(label.replace("Agreement No", ""));
|
||||
printResult.setLabel("Agreement No");
|
||||
List<DepositReportD> reportDs = report
|
||||
.getDepositReportDList();
|
||||
try {
|
||||
TaskH taskHs = TaskHDataAccess.getOneHeader(activity,
|
||||
reportDs.get(no).getUuid_task_h());
|
||||
String agreement_no = "";
|
||||
if (taskHs != null)
|
||||
agreement_no = taskHs.getAppl_no();
|
||||
if (agreement_no == null)
|
||||
agreement_no = "-";
|
||||
printResult.setValue(agreement_no);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (label.contains("Deposit Amount")) {
|
||||
int no = Integer.valueOf(label
|
||||
.replace("Deposit Amount", ""));
|
||||
printResult.setLabel("Deposit Amt");
|
||||
List<DepositReportD> reportDs = report
|
||||
.getDepositReportDList();
|
||||
try {
|
||||
printResult.setValue(Tool.separateThousand(reportDs
|
||||
.get(no).getDeposit_amt()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (label.equals("Total")) {
|
||||
printResult.setLabel(label);
|
||||
printResult.setValue(String.valueOf(Tool
|
||||
.separateThousand(total)));
|
||||
}
|
||||
} else if (bean.getPrint_type_id().equals(
|
||||
Global.PRINT_BRANCH_ADDRESS)) {
|
||||
printResult.setLabel(GlobalData.getSharedGlobalData().getUser()
|
||||
.getBranch_address());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_BRANCH_NAME)) {
|
||||
printResult.setLabel(GlobalData.getSharedGlobalData().getUser()
|
||||
.getBranch_name());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_BT_ID)) {
|
||||
String btAddr = "?";
|
||||
try {
|
||||
btAddr = BluetoothAdapter.getDefaultAdapter().getAddress();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue(btAddr);
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_LABEL)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_LABEL_BOLD)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id()
|
||||
.equals(Global.PRINT_LABEL_CENTER)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(
|
||||
Global.PRINT_LABEL_CENTER_BOLD)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_LOGO)) {
|
||||
printResult.setLabel("");
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_NEW_LINE)) {
|
||||
String label = bean.getPrint_item_label();
|
||||
int no = Integer.valueOf(label.replace("New Line", ""));
|
||||
List<DepositReportD> reportDs = report.getDepositReportDList();
|
||||
int size = reportDs.size();
|
||||
if (no < size) {
|
||||
printResult.setLabel("------------------------------");
|
||||
printResult.setValue("\n");
|
||||
}
|
||||
if (no == 999) {
|
||||
printResult.setLabel("==============================");
|
||||
printResult.setValue("\n");
|
||||
}
|
||||
if (no == 998) {
|
||||
printResult.setLabel("\n");
|
||||
printResult.setValue("\n");
|
||||
}
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_TIMESTAMP)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue("");
|
||||
} else if (bean.getPrint_type_id().equals(Global.PRINT_USER_NAME)) {
|
||||
printResult.setLabel(bean.getPrint_item_label());
|
||||
printResult.setValue(GlobalData.getSharedGlobalData().getUser()
|
||||
.getFullname());
|
||||
}
|
||||
if (printResult.getLabel() != null) {
|
||||
PrintResultDataAccess.add(activity, printResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDummyBankAccountSpinner() {
|
||||
Lookup bankAccountDummy = new Lookup();
|
||||
bankAccountDummy.setUuid_lookup(uuidLookupDummy);
|
||||
bankAccountDummy.setValue(getString(R.string.choose_one));
|
||||
|
||||
bankAccountList.add(0, bankAccountDummy);
|
||||
}
|
||||
|
||||
public class SendDepositReportTask extends AsyncTask<String, Void, List<String>> {
|
||||
String namaKasir;
|
||||
private ProgressDialog progressDialog;
|
||||
private final FragmentActivity activity;
|
||||
private DepositReportH header;
|
||||
private ArrayList<DepositReportD> details;
|
||||
private String errMsg;
|
||||
private StringBuilder sb;
|
||||
|
||||
public SendDepositReportTask(FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
this.progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.progressSend), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> doInBackground(String... params) {
|
||||
List<String> results = new ArrayList<>();
|
||||
String result = "";
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
sb = new StringBuilder();
|
||||
|
||||
DepositReportRequest request = new DepositReportRequest();
|
||||
request.addImeiAndroidIdToUnstructured();
|
||||
header = new DepositReportH();
|
||||
header.setCashier_name("");
|
||||
header.setUuid_deposit_report_h(Tool.getUUID());
|
||||
header.setBatch_id(batchId);
|
||||
header.setFlag(formName);
|
||||
header.setTransfered_date(Tool.getSystemDateTime());
|
||||
header.setDtm_crt(Tool.getSystemDateTime());
|
||||
header.setUuid_user(DepositReportRecapitulateFragmentNew.selectedDepositUser);
|
||||
header.setUser(DepositReportRecapitulateFragmentNew.selectedDepositUserObject);
|
||||
if (null != header.getUuid_user() && !"".equals(header.getUuid_user())) {
|
||||
header.setUsr_crt(header.getUuid_user());
|
||||
} else {
|
||||
header.setUsr_crt(GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
}
|
||||
|
||||
if (params[3].equals(String.valueOf(View.VISIBLE))) {
|
||||
String noRek = params[0];
|
||||
String bankName = params[1];
|
||||
|
||||
if (noRek != null && noRek.length() > 0) {
|
||||
header.setBank_account(noRek);
|
||||
header.setBank_name(bankName);
|
||||
} else {
|
||||
sb.append(getActivity().getString(R.string.transfer_to_required));
|
||||
}
|
||||
|
||||
if (image == null) {
|
||||
sb.append(getActivity().getString(R.string.evidence_required));
|
||||
} else {
|
||||
try {
|
||||
byteImage = Utils.bitmapToByte(tempImage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (byteImage != null)
|
||||
header.setImage(byteImage);
|
||||
else
|
||||
sb.append(getActivity().getString(R.string.evidence_required));
|
||||
}
|
||||
} else {
|
||||
namaKasir = params[2];
|
||||
if (namaKasir != null && namaKasir.length() > 0) {
|
||||
header.setCashier_name(namaKasir);
|
||||
} else {
|
||||
sb.append(getActivity().getString(R.string.cashier_required));
|
||||
}
|
||||
}
|
||||
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
request.setReportHeader(header);
|
||||
|
||||
if (sb.length() > 0) {
|
||||
result = sb.toString();
|
||||
results.add(0, result);
|
||||
} else {
|
||||
details = new ArrayList<DepositReportD>();
|
||||
List<TaskD> tasks = TaskDDataAccess.getTaskDTagTotalbyBatchId(getActivity(), DepositReportRecapitulateFragmentNew.selectedBatchId);
|
||||
List<TaskD> reportsReconcile = new ArrayList<TaskD>();
|
||||
|
||||
for (TaskD taskD : tasks) {
|
||||
TaskH taskH = TaskHDataAccess.getOneHeader(getActivity(), taskD.getUuid_task_h());
|
||||
if (taskH.getIs_reconciled().equals("0")) {
|
||||
reportsReconcile.add(taskD);
|
||||
}
|
||||
}
|
||||
for (TaskD task : reportsReconcile) {
|
||||
DepositReportD detail = new DepositReportD();
|
||||
detail.setUuid_task_h(task.getTaskH().getUuid_task_h());
|
||||
detail.setDtm_crt(Tool.getSystemDateTime());
|
||||
detail.setUsr_crt(DepositReportRecapitulateFragmentNew.selectedDepositUser);
|
||||
detail.setUuid_deposit_report_d(Tool.getUUID());
|
||||
String value = task.getText_answer();
|
||||
|
||||
if (value == null || value.equals(""))
|
||||
value = "0";
|
||||
String tempAnswer = Tool.deleteAll(value, ",");
|
||||
String[] intAnswer = Tool.split(tempAnswer, ".");
|
||||
if (intAnswer.length > 1) {
|
||||
if (intAnswer[1].equals("00")) {
|
||||
value = intAnswer[0];
|
||||
} else {
|
||||
value = tempAnswer;
|
||||
}
|
||||
} else {
|
||||
value = tempAnswer;
|
||||
}
|
||||
|
||||
detail.setDeposit_amt(value);
|
||||
|
||||
detail.setUuid_deposit_report_h(header.getUuid_deposit_report_h());
|
||||
details.add(detail);
|
||||
}
|
||||
|
||||
request.setListReportDetail(details);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_SENDDEPOSITREPORT();
|
||||
String json = GsonHelper.toJson(request);
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
// Firebase Performance Trace Network 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();
|
||||
}
|
||||
|
||||
MssRequestType cohRequest = new MssRequestType();
|
||||
cohRequest.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
cohRequest.addImeiAndroidIdToUnstructured();
|
||||
String urlCoh = GlobalData.getSharedGlobalData().getURL_UPDATE_CASH_ON_HAND();
|
||||
String jsonCoh = GsonHelper.toJson(cohRequest);
|
||||
HttpConnectionResult serverResultCoh = null;
|
||||
// Firebase Performance Trace Network Request
|
||||
HttpMetric networkMetricCoh = FirebasePerformance.getInstance().newHttpMetric(
|
||||
url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetricCoh, jsonCoh);
|
||||
|
||||
try {
|
||||
serverResultCoh = httpConn.requestToServer(urlCoh, jsonCoh, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetricCoh, serverResultCoh);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errMsg = e.getMessage();
|
||||
}
|
||||
|
||||
try {
|
||||
if (serverResult != null) {
|
||||
result = serverResult.getResult();
|
||||
}
|
||||
results.add(0, result);
|
||||
String resultCoh = null;
|
||||
if (serverResultCoh != null) {
|
||||
resultCoh = serverResultCoh.getResult();
|
||||
}
|
||||
results.add(1, resultCoh);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = getActivity().getString(R.string.no_internet_connection);
|
||||
results.add(0, result);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<String> results) {
|
||||
boolean error = false;
|
||||
if (progressDialog.isShowing()) {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
imageBukti.setDrawingCacheEnabled(false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (Global.IS_DEV)
|
||||
System.out.println(results);
|
||||
if (errMsg != null) {
|
||||
final NiftyDialogBuilder dialog = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialog.withTitle(getActivity().getString(R.string.error_capital)).withMessage(this.errMsg).
|
||||
withButton1Text("OK").
|
||||
setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View paramView) {
|
||||
dialog.dismiss();
|
||||
CustomerFragment.doBack(getActivity());
|
||||
}
|
||||
}).
|
||||
isCancelable(false).show();
|
||||
error = true;
|
||||
} else {
|
||||
if (getActivity().getString(R.string.no_internet_connection).equals(results.get(0))) {
|
||||
Toaster.warning(getActivity(), results.get(0));
|
||||
error = true;
|
||||
} else {
|
||||
if (sb != null && sb.length() > 0) {
|
||||
Toaster.warning(getActivity(), results.get(0));
|
||||
error = true;
|
||||
} else {
|
||||
try {
|
||||
DepositReportResponse responseType = GsonHelper.fromJson(results.get(0), DepositReportResponse.class);
|
||||
if (responseType.getStatus().getCode() == 0) {
|
||||
header.setBatch_id(responseType.getBatchId());
|
||||
DepositReportHDataAccess.add(getActivity(), header);
|
||||
for (DepositReportD reportD : details) {
|
||||
reportD.setIs_sent(Global.TRUE_STRING);
|
||||
reportD.setDepositReportH(header);
|
||||
DepositReportDDataAccess.add(getActivity(), reportD);
|
||||
}
|
||||
generatePrintResultDepReport(getActivity(), namaKasir, header);
|
||||
|
||||
if (results.size() == 2) {
|
||||
try {
|
||||
CashOnHandResponse cashOnHandResponse = GsonHelper.fromJson(results.get(1), CashOnHandResponse.class);
|
||||
if (cashOnHandResponse.getStatus().getCode() == 0) {
|
||||
User user = GlobalData.getSharedGlobalData().getUser();
|
||||
user.setCash_on_hand(cashOnHandResponse.getCashOnHand());
|
||||
GlobalData.getSharedGlobalData().getUser().setCash_on_hand(
|
||||
cashOnHandResponse.getCashOnHand()
|
||||
);
|
||||
UserDataAccess.addOrReplace(getActivity(), user);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
final NiftyDialogBuilder dialog = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialog.withTitle(getActivity().getString(R.string.success)).
|
||||
withMessage(getActivity().getString(R.string.success_deposit)).
|
||||
withButton1Text("OK").
|
||||
setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View paramView) {
|
||||
dialog.dismiss();
|
||||
CustomerFragment.doBack(getActivity());
|
||||
CustomerFragment.doBack(getActivity());
|
||||
DepositReportDetailActivity.report = header;
|
||||
Intent intent = new Intent(getActivity(), DepositReportDetailActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}).
|
||||
isCancelable(false).show();
|
||||
} else {
|
||||
final NiftyDialogBuilder dialog = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialog.withTitle(getActivity().getString(R.string.error_capital)).withMessage(responseType.getStatus().getMessage()).
|
||||
withButton1Text("OK").
|
||||
setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View paramView) {
|
||||
dialog.dismiss();
|
||||
CustomerFragment.doBack(getActivity());
|
||||
}
|
||||
}).
|
||||
isCancelable(false).show();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
Toaster.warning(getActivity(), results.get(0));
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
buttonSend.setClickable(true);
|
||||
buttonSelectPhoto.setClickable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BankAccountAdapter extends ArrayAdapter<Lookup> {
|
||||
private final Context context;
|
||||
private final List<Lookup> values;
|
||||
|
||||
public BankAccountAdapter(Context context, int resource, int textViewResourceId, List<Lookup> objects) {
|
||||
super(context, resource, textViewResourceId, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Lookup getItem(int position) {
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getValue());
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getValue());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#fbb34c"
|
||||
android:endColor="#d98002"
|
||||
android:angle="270" />
|
||||
<corners
|
||||
android:radius="0dp" />
|
||||
<!-- <padding -->
|
||||
<!-- android:left="10dp" -->
|
||||
<!-- android:top="10dp" -->
|
||||
<!-- android:right="10dp" -->
|
||||
<!-- android:bottom="10dp" /> -->
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView 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/list"
|
||||
android:name="com.adins.mss.coll.fragments.DashBoardFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:context="com.adins.mss.coll.fragments.DashBoardFragment"
|
||||
tools:listitem="@layout/fragment_dashboard" />
|
|
@ -0,0 +1,42 @@
|
|||
package com.adins.mss.odr.news;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class NewsListAdapter extends ArrayAdapter{
|
||||
private List<MobileContentH> objects;
|
||||
private Context context;
|
||||
private AQuery query;
|
||||
|
||||
public NewsListAdapter(Context context, List<MobileContentH> objects) {
|
||||
super(context, R.layout.news_listparent_item_layout);
|
||||
this.objects = objects;
|
||||
this.context = context;
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return objects.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.news_listparent_item_layout, parent, false);
|
||||
}
|
||||
MobileContentH contentH = objects.get(position);
|
||||
TextView textView = (TextView)convertView.findViewById(R.id.titleNewsParent);
|
||||
textView.setText(contentH.getContent_name());
|
||||
// query.id(R.id.titleNewsParent).text(contentH.getContent_name());
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import com.adins.mss.base.util.ExcludeFromGson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
|
||||
/**
|
||||
* Entity mapped to table "TR_RECEIPTHISTORY".
|
||||
*/
|
||||
public class ReceiptHistory {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_receipt_history")
|
||||
private String uuid_receipt_history;
|
||||
@SerializedName("uuid_task_h")
|
||||
private String uuid_task_h;
|
||||
@SerializedName("agreementNo")
|
||||
private String agreement_no;
|
||||
@SerializedName("invoiceNo")
|
||||
private String receipt_no;
|
||||
@SerializedName("valueDt")
|
||||
private String payment_date;
|
||||
|
||||
public ReceiptHistory() {
|
||||
}
|
||||
|
||||
public ReceiptHistory(String uuid_receipt_history) {
|
||||
this.uuid_receipt_history = uuid_receipt_history;
|
||||
}
|
||||
|
||||
public ReceiptHistory(String uuid_receipt_history, String uuid_task_h, String agreement_no, String receipt_no, String payment_date) {
|
||||
this.uuid_receipt_history = uuid_receipt_history;
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
this.agreement_no = agreement_no;
|
||||
this.receipt_no = receipt_no;
|
||||
this.payment_date = payment_date;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_receipt_history() {
|
||||
return uuid_receipt_history;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_receipt_history(String uuid_receipt_history) {
|
||||
this.uuid_receipt_history = uuid_receipt_history;
|
||||
}
|
||||
|
||||
public String getUuid_task_h() {
|
||||
return uuid_task_h;
|
||||
}
|
||||
|
||||
public void setUuid_task_h(String uuid_task_h) {
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
}
|
||||
|
||||
public String getAgreement_no() {
|
||||
return agreement_no;
|
||||
}
|
||||
|
||||
public void setAgreement_no(String agreement_no) {
|
||||
this.agreement_no = agreement_no;
|
||||
}
|
||||
|
||||
public String getReceipt_no() {
|
||||
return receipt_no;
|
||||
}
|
||||
|
||||
public void setReceipt_no(String receipt_no) {
|
||||
this.receipt_no = receipt_no;
|
||||
}
|
||||
|
||||
public String getPayment_date() {
|
||||
return payment_date;
|
||||
}
|
||||
|
||||
public void setPayment_date(String payment_date) {
|
||||
this.payment_date = payment_date;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 839 B |
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/loginLayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/bg_grayscale"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible" >
|
||||
|
||||
<include
|
||||
android:id="@+id/include1"
|
||||
layout="@layout/footer" />
|
||||
|
||||
<!-- <CheckBox -->
|
||||
<!-- android:id="@+id/cbShowPassword" -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:layout_below="@+id/relativeLayout2" -->
|
||||
<!-- android:text="Show Password" -->
|
||||
<!-- android:textAppearance="?android:attr/textAppearanceSmall" -->
|
||||
<!-- android:textColor="@color/tv_darker" -->
|
||||
<!-- android:visibility="visible" /> -->
|
||||
|
||||
|
||||
<!-- <Button -->
|
||||
<!-- android:id="@+id/btnLogin" -->
|
||||
<!-- android:layout_width="fill_parent" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:layout_below="@+id/cbShowPassword" -->
|
||||
<!-- android:layout_centerHorizontal="true" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:background="@drawable/button_background" -->
|
||||
<!-- android:text="@string/btnLogin" -->
|
||||
<!-- android:textColor="#ffffff" /> -->
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbShowPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/relativeLayout2"
|
||||
android:text="@string/lblShowPassword"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/tv_darker"
|
||||
android:visibility="visible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/include1"
|
||||
android:layout_below="@+id/profilePicture" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="20dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/txtUserId"
|
||||
android:layout_below="@+id/txtUserId"
|
||||
android:layout_marginTop="7dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/password"
|
||||
android:textColor="#000000"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/txtPassword"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/login_desc"
|
||||
android:textColor="#001135" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contentComment"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/txtPassword"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/user_id"
|
||||
android:textColor="#000000"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtPassword"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView2"
|
||||
android:layout_marginTop="7dp"
|
||||
android:drawableLeft="@drawable/ms_lock_icon_black"
|
||||
android:ems="10"
|
||||
android:hint="@string/lblLoginPassword"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/tv_darker"
|
||||
android:textColorHint="@color/tv_darker" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtUserId"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/txtPassword"
|
||||
android:layout_below="@+id/textView3"
|
||||
android:drawableLeft="@drawable/ms_user_icon_black"
|
||||
android:ems="10"
|
||||
android:hint="@string/lblLoginId"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/tv_darker"
|
||||
android:textColorHint="@color/tv_darker" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/txtUserId"
|
||||
android:background="@color/tv_normal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" >
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/include1"
|
||||
android:layout_alignParentRight="true"
|
||||
android:weightSum="1"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_below="@+id/cbShowPassword" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLogin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/btnLogin"
|
||||
android:textColor="#ffffff"
|
||||
android:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnExit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/button_background"
|
||||
android:text="@string/btnExit"
|
||||
android:textColor="#ffffff"
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbRememberMe2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignRight="@+id/include1"
|
||||
android:layout_below="@+id/relativeLayout2"
|
||||
android:text="@string/lblRememberMe"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/tv_darker"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profilePicture"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/dummy" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,212 @@
|
|||
package com.adins.mss.base.pdfrenderer;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.pdf.PdfRenderer;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.constant.Global;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ViewPdfRendererFragment extends FragmentActivity implements View.OnClickListener {
|
||||
|
||||
private static final int MAX_BITMAP_SIZE = 100 * 1024 * 1024; // 100 MB
|
||||
private static final float DEFAULT_ZOOM = 1;
|
||||
private float currentZoomLevel = DEFAULT_ZOOM;
|
||||
|
||||
private ParcelFileDescriptor mFileDescriptor;
|
||||
private PdfRenderer mPdfRenderer;
|
||||
private PdfRenderer.Page mCurrentPage;
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ImageView mButtonZoomOut;
|
||||
|
||||
private String urlFileName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.fragment_view_pdf_renderer);
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.recycleViewPdf);
|
||||
ImageView mButtonZoomIn = (ImageView) findViewById(R.id.btnZoomIn);
|
||||
mButtonZoomOut = (ImageView) findViewById(R.id.btnZoomOut);
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this,
|
||||
LinearLayoutManager.VERTICAL, false);
|
||||
mRecyclerView.setLayoutManager(linearLayoutManager);
|
||||
|
||||
urlFileName = getIntent().getStringExtra("FILE_LOC");
|
||||
|
||||
mButtonZoomIn.setOnClickListener(this);
|
||||
mButtonZoomOut.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
try {
|
||||
openRenderer(urlFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, getString(R.string.not_available), Toast.LENGTH_SHORT).show();
|
||||
this.finish();
|
||||
} catch (Exception e) {
|
||||
if (Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Toast.makeText(this, getString(R.string.not_available), Toast.LENGTH_SHORT).show();
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void openRenderer(String urlFileName) throws IOException {
|
||||
File file = new File(urlFileName);
|
||||
mFileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
|
||||
mPdfRenderer = new PdfRenderer(mFileDescriptor);
|
||||
showPagePdf();
|
||||
}
|
||||
|
||||
private void showPagePdf() {
|
||||
ArrayList<Bitmap> bitmaps = new ArrayList<>();
|
||||
for (int i = 0; i < getPageCount(); i++) {
|
||||
Bitmap bitmap = getPagePdf(i);
|
||||
bitmaps.add(bitmap);
|
||||
if (mCurrentPage != null) {
|
||||
mCurrentPage.close();
|
||||
}
|
||||
}
|
||||
|
||||
ViewPdfAdapter adapter = new ViewPdfAdapter(bitmaps);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
updateUi();
|
||||
}
|
||||
|
||||
private void updateUi() {
|
||||
mButtonZoomOut.setActivated(true);
|
||||
if (currentZoomLevel == 1) {
|
||||
mButtonZoomOut.setActivated(false);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private Bitmap getPagePdf(int i) {
|
||||
if (getPageCount() <= i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mCurrentPage = mPdfRenderer.openPage(i);
|
||||
float nPercentW = ((float) getResources().getDisplayMetrics().widthPixels / (float) mCurrentPage.getWidth() * currentZoomLevel);
|
||||
|
||||
int newWidth = Math.max(Math.round(mCurrentPage.getWidth() * nPercentW), 1);
|
||||
int newHeight = Math.max(Math.round(mCurrentPage.getHeight() * nPercentW), 1);
|
||||
Bitmap bitmap = Bitmap.createBitmap(newWidth, newHeight, Bitmap.Config.ARGB_8888);
|
||||
|
||||
if (bitmap.getByteCount() <= MAX_BITMAP_SIZE) {
|
||||
// Matrix matrix = new Matrix();
|
||||
// float dpiAdjustedZoomLevel = currentZoomLevel * DisplayMetrics.DENSITY_HIGH / getResources().getDisplayMetrics().densityDpi;
|
||||
// matrix.setScale(dpiAdjustedZoomLevel, dpiAdjustedZoomLevel);
|
||||
|
||||
mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
|
||||
return bitmap;
|
||||
} else {
|
||||
Toast.makeText(this, "Zoom has reached Max!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private int getPageCount() {
|
||||
return mPdfRenderer.getPageCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
try {
|
||||
closeRenderer();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private void closeRenderer() throws IOException {
|
||||
if (mCurrentPage != null) {
|
||||
mCurrentPage.close();
|
||||
mCurrentPage = null;
|
||||
}
|
||||
if (mPdfRenderer != null) {
|
||||
mPdfRenderer.close();
|
||||
}
|
||||
if (mFileDescriptor != null) {
|
||||
mFileDescriptor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int button = v.getId();
|
||||
if (button == R.id.btnZoomOut) {
|
||||
if (currentZoomLevel - 1 > 0) {
|
||||
--currentZoomLevel;
|
||||
showPagePdf();
|
||||
}
|
||||
} else if (button == R.id.btnZoomIn) {
|
||||
++currentZoomLevel;
|
||||
showPagePdf();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ViewPdfAdapter extends RecyclerView.Adapter<ViewPdfAdapter.ViewHolder> {
|
||||
List<Bitmap> dataPdf;
|
||||
|
||||
public ViewPdfAdapter(List<Bitmap> dataPdf) {
|
||||
this.dataPdf = dataPdf;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewPdfAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_view_pdf_page, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
holder.imageView.setImageBitmap(dataPdf.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataPdf.size();
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView imageView;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
imageView = (ImageView) itemView.findViewById(R.id.imageViewPdf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
package com.adins.mss.base.tasklog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Lookup;
|
||||
import com.adins.mss.dao.Scheme;
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.LookupDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskLogArrayAdapter extends ArrayAdapter<TaskH> {
|
||||
|
||||
boolean isLog = false;
|
||||
private Context context;
|
||||
private List<TaskH> objects;
|
||||
|
||||
public TaskLogArrayAdapter(Context context,
|
||||
List<TaskH> objects) {
|
||||
super(context, R.layout.log_item_layout, objects);
|
||||
this.context = context;
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
public TaskLogArrayAdapter(Context context,
|
||||
List<TaskH> objects, boolean isLog) {
|
||||
super(context, R.layout.new_log_item, objects);
|
||||
this.context = context;
|
||||
this.objects = objects;
|
||||
this.isLog = isLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (objects != null)
|
||||
return objects.size();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
|
||||
if (null == convertView) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.new_log_item, parent, false);
|
||||
}
|
||||
|
||||
TextView txtName = (TextView) convertView.findViewById(R.id.taskName);
|
||||
TextView txtTime = (TextView) convertView.findViewById(R.id.txtTime);
|
||||
TextView txtScheme = (TextView) convertView.findViewById(R.id.taskForm);
|
||||
TextView txtCollResult = (TextView) convertView.findViewById(R.id.taskCollResult);
|
||||
ImageView logIcon = (ImageView) convertView.findViewById(R.id.logIcon);
|
||||
ImageView imgPrint = (ImageView) convertView.findViewById(R.id.imgPrint);
|
||||
|
||||
TaskH task = objects.get(position);
|
||||
String taskId = task.getTask_id();
|
||||
String custName = task.getCustomer_name();
|
||||
String formId = "";
|
||||
if (task.getScheme() != null)
|
||||
formId = task.getScheme().getForm_id();
|
||||
Date dTime = task.getSubmit_date();
|
||||
String sTime = "";
|
||||
try {
|
||||
sTime = Formatter.formatDate(dTime, Global.DATE_TIME_STR_FORMAT);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
try {
|
||||
sTime = Formatter.formatDate(task.getDtm_crt(), Global.DATE_TIME_STR_FORMAT);
|
||||
} catch (Exception e2) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (taskId != null) {
|
||||
if (taskId.contains("belum di-mapping")) {
|
||||
txtScheme.setText(taskId);
|
||||
txtTime.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtScheme.setText(formId);
|
||||
txtTime.setVisibility(View.VISIBLE);
|
||||
txtTime.setText(sTime);
|
||||
}
|
||||
}
|
||||
|
||||
// olivia : UPDATE - icon priority ditampilkan untuk log
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (isLog) {
|
||||
// olivia : tambahan menampilkan collection result di log
|
||||
TaskD taskdCollResult = TaskDDataAccess.getOneFromTaskDWithTag(context, task.getUuid_task_h(), Global.TAG_COLLECTION_RESULT);
|
||||
if (taskdCollResult != null) {
|
||||
Lookup lookup = LookupDataAccess.getOneByCode(context, taskdCollResult.getUuid_lookup(), taskdCollResult.getLov());
|
||||
if (lookup != null) {
|
||||
TaskD taskdTotalBayar = TaskDDataAccess.getOneFromTaskDWithTag(context, task.getUuid_task_h(), Global.TAG_TOTAL);
|
||||
TaskD tasdPTP = TaskDDataAccess.getOneFromTaskDWithTag(context, task.getUuid_task_h(), Global.TAG_PTP);
|
||||
txtCollResult.setVisibility(View.VISIBLE);
|
||||
if (taskdTotalBayar != null) {
|
||||
txtCollResult.setText(lookup.getValue() + " - " + taskdTotalBayar.getText_answer());
|
||||
} else if (tasdPTP != null) {
|
||||
String ptpDate = "";
|
||||
if (!tasdPTP.getText_answer().contains("/")) {
|
||||
String format = Global.DATE_STR_FORMAT_GSON;
|
||||
Date date = null;
|
||||
try {
|
||||
date = Formatter.parseDate(tasdPTP.getText_answer(), format);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ptpDate = Formatter.formatDate(date, Global.DATE_STR_FORMAT);
|
||||
} else {
|
||||
ptpDate = tasdPTP.getText_answer();
|
||||
}
|
||||
txtCollResult.setText(lookup.getValue() + " - " + ptpDate);
|
||||
} else {
|
||||
txtCollResult.setText(lookup.getValue());
|
||||
}
|
||||
} else {
|
||||
txtCollResult.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
txtCollResult.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
logIcon.setVisibility(View.VISIBLE);
|
||||
if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application) && (NewMainActivity.mnSurveyApproval != null || NewMainActivity.mnSurveyVerif != null
|
||||
|| NewMainActivity.mnVerifByBranch != null || NewMainActivity.mnApprovalByBranch != null)) {
|
||||
if (task.getIs_prepocessed() != null && task.getIs_prepocessed().equals(Global.FORM_TYPE_VERIFICATION)) {
|
||||
logIcon.setImageResource(R.drawable.task_verification);
|
||||
} else if (task.getIs_prepocessed() != null && task.getIs_prepocessed().equals(Global.FORM_TYPE_APPROVAL)) {
|
||||
logIcon.setImageResource(R.drawable.task_approval);
|
||||
}
|
||||
} else if (task.getPriority() != null) {
|
||||
if (task.getPriority().equalsIgnoreCase("HIGH")) {
|
||||
logIcon.setImageResource(R.drawable.task_highpriority);
|
||||
} else if (task.getPriority().equalsIgnoreCase("NORMAL") || task.getPriority().equalsIgnoreCase("MEDIUM")) {
|
||||
logIcon.setImageResource(R.drawable.task_normalpriority);
|
||||
} else {
|
||||
logIcon.setImageResource(R.drawable.task_lowpriority);
|
||||
}
|
||||
} else
|
||||
logIcon.setImageResource(R.drawable.task_new);
|
||||
} else {
|
||||
logIcon.setVisibility(View.GONE);
|
||||
if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application) &&(TaskHDataAccess.STATUS_TASK_APPROVAL.equals(task.getStatus()) || TaskHDataAccess.STATUS_TASK_VERIFICATION.equals(task.getStatus()))) {
|
||||
logIcon.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
txtName.setText(custName);
|
||||
txtName.setSelected(true);
|
||||
|
||||
Scheme scheme = SchemeDataAccess.getOne(getContext(), task.getUuid_scheme());
|
||||
|
||||
// olivia : menampilkan icon print untuk task yang melakukan pembayaran namun belum diprint untuk collection
|
||||
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
if (scheme.getIs_printable().equals("1")) {
|
||||
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(getContext(), task.getUuid_user());
|
||||
if (!isRVinFront) {
|
||||
if (!"".equals(task.getRv_number()) && task.getRv_number() != null)
|
||||
imgPrint.setVisibility(View.GONE);
|
||||
else {
|
||||
if (task.getPrint_count() != 0 && task.getPrint_count() != null)
|
||||
imgPrint.setVisibility(View.GONE);
|
||||
else {
|
||||
List<TaskD> taskDs = TaskDDataAccess.getAll(getContext(), task.getUuid_task_h(), TaskDDataAccess.ALL_TASK);
|
||||
if (taskDs != null && !taskDs.isEmpty()) {
|
||||
boolean isTaskPaid = TaskDDataAccess.isTaskPaid(getContext(), task.getUuid_user(), task.getUuid_task_h());
|
||||
if (!isTaskPaid)
|
||||
imgPrint.setVisibility(View.GONE);
|
||||
else
|
||||
imgPrint.setVisibility(View.VISIBLE);
|
||||
} else
|
||||
imgPrint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
} else
|
||||
imgPrint.setVisibility(View.GONE);
|
||||
} else
|
||||
imgPrint.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public List<TaskH> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void setObjects(List<TaskH> objectList) {
|
||||
this.objects.clear();
|
||||
if (objectList != null && !objectList.isEmpty()) {
|
||||
for (TaskH task : objectList) {
|
||||
this.objects.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dashContentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="#F2F3F8"
|
||||
tools:context=".dashboardcollection.view.DashboardCollectionView">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.02" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.98" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/dashTargetProgressContainer"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline2"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/dashTargetTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/target_collected"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashProgressValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="0 / 0 IDR"
|
||||
android:textColor="#585D66"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashTargetTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashProgressPercent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:text="0 %"
|
||||
android:textColor="@color/gradient_start"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dashProgressValue"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashTargetTitle" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/dashTargetProgress"
|
||||
android:layout_marginTop="3dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashProgressValue"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:progressDrawable="@drawable/dashboard_progress_drawable"
|
||||
android:indeterminate="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="13dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
android:id="@+id/collectSummary"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline2"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashTargetProgressContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineTwoColumn"
|
||||
app:layout_constraintGuide_percent="0.5"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/guidelineTwoColumn"
|
||||
android:layout_marginRight="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="180dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:id="@+id/dashOutstandingTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="5dp"
|
||||
android:text="@string/outstanding_task"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashOutstandingValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/gradient_start"
|
||||
android:textSize="60sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashOutstandingTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashOutstandingAmount"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashOutstandingValue"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="0 IDR"
|
||||
android:textColor="#585D66"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guidelineTwoColumn"
|
||||
android:layout_marginLeft="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="180dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashCollResultTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="5dp"
|
||||
android:text="@string/collection_result"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashCollResultPie"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashCollResultTitle"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp" />
|
||||
<LinearLayout
|
||||
app:layout_constraintTop_toBottomOf="@id/dashCollResultPie"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashCollectedLegend"
|
||||
android:text="Collected"
|
||||
android:textSize="12dp"
|
||||
android:textColor="#1D6304"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashPtpLegend"
|
||||
android:text="PTP"
|
||||
android:textColor="#221E66"
|
||||
android:textSize="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashFailedLegend"
|
||||
android:text="Failed"
|
||||
android:textSize="12dp"
|
||||
android:textColor="#C61E00"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/collectSummary"
|
||||
android:id="@+id/dashResultDetailTitle"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline2"
|
||||
android:text="@string/collection_result_detail"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/collResultDetailCard"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashResultDetailTitle"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/dashDetailTab"
|
||||
android:layout_width="match_parent"
|
||||
app:tabTextAppearance="@style/DashboardCollTabText"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
app:layout_constraintTop_toBottomOf="@id/dashDetailTab"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:id="@+id/dashViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,436 @@
|
|||
package com.adins.mss.coll;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.adins.mss.base.ChangePasswordFragment;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuHelper;
|
||||
import com.adins.mss.base.tasklog.TaskLogImpl;
|
||||
import com.adins.mss.base.timeline.MenuAdapter;
|
||||
import com.adins.mss.base.timeline.MenuModel;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.TaskListFragment_new;
|
||||
import com.adins.mss.base.todolist.form.TaskListTask;
|
||||
import com.adins.mss.base.todolist.form.TaskList_Fragment;
|
||||
import com.adins.mss.coll.closingtask.models.ClosingTaskListResponse;
|
||||
import com.adins.mss.coll.closingtask.models.ClosingTaskRequest;
|
||||
import com.adins.mss.coll.closingtask.senders.ClosingTaskSender;
|
||||
import com.adins.mss.coll.fragments.CollectionActivityFragment;
|
||||
import com.adins.mss.coll.fragments.DepositReportFragment;
|
||||
import com.adins.mss.coll.fragments.InstallmentScheduleFragment;
|
||||
import com.adins.mss.coll.fragments.PaymentHistoryFragment;
|
||||
import com.adins.mss.coll.fragments.ReportSummaryFragment;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.services.MainServices;
|
||||
import com.services.NotificationThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MCMainMenuActivity extends com.adins.mss.base.mainmenu.MainMenuActivity{
|
||||
|
||||
public static MenuModel mnTimeline;
|
||||
// public static MenuModel mnTaskList;
|
||||
// public static MenuModel mnLog;
|
||||
public static MenuModel mnSVYApproval;
|
||||
public static MenuModel mnSVYVerify;
|
||||
public static MenuModel mnReportSummary;
|
||||
public static MenuModel mnDepositReport;
|
||||
public static MenuModel mnPaymentHistory;
|
||||
public static MenuModel mnInstallmentSchedule;
|
||||
public static MenuModel mnAbsentI;
|
||||
public static MenuModel mnExit;
|
||||
public static MenuModel mnAbout;
|
||||
public static MenuModel mnSynchronize;
|
||||
public static MenuModel mnChangePassword;
|
||||
public static int flag_edit=0;
|
||||
public static boolean inAbsent=false;
|
||||
Fragment fragment;
|
||||
ChangePasswordFragment fragmentChgPwd;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListLeft;
|
||||
|
||||
|
||||
@Override
|
||||
protected ArrayList<MenuModel> getModels() {
|
||||
// TODO Auto-generated method stub
|
||||
ArrayList<MenuModel> models = new ArrayList<MenuModel>();
|
||||
MenuModel titleGroup1 = new MenuModel(getString(R.string.title_mn_main_menu));
|
||||
titleGroup1.isGroupHeader();
|
||||
MenuModel titleGroup2 = new MenuModel(getString(R.string.title_mn_other));
|
||||
titleGroup2.isGroupHeader();
|
||||
|
||||
mnTimeline = new MenuModel(R.drawable.ic_home, getString(R.string.title_mn_home),null);
|
||||
models.add(titleGroup1);
|
||||
models.add(mnTimeline);
|
||||
List<String> mainMenuTitle = getMainMenuTitle();
|
||||
List<Integer> mainMenuIcon = getMainMenuIcon();
|
||||
for(int i=0; i<mainMenuTitle.size();i++){
|
||||
if(mainMenuTitle.get(i).equalsIgnoreCase(getString(R.string.title_mn_tasklist))){
|
||||
mnTaskList = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||
models.add(mnTaskList);
|
||||
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_log))){
|
||||
mnLog = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||
models.add(mnLog);
|
||||
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_surveyverification))){
|
||||
mnSVYVerify = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||
models.add(mnSVYVerify);
|
||||
}else if(getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_surveyapproval))){
|
||||
mnSVYApproval = new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),"0");
|
||||
models.add(mnSVYApproval);
|
||||
}else{
|
||||
models.add(new MenuModel(mainMenuIcon.get(i),mainMenuTitle.get(i),null));
|
||||
}
|
||||
}
|
||||
|
||||
models.add(titleGroup2);
|
||||
List<String> otherMenuTitle = getOtherMenuTitle();
|
||||
List<Integer> otherMenuIcon = getOtherMenuIcon();
|
||||
// mnChangePassword = new MenuModel(R.drawable.ic_changepassword,getString(R.string.title_mn_changepassword), null);
|
||||
// models.add(mnChangePassword);
|
||||
for(int i=0; i<otherMenuTitle.size();i++){
|
||||
models.add(new MenuModel(otherMenuIcon.get(i),otherMenuTitle.get(i),null));
|
||||
}
|
||||
|
||||
|
||||
for(int i=0 ; i<models.size(); i++){
|
||||
this.allMenu.add(models.get(i).getTitle());
|
||||
}
|
||||
|
||||
this.models=models;
|
||||
return models;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitleGroup() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Collection";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
super.onCreate(savedInstanceState);
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 0);
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerListLeft = (ListView) findViewById(R.id.left_drawer);
|
||||
|
||||
// TimelineModel model = new TimelineModel()
|
||||
// .setContentFrame(R.id.content_frame)
|
||||
// .setCustomerFragment(new com.adins.mss.base.dynamicform.CustomerFragment())
|
||||
// .setLogFragment(new LogResultActivity())
|
||||
// .setMainFragment(this)
|
||||
// .setTaskListFragment(new TaskList_Fragment())
|
||||
// .withColor(getResources().getColor(R.color.tv_normal));
|
||||
//
|
||||
menuAdapter = new MenuAdapter(this, getModels(), R.drawable.activated_background_indicator);
|
||||
mDrawerListLeft.setAdapter(menuAdapter);
|
||||
|
||||
mDrawerListLeft.setOnItemClickListener(this);
|
||||
|
||||
try {
|
||||
MCMainMenuActivity.mnLog.setCounter(String.valueOf(TaskLogImpl.getCounterLog(this)));
|
||||
MCMainMenuActivity.mnTaskList.setCounter(String.valueOf(ToDoList.getCounterTaskList(this)));
|
||||
} catch (Exception e) { FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
goTimeline(1);
|
||||
Global.positionStack.push(1);
|
||||
}
|
||||
Global.installmentSchIntent = new Intent(getApplicationContext(), InstallmentScheduleFragment.class);
|
||||
Global.paymentHisIntent = new Intent(getApplicationContext(), PaymentHistoryFragment.class);
|
||||
Global.collectionActIntent = new Intent(getApplicationContext(), CollectionActivityFragment.class);
|
||||
try {
|
||||
actionFromNotif(getIntent());
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionFromNotif(Intent intent){
|
||||
try {
|
||||
String action = intent.getAction();
|
||||
if(action!=null){
|
||||
if(action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)){
|
||||
Bundle argument = new Bundle();
|
||||
argument.putBoolean(TaskList_Fragment.BUND_KEY_ISERROR, false);
|
||||
Fragment fragment1 = new TaskListFragment_new();//TaskList_Fragment();
|
||||
fragment1.setArguments(argument);
|
||||
FragmentTransaction transaction = MainMenuActivity.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, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
actionFromNotif(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
Global.syncIntent = new Intent(getApplicationContext(), MCSynchronizeActivity.class);
|
||||
if(MainMenuActivity.getMss()==null) {
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
// NotificationService.mss = mss;
|
||||
MainServices.mainClass = mss;
|
||||
}
|
||||
MainMenuActivity.setMainMenuClass(MCMainMenuActivity.class);
|
||||
try {
|
||||
long logCounter = TaskLogImpl.getCounterLog(this);
|
||||
long taskListCounter = ToDoList.getCounterTaskList(this);
|
||||
mnLog.setCounter(String.valueOf(logCounter));
|
||||
mnTaskList.setCounter(String.valueOf(taskListCounter));
|
||||
|
||||
} catch (Exception e) { FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
// TimelineModel.taskList_Fragment=new TaskList_Fragment();
|
||||
getActionBar().removeAllTabs();
|
||||
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(){
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, final int position,
|
||||
long id) {
|
||||
super.onItemClick(parent, view, position, id);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(getString(R.string.title_mn_changepassword).equalsIgnoreCase(allMenu.get(position))){
|
||||
gotoChangePassword();
|
||||
}
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
|
||||
//bong 10 apr 15 - menjaga saat change password tidak dapat lihat menu
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
if(fragmentChgPwd!=null){
|
||||
if(fragmentChgPwd.isVisible()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
// 7 apr 15 disabled onBackpressed on fragment
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// TODO Auto-generated method stub
|
||||
// if(fragmentChgPwd!=null){
|
||||
// if(fragmentChgPwd.isVisible()){
|
||||
// if(GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")){
|
||||
// ChangePasswordFragment.onBackPressed();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(this, MCSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
private void gotoChangePassword() {
|
||||
fragment = new ChangePasswordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ChangePasswordFragment.AS_ACTIVITY, false);
|
||||
fragment.setArguments(args);
|
||||
if(GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")){
|
||||
fragmentChgPwd = (ChangePasswordFragment) fragment;
|
||||
fragmentChgPwd.setArguments(args);
|
||||
}
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
//bong 13 apr 15 - to set chgPassFragment untuk menjaga supaya menu tidak muncul
|
||||
@Override
|
||||
protected Fragment getChgPassFragment() {
|
||||
// TODO Auto-generated method stub
|
||||
return fragmentChgPwd;
|
||||
}
|
||||
@Override
|
||||
protected void goTimeline(int position) {
|
||||
// TimelineModel.taskList_Fragment=new TaskList_Fragment();
|
||||
super.goTimeline(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNewTask(int position) {
|
||||
fragment = new MCNewTaskActivity();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCheckOrder(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCreditSimulation(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCancelOrder(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoTaskList(int position) {
|
||||
TaskListTask task = new TaskListTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoTaskList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPromo(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNews(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderAssignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderReassignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyPerformance(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerification(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApproval(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyAssignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyReassignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoReportSummary(int position) {
|
||||
fragment = new ReportSummaryFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoDepositReport(int position) {
|
||||
fragment = new DepositReportFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoAbout() {
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 0);
|
||||
super.gotoAbout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPaymentHistory(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoInstallmentSchedule(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoClosingTask(int position) {
|
||||
ClosingTaskRequest request = new ClosingTaskRequest();
|
||||
request.setFlag(ClosingTaskRequest.CLOSING_TASK_LIST);
|
||||
ClosingTaskSender<ClosingTaskListResponse> sender = new ClosingTaskSender<>(
|
||||
this, request, ClosingTaskListResponse.class);
|
||||
sender.execute();
|
||||
}
|
||||
|
||||
public void showNotAvailableMenu(int position){
|
||||
MainMenuHelper.showNotAvailableMenuDialog(MCMainMenuActivity.this, allMenu.get(position));
|
||||
Global.positionStack.pop();
|
||||
mDrawerListLeft.setItemChecked(Global.positionStack.lastElement(), true);
|
||||
setTitle(models.get(Global.positionStack.lastElement()).getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerificationByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApprovalByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package com.services;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobService;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.location.LocationTrackingManager;
|
||||
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public class MssJobScheduler extends JobService {
|
||||
|
||||
@Override
|
||||
public boolean onStartJob(JobParameters params) {
|
||||
if (!isAppRunning(getApplicationContext(), getApplicationContext().getPackageName())) {
|
||||
Log.i("Alarm", "App Restarting...");
|
||||
openApp(getApplicationContext(), getApplicationContext().getPackageName());
|
||||
Log.i("Alarm", "App Restarted");
|
||||
}
|
||||
startAutoRestartService(getApplicationContext());
|
||||
ServiceAutoRestart.startAutoRestartService(getApplicationContext());
|
||||
Utility.scheduleJob(getApplicationContext());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStopJob(JobParameters params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void startAutoRestartService(Context context) {
|
||||
PendingIntent pendingIntent;
|
||||
ObscuredSharedPreferences sharedPref = ObscuredSharedPreferences.getPrefs(context, "GlobalData", Context.MODE_PRIVATE);
|
||||
boolean hasLogged = sharedPref.getBoolean("HAS_LOGGED", false);
|
||||
User user = GlobalData.getSharedGlobalData().getUser();
|
||||
if (user != null && hasLogged) {
|
||||
long delay = 1000L * 30;
|
||||
long time = SystemClock.elapsedRealtime() + delay;
|
||||
|
||||
Intent alarmIntent = new Intent(context, MssJobScheduler.class);
|
||||
pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, 0);
|
||||
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, time,
|
||||
pendingIntent);
|
||||
} else if (Build.VERSION.SDK_INT >= 19) {
|
||||
am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, time, pendingIntent);
|
||||
} else {
|
||||
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, time, pendingIntent);
|
||||
}
|
||||
Log.i("Alarm", "Alarm Started");
|
||||
|
||||
checkLocationTracking(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkLocationTracking(Context context) {
|
||||
if (null == Global.LTM) {
|
||||
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
LocationTrackingManager manager = new LocationTrackingManager(tm, lm, context);
|
||||
manager.setMinimalDistanceChangeLocation(100);
|
||||
manager.setMinimalTimeChangeLocation(5000);
|
||||
manager.applyLocationListener(context);
|
||||
Global.LTM = manager;
|
||||
} else {
|
||||
LocationTrackingManager ltm = Global.LTM;
|
||||
if (!ltm.hasConnected()){
|
||||
ltm.connectLocationClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAppRunning(final Context context, final String packageName) {
|
||||
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
final List<ActivityManager.RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
|
||||
if (procInfos != null) {
|
||||
for (final ActivityManager.RunningAppProcessInfo processInfo : procInfos) {
|
||||
if (processInfo.processName.equals(packageName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean openApp(Context context, String packageName) {
|
||||
PackageManager manager = context.getPackageManager();
|
||||
try {
|
||||
Intent i = manager.getLaunchIntentForPackage(packageName);
|
||||
if (i == null) {
|
||||
return false;
|
||||
}
|
||||
i.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
context.startActivity(i);
|
||||
return true;
|
||||
} catch (ActivityNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
|
||||
<color name="gradient_start1">#137877</color>
|
||||
<color name="gradient_start">#49a341</color>
|
||||
<color name="gradient_end1">#0e5e5d</color>
|
||||
<color name="gradient_end">#50b348</color>
|
||||
<color name="tv_lighter">#a2dea4</color>
|
||||
<!--#7adb4f-->
|
||||
<!--#6abd45-->
|
||||
<!--438c23-->
|
||||
<color name="canvas">#FF404040</color>
|
||||
<color name="bar">#C0202020</color>
|
||||
<color name="grey">#dcdcdc</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
<!-- Graph Color -->
|
||||
<color name="graphColor1">#a7fb72</color>
|
||||
<color name="graphColor2">#4bf824</color>
|
||||
<color name="graphColor3">#24ba29</color>
|
||||
<color name="graphColor4">#0c8f1d</color>
|
||||
<color name="graphColor5">#086114</color>
|
||||
|
||||
<!-- Rank Legends Color -->
|
||||
<color name="rankColor1">#FF0000</color>
|
||||
<color name="rankColor2">#000000</color>
|
||||
<color name="rankColor3">#32CD32</color>
|
||||
<color name="rankColor4">#0000FF</color>
|
||||
|
||||
|
||||
<color name="login_color">#1d930c</color>
|
||||
</resources>
|
|
@ -0,0 +1,61 @@
|
|||
package com.adins.mss.coll.assignment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderAssignmentActivity extends Fragment {
|
||||
protected View view;
|
||||
protected AQuery query;
|
||||
protected List<TaskH> objects;
|
||||
private User user = GlobalData.getSharedGlobalData().getUser();
|
||||
OrderAssignmentAdapter adapter;
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
getActivity().getActionBar().setTitle(getString(R.string.title_mn_orderassign));
|
||||
// objects = TaskHDataAccess.getall
|
||||
adapter = new OrderAssignmentAdapter(getActivity(), objects);
|
||||
}
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
getActivity().getActionBar().setTitle(getString(R.string.title_mn_orderassign));
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
if (view != null) {
|
||||
ViewGroup parent = (ViewGroup) view.getParent();
|
||||
if (parent != null)
|
||||
parent.removeView(view);
|
||||
}
|
||||
try {
|
||||
view = inflater.inflate(R.layout.newtask_layout, container, false);
|
||||
query = new AQuery(view);
|
||||
query.id(android.R.id.list).adapter(adapter);
|
||||
query.id(android.R.id.list).itemClicked(this, "itemClick");
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
public void itemClick(AdapterView<?> parent, View v, int position, long id){
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue