mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,165 @@
|
|||
package com.adins.mss.foundation.questiongenerator.form;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.InputFilter;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.questiongenerator.OptionAnswerBean;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DropdownQuestionView extends MultiOptionQuestionViewAbstract {
|
||||
|
||||
protected EditText txtDescription;
|
||||
private Spinner spinner;
|
||||
private TextView labelNoList;
|
||||
private List<OptionAnswerBean> mOptions;
|
||||
|
||||
public DropdownQuestionView(Context context, QuestionBean bean) {
|
||||
super(context, bean);
|
||||
|
||||
spinner = new Spinner(context);
|
||||
spinner.setPrompt("Select One"); //default prompt
|
||||
if (bean.isReadOnly()) {
|
||||
spinner.setClickable(false);
|
||||
spinner.setEnabled(false);
|
||||
}
|
||||
addView(spinner, defLayout);
|
||||
labelNoList = new TextView(context);
|
||||
labelNoList.setText("The list is not available, contact your administrator");
|
||||
labelNoList.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
//Use setOptions instead
|
||||
public void setSpinnerOptions(Context context, List<OptionAnswerBean> options) {
|
||||
setOptions(context, options);
|
||||
}
|
||||
|
||||
//Set as override of abstract method
|
||||
@Override
|
||||
public void setOptions(Context context, List<OptionAnswerBean> options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
|
||||
int nextOptionIndex = -1;
|
||||
try {
|
||||
QuestionBean bean = this.getQuestionBean();
|
||||
String optionSelectedIdStr = QuestionBean.getAnswer(bean);
|
||||
if (optionSelectedIdStr == null)
|
||||
optionSelectedIdStr = bean.getLovCode();
|
||||
if (!options.isEmpty()) {
|
||||
//search new options selected id
|
||||
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
OptionAnswerBean option = options.get(i);
|
||||
if (option.getCode().equalsIgnoreCase(optionSelectedIdStr)) { //this is the same option (based on id)
|
||||
nextOptionIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
try {
|
||||
labelNoList.setVisibility(View.GONE);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
labelNoList.setVisibility(View.VISIBLE);
|
||||
addView(labelNoList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
|
||||
}
|
||||
|
||||
ArrayAdapter<OptionAnswerBean> spAdapter = new ArrayAdapter<>(
|
||||
context, R.layout.spinner_style2, options);
|
||||
spAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||
spinner.setAdapter(spAdapter);
|
||||
|
||||
//Glen 1 Sept 2014, set selected id on new spinner items
|
||||
if (nextOptionIndex >= 0 && nextOptionIndex < options.size()) {
|
||||
spinner.setSelection(nextOptionIndex);
|
||||
}
|
||||
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1,
|
||||
int arg2, long arg3) {
|
||||
|
||||
if (arg1 != null && arg1.getId() != 0 && !bean.isReadOnly()) {
|
||||
//do your code here to avoid callback twice
|
||||
setChanged(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
//EMPTY
|
||||
}
|
||||
});
|
||||
this.mOptions = options;
|
||||
//Glen 14 Oct 2014, select saved selected options
|
||||
selectSavedOptionsFromBeans(this.getSelectedOptionAnswers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectOption(int id, String desc) {
|
||||
if (spinner != null) {
|
||||
spinner.setSelection(id);
|
||||
}
|
||||
//description
|
||||
if (desc != null) {
|
||||
enableDescription(this.getContext()); // use same context as view
|
||||
txtDescription.setText(bean.getAnswer());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSelectedOptionToBean() {
|
||||
OptionAnswerBean selected = (OptionAnswerBean) spinner.getSelectedItem();
|
||||
|
||||
//check description if any
|
||||
if (txtDescription != null) {
|
||||
String description = txtDescription.getText().toString();
|
||||
bean.setAnswer(description);
|
||||
}
|
||||
|
||||
setSelectedOptionAnswer(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableDescription(Context context) {
|
||||
if (txtDescription == null) {
|
||||
txtDescription = new EditText(context);
|
||||
InputFilter[] inputFilters = {new InputFilter.LengthFilter(
|
||||
Global.DEFAULT_MAX_LENGTH)};
|
||||
txtDescription.setFilters(inputFilters);
|
||||
addView(txtDescription, defLayout);
|
||||
}
|
||||
txtDescription.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public Spinner getSpinner() {
|
||||
return spinner;
|
||||
}
|
||||
|
||||
public void setSpinner(Spinner spinner) {
|
||||
this.spinner = spinner;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,932 @@
|
|||
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.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
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.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.coll.models.PaymentChannelRequest;
|
||||
import com.adins.mss.coll.models.PaymentChannelResponse;
|
||||
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.PaymentChannel;
|
||||
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.PaymentChannelDataAccess;
|
||||
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.DialogManager;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 2/4/2015.
|
||||
*/
|
||||
public class DepositReportPCTransferFragment extends Fragment {
|
||||
private static final int REQUEST_FOR_CAMERA_CAPTURE = 4;
|
||||
private View asPaymentChanel;
|
||||
private TextView txtBuktiTransfer;
|
||||
private EditText editKodeTransaksi;
|
||||
private ImageView imageBukti;
|
||||
private Button buttonSelectPhoto;
|
||||
private Button buttonSend;
|
||||
|
||||
boolean isValidate = true;
|
||||
public static final String uuidLookupDummy="lookupDummy";
|
||||
protected Spinner spinnerBankAccount;
|
||||
private BankAccountAdapter bankAccountAdapter;
|
||||
private List<Lookup> bankAccountList;
|
||||
private String selectedBank, selectedbankName, selectedBankAccount,
|
||||
selectedChannel, selectedChannelName;
|
||||
private boolean isViaChannel = false;
|
||||
|
||||
private View view;
|
||||
protected static byte[] byteImage = null;
|
||||
Double total;
|
||||
String batchId ="";
|
||||
String formName="";
|
||||
String transactionCode = "";
|
||||
protected static Bitmap image = null;
|
||||
protected static Bitmap tempImage = null;
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
|
||||
// if(image!=null && !image.isRecycled()){
|
||||
// image.recycle();
|
||||
// image=null;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String totDeposit = getArguments().getString("TOTAL_DEPOSIT");
|
||||
total = Double.parseDouble(totDeposit);
|
||||
batchId = getArguments().getString("BATCHID");
|
||||
formName = getArguments().getString("FORM");
|
||||
bankAccountList = new ArrayList<>();
|
||||
bankAccountList.clear();
|
||||
setDummyBankAccountSpinner();
|
||||
|
||||
List<Lookup> lookupChannel = new ArrayList<>();
|
||||
List<PaymentChannel> paymentChannel = PaymentChannelDataAccess.getAllPaymentChannel(getActivity(), total);
|
||||
for(PaymentChannel channel : paymentChannel){
|
||||
Lookup luChannel = new Lookup();
|
||||
luChannel.setValue(channel.getDescription() + " | " + channel.getCode());
|
||||
lookupChannel.add(luChannel);
|
||||
}
|
||||
bankAccountList.addAll(lookupChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.fragment_deposit_report_transfer_pc, container, false);
|
||||
spinnerBankAccount = (Spinner) 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 = "";
|
||||
selectedChannel = "";
|
||||
selectedChannelName = "";
|
||||
} else {
|
||||
selectedBank = bankAccountAdapter.getItem(position).getValue();
|
||||
selectedBank = selectedBank.replace(" ", "");
|
||||
String answers[] = Tool.split(selectedBank, "|");
|
||||
isViaChannel = true;
|
||||
selectedChannel = answers[1].trim();
|
||||
selectedChannelName = answers[0].trim();
|
||||
asPaymentChanel.setVisibility(View.VISIBLE);
|
||||
editKodeTransaksi.setVisibility(View.VISIBLE);
|
||||
editKodeTransaksi.setEnabled(false);
|
||||
TransactionCodeTask task = new TransactionCodeTask();
|
||||
task.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
private class TransactionCodeTask extends AsyncTask<Void, Void, String> {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage, message;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(getContext(), "", getString(com.adins.mss.base.R.string.progressWait));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... voids) {
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
PaymentChannelRequest request = new PaymentChannelRequest();
|
||||
request.setBatchID(batchId);
|
||||
request.setCodeChannel(selectedChannel);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CODETRANSACTION();
|
||||
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();
|
||||
}
|
||||
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
PaymentChannelResponse response = GsonHelper.fromJson(responseBody, PaymentChannelResponse.class);
|
||||
if (response.getStatus().getCode() != 0) {
|
||||
message = response.getStatus().getMessage();
|
||||
return "";
|
||||
} else {
|
||||
if("1".equals(response.getFlagLimit())){
|
||||
message = getActivity().getString(com.adins.mss.base.R.string.paymentchannel_limit);
|
||||
}
|
||||
return response.getNoTransaction();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = getString(com.adins.mss.base.R.string.server_down);
|
||||
}
|
||||
|
||||
} else {
|
||||
errMessage = getString(com.adins.mss.base.R.string.no_internet_connection);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String transactionCode) {
|
||||
super.onPostExecute(transactionCode);
|
||||
isValidate = (transactionCode != null && !transactionCode.isEmpty())? true : false ;
|
||||
setCodeTransaction(transactionCode);
|
||||
progressDialog.dismiss();
|
||||
|
||||
if (!isValidate){
|
||||
if(message != null) {
|
||||
DialogManager.showAlertNotif(getActivity(),
|
||||
message, "Transaction's Code");
|
||||
} else if (errMessage != null) {
|
||||
Toast.makeText(getContext(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
DialogManager.showAlertNotif(getActivity(),
|
||||
getActivity().getString(com.adins.mss.base.R.string.msgUnavaibleCodeTransaction ), "Transaction's Code");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCodeTransaction(String transactionCode){
|
||||
editKodeTransaksi.setText(transactionCode);
|
||||
this.transactionCode = transactionCode;
|
||||
}
|
||||
|
||||
|
||||
public void setLabel(){
|
||||
if(view!=null) {
|
||||
txtBuktiTransfer = (TextView) view.findViewById(R.id.txtBuktiTransfer);
|
||||
|
||||
txtBuktiTransfer.setText(getActivity().getString(R.string.label_transfer_evidence_pc));
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
|
||||
asPaymentChanel = view.findViewById(R.id.txtTransactionCode);
|
||||
asPaymentChanel.setVisibility(View.GONE);
|
||||
|
||||
editKodeTransaksi = (EditText) view.findViewById(R.id.editKodeTransaksi);
|
||||
imageBukti = (ImageView) view.findViewById(R.id.imageBukti);
|
||||
buttonSelectPhoto = (Button) view.findViewById(R.id.buttonSelectPhoto);
|
||||
buttonSend = (Button) view.findViewById(R.id.buttonSend);
|
||||
editKodeTransaksi.setVisibility(View.GONE);
|
||||
|
||||
setLabel();
|
||||
imageBukti.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View paramView) {
|
||||
// TODO Auto-generated method stub
|
||||
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) {
|
||||
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,
|
||||
"",
|
||||
"",
|
||||
selectedChannel, selectedChannelName
|
||||
);
|
||||
}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) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
imageBukti.setImageBitmap(image);
|
||||
}
|
||||
Utility.freeMemory();
|
||||
}
|
||||
public void onDestroy(){
|
||||
super.onDestroy();
|
||||
// if(image!=null && !image.isRecycled()){
|
||||
// image.recycle();
|
||||
// image=null;
|
||||
// }
|
||||
// if(tempImage!=null && !tempImage.isRecycled()){
|
||||
// tempImage.recycle();
|
||||
// tempImage=null;
|
||||
// }
|
||||
}
|
||||
|
||||
public class SendDepositReportTask extends AsyncTask<String, Void, List<String>> {
|
||||
private ProgressDialog progressDialog;
|
||||
private Activity activity;
|
||||
private DepositReportH header;
|
||||
private ArrayList<DepositReportD> details;
|
||||
String namaKasir;
|
||||
private String errMsg;
|
||||
private StringBuilder sb;
|
||||
public SendDepositReportTask(Activity 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(DepositReportPCRecapitulateFragment.selectedDepositUser);
|
||||
header.setUser(DepositReportPCRecapitulateFragment.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());
|
||||
}
|
||||
|
||||
String channelCode = params[4];
|
||||
if (channelCode != null && channelCode.length() > 0) {
|
||||
header.setCode_channel(channelCode);
|
||||
header.setNo_transaction(transactionCode);
|
||||
} else {
|
||||
sb.append(getActivity().getString(R.string.channel_to_required));
|
||||
}
|
||||
if (transactionCode != null && transactionCode.isEmpty()) {
|
||||
sb.append(getActivity().getString(R.string.transfer_code_required));
|
||||
}
|
||||
if (image == null)
|
||||
sb.append(getActivity().getString(R.string.evidence_pc_required));
|
||||
else {
|
||||
try {
|
||||
byteImage = Utils.bitmapToByte(tempImage);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
if (byteImage != null)
|
||||
header.setImage(byteImage);
|
||||
else
|
||||
sb.append(getActivity().getString(R.string.evidence_pc_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(),
|
||||
DepositReportPCRecapitulateFragment.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(DepositReportPCRecapitulateFragment.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_SUBMIT_DEPOSIT_PC();
|
||||
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) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
}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) {
|
||||
}
|
||||
}
|
||||
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());
|
||||
DepositReportPCDetailActivity.report = header;
|
||||
Intent intent = new Intent(getActivity(), DepositReportPCDetailActivity.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){
|
||||
Toaster.warning(getActivity(), results.get(0));
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(error) {
|
||||
buttonSend.setClickable(true);
|
||||
buttonSelectPhoto.setClickable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void openCameraApp(Activity 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) {
|
||||
}
|
||||
if (photoFile != null) {
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT,
|
||||
Uri.fromFile(photoFile));
|
||||
startActivityForResult(intent, Utils.REQUEST_CAMERA);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception for failed open camera
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void generatePrintResultDepReport(Activity activity, String cashierName, DepositReportH report){
|
||||
List<PrintItem> printItemList = PrintItemDataAccess.getAll(activity, "DUMYUUIDSCHEMEFORDEPOSITREPORT");
|
||||
List<PrintResult> printResultList = new ArrayList<PrintResult>();
|
||||
|
||||
//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) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
} 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) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
} 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) {
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BankAccountAdapter extends ArrayAdapter<Lookup> {
|
||||
private Context context;
|
||||
private 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;
|
||||
}
|
||||
}
|
||||
|
||||
private void setDummyBankAccountSpinner() {
|
||||
Lookup bankAccountDummy = new Lookup();
|
||||
bankAccountDummy.setUuid_lookup(uuidLookupDummy);
|
||||
bankAccountDummy.setValue(getString(R.string.choose_one_pc));
|
||||
|
||||
bankAccountList.add(0,bankAccountDummy);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.adins.mss.odr.tool;
|
||||
|
||||
public class Constants {
|
||||
public static final int START_DATE_DIALOG_ID=0;
|
||||
public static final int END_DATE_DIALOG_ID=1;
|
||||
public static final String KEY_START_DATE="start date";
|
||||
public static final String KEY_END_DATE="end date";
|
||||
public static final String KEY_DATE="date";
|
||||
public static final String KEY_NEWS="news";
|
||||
public static final int NEWS_ID=0;
|
||||
public static final String BUND_KEY_NEWS_ERROR = "isError";
|
||||
public static final String BUND_KEY_NEWS_ERROR_MESSAGE = "ErrorMessage";
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.adins.mss.odr.model;
|
||||
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class JsonTaskD extends MssResponseType {
|
||||
@SerializedName("taskD")
|
||||
TaskD taskD;
|
||||
|
||||
public TaskD getTaskD(){
|
||||
return taskD;
|
||||
}
|
||||
public void setTaskD (TaskD taskD){
|
||||
this.taskD = taskD;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:visibility="visible"
|
||||
android:id="@+id/checkOrderLayout"
|
||||
android:background="@color/bgColor">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_below="@+id/actionbar" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/container"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:gravity="center_horizontal"
|
||||
android:id="@+id/searchBy">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:text="@string/lblSearchBy"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#000000" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/filterBy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp" >
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/cbSearchBy"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:entries="@array/cbSearchBy"
|
||||
android:background="@drawable/button_background"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/cbSearchBy"
|
||||
android:layout_alignRight="@+id/cbSearchBy"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/dropdown_right" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:text="@string/lblSearchByStatus"
|
||||
android:id="@+id/lblSearchByStatus"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:visibility="gone"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/filterByStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="5dp" >
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/cbSearcrByStatus"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:entries="@array/cbSearchByStatus"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnRefresh2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/cbSearcrByStatus"
|
||||
android:layout_alignRight="@+id/cbSearcrByStatus"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/dropdown_right" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/byDate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/startdate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:text="@string/lblStartDate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtStartDate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/startdate"
|
||||
android:layout_toLeftOf="@+id/btnStartDate"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:hint="@string/requiredField" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enddate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/txtStartDate"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:text="@string/lblEndDate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtEndDate"
|
||||
android:hint="@string/requiredField"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignRight="@+id/txtStartDate"
|
||||
android:layout_below="@+id/enddate"
|
||||
android:editable="false"
|
||||
android:ems="10" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnStartDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/txtStartDate"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/icon_calendar_mma" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnEndDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/txtEndDate"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/icon_calendar_mma" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/byNoOrder"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:gravity="center_horizontal" >
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:text="@string/lblNomorOrder"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#000000"/>
|
||||
|
||||
<EditText android:id="@+id/txtNomorOrder"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:hint="@string/requiredField"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/byCustName"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:gravity="center_horizontal">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:text="@string/lblCustomerName"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#000000"/>
|
||||
|
||||
<EditText android:id="@+id/txtCustomerName"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:hint="@string/requiredField"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_below="@+id/byDay"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingTop="20dp" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSearchOrder"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/button_background"
|
||||
android:ems="10"
|
||||
android:text="@string/btnSearchOrder"
|
||||
android:textColor="#ffffff" >
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,22 @@
|
|||
package com.adins.mss.coll.networks.responses;
|
||||
|
||||
import com.adins.mss.coll.networks.entities.ClosingTaskEntity;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 6/6/2016.
|
||||
*/
|
||||
public class ClosingTaskListResponse extends MssResponseType {
|
||||
|
||||
private List<ClosingTaskEntity> taskList;
|
||||
|
||||
public List<ClosingTaskEntity> getTaskList() {
|
||||
return taskList;
|
||||
}
|
||||
|
||||
public void setTaskList(List<ClosingTaskEntity> taskList) {
|
||||
this.taskList = taskList;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue