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
|
@ -0,0 +1,144 @@
|
|||
package com.services;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.content.IntentCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adins.mss.base.AppContext;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.commons.BackupManager;
|
||||
import com.adins.mss.base.timeline.TimelineManager;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||
import com.adins.mss.foundation.notification.Notification;
|
||||
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
|
||||
import com.google.firebase.messaging.RemoteMessage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static java.lang.Thread.NORM_PRIORITY;
|
||||
|
||||
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
super.onMessageReceived(remoteMessage);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
NotificationChannel channel = new NotificationChannel("messaging", "Notification", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel.setDescription("Application Notification Message");
|
||||
mNotificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
// TODO(developer): Handle FCM messages here.
|
||||
// Not getting messages here? See why this may be: https://goo.gl/39bRNJ
|
||||
Logger.d("FirebaseMessagingServ", "From: " + remoteMessage.getFrom());
|
||||
|
||||
// Check if message contains a data payload.
|
||||
if (remoteMessage.getData().size() > 0) {
|
||||
Logger.d("FirebaseMessagingServ", "Message data payload: " + remoteMessage.getData());
|
||||
|
||||
//Nendi: 2019-01-18 | Add event listener
|
||||
Map<String, String> extras = remoteMessage.getData();
|
||||
if (extras.containsKey("event")) {
|
||||
String eventType = extras.get("event");
|
||||
if (eventType == null)
|
||||
return;
|
||||
|
||||
switch (eventType) {
|
||||
case "backup":
|
||||
String entity = extras.get("entity");
|
||||
String constraint = null;
|
||||
if (extras.containsKey("constraint")) {
|
||||
constraint = extras.get("constraint");
|
||||
BackupManager backupManager = new BackupManager(getApplicationContext());
|
||||
backupManager.backup(entity, constraint);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if message contains a notification payload.
|
||||
if (remoteMessage.getNotification() != null) {
|
||||
Logger.d("FirebaseMessagingServ", "Message Notification Body: " + remoteMessage.getNotification().getBody());
|
||||
}
|
||||
String notif = null;
|
||||
try {
|
||||
|
||||
notif = remoteMessage.getData().get("message");
|
||||
if (notif == null || notif == "") {
|
||||
notif = remoteMessage.getNotification().getBody();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ObscuredSharedPreferences sharedPref = ObscuredSharedPreferences.getPrefs(getApplicationContext(),
|
||||
"GlobalData", Context.MODE_PRIVATE);
|
||||
boolean hasLogged = sharedPref.getBoolean("HAS_LOGGED", false);
|
||||
User user = GlobalData.getSharedGlobalData().getUser();
|
||||
if (null != user && hasLogged){
|
||||
showNotif("" + notif);
|
||||
TimelineManager.insertTimelinePushNotification(getBaseContext(), "" + notif);
|
||||
}
|
||||
}
|
||||
|
||||
public static String MAINMENU_NOTIFICATION_KEY = "MAINMENU_NOTIFICATION_KEY";
|
||||
public void showNotif(String notif) {
|
||||
String notifTitle = getApplicationContext().getString(com.adins.mss.base.R.string.push_notification);
|
||||
// String message = getApplicationContext().getString(com.adins.mss.base.R.string.push_notification_info);
|
||||
// TODO munculkan notifikasi di sini
|
||||
|
||||
Intent intent = new Intent(getApplicationContext(), AppContext.getInstance().getHomeClass());
|
||||
ComponentName cn = intent.getComponent();
|
||||
Intent resultIntent = Intent.makeMainActivity(cn);
|
||||
resultIntent.setAction(MAINMENU_NOTIFICATION_KEY);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent
|
||||
.getActivity(getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
Notification.getSharedNotification().setDefaultIcon(
|
||||
com.adins.mss.base.R.drawable.icon_notif_new);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), "messaging");
|
||||
builder.setSmallIcon(getNotificationIcon());
|
||||
builder.setContentTitle(notifTitle);
|
||||
builder.setContentText(notif);
|
||||
builder.setPriority(NORM_PRIORITY);
|
||||
NotificationCompat.BigTextStyle inboxStyle =
|
||||
new NotificationCompat.BigTextStyle();
|
||||
// Sets a title for the Inbox in expanded layout
|
||||
inboxStyle.setBigContentTitle(notifTitle);
|
||||
inboxStyle.bigText(notif);
|
||||
inboxStyle.setSummaryText(getApplicationContext().getString(com.adins.mss.base.R.string.click_to_open));
|
||||
|
||||
|
||||
builder.setDefaults(android.app.Notification.DEFAULT_ALL);
|
||||
builder.setStyle(inboxStyle);
|
||||
builder.setAutoCancel(true);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(1, builder.build());
|
||||
|
||||
}
|
||||
|
||||
public static int getNotificationIcon() {
|
||||
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
|
||||
return useWhiteIcon ? com.adins.mss.base.R.drawable.icon_notif_new_white : com.adins.mss.base.R.drawable.icon_notif_new;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -0,0 +1,17 @@
|
|||
package com.adins.mss.base.dynamicform.form.models;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CheckRejectedOrderRequest extends MssRequestType {
|
||||
@SerializedName("reviewTask")
|
||||
private ReviewTask reviewTask;
|
||||
|
||||
public ReviewTask getReviewTask() {
|
||||
return reviewTask;
|
||||
}
|
||||
|
||||
public void setReviewTask(ReviewTask reviewTask) {
|
||||
this.reviewTask = reviewTask;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.adins.mss.coll.loyalti.barchart;
|
||||
|
||||
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||
|
||||
public class LoyaltyXLabelFormatter extends ValueFormatter {
|
||||
|
||||
private String[] labels;
|
||||
|
||||
public LoyaltyXLabelFormatter(String[] labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
public int getLabelCount(){
|
||||
if(labels == null)
|
||||
return 0;
|
||||
return labels.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedValue(float value) {
|
||||
int idx = Math.round(value);
|
||||
if(labels.length == 0)
|
||||
return "";
|
||||
|
||||
if(idx < 0 || idx >= labels.length)
|
||||
return "";
|
||||
|
||||
return labels[idx];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.adins.mss.foundation.camerainapp.helper;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 7/26/2016.
|
||||
*/
|
||||
public class Logger {
|
||||
|
||||
private static final String TAG = "com.adins.mss";
|
||||
|
||||
public static void d(Object object, String message) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Log.d(getTag(object), message);
|
||||
}
|
||||
|
||||
public static void v(Object object, String message, Throwable e) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Log.v(getTag(object), message, e);
|
||||
}
|
||||
|
||||
public static void e(Object object, String message) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Logger.e(getTag(object), message);
|
||||
}
|
||||
|
||||
public static void e(Object object, Throwable e) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Logger.e(getTag(object), getTag(object).toString(), e);
|
||||
}
|
||||
|
||||
public static void w(Object object, String message) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Log.w(getTag(object), message);
|
||||
}
|
||||
|
||||
|
||||
public static void e(Object object, String message, Throwable e) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Logger.e(getTag(object), message, e);
|
||||
}
|
||||
|
||||
public static void i(Object object, String message) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
Log.i(getTag(object), message);
|
||||
}
|
||||
|
||||
public static void printStackTrace(Exception e) {
|
||||
if (!Global.IS_DEV) return;
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
private static String getTag(Object object) {
|
||||
return object != null ? object.getClass().getSimpleName() : TAG;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,489 @@
|
|||
package com.adins.mss.coll.fragments.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.errorhandler.ErrorMessageHandler;
|
||||
import com.adins.mss.base.errorhandler.IShowError;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.api.PaymentHistoryApi;
|
||||
import com.adins.mss.coll.commons.Toaster;
|
||||
import com.adins.mss.coll.commons.ViewManager;
|
||||
import com.adins.mss.coll.fragments.PaymentHistoryDetailFragment;
|
||||
import com.adins.mss.coll.fragments.PaymentHistoryFragment;
|
||||
import com.adins.mss.coll.models.PaymentHistoryHBean;
|
||||
import com.adins.mss.coll.models.PaymentHistoryResponse;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.PaymentHistoryD;
|
||||
import com.adins.mss.dao.PaymentHistoryH;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.PaymentHistoryDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.PaymentHistoryHDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kusnendi.muhamad on 31/07/2017.
|
||||
*/
|
||||
|
||||
public class PaymentHistoryView extends ViewManager implements IShowError {
|
||||
private Activity activity;
|
||||
private Intent intent;
|
||||
private NetworkInfo activeNetworkInfo;
|
||||
private ConnectivityManager connectivityManager;
|
||||
private List<PaymentHistoryH> paymentHistoryHLocalList = null;
|
||||
private List<PaymentHistoryD> paymentHistoryDLocalList = null;
|
||||
private String transactionCode;
|
||||
PaymentHistoryResponse historyResponse;
|
||||
ImageButton imageButton;
|
||||
String taskId;
|
||||
private ErrorMessageHandler errorMessageHandler;
|
||||
|
||||
public PaymentHistoryView(Activity activity) {
|
||||
super(activity);
|
||||
this.activity = activity;
|
||||
this.intent = activity.getIntent();
|
||||
errorMessageHandler = new ErrorMessageHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
taskId = intent.getStringExtra(Global.BUND_KEY_TASK_ID);
|
||||
|
||||
initialize();
|
||||
imageButton = (ImageButton) activity.findViewById(R.id.imageBtnDownload);
|
||||
imageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TableLayout table = (TableLayout) findViewById(R.id.tablePaymentHeaders);
|
||||
// int index = 1;
|
||||
// table.removeViews(index, table.getChildCount()-1);
|
||||
// initialize();
|
||||
imageButton.setEnabled(false);
|
||||
imageButton.setClickable(false);
|
||||
saveData(activity, historyResponse);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void saveData(Context context, PaymentHistoryResponse paymentHistoryResp) {
|
||||
// TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
|
||||
// PaymentHistoryHDataAccess.delete(context, taskH.getUuid_task_h());
|
||||
// PaymentHistoryDDataAccess.delete(context, taskH.getUuid_task_h());
|
||||
|
||||
if(paymentHistoryResp!=null && paymentHistoryResp.getStatus().getCode()==0){
|
||||
List<PaymentHistoryHBean> paymentHistoryHList = paymentHistoryResp.getPaymentHistoryHList();
|
||||
//List<PaymentHistoryH> paymentHistoryHList = paymentHistoryResp.getPaymentHistoryHList();
|
||||
//List<PaymentHistoryD> paymentHistoryDList = paymentHistoryResp.getPaymentHistoryDList();
|
||||
//List<PaymentHistoryH> paymentHistoryHLocalList = null;
|
||||
//List<PaymentHistoryD> paymentHistoryDLocalList = null;
|
||||
if(paymentHistoryHList!=null){
|
||||
|
||||
TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
|
||||
if(paymentHistoryHLocalList!=null && paymentHistoryHLocalList.size()>0){
|
||||
PaymentHistoryHDataAccess.delete(context, taskH.getUuid_task_h());
|
||||
|
||||
if(paymentHistoryDLocalList!=null && paymentHistoryDLocalList.size()>0){
|
||||
PaymentHistoryDDataAccess.delete(context, taskH.getUuid_task_h());
|
||||
}
|
||||
}
|
||||
for(PaymentHistoryHBean paymentHistoryHBean : paymentHistoryHList){
|
||||
String agreementNo = paymentHistoryHBean.getPaymentHistoryH().getAgreement_no();
|
||||
if(agreementNo!=null && agreementNo.length()>0){
|
||||
//paymentHistoryHLocalList = PaymentHistoryHDataAccess.getAll(context, agreementNo);
|
||||
//paymentHistoryDLocalList = PaymentHistoryDDataAccess.getAll(context, uuidTaskH);
|
||||
//if(paymentHistoryDLocalList.size()>0){
|
||||
// PaymentHistoryDDataAccess.delete(context, uuidTaskH);
|
||||
//}
|
||||
// taskH.setAppl_no(agreementNo);
|
||||
// TaskHDataAccess.addOrReplace(context, taskH);
|
||||
// if(paymentHistoryHBean.getPaymentHistoryDList()!=null){
|
||||
// if(paymentHistoryHBean.getPaymentHistoryDList().size()>0){
|
||||
// for(PaymentHistoryD paymentHistoryD : paymentHistoryHBean.getPaymentHistoryDList()){
|
||||
// PaymentHistoryDDataAccess.delete(context, paymentHistoryD);
|
||||
// }
|
||||
// PaymentHistoryDDataAccess.delete(context, paymentHistoryHBean.getPaymentHistoryH().getUuid_task_h());
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if(paymentHistoryHBean.getPaymentHistoryH().getUuid_payment_history_h()==null){
|
||||
paymentHistoryHBean.getPaymentHistoryH().setUuid_payment_history_h(Tool.getUUID());
|
||||
}
|
||||
paymentHistoryHBean.getPaymentHistoryH().setUuid_task_h(taskH.getUuid_task_h());
|
||||
PaymentHistoryHDataAccess.addOrReplace(context, paymentHistoryHBean.getPaymentHistoryH());
|
||||
|
||||
if(paymentHistoryHBean.getPaymentHistoryDList()!=null){
|
||||
if(paymentHistoryHBean.getPaymentHistoryDList().size()>0){
|
||||
for(PaymentHistoryD historyD : paymentHistoryHBean.getPaymentHistoryDList()){
|
||||
historyD.setUuid_payment_history_d(Tool.getUUID());
|
||||
historyD.setUuid_task_h(taskH.getUuid_task_h());
|
||||
historyD.setUuid_payment_history_h(paymentHistoryHBean.getPaymentHistoryH().getUuid_payment_history_h());
|
||||
PaymentHistoryDDataAccess.addOrReplace(context, historyD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Toast.makeText(context, context.getString(R.string.data_saved), Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
Toaster.warning(context, activity.getString(R.string.failed_save_data));
|
||||
}
|
||||
imageButton.setEnabled(true);
|
||||
imageButton.setClickable(true);
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
TaskH taskH = TaskHDataAccess.getOneTaskHeader(activity, taskId);
|
||||
paymentHistoryHLocalList = PaymentHistoryHDataAccess.getAllbyTask(activity, taskH.getUuid_task_h());
|
||||
paymentHistoryDLocalList = PaymentHistoryDDataAccess.getAll(activity, taskH.getUuid_task_h());
|
||||
|
||||
connectivityManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
|
||||
new AsyncTask<String, Void, PaymentHistoryResponse>() {
|
||||
private ProgressDialog progressDialog;
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(activity,
|
||||
"", activity.getString(R.string.progressWait), true);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected PaymentHistoryResponse doInBackground(String... params) {
|
||||
PaymentHistoryApi api = new PaymentHistoryApi(activity);
|
||||
try {
|
||||
if(Tool.isInternetconnected(activity)){
|
||||
return api.request(params[0]);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(PaymentHistoryResponse paymentHistoryResponse) {
|
||||
super.onPostExecute(paymentHistoryResponse);
|
||||
if (progressDialog!=null&&progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
if(!GlobalData.isRequireRelogin()) {
|
||||
if (paymentHistoryResponse == null) {
|
||||
// NiftyDialogBuilder.getInstance(PaymentHistoryFragment.this)
|
||||
// .withMessage("Unable to retrieve data from the server - offline mode")
|
||||
// .withTitle("Server Error")
|
||||
// .withButton1Text("Close")
|
||||
// .setButton1Click(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// //finish();
|
||||
// NiftyDialogBuilder.getInstance(PaymentHistoryFragment.this).dismiss();
|
||||
// }
|
||||
// })
|
||||
// .show();
|
||||
//return;
|
||||
|
||||
//bong 25 mei 15 - display local data
|
||||
{
|
||||
TaskH taskH = TaskHDataAccess.getOneTaskHeader(activity, taskId);
|
||||
List<PaymentHistoryH> paymentHistoryHeaderList = null;
|
||||
if (null != taskH) {
|
||||
//paymentHistoryHeaderList = PaymentHistoryHDataAccess.getAll(getApplicationContext(), taskH.getUuid_task_h());
|
||||
paymentHistoryHeaderList = PaymentHistoryHDataAccess.getAllbyTask(activity, taskH.getUuid_task_h());
|
||||
if (paymentHistoryHeaderList != null && !paymentHistoryHeaderList.isEmpty()) {
|
||||
TextView agreementNumber = (TextView) activity.findViewById(R.id.agreementNumber);
|
||||
//agreementNumber.setText(paymentHistoryResponse.getAgreementNo());
|
||||
agreementNumber.setText(paymentHistoryHeaderList.get(0).getAgreement_no());
|
||||
|
||||
List<PaymentHistoryHBean> paymentHistoryHeaderBeanList = new ArrayList<PaymentHistoryHBean>();
|
||||
|
||||
for (PaymentHistoryH paymentHistoryH : paymentHistoryHeaderList) {
|
||||
PaymentHistoryHBean paymentHistoryHBean = new PaymentHistoryHBean();
|
||||
List<PaymentHistoryD> paymentHistoryDList = PaymentHistoryDDataAccess.getAllByHistoryH(activity, paymentHistoryH.getUuid_payment_history_h());
|
||||
paymentHistoryHBean.setPaymentHistoryH(paymentHistoryH);
|
||||
paymentHistoryHBean.setPaymentHistoryDList(paymentHistoryDList);
|
||||
paymentHistoryHeaderBeanList.add(paymentHistoryHBean);
|
||||
}
|
||||
|
||||
TableLayout table = (TableLayout) activity.findViewById(R.id.tablePaymentHeaders);
|
||||
int index = 1;
|
||||
for (PaymentHistoryHBean header : paymentHistoryHeaderBeanList) {
|
||||
View row = LayoutInflater.from(activity).inflate(R.layout.view_row_payment_history, table, false);
|
||||
List<PaymentHistoryD> details = new ArrayList<PaymentHistoryD>();
|
||||
if (header.getPaymentHistoryDList() != null) {
|
||||
for (PaymentHistoryD detail : header.getPaymentHistoryDList()) {
|
||||
if (detail.getUuid_task_h().equals(header.getPaymentHistoryH().getUuid_task_h())) {
|
||||
detail.setReceipt_no(header.getPaymentHistoryH().getReceipt_no());
|
||||
detail.setValue_date(header.getPaymentHistoryH().getValue_date());
|
||||
detail.setPosting_date(header.getPaymentHistoryH().getPost_date());
|
||||
detail.setPayment_amount(header.getPaymentHistoryH().getPayment_amount());
|
||||
detail.setInstallment_amount(header.getPaymentHistoryH().getInstallment_amount());
|
||||
detail.setInstallment_number(header.getPaymentHistoryH().getInstallment_number());
|
||||
detail.setWop_code(header.getPaymentHistoryH().getWop_code());
|
||||
detail.setPayment_amount(header.getPaymentHistoryH().getPayment_amount());
|
||||
detail.setInstallment_amount(header.getPaymentHistoryH().getInstallment_amount());
|
||||
detail.setInstallment_number(header.getPaymentHistoryH().getInstallment_number());
|
||||
detail.setTransaction_type(header.getPaymentHistoryH().getTransaction_type());
|
||||
detail.setWop_code(header.getPaymentHistoryH().getWop_code());
|
||||
details.add(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* List<PaymentHistoryResponseDetail> paymentHistoryResponseDetailList = new ArrayList<PaymentHistoryResponseDetail>();
|
||||
for(PaymentHistoryD detail : details){
|
||||
PaymentHistoryResponseDetail paymentHistoryResponseDetail = new PaymentHistoryResponseDetail();
|
||||
paymentHistoryResponseDetail.setDtmCrt(detail.getDtm_crt());
|
||||
paymentHistoryResponseDetail.setDtmUpd(detail.getDtm_upd());
|
||||
paymentHistoryResponseDetail.setOsAmountOd(detail.getOs_amount_od());
|
||||
paymentHistoryResponseDetail.setPaymentAllocationName(detail.getPayment_allocation_name());
|
||||
paymentHistoryResponseDetail.setReceiveAmount(detail.getReceive_amount());
|
||||
paymentHistoryResponseDetail.setStatus(null);
|
||||
paymentHistoryResponseDetail.setUnstructured(null);
|
||||
paymentHistoryResponseDetail.setUsrCrt(detail.getUsr_crt());
|
||||
paymentHistoryResponseDetail.setUsrUpd(detail.getUsr_upd());
|
||||
paymentHistoryResponseDetail.setUuidTaskId(detail.getUuid_task_h());
|
||||
paymentHistoryResponseDetail.setUuidViewPaymentHistoryD(detail.getUuid_payment_history_d());
|
||||
paymentHistoryResponseDetailList.add(paymentHistoryResponseDetail);
|
||||
}*/
|
||||
//row.setTag(details);
|
||||
row.setTag(R.string.tag_paymenthistoryDetail, details);
|
||||
row.setTag(R.string.tag_transactioncode, header.getPaymentHistoryH().getReceipt_no());
|
||||
|
||||
TextView no = (TextView) row.findViewById(R.id.no);
|
||||
TextView transactionCode = (TextView) row.findViewById(R.id.transactionCode);
|
||||
TextView postingDate = (TextView) row.findViewById(R.id.postingDate);
|
||||
TextView amountPaid = (TextView) row.findViewById(R.id.amountPaid);
|
||||
TextView amountInstallment = (TextView) row.findViewById(R.id.amountInstallment);
|
||||
|
||||
no.setText(String.valueOf(index++));
|
||||
transactionCode.setText(header.getPaymentHistoryH().getReceipt_no());
|
||||
postingDate.setText(Formatter.formatDate(header.getPaymentHistoryH().getPost_date(), Global.DATE_STR_FORMAT));
|
||||
|
||||
String amtIns = header.getPaymentHistoryH().getInstallment_amount();
|
||||
if (amtIns != null && amtIns.length() > 0) {
|
||||
String part1 = amtIns.substring(amtIns.length() - 3);
|
||||
if (part1.substring(0, 1).equals(".")) {
|
||||
amountInstallment.setGravity(Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String amtPaid = header.getPaymentHistoryH().getPayment_amount();
|
||||
if (amtPaid != null && amtPaid.length() > 0) {
|
||||
String part2 = amtPaid.substring(amtPaid.length() - 3);
|
||||
if (part2.substring(0, 1).equals(".")) {
|
||||
amountPaid.setGravity(Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
amountPaid.setText(header.getPaymentHistoryH().getPayment_amount());
|
||||
amountInstallment.setText(header.getPaymentHistoryH().getInstallment_amount());
|
||||
|
||||
// if (index % 2 == 1) {
|
||||
// row.setBackgroundResource(R.color.tv_gray_light);
|
||||
// }else if(index % 2 == 0){
|
||||
// row.setBackgroundResource(R.color.tv_gray);
|
||||
// }
|
||||
|
||||
row.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// List<PaymentHistoryD> details =
|
||||
// (List<PaymentHistoryD>) v.getTag();
|
||||
// openDetails((Serializable) details);
|
||||
gotoDetails(v);
|
||||
}
|
||||
});
|
||||
|
||||
table.addView(row);
|
||||
}
|
||||
} else {
|
||||
errorMessageHandler.processError(activity.getString(R.string.warning_capital)
|
||||
, activity.getString(R.string.no_data_found_offline)
|
||||
, ErrorMessageHandler.DIALOG_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// else
|
||||
// {
|
||||
else if (paymentHistoryResponse.getStatus().getCode() != 0) {
|
||||
errorMessageHandler.processError(activity.getString(R.string.server_error)
|
||||
, paymentHistoryResponse.getStatus().getMessage()
|
||||
, ErrorMessageHandler.DIALOG_TYPE);
|
||||
return;
|
||||
}
|
||||
// }
|
||||
else {
|
||||
historyResponse = paymentHistoryResponse;
|
||||
TextView agreementNumber = (TextView) activity.findViewById(R.id.agreementNumber);
|
||||
agreementNumber.setText(paymentHistoryResponse.getAgreementNo());
|
||||
|
||||
TableLayout table = (TableLayout) activity.findViewById(R.id.tablePaymentHeaders);
|
||||
int index = 1;
|
||||
if (paymentHistoryResponse.getPaymentHistoryHList().size() == 0) {
|
||||
errorMessageHandler.processError(activity.getString(R.string.info_capital)
|
||||
, activity.getString(R.string.no_data_from_server)
|
||||
, ErrorMessageHandler.DIALOG_TYPE);
|
||||
}
|
||||
for (PaymentHistoryHBean header : paymentHistoryResponse.getPaymentHistoryHList()) {
|
||||
View row = LayoutInflater.from(activity).inflate(R.layout.view_row_payment_history, table, false);
|
||||
List<PaymentHistoryD> details = new ArrayList<PaymentHistoryD>();
|
||||
for (PaymentHistoryD detail : header.getPaymentHistoryDList()) {
|
||||
//if (detail.getUuid_task_h().equals(header.getPaymentHistoryH().getUuid_task_h())) {
|
||||
detail.setReceipt_no(header.getPaymentHistoryH().getReceipt_no());
|
||||
detail.setValue_date(header.getPaymentHistoryH().getValue_date());
|
||||
detail.setPosting_date(header.getPaymentHistoryH().getPost_date());
|
||||
detail.setPayment_amount(header.getPaymentHistoryH().getPayment_amount());
|
||||
detail.setInstallment_amount(header.getPaymentHistoryH().getInstallment_amount());
|
||||
detail.setInstallment_number(header.getPaymentHistoryH().getInstallment_number());
|
||||
detail.setWop_code(header.getPaymentHistoryH().getWop_code());
|
||||
detail.setPayment_amount(header.getPaymentHistoryH().getPayment_amount());
|
||||
detail.setInstallment_amount(header.getPaymentHistoryH().getInstallment_amount());
|
||||
detail.setInstallment_number(header.getPaymentHistoryH().getInstallment_number());
|
||||
detail.setWop_code(header.getPaymentHistoryH().getWop_code());
|
||||
detail.setTransaction_type(header.getPaymentHistoryH().getTransaction_type());
|
||||
details.add(detail);
|
||||
//}
|
||||
}
|
||||
|
||||
/* List<PaymentHistoryD> paymentHistoryResponseDetailList = new ArrayList<PaymentHistoryD>();
|
||||
for(PaymentHistoryD detail : details){
|
||||
PaymentHistoryResponseDetail paymentHistoryResponseDetail = new PaymentHistoryResponseDetail();
|
||||
paymentHistoryResponseDetail.setDtmCrt(detail.getDtm_crt());
|
||||
paymentHistoryResponseDetail.setDtmUpd(detail.getDtm_upd());
|
||||
paymentHistoryResponseDetail.setOsAmountOd(detail.getOs_amount_od());
|
||||
paymentHistoryResponseDetail.setPaymentAllocationName(detail.getPayment_allocation_name());
|
||||
paymentHistoryResponseDetail.setReceiveAmount(detail.getReceive_amount());
|
||||
paymentHistoryResponseDetail.setStatus(paymentHistoryResponse.getStatus());
|
||||
paymentHistoryResponseDetail.setUnstructured(paymentHistoryResponse.getUnstructured());
|
||||
paymentHistoryResponseDetail.setUsrCrt(detail.getUsr_crt());
|
||||
paymentHistoryResponseDetail.setUsrUpd(detail.getUsr_upd());
|
||||
paymentHistoryResponseDetail.setUuidTaskId(detail.getUuid_task_h());
|
||||
paymentHistoryResponseDetail.setUuidViewPaymentHistoryD(detail.getUuid_payment_history_d());
|
||||
paymentHistoryResponseDetailList.add(paymentHistoryResponseDetail);
|
||||
}*/
|
||||
//row.setTag(details);
|
||||
row.setTag(R.string.tag_paymenthistoryDetail, details);
|
||||
row.setTag(R.string.tag_transactioncode, header.getPaymentHistoryH().getReceipt_no());
|
||||
|
||||
TextView no = (TextView) row.findViewById(R.id.no);
|
||||
TextView transactionCode = (TextView) row.findViewById(R.id.transactionCode);
|
||||
TextView postingDate = (TextView) row.findViewById(R.id.postingDate);
|
||||
TextView amountPaid = (TextView) row.findViewById(R.id.amountPaid);
|
||||
TextView amountInstallment = (TextView) row.findViewById(R.id.amountInstallment);
|
||||
|
||||
no.setText(String.valueOf(index++));
|
||||
transactionCode.setText(header.getPaymentHistoryH().getTransaction_type());
|
||||
postingDate.setText(null != header.getPaymentHistoryH().getPost_date() ?
|
||||
Formatter.formatDate(header.getPaymentHistoryH().getPost_date(), Global.DATE_STR_FORMAT) : "-");
|
||||
amountPaid.setText(header.getPaymentHistoryH().getPayment_amount());
|
||||
amountInstallment.setText(header.getPaymentHistoryH().getInstallment_amount());
|
||||
|
||||
String amtIns = header.getPaymentHistoryH().getInstallment_amount();
|
||||
if (amtIns != null && amtIns.length() > 0) {
|
||||
String part1 = amtIns.substring(amtIns.length() - 3);
|
||||
if (part1.substring(0, 1).equals(".")) {
|
||||
amountInstallment.setGravity(Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String amtPaid = header.getPaymentHistoryH().getPayment_amount();
|
||||
if (amtPaid != null && amtPaid.length() > 0) {
|
||||
String part2 = amtPaid.substring(amtPaid.length() - 3);
|
||||
if (part2.substring(0, 1).equals(".")) {
|
||||
amountPaid.setGravity(Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
// if (index % 2 == 1) {
|
||||
// row.setBackgroundResource(R.color.tv_gray_light);
|
||||
// }else if(index % 2 == 0){
|
||||
// row.setBackgroundResource(R.color.tv_gray);
|
||||
// }
|
||||
|
||||
row.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// List<PaymentHistoryD> details =
|
||||
// (List<PaymentHistoryD>) v.getTag();
|
||||
// openDetails((Serializable) details);
|
||||
gotoDetails(v);
|
||||
}
|
||||
});
|
||||
|
||||
table.addView(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute(taskId);
|
||||
}
|
||||
|
||||
private void openDetails(Serializable details) {
|
||||
Intent intent = new Intent(activity, PaymentHistoryDetailFragment.class);
|
||||
intent.putExtra(PaymentHistoryDetailFragment.PAYMENT_HISTORY_DETAIL, details);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
private void gotoDetails(View v) {
|
||||
PaymentHistoryFragment.details = (List<PaymentHistoryD>) v.getTag(R.string.tag_paymenthistoryDetail);
|
||||
transactionCode = (String)v.getTag(R.string.tag_transactioncode);
|
||||
Intent intent = new Intent(activity, PaymentHistoryDetailFragment.class);
|
||||
intent.putExtra(PaymentHistoryDetailFragment.BUND_KEY_TRANSACTIONCODE, transactionCode);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String errorSubject, String errorMsg, int notifType) {
|
||||
NiftyDialogBuilder.getInstance(activity)
|
||||
.withMessage(errorMsg)
|
||||
.withTitle(errorSubject)
|
||||
.isCancelableOnTouchOutside(false)
|
||||
.withButton1Text(activity.getString(R.string.btnClose))
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//finish();
|
||||
NiftyDialogBuilder.getInstance(activity).dismiss();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
|
@ -0,0 +1,98 @@
|
|||
package zj.com.command.sdk;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import zj.com.customize.sdk.Other;
|
||||
|
||||
public class PrintPicture {
|
||||
|
||||
/**
|
||||
* 打å<E2809C>°ä½<C3A4>图函数
|
||||
* æ¤å‡½æ•°æ˜¯å°†ä¸€è¡Œä½œä¸ºä¸€ä¸ªå›¾ç‰‡æ‰“å<E2809C>°ï¼Œè¿™æ ·å¤„ç<E2809E>†ä¸<C3A4>容易出é<C2BA>?™
|
||||
*
|
||||
* @param mBitmap
|
||||
* @param nWidth
|
||||
* @param nMode
|
||||
* @return
|
||||
*/
|
||||
public static byte[] POS_PrintBMP(Bitmap mBitmap, int nWidth, int nMode) {
|
||||
// 先转黑白,å†<C3A5>è°ƒç<C692>?¨å‡½æ•°ç¼©æ<C2A9>?¾ä½<C3A4>图
|
||||
int width = ((nWidth + 7) / 8) * 8;
|
||||
int height = mBitmap.getHeight() * width / mBitmap.getWidth();
|
||||
height = ((height + 7) / 8) * 8;
|
||||
|
||||
Bitmap rszBitmap = mBitmap;
|
||||
if (mBitmap.getWidth() != width) {
|
||||
rszBitmap = Other.resizeImage(mBitmap, width, height);
|
||||
}
|
||||
|
||||
Bitmap grayBitmap = Other.toGrayscale(rszBitmap);
|
||||
|
||||
byte[] dithered = Other.thresholdToBWPic(grayBitmap);
|
||||
|
||||
byte[] data = Other.eachLinePixToCmd(dithered, width, nMode);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使ç<C2BF>?¨ä¸‹ä¼ ä½<C3A4>图打å<E2809C>°å›¾ç‰‡
|
||||
* å…ˆæ<CB86>?¶å®Œå†<C3A5>打å<E2809C>°
|
||||
*
|
||||
* @param bmp
|
||||
* @return
|
||||
*/
|
||||
public static byte[] Print_1D2A(Bitmap bmp) {
|
||||
|
||||
/*
|
||||
* 使ç<C2BF>?¨ä¸‹ä¼ ä½<C3A4>图打å<E2809C>°å›¾ç‰‡
|
||||
* å…ˆæ<CB86>?¶å®Œå†<C3A5>打å<E2809C>°
|
||||
*/
|
||||
int width = bmp.getWidth();
|
||||
int height = bmp.getHeight();
|
||||
byte data[] = new byte[1024 * 10];
|
||||
data[0] = 0x1D;
|
||||
data[1] = 0x2A;
|
||||
data[2] = (byte) ((width - 1) / 8 + 1);
|
||||
data[3] = (byte) ((height - 1) / 8 + 1);
|
||||
byte k = 0;
|
||||
int position = 4;
|
||||
int i;
|
||||
int j;
|
||||
byte temp = 0;
|
||||
for (i = 0; i < width; i++) {
|
||||
|
||||
System.out.println("è¿›æ<E280BA>¥äº†...I");
|
||||
for (j = 0; j < height; j++) {
|
||||
System.out.println("è¿›æ<E280BA>¥äº†...J");
|
||||
if (bmp.getPixel(i, j) != -1) {
|
||||
temp |= (0x80 >> k);
|
||||
} // end if
|
||||
k++;
|
||||
if (k == 8) {
|
||||
data[position++] = temp;
|
||||
temp = 0;
|
||||
k = 0;
|
||||
} // end if k
|
||||
}// end for j
|
||||
if (k % 8 != 0) {
|
||||
data[position++] = temp;
|
||||
temp = 0;
|
||||
k = 0;
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("data" + data);
|
||||
|
||||
if (width % 8 != 0) {
|
||||
i = height / 8;
|
||||
if (height % 8 != 0) i++;
|
||||
j = 8 - (width % 8);
|
||||
for (k = 0; k < i * j; k++) {
|
||||
data[position++] = 0;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2013 Chris Banes
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<string name="pull_to_refresh_pull_label">Pull to refresh…</string>
|
||||
<string name="pull_to_refresh_release_label">Release to refresh…</string>
|
||||
<string name="pull_to_refresh_refreshing_label">Loading…</string>
|
||||
|
||||
</resources>
|
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true">
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/gradient_start"
|
||||
android:endColor="@color/gradient_end"
|
||||
android:angle="270"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bg_menu_press" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
Loading…
Add table
Add a link
Reference in a new issue