mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,193 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bgColor">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:background="@drawable/header"
|
||||
app:titleTextAppearance="?android:attr/textAppearanceSmall"
|
||||
android:titleTextColor="@color/fontColorWhite"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||
app:layout_collapseMode="pin"
|
||||
android:fitsSystemWindows="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/collActivityContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="7dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_marginTop="@dimen/card_margin"
|
||||
android:layout_marginLeft="@dimen/card_margin"
|
||||
android:layout_marginRight="@dimen/card_margin"
|
||||
android:layout_marginBottom="60dp"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/agreementNo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_agreement_number"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorMC"
|
||||
android:paddingBottom="10dp"/>
|
||||
<TextView
|
||||
android:id="@+id/agreementNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorMC"
|
||||
android:paddingBottom="10dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/horizontalScrollView1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fillViewport="true">
|
||||
<TableLayout
|
||||
android:id="@+id/tableHeaders"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="4">
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/label_no"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"/>
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/label_due_date"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:minWidth="50dp"
|
||||
android:text="@string/label_amount_installment"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/label_amount_paid"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp" />
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp" />
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp" />
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/timelineLine" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageBtnDownload"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/ic_file_download"
|
||||
android:background="@drawable/round_shape" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,466 @@
|
|||
package com.adins.mss.base.util;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.job.JobInfo;
|
||||
import android.app.job.JobScheduler;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.StatFs;
|
||||
import android.provider.Settings;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
import com.services.MainServices;
|
||||
import com.services.MssJobScheduler;
|
||||
import com.services.NotificationThread;
|
||||
import com.tracking.LocationTrackingService;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 25/02/2016.
|
||||
*/
|
||||
public class Utility {
|
||||
public static final int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 6666;
|
||||
public static final int REQUEST_CODE_ASK_SINGLE_PERMISSIONS = 6667;
|
||||
private static boolean isShow = false;
|
||||
/**
|
||||
* Permissions required to access Location.
|
||||
*/
|
||||
private static String[] PERMISSIONS_LOCATION = {Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION};
|
||||
|
||||
public static void deleteCache(Context context) {
|
||||
try {
|
||||
File cache = context.getCacheDir();
|
||||
File appDir = new File(cache.getParent());
|
||||
if (appDir.exists()) {
|
||||
String[] children = appDir.list();
|
||||
for (String s : children) {
|
||||
if (!s.equals("lib") && !s.equals("shared_prefs")) {
|
||||
deleteDir(new File(appDir, s));
|
||||
Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s + " DELETED *******************");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean deleteDir(File dir) {
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDir(new File(dir, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
} else if (dir != null && dir.isFile())
|
||||
return dir.delete();
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void freeMemory() {
|
||||
System.runFinalization();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
public static void stopAllServices(Activity activity) {
|
||||
try {
|
||||
if (NewMainActivity.AutoSendLocationHistoryService != null)
|
||||
activity.stopService(NewMainActivity.AutoSendLocationHistoryService);
|
||||
else
|
||||
activity.stopService(new Intent(activity, LocationTrackingService.class));
|
||||
|
||||
if (NewMainActivity.RunNotificationService != null)
|
||||
activity.stopService(NewMainActivity.RunNotificationService);
|
||||
else
|
||||
activity.stopService(new Intent(activity, MainServices.class));
|
||||
|
||||
if (Global.approvalNotivIntent != null)
|
||||
activity.stopService(Global.approvalNotivIntent);
|
||||
|
||||
if (Global.verifyNotivIntent != null)
|
||||
activity.stopService(Global.verifyNotivIntent);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
public static void checkPermission(final Activity activity, final String permission, String description) {
|
||||
if (activity.checkSelfPermission(
|
||||
permission)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
// Should we show an explanation?
|
||||
if (activity.shouldShowRequestPermissionRationale(
|
||||
permission)) {
|
||||
|
||||
// Show an expanation to the user *asynchronously* -- don't block
|
||||
// this thread waiting for the user's response! After the user
|
||||
// sees the explanation, try again to request the permission.
|
||||
String message = activity.getString(R.string.need_permision) + " " + description;
|
||||
final NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
showMessageOKCancel2(builder, activity, message,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
builder.dismiss();
|
||||
activity.requestPermissions(new String[]{permission},
|
||||
REQUEST_CODE_ASK_SINGLE_PERMISSIONS);
|
||||
}
|
||||
}, null);
|
||||
return;
|
||||
} else {
|
||||
|
||||
// No explanation needed, we can request the permission.
|
||||
|
||||
activity.requestPermissions(
|
||||
new String[]{permission},
|
||||
REQUEST_CODE_ASK_SINGLE_PERMISSIONS);
|
||||
|
||||
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
|
||||
// app-defined int constant. The callback method gets the
|
||||
// result of the request.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkPermissionResult(final Activity activity, String[] permissions, int[] grantResults) {
|
||||
Map<String, Integer> perms = new HashMap<String, Integer>();
|
||||
// Initial
|
||||
|
||||
perms.put(Manifest.permission.ACCESS_FINE_LOCATION, PackageManager.PERMISSION_GRANTED);
|
||||
perms.put(Manifest.permission.CAMERA, PackageManager.PERMISSION_GRANTED);
|
||||
perms.put(Manifest.permission.READ_EXTERNAL_STORAGE, PackageManager.PERMISSION_GRANTED);
|
||||
perms.put(Manifest.permission.WRITE_EXTERNAL_STORAGE, PackageManager.PERMISSION_GRANTED);
|
||||
perms.put(Manifest.permission.READ_PHONE_STATE, PackageManager.PERMISSION_GRANTED);
|
||||
perms.put(Manifest.permission.ACCESS_BACKGROUND_LOCATION, PackageManager.PERMISSION_GRANTED);
|
||||
|
||||
// Fill with results
|
||||
for (int i = 0; i < permissions.length; i++)
|
||||
perms.put(permissions[i], grantResults[i]);
|
||||
|
||||
if (perms.get(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
&& perms.get(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
|
||||
&& perms.get(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
|
||||
&& perms.get(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
|
||||
&& perms.get(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED
|
||||
&& perms.get(Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
// All Permissions Granted
|
||||
return true;
|
||||
} else {
|
||||
// Permission Denied
|
||||
isShow = true;
|
||||
if (activity == null) {
|
||||
return false;
|
||||
}
|
||||
String errorPermissionMessage = activity.getString(R.string.permission_required);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
|
||||
perms.get(Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
activity.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_BACKGROUND_LOCATION)) {
|
||||
//TODO Change message and test permission requesta when android 11 device available at hand.
|
||||
//Message will be changed later to accommodate android 11, since there is no android 11 device on hand atm.
|
||||
errorPermissionMessage = activity.getString(R.string.background_location_permission_required);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
|
||||
perms.get(Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
errorPermissionMessage = activity.getString(R.string.background_location_permission_required);
|
||||
}
|
||||
final NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
showMessageOK2(builder, activity, errorPermissionMessage, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
builder.dismiss();
|
||||
isShow = false;
|
||||
final Intent i = new Intent();
|
||||
i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
i.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
i.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
activity.startActivity(i);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkPermissionGranted(final Activity activity) {
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
List<String> permissionsNeeded = new ArrayList<String>();
|
||||
|
||||
final List<String> permissionsList = new ArrayList<String>();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (!addPermission(activity, permissionsList, Manifest.permission.ACCESS_BACKGROUND_LOCATION) &&
|
||||
!addPermission(activity, permissionsList, Manifest.permission.ACCESS_FINE_LOCATION) &&
|
||||
!addPermission(activity, permissionsList, Manifest.permission.ACCESS_COARSE_LOCATION)) {
|
||||
permissionsNeeded.add("GPS");
|
||||
}
|
||||
} else {
|
||||
if (!addPermission(activity, permissionsList, Manifest.permission.ACCESS_FINE_LOCATION) &&
|
||||
!addPermission(activity, permissionsList, Manifest.permission.ACCESS_COARSE_LOCATION)) {
|
||||
permissionsNeeded.add("GPS");
|
||||
}
|
||||
}
|
||||
|
||||
if (!addPermission(activity, permissionsList, Manifest.permission.CAMERA)) {
|
||||
permissionsNeeded.add("Camera");
|
||||
}
|
||||
|
||||
if (!addPermission(activity, permissionsList, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
&& !addPermission(activity, permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
permissionsNeeded.add("Storage");
|
||||
}
|
||||
if (!addPermission(activity, permissionsList, Manifest.permission.READ_PHONE_STATE)) {
|
||||
permissionsNeeded.add("Phone State");
|
||||
}
|
||||
|
||||
if (permissionsList.size() > 0) {
|
||||
if (permissionsNeeded.size() > 0) {
|
||||
// Need Rationale
|
||||
String message = activity.getString(R.string.need_permision) + " " + permissionsNeeded.get(0);
|
||||
for (int i = 1; i < permissionsNeeded.size(); i++)
|
||||
message = message + ", " + permissionsNeeded.get(i);
|
||||
if (!isShow) {
|
||||
final NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
showMessageOKCancel2(builder, activity, message,
|
||||
new View.OnClickListener() {
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
builder.dismiss();
|
||||
activity.requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),
|
||||
REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!isShow) {
|
||||
activity.requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),
|
||||
REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean addPermission(Activity activity, List<String> permissionsList, String permission) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
permissionsList.add(permission);
|
||||
// Check for Rationale Option
|
||||
if (!activity.shouldShowRequestPermissionRationale(permission))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void showMessageOKCancel2(NiftyDialogBuilder builder, Activity activity, String message, View.OnClickListener okListener, View.OnClickListener cancelListener) {
|
||||
builder.withTitle(activity.getString(R.string.info_capital))
|
||||
.withMessage(message)
|
||||
.isCancelable(false)
|
||||
.isCancelableOnTouchOutside(false)
|
||||
.withButton1Text(activity.getString(R.string.btnOk))
|
||||
.setButton1Click(okListener);
|
||||
if (cancelListener != null) {
|
||||
builder.withButton2Text(activity.getString(R.string.btnCancel))
|
||||
.setButton2Click(cancelListener);
|
||||
}
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private static void showMessageOKCancel(Activity activity, String message, DialogInterface.OnClickListener okListener, DialogInterface.OnClickListener cancelListener) {
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(activity.getString(R.string.btnOk), okListener)
|
||||
.setNegativeButton(activity.getString(R.string.btnCancel), cancelListener)
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
private static void showMessageOK2(NiftyDialogBuilder builder, Activity activity, String message, View.OnClickListener okListener) {
|
||||
builder.withTitle(activity.getString(R.string.info_capital))
|
||||
.withMessage(message)
|
||||
.isCancelable(false)
|
||||
.isCancelableOnTouchOutside(false)
|
||||
.withButton1Text(activity.getString(R.string.btnOk))
|
||||
.setButton1Click(okListener);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private static void showMessageOK(Activity activity, String message, DialogInterface.OnClickListener okListener) {
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(activity.getString(R.string.btnOk), okListener)
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
public static boolean verifyPermissions(int[] grantResults) {
|
||||
// At least one result must be checked.
|
||||
if (grantResults.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify that each required permission has been granted, otherwise return false.
|
||||
for (int result : grantResults) {
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void checkInternalStorage(Context context) {
|
||||
boolean isFull = false;
|
||||
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
|
||||
statFs.restat(Environment.getDataDirectory().getPath());
|
||||
|
||||
String freeSpace;
|
||||
double storageAvailable;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
long bytesAvailable = statFs.getBlockSizeLong() * statFs.getAvailableBlocksLong();
|
||||
storageAvailable = (double) bytesAvailable / Math.pow(1024, 2);
|
||||
freeSpace = Formatter.formatByteSize(bytesAvailable);
|
||||
Logger.d("availableMemory", freeSpace);
|
||||
if (storageAvailable < 300d) {
|
||||
isFull = true;
|
||||
}
|
||||
} else {
|
||||
long bytesAvailable = (long)(statFs.getBlockSize() * statFs.getAvailableBlocks());
|
||||
storageAvailable = (double) bytesAvailable / Math.pow(1024, 2);
|
||||
freeSpace = Formatter.formatByteSize(bytesAvailable);
|
||||
Logger.d("availableMemory", freeSpace);
|
||||
if (storageAvailable < 300d) {
|
||||
isFull = true;
|
||||
}
|
||||
}
|
||||
|
||||
FirebaseDatabase database = FirebaseDatabase.getInstance();
|
||||
DatabaseReference devices = database.getReference("devices");
|
||||
devices.child(GlobalData.getSharedGlobalData().getUser().getUuid_user()).setValue("Free Storage: " + storageAvailable + ", Desc: " + freeSpace);
|
||||
|
||||
if (isFull) {
|
||||
Intent resultIntent = new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS);
|
||||
PendingIntent pendingIntent = PendingIntent
|
||||
.getActivity(context, 0, resultIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
||||
builder.setSmallIcon(NotificationThread.getNotificationIcon());
|
||||
builder.setContentTitle(context.getString(R.string.freeup_space));
|
||||
builder.setContentText(context.getString(R.string.freeup_space_detail));
|
||||
builder.setPriority(Notification.PRIORITY_DEFAULT);
|
||||
NotificationCompat.BigTextStyle inboxStyle =
|
||||
new NotificationCompat.BigTextStyle();
|
||||
inboxStyle.setBigContentTitle(context.getString(R.string.freeup_space));
|
||||
inboxStyle.bigText(context.getString(R.string.freeup_space_detail));
|
||||
|
||||
builder.setDefaults(android.app.Notification.DEFAULT_ALL);
|
||||
builder.setStyle(inboxStyle);
|
||||
builder.setAutoCancel(true);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(9, builder.build());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void scheduleJob(Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
ComponentName serviceComponent = new ComponentName(context, MssJobScheduler.class);
|
||||
JobInfo.Builder builder = null;
|
||||
builder = new JobInfo.Builder(0, serviceComponent);
|
||||
builder.setMinimumLatency(1000); // wait at least
|
||||
builder.setOverrideDeadline((long)(3 * 1000)); // maximum delay
|
||||
JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
|
||||
jobScheduler.schedule(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRegexCheckValid(String text,String patternStr){
|
||||
Pattern pattern = Pattern.compile(patternStr);
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
public static int getViewById(Context context, String id){
|
||||
return context.getResources().getIdentifier(id, "id", context.getPackageName());
|
||||
}
|
||||
|
||||
public static int getDrawableById(Context context, String id){
|
||||
return context.getResources().getIdentifier(id, "drawable", context.getPackageName());
|
||||
}
|
||||
|
||||
public static void metricStart(HttpMetric metric, String json){
|
||||
try {
|
||||
metric.start();
|
||||
metric.setRequestPayloadSize(json.getBytes().length);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void metricStop(HttpMetric metric, HttpConnectionResult serverResult){
|
||||
metric.setResponseContentType("Application/json");
|
||||
metric.setResponsePayloadSize(serverResult.getResult().getBytes().length);
|
||||
metric.setHttpResponseCode(serverResult.getStatusCode());
|
||||
metric.stop();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.base.todolist.form;
|
||||
|
||||
import com.adins.mss.dao.BankAccountOfBranch;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 29/09/2016.
|
||||
*/
|
||||
|
||||
public class BankAccountOfBranchResponse extends MssResponseType {
|
||||
@SerializedName("listBankAccountOfBranch")
|
||||
private List<BankAccountOfBranch> listBankAccountOfBranch;
|
||||
|
||||
public List<BankAccountOfBranch> getListBankAccountOfBranch() {
|
||||
return listBankAccountOfBranch;
|
||||
}
|
||||
|
||||
public void setListBankAccountOfBranch(List<BankAccountOfBranch> listBankAccountOfBranch) {
|
||||
this.listBankAccountOfBranch = listBankAccountOfBranch;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,360 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.ProductDataAccess;
|
||||
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.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchRequest;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/15/2017.
|
||||
*/
|
||||
|
||||
public class FragmentAccountsSearch extends Fragment {
|
||||
|
||||
private AppCompatSpinner spinnerAccount;
|
||||
private AppCompatSpinner spinnerProduct;
|
||||
private AppCompatSpinner spinnerStatus;
|
||||
private Button btnSearch;
|
||||
private List<Account> accountList;
|
||||
private List<Product> productList;
|
||||
private String[] statusList;
|
||||
private String tempAccount;
|
||||
private String tempProduct;
|
||||
private String tempStatus;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.new_fragment_account_search, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
spinnerAccount = (AppCompatSpinner) view.findViewById(R.id.spinnerAccount);
|
||||
spinnerProduct = (AppCompatSpinner) view.findViewById(R.id.spinnerProduct);
|
||||
spinnerStatus = (AppCompatSpinner) view.findViewById(R.id.spinnerStatus);
|
||||
btnSearch = (Button) view.findViewById(R.id.btnSearch);
|
||||
|
||||
accountList = new ArrayList<>();
|
||||
accountList.clear();
|
||||
setAllAccountSpinner();
|
||||
List<Account> listAcc = AccountDataAccess.getAll(getActivity());
|
||||
if (listAcc != null)
|
||||
accountList.addAll(listAcc);
|
||||
AccountAdapter accountSpinner = new AccountAdapter(getContext(), R.layout.spinner_style2, accountList);
|
||||
spinnerAccount.setAdapter(accountSpinner);
|
||||
|
||||
productList = new ArrayList<>();
|
||||
productList.clear();
|
||||
setAllProductSpinner();
|
||||
List<Product> listProd = ProductDataAccess.getAll(getContext());
|
||||
if (listProd != null)
|
||||
productList.addAll(listProd);
|
||||
ProductAdapter productSpinner = new ProductAdapter(getContext(), R.layout.spinner_style2, productList);
|
||||
spinnerProduct.setAdapter(productSpinner);
|
||||
|
||||
statusList = getActivity().getResources().getStringArray(R.array.dropdownAccountStatus);
|
||||
StatusAdapter statusSpinner = new StatusAdapter(getContext(), R.layout.spinner_style2, statusList);
|
||||
spinnerStatus.setAdapter(statusSpinner);
|
||||
|
||||
btnSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Account account = (Account) spinnerAccount.getSelectedItem();
|
||||
Product product = (Product) spinnerProduct.getSelectedItem();
|
||||
|
||||
tempStatus = spinnerStatus.getSelectedItem().toString();
|
||||
if (tempStatus.equalsIgnoreCase(getString(R.string.allStatus)))
|
||||
tempStatus = "";
|
||||
tempAccount = account.getUuid_account();
|
||||
tempProduct = product.getUuid_product();
|
||||
|
||||
try {
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
doSearch(tempAccount, tempProduct, tempStatus);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setAllAccountSpinner() {
|
||||
Account accountDummy = new Account();
|
||||
accountDummy.setUuid_account("");
|
||||
accountDummy.setAccount_name("All Account");
|
||||
|
||||
accountList.add(0, accountDummy);
|
||||
}
|
||||
|
||||
private void setAllProductSpinner() {
|
||||
Product productDummy = new Product();
|
||||
productDummy.setUuid_product("");
|
||||
productDummy.setProduct_name("All Product");
|
||||
|
||||
productList.add(0, productDummy);
|
||||
}
|
||||
|
||||
private void doSearch(final String account, final String product, final String status) throws ParseException, IOException {
|
||||
new AsyncTask<Void, Void, ArrayList<String>>() {
|
||||
final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||
String errMessage;
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||
progress.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<String> doInBackground(Void... params) {
|
||||
AccountsSearchRequest request = new AccountsSearchRequest();
|
||||
request.setUuid_account(account);
|
||||
request.setUuid_product(product);
|
||||
request.setUuid_status(status);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_ACCOUNT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
AccountsSearchResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, AccountsSearchResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Account> listAccounts = response.getListAccount();
|
||||
if (listAccounts != null && listAccounts.size() != 0) {
|
||||
for(Account acc : listAccounts){
|
||||
result.add(acc.getUuid_account());
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.server_down);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<String> result) {
|
||||
if(getActivity()!=null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(getActivity().getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(getActivity(), AccountsListActivity.class);
|
||||
Bundle extra = new Bundle();
|
||||
extra.putStringArrayList(Global.BUND_KEY_ACCOUNT_ID, result);
|
||||
intent.putExtras(extra);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(R.string.title_mn_account));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
public class StatusAdapter extends ArrayAdapter<String> {
|
||||
private Context context;
|
||||
private String[] values;
|
||||
|
||||
public StatusAdapter(Context context, int resource, String[] objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.length;
|
||||
}
|
||||
|
||||
public String getItem(int position) {
|
||||
return values[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_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values[position]);
|
||||
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[position]);
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class AccountAdapter extends ArrayAdapter<Account> {
|
||||
private Context context;
|
||||
private List<Account> values;
|
||||
|
||||
public AccountAdapter(Context context, int resource, List<Account> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Account 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_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getAccount_name());
|
||||
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).getAccount_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProductAdapter extends ArrayAdapter<Product> {
|
||||
private Context context;
|
||||
private List<Product> values;
|
||||
|
||||
public ProductAdapter(Context context, int resource, List<Product> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Product 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_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getProduct_name());
|
||||
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).getProduct_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import android.database.Cursor;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import de.greenrobot.dao.internal.DaoConfig;
|
||||
import de.greenrobot.dao.database.Database;
|
||||
import de.greenrobot.dao.database.DatabaseStatement;
|
||||
|
||||
import com.adins.mss.dao.PaymentHistoryD;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table "TR_PAYMENTHISTORY_D".
|
||||
*/
|
||||
public class PaymentHistoryDDao extends AbstractDao<PaymentHistoryD, String> {
|
||||
|
||||
public static final String TABLENAME = "TR_PAYMENTHISTORY_D";
|
||||
|
||||
/**
|
||||
* Properties of entity PaymentHistoryD.<br/>
|
||||
* Can be used for QueryBuilder and for referencing column names.
|
||||
*/
|
||||
public static class Properties {
|
||||
public final static Property Uuid_payment_history_d = new Property(0, String.class, "uuid_payment_history_d", true, "UUID_PAYMENT_HISTORY_D");
|
||||
public final static Property Uuid_task_h = new Property(1, String.class, "uuid_task_h", false, "UUID_TASK_H");
|
||||
public final static Property Transaction_type = new Property(2, String.class, "transaction_type", false, "TRANSACTION_TYPE");
|
||||
public final static Property Receipt_no = new Property(3, String.class, "receipt_no", false, "RECEIPT_NO");
|
||||
public final static Property Value_date = new Property(4, java.util.Date.class, "value_date", false, "VALUE_DATE");
|
||||
public final static Property Posting_date = new Property(5, java.util.Date.class, "posting_date", false, "POSTING_DATE");
|
||||
public final static Property Payment_amount = new Property(6, String.class, "payment_amount", false, "PAYMENT_AMOUNT");
|
||||
public final static Property Installment_amount = new Property(7, String.class, "installment_amount", false, "INSTALLMENT_AMOUNT");
|
||||
public final static Property Installment_number = new Property(8, String.class, "installment_number", false, "INSTALLMENT_NUMBER");
|
||||
public final static Property Wop_code = new Property(9, String.class, "wop_code", false, "WOP_CODE");
|
||||
public final static Property Payment_allocation_name = new Property(10, String.class, "payment_allocation_name", false, "PAYMENT_ALLOCATION_NAME");
|
||||
public final static Property Os_amount_od = new Property(11, String.class, "os_amount_od", false, "OS_AMOUNT_OD");
|
||||
public final static Property Receive_amount = new Property(12, String.class, "receive_amount", false, "RECEIVE_AMOUNT");
|
||||
public final static Property Dtm_upd = new Property(13, java.util.Date.class, "dtm_upd", false, "DTM_UPD");
|
||||
public final static Property Usr_upd = new Property(14, String.class, "usr_upd", false, "USR_UPD");
|
||||
public final static Property Dtm_crt = new Property(15, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||
public final static Property Usr_crt = new Property(16, String.class, "usr_crt", false, "USR_CRT");
|
||||
public final static Property Uuid_payment_history_h = new Property(17, String.class, "uuid_payment_history_h", false, "UUID_PAYMENT_HISTORY_H");
|
||||
};
|
||||
|
||||
|
||||
public PaymentHistoryDDao(DaoConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public PaymentHistoryDDao(DaoConfig config, DaoSession daoSession) {
|
||||
super(config, daoSession);
|
||||
}
|
||||
|
||||
/** Creates the underlying database table. */
|
||||
public static void createTable(Database db, boolean ifNotExists) {
|
||||
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"TR_PAYMENTHISTORY_D\" (" + //
|
||||
"\"UUID_PAYMENT_HISTORY_D\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_payment_history_d
|
||||
"\"UUID_TASK_H\" TEXT," + // 1: uuid_task_h
|
||||
"\"TRANSACTION_TYPE\" TEXT," + // 2: transaction_type
|
||||
"\"RECEIPT_NO\" TEXT," + // 3: receipt_no
|
||||
"\"VALUE_DATE\" INTEGER," + // 4: value_date
|
||||
"\"POSTING_DATE\" INTEGER," + // 5: posting_date
|
||||
"\"PAYMENT_AMOUNT\" TEXT," + // 6: payment_amount
|
||||
"\"INSTALLMENT_AMOUNT\" TEXT," + // 7: installment_amount
|
||||
"\"INSTALLMENT_NUMBER\" TEXT," + // 8: installment_number
|
||||
"\"WOP_CODE\" TEXT," + // 9: wop_code
|
||||
"\"PAYMENT_ALLOCATION_NAME\" TEXT," + // 10: payment_allocation_name
|
||||
"\"OS_AMOUNT_OD\" TEXT," + // 11: os_amount_od
|
||||
"\"RECEIVE_AMOUNT\" TEXT," + // 12: receive_amount
|
||||
"\"DTM_UPD\" INTEGER," + // 13: dtm_upd
|
||||
"\"USR_UPD\" TEXT," + // 14: usr_upd
|
||||
"\"DTM_CRT\" INTEGER," + // 15: dtm_crt
|
||||
"\"USR_CRT\" TEXT," + // 16: usr_crt
|
||||
"\"UUID_PAYMENT_HISTORY_H\" TEXT);"); // 17: uuid_payment_history_h
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(Database db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_PAYMENTHISTORY_D\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected void bindValues(DatabaseStatement stmt, PaymentHistoryD entity) {
|
||||
stmt.clearBindings();
|
||||
stmt.bindString(1, entity.getUuid_payment_history_d());
|
||||
|
||||
String uuid_task_h = entity.getUuid_task_h();
|
||||
if (uuid_task_h != null) {
|
||||
stmt.bindString(2, uuid_task_h);
|
||||
}
|
||||
|
||||
String transaction_type = entity.getTransaction_type();
|
||||
if (transaction_type != null) {
|
||||
stmt.bindString(3, transaction_type);
|
||||
}
|
||||
|
||||
String receipt_no = entity.getReceipt_no();
|
||||
if (receipt_no != null) {
|
||||
stmt.bindString(4, receipt_no);
|
||||
}
|
||||
|
||||
java.util.Date value_date = entity.getValue_date();
|
||||
if (value_date != null) {
|
||||
stmt.bindLong(5, value_date.getTime());
|
||||
}
|
||||
|
||||
java.util.Date posting_date = entity.getPosting_date();
|
||||
if (posting_date != null) {
|
||||
stmt.bindLong(6, posting_date.getTime());
|
||||
}
|
||||
|
||||
String payment_amount = entity.getPayment_amount();
|
||||
if (payment_amount != null) {
|
||||
stmt.bindString(7, payment_amount);
|
||||
}
|
||||
|
||||
String installment_amount = entity.getInstallment_amount();
|
||||
if (installment_amount != null) {
|
||||
stmt.bindString(8, installment_amount);
|
||||
}
|
||||
|
||||
String installment_number = entity.getInstallment_number();
|
||||
if (installment_number != null) {
|
||||
stmt.bindString(9, installment_number);
|
||||
}
|
||||
|
||||
String wop_code = entity.getWop_code();
|
||||
if (wop_code != null) {
|
||||
stmt.bindString(10, wop_code);
|
||||
}
|
||||
|
||||
String payment_allocation_name = entity.getPayment_allocation_name();
|
||||
if (payment_allocation_name != null) {
|
||||
stmt.bindString(11, payment_allocation_name);
|
||||
}
|
||||
|
||||
String os_amount_od = entity.getOs_amount_od();
|
||||
if (os_amount_od != null) {
|
||||
stmt.bindString(12, os_amount_od);
|
||||
}
|
||||
|
||||
String receive_amount = entity.getReceive_amount();
|
||||
if (receive_amount != null) {
|
||||
stmt.bindString(13, receive_amount);
|
||||
}
|
||||
|
||||
java.util.Date dtm_upd = entity.getDtm_upd();
|
||||
if (dtm_upd != null) {
|
||||
stmt.bindLong(14, dtm_upd.getTime());
|
||||
}
|
||||
|
||||
String usr_upd = entity.getUsr_upd();
|
||||
if (usr_upd != null) {
|
||||
stmt.bindString(15, usr_upd);
|
||||
}
|
||||
|
||||
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||
if (dtm_crt != null) {
|
||||
stmt.bindLong(16, dtm_crt.getTime());
|
||||
}
|
||||
|
||||
String usr_crt = entity.getUsr_crt();
|
||||
if (usr_crt != null) {
|
||||
stmt.bindString(17, usr_crt);
|
||||
}
|
||||
|
||||
String uuid_payment_history_h = entity.getUuid_payment_history_h();
|
||||
if (uuid_payment_history_h != null) {
|
||||
stmt.bindString(18, uuid_payment_history_h);
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String readKey(Cursor cursor, int offset) {
|
||||
return cursor.getString(offset + 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public PaymentHistoryD readEntity(Cursor cursor, int offset) {
|
||||
PaymentHistoryD entity = new PaymentHistoryD( //
|
||||
cursor.getString(offset + 0), // uuid_payment_history_d
|
||||
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // uuid_task_h
|
||||
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // transaction_type
|
||||
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // receipt_no
|
||||
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)), // value_date
|
||||
cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)), // posting_date
|
||||
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // payment_amount
|
||||
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // installment_amount
|
||||
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // installment_number
|
||||
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // wop_code
|
||||
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // payment_allocation_name
|
||||
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // os_amount_od
|
||||
cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // receive_amount
|
||||
cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13)), // dtm_upd
|
||||
cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // usr_upd
|
||||
cursor.isNull(offset + 15) ? null : new java.util.Date(cursor.getLong(offset + 15)), // dtm_crt
|
||||
cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // usr_crt
|
||||
cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17) // uuid_payment_history_h
|
||||
);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public void readEntity(Cursor cursor, PaymentHistoryD entity, int offset) {
|
||||
entity.setUuid_payment_history_d(cursor.getString(offset + 0));
|
||||
entity.setUuid_task_h(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||
entity.setTransaction_type(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||
entity.setReceipt_no(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||
entity.setValue_date(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)));
|
||||
entity.setPosting_date(cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)));
|
||||
entity.setPayment_amount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||
entity.setInstallment_amount(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||
entity.setInstallment_number(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||
entity.setWop_code(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
|
||||
entity.setPayment_allocation_name(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
|
||||
entity.setOs_amount_od(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
|
||||
entity.setReceive_amount(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
|
||||
entity.setDtm_upd(cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13)));
|
||||
entity.setUsr_upd(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
|
||||
entity.setDtm_crt(cursor.isNull(offset + 15) ? null : new java.util.Date(cursor.getLong(offset + 15)));
|
||||
entity.setUsr_crt(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
|
||||
entity.setUuid_payment_history_h(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected String updateKeyAfterInsert(PaymentHistoryD entity, long rowId) {
|
||||
return entity.getUuid_payment_history_d();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String getKey(PaymentHistoryD entity) {
|
||||
if(entity != null) {
|
||||
return entity.getUuid_payment_history_d();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected boolean isEntityUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.adins.mss.base.receipt;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.graphics.Color.BLACK;
|
||||
import static android.graphics.Color.WHITE;
|
||||
|
||||
public class Barcode extends View {
|
||||
|
||||
public Barcode(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
//EMPTY
|
||||
}
|
||||
|
||||
public static Bitmap encode(String contents, BarcodeFormat format, int img_width, int img_height) throws WriterException
|
||||
{
|
||||
if (contents == null) {
|
||||
return null;
|
||||
}
|
||||
Map<EncodeHintType, Object> hints = null;
|
||||
String encoding = guessAppropriateEncoding(contents);
|
||||
if (encoding != null) {
|
||||
hints = new EnumMap<>(EncodeHintType.class);
|
||||
hints.put(EncodeHintType.CHARACTER_SET, encoding);
|
||||
}
|
||||
MultiFormatWriter writer = new MultiFormatWriter();
|
||||
BitMatrix result;
|
||||
try {
|
||||
result = writer.encode(contents, format, img_width, img_height, hints);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// Unsupported format
|
||||
return null;
|
||||
}
|
||||
int width = result.getWidth();
|
||||
int height = result.getHeight();
|
||||
int[] pixels = new int[width * height];
|
||||
for (int y = 0; y < height; y++) {
|
||||
int offset = y * width;
|
||||
for (int x = 0; x < width; x++) {
|
||||
pixels[offset + x] = result.get(x, y) ? BLACK : WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height,
|
||||
Bitmap.Config.ARGB_8888);
|
||||
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private static String guessAppropriateEncoding(CharSequence contents) {
|
||||
// Very crude at the moment
|
||||
for (int i = 0; i < contents.length(); i++) {
|
||||
if (contents.charAt(i) > 0xFF) {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2013, Edmodo, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License.
|
||||
* You may obtain a copy of the License in the LICENSE file, or 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 com.edmodo.cropper.cropwindow.handle;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.edmodo.cropper.cropwindow.edge.Edge;
|
||||
import com.edmodo.cropper.cropwindow.edge.EdgePair;
|
||||
|
||||
/**
|
||||
* HandleHelper class to handle corner Handles (i.e. top-left, top-right,
|
||||
* bottom-left, and bottom-right handles).
|
||||
*/
|
||||
class CornerHandleHelper extends HandleHelper {
|
||||
|
||||
// Constructor /////////////////////////////////////////////////////////////
|
||||
|
||||
CornerHandleHelper(Edge horizontalEdge, Edge verticalEdge) {
|
||||
super(horizontalEdge, verticalEdge);
|
||||
}
|
||||
|
||||
// HandleHelper Methods ////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
void updateCropWindow(float x,
|
||||
float y,
|
||||
float targetAspectRatio,
|
||||
Rect imageRect,
|
||||
float snapRadius) {
|
||||
|
||||
final EdgePair activeEdges = getActiveEdges(x, y, targetAspectRatio);
|
||||
final Edge primaryEdge = activeEdges.primary;
|
||||
final Edge secondaryEdge = activeEdges.secondary;
|
||||
|
||||
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
|
||||
secondaryEdge.adjustCoordinate(targetAspectRatio);
|
||||
|
||||
if (secondaryEdge.isOutsideMargin(imageRect, snapRadius)) {
|
||||
secondaryEdge.snapToRect(imageRect);
|
||||
primaryEdge.adjustCoordinate(targetAspectRatio);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.adins.mss.odr.marketingreport;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class MarketingSearchRequest extends MssRequestType {
|
||||
@SerializedName("date1")
|
||||
private Date date1;
|
||||
@SerializedName("date2")
|
||||
private Date date2;
|
||||
@SerializedName("month")
|
||||
private String month;
|
||||
@SerializedName("uuid_user")
|
||||
private String uuidUser;
|
||||
|
||||
public String getUuidUser() {
|
||||
return uuidUser;
|
||||
}
|
||||
|
||||
public void setUuidUser(String uuidUser) {
|
||||
this.uuidUser = uuidUser;
|
||||
}
|
||||
|
||||
public Date getDate1() {
|
||||
return date1;
|
||||
}
|
||||
|
||||
public void setDate1(Date date1) {
|
||||
this.date1 = date1;
|
||||
}
|
||||
|
||||
public Date getDate2() {
|
||||
return date2;
|
||||
}
|
||||
|
||||
public void setDate2(Date date2) {
|
||||
this.date2 = date2;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
A custom layout for each tab that ensures the two tabs fill
|
||||
all the available horizontal space. Otherwise, by default the
|
||||
two tabs will be left-justified.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/customTab"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tabText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue