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,164 @@
|
|||
package com.adins.mss.base.payment;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.BuildConfig;
|
||||
import com.adins.mss.base.dynamicform.form.FragmentQuestion;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.pax.dal.IDAL;
|
||||
import com.pax.dal.entity.ETermInfoKey;
|
||||
import com.pax.neptunelite.api.NeptuneLiteUser;
|
||||
|
||||
import org.bouncycastle.crypto.Digest;
|
||||
import org.bouncycastle.crypto.digests.SHA256Digest;
|
||||
import org.bouncycastle.crypto.macs.HMac;
|
||||
import org.bouncycastle.crypto.params.KeyParameter;
|
||||
import org.bouncycastle.jce.provider.JCEKeyGenerator;
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
|
||||
public class PaxPayment {
|
||||
private static final String APP_PACKAGE = "com.pax_bni.edc";
|
||||
private static final String SECRET_KEY = "0000000000000000";
|
||||
private static final String IDENTIFIER = "adins";
|
||||
private static final String MENU_LOGON = "logon";
|
||||
private static final String MENU_SALES = "sale";
|
||||
private static final String MENU_VOID = "void";
|
||||
private static final String MENU_SETTLEMENT = "settlement";
|
||||
public static final String ACTION_SUCCESS_PAYMENT = "com.adins.mss.ACTION_SUCCESS";
|
||||
private static final String ACTION_FAIL_PAYMENT = "com.adins.mss.ACTION_FAIL";
|
||||
|
||||
private static PaxPayment INSTANCE;
|
||||
private Context context;
|
||||
|
||||
public static PaxPayment getInstance(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new PaxPayment(context);
|
||||
}
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public PaxPayment(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
//Logon Method for Initial Request Payment
|
||||
public void logon() {
|
||||
Intent intent = getIntent(this.context);
|
||||
if (intent == null) {
|
||||
intentNotAvailable();
|
||||
return;
|
||||
}
|
||||
requestIntent(intent, MENU_LOGON);
|
||||
}
|
||||
|
||||
public void sale(String amount, String fee) {
|
||||
Intent intent = getIntent(this.context);
|
||||
|
||||
if (intent == null) {
|
||||
intentNotAvailable();
|
||||
return;
|
||||
}
|
||||
intent.putExtra("amount", amount);
|
||||
intent.putExtra("tipAmount", fee);
|
||||
requestIntent(intent, MENU_SALES);
|
||||
}
|
||||
|
||||
public void settlement() {
|
||||
Intent intent = getIntent(context);
|
||||
if (intent == null) {
|
||||
intentNotAvailable();
|
||||
return;
|
||||
}
|
||||
requestIntent(intent, MENU_SETTLEMENT);
|
||||
}
|
||||
|
||||
private Intent getIntent(Context context) {
|
||||
Intent intent = null;
|
||||
try {
|
||||
intent = context.getPackageManager().getLaunchIntentForPackage(APP_PACKAGE);
|
||||
} catch (Exception ex) {
|
||||
Toast.makeText(context, "Payment Channel not available!", Toast.LENGTH_LONG).show();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return intent;
|
||||
}
|
||||
|
||||
private void requestIntent(Intent intent, String menu) {
|
||||
String serialNumber = "";
|
||||
try {
|
||||
IDAL dal = NeptuneLiteUser.getInstance().getDal(context);
|
||||
serialNumber = dal.getSys().getTermInfo().get(ETermInfoKey.SN);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Format : DateTime + EDC Serial Number + App + Menu
|
||||
String dateTime = Formatter.formatDate(new Date(), "ddMMyyyyHHmmss");
|
||||
String rawContent= dateTime + serialNumber + IDENTIFIER + menu;
|
||||
String signature = sign(rawContent);
|
||||
|
||||
//Prepare Intent Request
|
||||
intent.putExtra("menu", menu);
|
||||
intent.putExtra("app", IDENTIFIER);
|
||||
intent.putExtra("DateTime", dateTime);
|
||||
intent.putExtra("signature", signature);
|
||||
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private String sign(String content) {
|
||||
Digest digest = new SHA256Digest();
|
||||
HMac hmac = new HMac(digest);
|
||||
hmac.init(new KeyParameter(SECRET_KEY.getBytes()));
|
||||
hmac.update(content.getBytes(), 0, content.getBytes().length);
|
||||
byte[] result = new byte[digest.getDigestSize()];
|
||||
hmac.doFinal(result, 0);
|
||||
String signature = new String(Hex.encode(result));
|
||||
return signature.toUpperCase();
|
||||
}
|
||||
|
||||
private void intentNotAvailable() {
|
||||
Toast.makeText(context, "Payment Channel not available!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public static class PaymentResultReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String app = intent.getStringExtra("App");
|
||||
String response = intent.getStringExtra("Respon"); //OK||FAIL
|
||||
|
||||
if (response.equalsIgnoreCase("OK") && intent.hasExtra("Data")) {
|
||||
String result = intent.getStringExtra("Data");
|
||||
Log.d("Result", result);
|
||||
|
||||
if (BuildConfig.DEBUG) Toast.makeText(context, result, Toast.LENGTH_SHORT).show();
|
||||
if (!result.toUpperCase().contains("SALE")) return;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(FragmentQuestion.BUND_KEY_ACTION, FragmentQuestion.SUBMIT_FORM);
|
||||
bundle.putString("Result", result);
|
||||
Message message = new Message();
|
||||
message.setData(bundle);
|
||||
FragmentQuestion.questionHandler.sendMessage(message);
|
||||
} else {
|
||||
Intent notify = new Intent(ACTION_FAIL_PAYMENT);
|
||||
context.sendBroadcast(notify);
|
||||
Toast.makeText(context, "Transaction Failed.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
Log.d("App", app);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.adins.mss.base.todolist;
|
||||
|
||||
import com.adins.mss.dao.QuestionSet;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JsonQuestionSet extends MssResponseType {
|
||||
@SerializedName("listQuestionSet")
|
||||
private List<QuestionSet> listQuestionSet;
|
||||
|
||||
public List<QuestionSet> getListQuestionSet() {
|
||||
return listQuestionSet;
|
||||
}
|
||||
|
||||
public void setListQuestionSet(List<QuestionSet> listQuestionSet) {
|
||||
this.listQuestionSet = listQuestionSet;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,506 @@
|
|||
package com.adins.mss.foundation.dialog;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.foundation.dialog.gitonway.lib.ColorUtils;
|
||||
import com.adins.mss.foundation.dialog.gitonway.lib.Effectstype;
|
||||
import com.adins.mss.foundation.dialog.gitonway.lib.effects.BaseEffects;
|
||||
import com.adins.mss.foundation.image.ImageViewer;
|
||||
|
||||
//
|
||||
//import de.greenrobot.daoexample.R;
|
||||
//
|
||||
|
||||
/*
|
||||
* Copyright 2014 litao
|
||||
* https://github.com/sd6352051/NiftyDialogEffects
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
public class NiftyDialogBuilder_PL extends Dialog implements DialogInterface {
|
||||
|
||||
private static Context tmpContext;
|
||||
private static int mOrientation = 1;
|
||||
private static NiftyDialogBuilder_PL instance;
|
||||
private final String defTextColor = "#FFFFFFFF";
|
||||
private final String defDividerColor = "#11000000";
|
||||
private final String defMsgColor = "#FFFFFFFF";
|
||||
private final String defDialogColor = "#FF5f5f5f";
|
||||
private Effectstype type = null;
|
||||
private LinearLayout mLinearLayoutView;
|
||||
private LinearLayout mTaskListLayoutView;
|
||||
private LinearLayout mVerificationLayoutView;
|
||||
private LinearLayout mApprovalLayoutView;
|
||||
private LinearLayout mVerificationLayoutViewByBranch;
|
||||
private LinearLayout mApprovalLayoutViewByBranch;
|
||||
private LinearLayout mAssignmentLayoutView;
|
||||
private RelativeLayout mRelativeLayoutView;
|
||||
private LinearLayout mLinearLayoutMsgView;
|
||||
private LinearLayout mLinearLayoutTopView;
|
||||
private FrameLayout mFrameLayoutCustomView;
|
||||
private ImageView mImageView;
|
||||
private AutoCompleteTextView mtxtSearch;
|
||||
private View mDialogView;
|
||||
private View mDivider;
|
||||
private TextView mTitle;
|
||||
private TextView mMessage;
|
||||
private TextView mTasklistChoice;
|
||||
private TextView mApprovallistChoice;
|
||||
private TextView mVerificationlistChoice;
|
||||
private TextView mApprovallistChoiceByBranch;
|
||||
private TextView mVerificationlistChoiceByBranch;
|
||||
private TextView mAssignmentlistChoice;
|
||||
private ImageView mIcon;
|
||||
private Button mButton1;
|
||||
private Button mButton2;
|
||||
private int mDuration = -1;
|
||||
private boolean isCancelable = true;
|
||||
|
||||
public NiftyDialogBuilder_PL(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL(Context context, int theme) {
|
||||
super(context, theme);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public static NiftyDialogBuilder_PL getInstance(Context context) {
|
||||
|
||||
if (instance == null || !tmpContext.equals(context)) {
|
||||
synchronized (NiftyDialogBuilder_PL.class) {
|
||||
if (instance == null || !tmpContext.equals(context)) {
|
||||
instance = new NiftyDialogBuilder_PL(context, R.style.dialog_untran);
|
||||
}
|
||||
}
|
||||
}
|
||||
tmpContext = context;
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
|
||||
mDialogView = View.inflate(context, R.layout.dialog_layout_timeline, null);
|
||||
|
||||
mLinearLayoutView = (LinearLayout) mDialogView.findViewById(R.id.parentPanelT);
|
||||
mTaskListLayoutView = (LinearLayout) mDialogView.findViewById(R.id.ChoiceTaskList);
|
||||
mApprovalLayoutView = (LinearLayout) mDialogView.findViewById(R.id.ChoiceApprovalList);
|
||||
mVerificationLayoutView = (LinearLayout) mDialogView.findViewById(R.id.ChoiceVerificationlist);
|
||||
mApprovalLayoutViewByBranch = (LinearLayout) mDialogView.findViewById(R.id.ChoiceApprovalListByBranch);
|
||||
mVerificationLayoutViewByBranch = (LinearLayout) mDialogView.findViewById(R.id.ChoiceVerificationlistByBranch);
|
||||
mAssignmentLayoutView = (LinearLayout) mDialogView.findViewById(R.id.ChoiceAssignmentList);
|
||||
mRelativeLayoutView = (RelativeLayout) mDialogView.findViewById(R.id.mainlayout);
|
||||
mLinearLayoutTopView = (LinearLayout) mDialogView.findViewById(R.id.topPanelT);
|
||||
mLinearLayoutMsgView = (LinearLayout) mDialogView.findViewById(R.id.contentPanelT);
|
||||
mFrameLayoutCustomView = (FrameLayout) mDialogView.findViewById(R.id.customPanelT);
|
||||
|
||||
mImageView = (ImageView) mDialogView.findViewById(R.id.imageViewT);
|
||||
mImageView.setOnTouchListener(new ImageViewer());
|
||||
|
||||
mtxtSearch = (AutoCompleteTextView) mDialogView.findViewById(R.id.txtSearch);
|
||||
|
||||
|
||||
mTitle = (TextView) mDialogView.findViewById(R.id.alertTitleT);
|
||||
mMessage = (TextView) mDialogView.findViewById(R.id.messageT);
|
||||
mTasklistChoice = (TextView) mDialogView.findViewById(R.id.Choice1);
|
||||
mVerificationlistChoice = (TextView) mDialogView.findViewById(R.id.Choice2);
|
||||
mApprovallistChoice = (TextView) mDialogView.findViewById(R.id.Choice3);
|
||||
mVerificationlistChoiceByBranch = (TextView) mDialogView.findViewById(R.id.Choice4);
|
||||
mApprovallistChoiceByBranch = (TextView) mDialogView.findViewById(R.id.Choice5);
|
||||
mAssignmentlistChoice = (TextView) mDialogView.findViewById(R.id.Choice6);
|
||||
mIcon = (ImageView) mDialogView.findViewById(R.id.iconT);
|
||||
mDivider = mDialogView.findViewById(R.id.titleDividerT);
|
||||
mButton1 = (Button) mDialogView.findViewById(R.id.button1T);
|
||||
mButton2 = (Button) mDialogView.findViewById(R.id.button2T);
|
||||
|
||||
setContentView(mDialogView);
|
||||
|
||||
this.setOnShowListener(new OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
|
||||
mLinearLayoutView.setVisibility(View.VISIBLE);
|
||||
if (type == null) {
|
||||
type = Effectstype.Slidetop;
|
||||
}
|
||||
start(type);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
mRelativeLayoutView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isCancelable) dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void toDefault() {
|
||||
mTitle.setTextColor(Color.parseColor(defTextColor));
|
||||
mDivider.setBackgroundColor(Color.parseColor(defDividerColor));
|
||||
mMessage.setTextColor(Color.parseColor(defMsgColor));
|
||||
mLinearLayoutView.setBackgroundColor(Color.parseColor(defDialogColor));
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTaskListChoice() {
|
||||
mTaskListLayoutView.setVisibility(View.VISIBLE);
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setTaskListChoiceClick(View.OnClickListener click) {
|
||||
mTasklistChoice.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withVerificationListChoice() {
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
mVerificationLayoutView.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setVerificationListChoiceClick(View.OnClickListener click) {
|
||||
mVerificationlistChoice.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withApprovalListChoice() {
|
||||
mApprovalLayoutView.setVisibility(View.VISIBLE);
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setApprovalListChoiceClick(View.OnClickListener click) {
|
||||
mApprovallistChoice.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withVerificationListChoiceByBranch() {
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
mVerificationLayoutViewByBranch.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setVerificationListChoiceByBranchClick(View.OnClickListener click) {
|
||||
mVerificationlistChoiceByBranch.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withApprovalListChoiceByBranch() {
|
||||
mApprovalLayoutViewByBranch.setVisibility(View.VISIBLE);
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withAssignmentListChoice() {
|
||||
mAssignmentLayoutView.setVisibility(View.VISIBLE);
|
||||
mLinearLayoutMsgView.setVisibility(View.VISIBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setAssignmentListChoiceClick(View.OnClickListener click) {
|
||||
mAssignmentlistChoice.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setApprovalListChoiceByBranchClick(View.OnClickListener click) {
|
||||
mApprovallistChoiceByBranch.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withDividerColor(String colorString) {
|
||||
mDivider.setBackgroundColor(Color.parseColor(colorString));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withDividerColor(int color) {
|
||||
mDivider.setBackgroundColor(color);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTransparentBackground() {
|
||||
mLinearLayoutView.setBackgroundColor(Color.TRANSPARENT);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTitle(CharSequence title) {
|
||||
toggleView(mLinearLayoutTopView, title);
|
||||
mTitle.setText(title);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withStatusListTitle() {
|
||||
toggleView(mTaskListLayoutView, "Status Task");
|
||||
mTasklistChoice.setText("Status Task");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withStatusListTitleAndCounter(String count) {
|
||||
toggleView(mTaskListLayoutView, "Status Task");
|
||||
mTasklistChoice.setText("Status Task - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTaskListTitleAndCounter(String count) {
|
||||
toggleView(mTaskListLayoutView, "Task List");
|
||||
mTasklistChoice.setText("Task List - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withVerificationListTitleAndCounter(String count) {
|
||||
toggleView(mVerificationLayoutView, "Verification List");
|
||||
mVerificationlistChoice.setText("Verification List - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withApprovalListTitleAndCounter(String count) {
|
||||
toggleView(mApprovalLayoutView, "Approval List");
|
||||
mApprovallistChoice.setText("Approval List - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withVerificationListByBranchTitleAndCounter(String count) {
|
||||
toggleView(mVerificationLayoutViewByBranch, "Verification By Branch List");
|
||||
mVerificationlistChoiceByBranch.setText("Verification By Branch - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withApprovalListByBranchTitleAndCounter(String count) {
|
||||
toggleView(mApprovalLayoutViewByBranch, "Approval By Branch List");
|
||||
mApprovallistChoiceByBranch.setText("Approval By Branch - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withAssignmentListTitleAndCounter(String count) {
|
||||
toggleView(mAssignmentLayoutView, "Assignment List");
|
||||
mAssignmentlistChoice.setText("Assignment List - [" + count + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withNoTitle() {
|
||||
mLinearLayoutTopView.setVisibility(View.GONE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTitleColor(String colorString) {
|
||||
mTitle.setTextColor(Color.parseColor(colorString));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withTitleColor(int color) {
|
||||
mTitle.setTextColor(color);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withMessage(int textResId) {
|
||||
toggleView(mLinearLayoutMsgView, textResId);
|
||||
mMessage.setText(textResId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withNoMessage() {
|
||||
mLinearLayoutMsgView.setVisibility(View.GONE);
|
||||
mMessage.setVisibility(View.GONE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withMessage(CharSequence msg) {
|
||||
toggleView(mLinearLayoutMsgView, msg);
|
||||
mMessage.setText(msg);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withMessageColor(String colorString) {
|
||||
mMessage.setTextColor(Color.parseColor(colorString));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withMessageColor(int color) {
|
||||
mMessage.setTextColor(color);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withImageView(Bitmap bitmap) {
|
||||
mImageView.setVisibility(View.VISIBLE);
|
||||
mImageView.setImageBitmap(bitmap);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withAutoText(ArrayAdapter<String> adapter) {
|
||||
mtxtSearch.setVisibility(View.VISIBLE);
|
||||
mtxtSearch.setText("");
|
||||
mtxtSearch.setAdapter(adapter);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAutoText() {
|
||||
return mtxtSearch.getText().toString();
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withDialogColor(String colorString) {
|
||||
mLinearLayoutView.getBackground().setColorFilter(ColorUtils.getColorFilter(Color.parseColor(colorString)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withDialogColor(int color) {
|
||||
mLinearLayoutView.getBackground().setColorFilter(ColorUtils.getColorFilter(color));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withIcon(int drawableResId) {
|
||||
mIcon.setImageResource(drawableResId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withIcon(Drawable icon) {
|
||||
mIcon.setImageDrawable(icon);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withDuration(int duration) {
|
||||
this.mDuration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withEffect(Effectstype type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withButtonDrawable(int resid) {
|
||||
mButton1.setBackgroundResource(resid);
|
||||
mButton2.setBackgroundResource(resid);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withButton1Text(CharSequence text) {
|
||||
mButton1.setVisibility(View.VISIBLE);
|
||||
mButton1.setText(text);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL withButton2Text(CharSequence text) {
|
||||
mButton2.setVisibility(View.VISIBLE);
|
||||
mButton2.setText(text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setButton1Click(View.OnClickListener click) {
|
||||
mButton1.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setButton2Click(View.OnClickListener click) {
|
||||
mButton2.setOnClickListener(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public NiftyDialogBuilder_PL setCustomView(int resId, Context context) {
|
||||
View customView = View.inflate(context, resId, null);
|
||||
if (mFrameLayoutCustomView.getChildCount() > 0) {
|
||||
mFrameLayoutCustomView.removeAllViews();
|
||||
}
|
||||
mFrameLayoutCustomView.addView(customView);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL setCustomView(View view, Context context) {
|
||||
if (mFrameLayoutCustomView.getChildCount() > 0) {
|
||||
mFrameLayoutCustomView.removeAllViews();
|
||||
}
|
||||
mFrameLayoutCustomView.addView(view);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL isCancelableOnTouchOutside(boolean cancelable) {
|
||||
this.isCancelable = cancelable;
|
||||
this.setCanceledOnTouchOutside(cancelable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NiftyDialogBuilder_PL isCancelable(boolean cancelable) {
|
||||
this.isCancelable = cancelable;
|
||||
this.setCancelable(cancelable);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void toggleView(View view, Object obj) {
|
||||
if (obj == null) {
|
||||
view.setVisibility(View.GONE);
|
||||
} else {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
}
|
||||
|
||||
private void start(Effectstype type) {
|
||||
BaseEffects animator = type.getAnimator();
|
||||
if (mDuration != -1) {
|
||||
animator.setDuration(Math.abs(mDuration));
|
||||
}
|
||||
animator.start(mRelativeLayoutView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
mButton1.setVisibility(View.GONE);
|
||||
mButton2.setVisibility(View.GONE);
|
||||
mTaskListLayoutView.setVisibility(View.GONE);
|
||||
mVerificationLayoutView.setVisibility(View.GONE);
|
||||
mApprovalLayoutView.setVisibility(View.GONE);
|
||||
mVerificationLayoutViewByBranch.setVisibility(View.GONE);
|
||||
mApprovalLayoutViewByBranch.setVisibility(View.GONE);
|
||||
mAssignmentLayoutView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.Logger;
|
||||
import com.adins.mss.dao.LoggerDao;
|
||||
import com.adins.mss.dao.ReceiptVoucher;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
/**
|
||||
* @author michael.bw
|
||||
*/
|
||||
public class LoggerDataAccess {
|
||||
private LoggerDataAccess() {
|
||||
}
|
||||
|
||||
/**
|
||||
* use to generate dao session that you can access modelDao
|
||||
*
|
||||
* @param context --> context from activity
|
||||
* @return
|
||||
*/
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get logger dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static LoggerDao getLoggerDao(Context context) {
|
||||
return getDaoSession(context).getLoggerDao();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @param screenId --> page of mobile application
|
||||
* @param detail --> detail that can you inform
|
||||
*/
|
||||
public static void addLog(Context context, String uuidUser, String screenId, String detail) {
|
||||
Logger logger = new Logger(Tool.getUUID(), screenId, new Date(),
|
||||
detail, uuidUser);
|
||||
getLoggerDao(context).insert(logger);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* add log as entity
|
||||
*
|
||||
* @param context
|
||||
* @param logger
|
||||
*/
|
||||
public static void addLog(Context context, Logger logger) {
|
||||
getLoggerDao(context).insert(logger);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* add log as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param loggerList
|
||||
*/
|
||||
public static void addLog(Context context, List<Logger> loggerList) {
|
||||
getLoggerDao(context).insertInTx(loggerList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getLoggerDao(context).deleteAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* delete log berdasarkan start date dan end date
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
*/
|
||||
public static void deleteLog(Context context, String uuidUser, Date startDate, Date endDate) {
|
||||
|
||||
QueryBuilder<Logger> qb = getLoggerDao(context).queryBuilder();
|
||||
qb.where(LoggerDao.Properties.Uuid_user.eq(uuidUser),
|
||||
LoggerDao.Properties.Timestamp.between(startDate, endDate));
|
||||
|
||||
qb.build();
|
||||
List<Logger> qbList = qb.list();
|
||||
getLoggerDao(context).deleteInTx(qbList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param logger
|
||||
* @param context
|
||||
*/
|
||||
public static void deleteLog(Logger logger, Context context) {
|
||||
getLoggerDao(context).delete(logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param logger
|
||||
* @param context
|
||||
*/
|
||||
public static void updateLog(Logger logger, Context context) {
|
||||
getLoggerDao(context).update(logger);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* select * from table where uuid_user = param
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static List<Logger> getAll(Context context, String uuidUser) {
|
||||
QueryBuilder<Logger> qb = getLoggerDao(context).queryBuilder();
|
||||
|
||||
qb.where(LoggerDao.Properties.Uuid_user.eq(uuidUser));
|
||||
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* select log for today per user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static List<Logger> getToday(Context context, String uuidUser) {
|
||||
QueryBuilder<Logger> qb = getLoggerDao(context).queryBuilder();
|
||||
qb.where(LoggerDao.Properties.Uuid_user.eq(uuidUser));
|
||||
qb.build();
|
||||
|
||||
User user = new User();
|
||||
user.getTaskHList();
|
||||
|
||||
|
||||
ReceiptVoucher kwitansi = new ReceiptVoucher();
|
||||
|
||||
kwitansi.getUser().getFullname();
|
||||
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Select log by range date, per user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public static List<Logger> getByDate(Context context, String uuidUser, Date startDate, Date endDate) {
|
||||
QueryBuilder<Logger> qb = getLoggerDao(context).queryBuilder();
|
||||
qb.where(LoggerDao.Properties.Uuid_user.eq(uuidUser),
|
||||
LoggerDao.Properties.Timestamp.between(startDate, endDate));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get total row per user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static long countLog(Context context, String uuidUser) {
|
||||
QueryBuilder<Logger> qb = getLoggerDao(context).queryBuilder();
|
||||
return qb.where(LoggerDao.Properties.Uuid_user.eq(uuidUser)).count();
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,224 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.LocationInfo;
|
||||
import com.adins.mss.dao.LocationInfoDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class LocationInfoDataAccess {
|
||||
private LocationInfoDataAccess() {
|
||||
}
|
||||
|
||||
/**
|
||||
* use to generate dao session that you can access modelDao
|
||||
*
|
||||
* @param context --> context from activity
|
||||
* @return
|
||||
*/
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get locationTracking dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static LocationInfoDao getLocationInfoDao(Context context) {
|
||||
return getDaoSession(context).getLocationInfoDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add locationTracking as entity
|
||||
*
|
||||
* @param context
|
||||
* @param locationInfo
|
||||
*/
|
||||
public static void add(Context context, LocationInfo locationInfo) {
|
||||
getLocationInfoDao(context).insertInTx(locationInfo);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* add locationTracking as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param locationInfoList
|
||||
*/
|
||||
public static void add(Context context, List<LocationInfo> locationInfoList) {
|
||||
getLocationInfoDao(context).insertInTx(locationInfoList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* addOrEplace locationTracking as entity
|
||||
*
|
||||
* @param context
|
||||
* @param locationInfo
|
||||
*/
|
||||
public static void addOrReplace(Context context, LocationInfo locationInfo) {
|
||||
getLocationInfoDao(context).insertOrReplaceInTx(locationInfo);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* addOrReplace locationTracking as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param locationInfoList
|
||||
*/
|
||||
public static void addOrReplace(Context context, List<LocationInfo> locationInfoList) {
|
||||
getLocationInfoDao(context).insertOrReplaceInTx(locationInfoList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getLocationInfoDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param locationInfo
|
||||
*/
|
||||
public static void delete(Context context, LocationInfo locationInfo) {
|
||||
getLocationInfoDao(context).deleteInTx(locationInfo);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param listLocationInfo
|
||||
*/
|
||||
public static void deleteList(Context context, List<LocationInfo> listLocationInfo) {
|
||||
getLocationInfoDao(context).deleteInTx(listLocationInfo);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void deleteListByKey(Context context, List<String> keys) {
|
||||
getLocationInfoDao(context).deleteByKeyInTx(keys);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
*/
|
||||
public static void delete(Context context, String uuidUser) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_user.eq(uuidUser));
|
||||
qb.build();
|
||||
getLocationInfoDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete where location_type = param
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static void deleteAllbyType(Context context, String uuidUser, String locationType) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_user.eq(uuidUser),
|
||||
(LocationInfoDao.Properties.Location_type.eq(locationType)));
|
||||
qb.build();
|
||||
getLocationInfoDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param locationInfo
|
||||
*/
|
||||
public static void update(Context context, LocationInfo locationInfo) {
|
||||
getLocationInfoDao(context).updateInTx(locationInfo);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_user = Global.user.Uuid_user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static List<LocationInfo> getAll(Context context, String uuidUser) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_user.eq(uuidUser));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_user = Global.user.Uuid_user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static List<LocationInfo> getAllbyType(Context context, String uuidUser, String locationType) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_user.eq(uuidUser),
|
||||
(LocationInfoDao.Properties.Location_type.eq(locationType)));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
public static List<LocationInfo> getAllbyTypewithlimited(Context context, String uuidUser, String locationType, int limited) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_user.eq(uuidUser),
|
||||
(LocationInfoDao.Properties.Location_type.eq(locationType)));
|
||||
qb.orderAsc(LocationInfoDao.Properties.Handset_time);
|
||||
qb.limit(limited);
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* getOne location info
|
||||
*
|
||||
* @param context
|
||||
* @param uuidLocationInfo
|
||||
* @return
|
||||
*/
|
||||
public static LocationInfo getOne(Context context, String uuidLocationInfo) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.where(LocationInfoDao.Properties.Uuid_location_info.eq(uuidLocationInfo));
|
||||
qb.build();
|
||||
if (qb.list().size() == 1)
|
||||
return qb.list().get(0);
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static LocationInfo getLastOne(Context context) {
|
||||
QueryBuilder<LocationInfo> qb = getLocationInfoDao(context).queryBuilder();
|
||||
qb.orderDesc(LocationInfoDao.Properties.Handset_time);
|
||||
qb.build();
|
||||
if (!qb.list().isEmpty())
|
||||
return qb.list().get(0);
|
||||
else return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.adins.mss.migration;
|
||||
|
||||
import com.adins.mss.dao.BankAccountOfBranchDao;
|
||||
import com.adins.mss.dao.BroadcastDao;
|
||||
import com.adins.mss.dao.ReceiptHistoryDao;
|
||||
|
||||
import de.greenrobot.dao.database.Database;
|
||||
|
||||
public class MigrationV12toV13 {
|
||||
|
||||
public static void execute(Database db, int oldVersion) {
|
||||
if (oldVersion < 13) {
|
||||
db.execSQL("ALTER TABLE TR_DEPOSITREPORT_H ADD BRANCH_PAYMENT STRING");
|
||||
db.execSQL("ALTER TABLE TR_DEPOSITREPORT_H ADD CODE_CHANNEL STRING");
|
||||
db.execSQL("ALTER TABLE TR_DEPOSITREPORT_H ADD NO_TRANSACTION STRING");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD BATCH_ID STRING");
|
||||
db.execSQL("CREATE TABLE MS_PAYMENTCHANNEL (" +
|
||||
" UUID_PAYMENT STRING PRIMARY KEY," +
|
||||
" USR_CRT STRING," +
|
||||
" DTM_CRT DATE," +
|
||||
" IS_ACTIVE STRING," +
|
||||
" CODE STRING," +
|
||||
" DESCRIPTION STRING," +
|
||||
" PAYMENT_LIMIT DOUBLE)");
|
||||
|
||||
BankAccountOfBranchDao.createTable(db, true);
|
||||
|
||||
db.execSQL("ALTER TABLE MS_USER ADD PILOTING_BRANCH TEXT");
|
||||
|
||||
db.execSQL("ALTER TABLE TR_RECEIPTVOUCHER ADD FLAG_SOURCES STRING");
|
||||
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD SURVEY_LOCATION TEXT");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD NO_RANGKA TEXT");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD NO_PLAT TEXT");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD NO_MESIN TEXT");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD BATCH_ID TEXT");
|
||||
db.execSQL("ALTER TABLE TR_TASK_H ADD SURVEY_LOCATION TEXT");
|
||||
|
||||
BroadcastDao.createTable(db, true);
|
||||
ReceiptHistoryDao.createTable(db, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- the theme applied to the application or activity -->
|
||||
<style name="CustomTheme"
|
||||
parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">@color/gradient_end</item>
|
||||
<item name="colorPrimaryDark">@color/login_color</item>
|
||||
<item name="colorAccent">@color/gradient_end</item>
|
||||
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
||||
<item name="android:popupMenuStyle">@style/PopupMenu</item>
|
||||
<item name="android:editTextStyle">@style/MyEditText</item>
|
||||
<item name="android:textViewStyle">@style/MyTextView</item>
|
||||
<item name="android:spinnerStyle">@style/MySpinner</item>
|
||||
<item name="android:actionBarTabStyle">@style/MyActionBarTab</item>
|
||||
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
|
||||
<item name="ptrHeaderStyle">@style/PtrHeader</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="PtrHeader" parent="@android:style/Widget">
|
||||
<item name="ptrHeaderBackground">@drawable/actionbar_background</item>
|
||||
<item name="ptrHeaderTitleTextAppearance">@style/TextAppearance.Custom.PtrHeader.Title</item>
|
||||
<item name="ptrProgressBarStyle">inside</item>
|
||||
<item name="ptrProgressBarColor">@android:color/holo_green_light</item>
|
||||
<item name="ptrPullText">Pull to Refresh</item>
|
||||
<item name="ptrRefreshingText">Loading ...</item>
|
||||
<item name="ptrReleaseText">Let go if you want me to refresh!</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Custom.PtrHeader.Title"
|
||||
parent="android:TextAppearance.Large.Inverse">
|
||||
<item name="android:textSize">20dp</item>
|
||||
</style>
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<style name="MyActionBar"
|
||||
parent="Widget.AppCompat.ActionBar">
|
||||
<item name="android:background">@drawable/actionbar_background</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:actionModeSplitBackground">@drawable/button_background</item>
|
||||
</style>
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<style name="MyActionBarTab"
|
||||
parent="Widget.AppCompat.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/actionbar_tabindicator</item>
|
||||
<item name="android:showDividers">none</item>
|
||||
</style>
|
||||
|
||||
<style name="MyActionBarTabText" parent="Widget.AppCompat.ActionBar">
|
||||
<item name="android:textColor">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<!-- Popup styles -->
|
||||
<style name="PopupMenu"
|
||||
parent="Widget.AppCompat.PopupMenu">
|
||||
<item name="android:popupBackground">@android:color/white</item>
|
||||
<item name="android:textColor">@color/tv_darker</item>
|
||||
<item name="android:showDividers">middle|beginning|end</item>
|
||||
</style>
|
||||
|
||||
<!-- Edittext styles -->
|
||||
<style name="MyEditText"
|
||||
parent="Widget.AppCompat.EditText">
|
||||
<item name="android:textColor">@color/tv_darker</item>
|
||||
<item name="android:minHeight">40dp</item>
|
||||
<item name="android:textColorHint">@color/shadowColor</item>
|
||||
</style>
|
||||
|
||||
<!-- Text View styles -->
|
||||
<style name="MyTextView"
|
||||
parent="Widget.AppCompat.TextView.SpinnerItem">
|
||||
<item name="android:textColor">@color/tv_darker</item>
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
|
||||
</style>
|
||||
|
||||
<!-- Spinner styles -->
|
||||
<style name="MySpinner"
|
||||
parent="Widget.AppCompat.Spinner">
|
||||
<item name="android:background">@color/fontColorWhite</item>
|
||||
<item name="android:popupBackground">@color/fontColorWhite</item>
|
||||
<item name="android:padding">3dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:animation="@anim/list_anim_2"
|
||||
android:animationOrder="normal"
|
||||
android:delay="0.5" />
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright 2010 Kevin Gaudin
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.acra.collector;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ACRAConstants;
|
||||
import org.acra.annotation.ReportsCrashes;
|
||||
import org.acra.util.BoundedLinkedList;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.acra.ACRA.LOG_TAG;
|
||||
|
||||
|
||||
/**
|
||||
* Executes logcat commands and collects it's output.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
class LogCatCollector {
|
||||
|
||||
/**
|
||||
* Default number of latest lines kept from the logcat output.
|
||||
*/
|
||||
private static final int DEFAULT_TAIL_COUNT = 100;
|
||||
|
||||
/**
|
||||
* Executes the logcat command with arguments taken from
|
||||
* {@link ReportsCrashes#logcatArguments()}
|
||||
*
|
||||
* @param bufferName The name of the buffer to be read: "main" (default), "radio"
|
||||
* or "events".
|
||||
* @return A {@link String} containing the latest lines of the output.
|
||||
* Default is 100 lines, use "-t", "300" in
|
||||
* {@link ReportsCrashes#logcatArguments()} if you want 300 lines.
|
||||
* You should be aware that increasing this value causes a longer
|
||||
* report generation time and a bigger footprint on the device data
|
||||
* plan consumption.
|
||||
*/
|
||||
public static String collectLogCat(String bufferName) {
|
||||
final int myPid = android.os.Process.myPid();
|
||||
String myPidStr = null;
|
||||
if (ACRA.getConfig().logcatFilterByPid() && myPid > 0) {
|
||||
myPidStr = Integer.toString(myPid) + "):";
|
||||
}
|
||||
|
||||
final List<String> commandLine = new ArrayList<String>();
|
||||
commandLine.add("logcat");
|
||||
if (bufferName != null) {
|
||||
commandLine.add("-b");
|
||||
commandLine.add(bufferName);
|
||||
}
|
||||
|
||||
// "-t n" argument has been introduced in FroYo (API level 8). For
|
||||
// devices with lower API level, we will have to emulate its job.
|
||||
final int tailCount;
|
||||
final List<String> logcatArgumentsList = new ArrayList<String>(
|
||||
Arrays.asList(ACRA.getConfig().logcatArguments()));
|
||||
|
||||
final int tailIndex = logcatArgumentsList.indexOf("-t");
|
||||
if (tailIndex > -1 && tailIndex < logcatArgumentsList.size()) {
|
||||
tailCount = Integer.parseInt(logcatArgumentsList.get(tailIndex + 1));
|
||||
if (Compatibility.getAPILevel() < 8) {
|
||||
logcatArgumentsList.remove(tailIndex + 1);
|
||||
logcatArgumentsList.remove(tailIndex);
|
||||
logcatArgumentsList.add("-d");
|
||||
}
|
||||
} else {
|
||||
tailCount = -1;
|
||||
}
|
||||
|
||||
final LinkedList<String> logcatBuf = new BoundedLinkedList<String>(tailCount > 0 ? tailCount
|
||||
: DEFAULT_TAIL_COUNT);
|
||||
commandLine.addAll(logcatArgumentsList);
|
||||
|
||||
BufferedReader bufferedReader = null;
|
||||
|
||||
try {
|
||||
final Process process = Runtime.getRuntime().exec(commandLine.toArray(new String[commandLine.size()]));
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()), ACRAConstants.DEFAULT_BUFFER_SIZE_IN_BYTES);
|
||||
|
||||
ACRA.log.d(LOG_TAG, "Retrieving logcat output...");
|
||||
|
||||
// Dump stderr to null
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
InputStream stderr = process.getErrorStream();
|
||||
byte[] dummy = new byte[ACRAConstants.DEFAULT_BUFFER_SIZE_IN_BYTES];
|
||||
while (stderr.read(dummy) >= 0)
|
||||
;
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
while (true) {
|
||||
final String line = bufferedReader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
if (myPidStr == null || line.contains(myPidStr)) {
|
||||
logcatBuf.add(line + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
ACRA.log.e(LOG_TAG, "LogCatCollector.collectLogCat could not retrieve data.", e);
|
||||
} finally {
|
||||
CollectorUtil.safeClose(bufferedReader);
|
||||
}
|
||||
|
||||
return logcatBuf.toString();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue