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,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_spin"
|
||||
android:singleLine="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/fontColor" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,320 @@
|
|||
package zj.com.cn.bluetooth.sdk;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This Activity appears as a dialog. It lists any paired devices and
|
||||
* devices detected in the area after discovery. When a device is chosen
|
||||
* by the user, the MAC address of the device is sent back to the parent
|
||||
* Activity in the result Intent.
|
||||
*/
|
||||
public class DeviceListActivity extends Activity {
|
||||
// Debugging
|
||||
private static final String TAG = "DeviceListActivity";
|
||||
private static final boolean DEBUG = true;
|
||||
// Return Intent extra
|
||||
public static String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||
public static String EXTRA_ACTION_DELETE = "action_delete";
|
||||
private static Set<BluetoothDevice> pairedDevices;
|
||||
private Set<BluetoothDevice> newDevices;
|
||||
// Member fields
|
||||
private BluetoothAdapter mBtAdapter;
|
||||
private ArrayAdapter<String> mPairedDevicesArrayAdapter;
|
||||
private ArrayAdapter<String> mNewDevicesArrayAdapter;
|
||||
|
||||
private FirebaseAnalytics screenName;
|
||||
// The BroadcastReceiver that listens for discovered devices and
|
||||
// changes the title when discovery is finished
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
|
||||
// When discovery finds a device
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
// Get the BluetoothDevice object from the Intent
|
||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
// If it's already paired, skip it, because it's been listed already
|
||||
if (device.getBondState() != BluetoothDevice.BOND_BONDED && !newDevices.contains(device)) {
|
||||
if (device.getName() != null){
|
||||
mNewDevicesArrayAdapter.add(device.getName());
|
||||
newDevices.add(device);
|
||||
}
|
||||
}
|
||||
// When discovery is finished, change the Activity title
|
||||
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
setTitle(R.string.select_device);
|
||||
if (mNewDevicesArrayAdapter.getCount() == 0) {
|
||||
String noDevices = getResources().getText(R.string.none_found).toString();
|
||||
mNewDevicesArrayAdapter.add(noDevices);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Nendi: 2019-01-08 | Add unpair confirmation request
|
||||
private void confirmUnpairDevice(final BluetoothDevice device) {
|
||||
final String title = "Unpair Bluetooth";
|
||||
final String message = getString(R.string.message_confirm_unpair_bluetooth);
|
||||
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(this);
|
||||
dialogBuilder.withTitle(title)
|
||||
.withMessage(message)
|
||||
.withButton1Text(getString(R.string.btnConfirm))
|
||||
.withButton2Text(getString(R.string.btnCancel))
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||
intent.putExtra(EXTRA_ACTION_DELETE, 1);
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
|
||||
//Notify adapter data has changed
|
||||
mPairedDevicesArrayAdapter.remove(device.getName());
|
||||
mPairedDevicesArrayAdapter.notifyDataSetChanged();
|
||||
|
||||
dialogBuilder.dismiss();
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setButton2Click(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialogBuilder.dismiss();
|
||||
}
|
||||
})
|
||||
.isCancelable(false)
|
||||
.isCancelableOnTouchOutside(false)
|
||||
.show();
|
||||
}
|
||||
|
||||
// The long click listener for all devices in the ListViews
|
||||
private AdapterView.OnItemLongClickListener mDeviceLongClickListener = new AdapterView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
String info = ((TextView) view).getText().toString();
|
||||
if (pairedDevices.size() > 0) {
|
||||
for (BluetoothDevice device : pairedDevices) {
|
||||
if (device.getName().equalsIgnoreCase(info)) {
|
||||
confirmUnpairDevice(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// The on-click listener for all devices in the ListViews
|
||||
private OnItemClickListener mDeviceClickListener = new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
|
||||
// Cancel discovery because it's costly and we're about to connect
|
||||
mBtAdapter.cancelDiscovery();
|
||||
|
||||
// Get the device MAC address, which is the last 17 chars in the View
|
||||
String info = ((TextView) v).getText().toString();
|
||||
String noDevices = getResources().getText(R.string.none_paired).toString();
|
||||
String noNewDevice = getResources().getText(R.string.none_found).toString();
|
||||
Log.i("tag", info);
|
||||
|
||||
String address = "";
|
||||
|
||||
//if (! info.equals(noDevices) && ! info.equals(noNewDevice)) {
|
||||
//String address = info.substring(info.length());
|
||||
// Create the result Intent and include the MAC address
|
||||
Intent intent = new Intent();
|
||||
if (pairedDevices.size() > 0) {
|
||||
for (BluetoothDevice device : pairedDevices) {
|
||||
if (device.getName().equalsIgnoreCase(info)) {
|
||||
address = device.getAddress();
|
||||
intent.putExtra(EXTRA_DEVICE_ADDRESS, address);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newDevices.size() > 0) {
|
||||
for (BluetoothDevice device : newDevices) {
|
||||
if (device.getName().equalsIgnoreCase(info)) {
|
||||
intent.putExtra(BluetoothDevice.EXTRA_NAME, device.getName());
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { //Nendi: 2019-01-08 | Add return new device for paring request
|
||||
for (BluetoothDevice device : newDevices) {
|
||||
if (device.getName().equalsIgnoreCase(info)) {
|
||||
intent.putExtra(BluetoothDevice.EXTRA_NAME, device.getName());
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Intent intent = new Intent();
|
||||
// intent.putExtra(EXTRA_DEVICE_ADDRESS, address);
|
||||
// Set result and finish this Activity
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
finish();
|
||||
//}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
// Setup the window
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
this.setFinishOnTouchOutside(false);
|
||||
setContentView(R.layout.device_list);
|
||||
|
||||
// Set result CANCELED incase the user backs out
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
|
||||
// Initialize the button to perform device discovery
|
||||
Button scanButton = (Button) findViewById(R.id.button_scan);
|
||||
scanButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
doDiscovery();
|
||||
v.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize array adapters. One for already paired devices and
|
||||
// one for newly discovered devices
|
||||
mPairedDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name);
|
||||
mNewDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name);
|
||||
newDevices = new HashSet<>();
|
||||
|
||||
// Find and set up the ListView for paired devices
|
||||
ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
|
||||
pairedListView.setAdapter(mPairedDevicesArrayAdapter);
|
||||
pairedListView.setOnItemClickListener(mDeviceClickListener);
|
||||
|
||||
// Find and set up the ListView for newly discovered devices
|
||||
ListView newDevicesListView = (ListView) findViewById(R.id.new_devices);
|
||||
newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
|
||||
newDevicesListView.setOnItemClickListener(mDeviceClickListener);
|
||||
pairedListView.setOnItemLongClickListener(mDeviceLongClickListener);
|
||||
|
||||
// Register for broadcasts when a device is discovered
|
||||
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
|
||||
this.registerReceiver(mReceiver, filter);
|
||||
|
||||
// Register for broadcasts when discovery has finished
|
||||
filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||
this.registerReceiver(mReceiver, filter);
|
||||
|
||||
// Get the local Bluetooth adapter
|
||||
mBtAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
|
||||
// Get a set of currently paired devices
|
||||
pairedDevices = mBtAdapter.getBondedDevices();
|
||||
|
||||
// If there are paired devices, add each one to the ArrayAdapter
|
||||
if (pairedDevices.size() > 0) {
|
||||
findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
|
||||
for (BluetoothDevice device : pairedDevices) {
|
||||
mPairedDevicesArrayAdapter.add(device.getName());
|
||||
}
|
||||
} else {
|
||||
String noDevices = getResources().getText(R.string.none_paired).toString();
|
||||
mPairedDevicesArrayAdapter.add(noDevices);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this, getString(R.string.screen_name_device_list), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try {
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
if (null == locale) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
}
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
// Make sure we're not doing discovery anymore
|
||||
if (mBtAdapter != null) {
|
||||
mBtAdapter.cancelDiscovery();
|
||||
}
|
||||
|
||||
// Unregister broadcast listeners
|
||||
this.unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start device discover with the BluetoothAdapter
|
||||
*/
|
||||
private void doDiscovery() {
|
||||
if (DEBUG) Logger.d(TAG, "doDiscovery()");
|
||||
|
||||
// Indicate scanning in the title
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
setTitle(R.string.scanning);
|
||||
|
||||
// Turn on sub-title for new devices
|
||||
findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
|
||||
|
||||
// If we're already discovering, stop it
|
||||
if (mBtAdapter.isDiscovering()) {
|
||||
mBtAdapter.cancelDiscovery();
|
||||
}
|
||||
|
||||
mNewDevicesArrayAdapter.clear();//20160617
|
||||
// mPairedDevicesArrayAdapter.clear();//20160617
|
||||
// Request discover from BluetoothAdapter
|
||||
mBtAdapter.startDiscovery();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright 2013 Chris Banes
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package uk.co.senab.actionbarpulltorefresh.library.viewdelegates;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
*/
|
||||
public class AbsListViewDelegate implements ViewDelegate {
|
||||
|
||||
public static final Class[] SUPPORTED_VIEW_CLASSES = {AbsListView.class};
|
||||
|
||||
@Override
|
||||
public boolean isReadyForPull(View view, final float x, final float y) {
|
||||
boolean ready = false;
|
||||
|
||||
// First we check whether we're scrolled to the top
|
||||
AbsListView absListView = (AbsListView) view;
|
||||
if (absListView.getCount() == 0) {
|
||||
ready = true;
|
||||
} else if (absListView.getFirstVisiblePosition() == 0) {
|
||||
final View firstVisibleChild = absListView.getChildAt(0);
|
||||
ready = firstVisibleChild != null && firstVisibleChild.getTop() >= absListView.getPaddingTop();
|
||||
}
|
||||
|
||||
// Then we have to check whether the fas scroller is enabled, and check we're not starting
|
||||
// the gesture from the scroller
|
||||
if (ready && absListView.isFastScrollEnabled() && isFastScrollAlwaysVisible(absListView)) {
|
||||
switch (getVerticalScrollbarPosition(absListView)) {
|
||||
case View.SCROLLBAR_POSITION_RIGHT:
|
||||
ready = x < absListView.getRight() - absListView.getVerticalScrollbarWidth();
|
||||
break;
|
||||
case View.SCROLLBAR_POSITION_LEFT:
|
||||
ready = x > absListView.getVerticalScrollbarWidth();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ready;
|
||||
}
|
||||
|
||||
int getVerticalScrollbarPosition(AbsListView absListView) {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ?
|
||||
CompatV11.getVerticalScrollbarPosition(absListView) :
|
||||
Compat.getVerticalScrollbarPosition(absListView);
|
||||
}
|
||||
|
||||
boolean isFastScrollAlwaysVisible(AbsListView absListView) {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ?
|
||||
CompatV11.isFastScrollAlwaysVisible(absListView) :
|
||||
Compat.isFastScrollAlwaysVisible(absListView);
|
||||
}
|
||||
|
||||
static class Compat {
|
||||
static int getVerticalScrollbarPosition(AbsListView absListView) {
|
||||
return View.SCROLLBAR_POSITION_RIGHT;
|
||||
}
|
||||
|
||||
static boolean isFastScrollAlwaysVisible(AbsListView absListView) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
static class CompatV11 {
|
||||
static int getVerticalScrollbarPosition(AbsListView absListView) {
|
||||
return absListView.getVerticalScrollbarPosition();
|
||||
}
|
||||
|
||||
static boolean isFastScrollAlwaysVisible(AbsListView absListView) {
|
||||
return absListView.isFastScrollAlwaysVisible();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.adins.mss.base.dynamicform.form.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SummaryAnswerBean {
|
||||
@SerializedName("listHeader")
|
||||
private List<ListHeader> listHeader;
|
||||
@SerializedName("listDetail")
|
||||
private List<Map<String, Object>> listDetail;
|
||||
|
||||
public List<ListHeader> getListHeader() {
|
||||
return listHeader;
|
||||
}
|
||||
|
||||
public void setListHeader(List<ListHeader> listHeader) {
|
||||
this.listHeader = listHeader;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getListDetail() {
|
||||
return listDetail;
|
||||
}
|
||||
|
||||
public void setListDetail(List<Map<String, Object>> listDetail) {
|
||||
this.listDetail = listDetail;
|
||||
}
|
||||
|
||||
public class ListHeader {
|
||||
@SerializedName("refId")
|
||||
private String refId;
|
||||
@SerializedName("label")
|
||||
private String label;
|
||||
// @SerializedName("ansType")
|
||||
// private String ansType;
|
||||
|
||||
public String getRefId() {
|
||||
return refId;
|
||||
}
|
||||
|
||||
public void setRefId(String refId) {
|
||||
this.refId = refId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
// public String getAnsType() {
|
||||
// return ansType;
|
||||
// }
|
||||
//
|
||||
// public void setAnsType(String ansType) {
|
||||
// this.ansType = ansType;
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/gradient_start" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@android:color/transparent" />
|
||||
<corners
|
||||
android:radius="10dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/gradient_start"
|
||||
android:endColor="@color/gradient_end"
|
||||
android:angle="270" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@android:color/transparent" />
|
||||
<corners
|
||||
android:radius="10dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,301 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dummyDashContentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="#F2F3F8"
|
||||
tools:context=".dashboardcollection.view.DummyDashboardCollView">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/dummyGuideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.02" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/dummyGuideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.98" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/dummyDashTargetProgressContainer"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyGuideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/dummyGuideline2"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyTargetCollected"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/dummyDashTargetTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/target_collected"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dummyDashProgressValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="0 / 0 IDR"
|
||||
android:textColor="#585D66"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashTargetTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dummyDashProgressPercent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:text="0 %"
|
||||
android:textColor="@color/gradient_start"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyDashProgressValue"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashTargetTitle" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/dummyDashTargetProgress"
|
||||
android:layout_marginTop="3dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashProgressValue"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:progressDrawable="@drawable/dashboard_progress_drawable"
|
||||
android:indeterminate="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="13dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
android:id="@+id/dummyCollectSummary"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyGuideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/dummyGuideline2"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashTargetProgressContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/dummyGuidelineTwoColumn"
|
||||
app:layout_constraintGuide_percent="0.5"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/dummyGuidelineTwoColumn"
|
||||
android:layout_marginRight="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="180dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyOutstandingTask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:id="@+id/dummyDashOutstandingTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="5dp"
|
||||
android:text="@string/outstanding_task"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dummyDashOutstandingValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/gradient_start"
|
||||
android:textSize="60sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashOutstandingTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dummyDashOutstandingAmount"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashOutstandingValue"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="0 IDR"
|
||||
android:textColor="#585D66"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyGuidelineTwoColumn"
|
||||
android:layout_marginLeft="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="180dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyCollectionResult"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dummyDashCollResultTitle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="5dp"
|
||||
android:text="@string/collection_result"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dummyDashCollResultPie"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashCollResultTitle"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/dummyPieLegend"
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashCollResultPie"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashCollectedLegend"
|
||||
android:text="Collected"
|
||||
android:textSize="12dp"
|
||||
android:textColor="#008000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashPtpLegend"
|
||||
android:text="PTP"
|
||||
android:textColor="#EA9431"
|
||||
android:textSize="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashFailedLegend"
|
||||
android:text="Failed"
|
||||
android:textSize="12dp"
|
||||
android:textColor="#ffff0000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyCollectSummary"
|
||||
android:id="@+id/dashResultDetailTitle"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyGuideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/dummyGuideline2"
|
||||
android:text="@string/collection_result_detail"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/dummyCollResultDetailCard"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashResultDetailTitle"
|
||||
app:layout_constraintStart_toEndOf="@id/dummyGuideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/dummyGuideline2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dummyCollResDetail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/dummyDashDetailTab"
|
||||
android:layout_width="match_parent"
|
||||
app:tabTextAppearance="@style/DashboardCollTabText"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/dummyCollected"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="COLLECTED" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/dummyPTP"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="PTP" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/dummyFailed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="FAILED" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
app:layout_constraintTop_toBottomOf="@id/dummyDashDetailTab"
|
||||
android:id="@+id/dummyDashViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,59 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
|
||||
public class ReviewLookupDukcapilViewHolder extends RecyclerView.ViewHolder {
|
||||
public RelativeLayout layout;
|
||||
public TextView mLabelNo;
|
||||
public TextView mQuestionLabel;
|
||||
public TextView mQuestionAnswer;
|
||||
public QuestionBean bean;
|
||||
public FragmentActivity mActivity;
|
||||
public OnQuestionClickListener listener;
|
||||
|
||||
@Deprecated
|
||||
public ReviewLookupDukcapilViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
layout = (RelativeLayout) itemView.findViewById(R.id.lookupDukcapilReviewLayout);
|
||||
mLabelNo = (TextView) itemView.findViewById(R.id.questionDukcapilNoLabel);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDukcapilTextLabel);
|
||||
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionDukcapilTextAnswer);
|
||||
}
|
||||
|
||||
public ReviewLookupDukcapilViewHolder(View itemView, FragmentActivity activity, OnQuestionClickListener listener) {
|
||||
super(itemView);
|
||||
mActivity = activity;
|
||||
layout = (RelativeLayout) itemView.findViewById(R.id.lookupDukcapilReviewLayout);
|
||||
mLabelNo = (TextView) itemView.findViewById(R.id.questionDukcapilNoLabel);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDukcapilTextLabel);
|
||||
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionDukcapilTextAnswer);
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void bind(final QuestionBean item, final int group, final int number) {
|
||||
bean = item;
|
||||
mLabelNo.setText(number + ".");
|
||||
String qLabel = bean.getQuestion_label();
|
||||
mQuestionLabel.setText(qLabel);
|
||||
|
||||
if(bean.getAnswer()!=null && !"".equals(bean.getAnswer())){
|
||||
mQuestionAnswer.setText(bean.getAnswer());
|
||||
}
|
||||
|
||||
layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null)
|
||||
listener.onReviewClickListener(bean, group, number - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.adins.mss.base.todolist.todayplanrepository;
|
||||
|
||||
import com.adins.mss.dao.PlanTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPlanTaskDataSource {
|
||||
//local data source by sqlite or sharedpref
|
||||
void loadPlans(Result<List<PlanTask>> resultCallback);
|
||||
void updatePlanStatus(List<PlanTask> planTasks, Result<List<PlanTask>> resultCallback);
|
||||
void updatePlanStatus(List<PlanTask> planTasks);
|
||||
int getTotalPlanFromStart();
|
||||
int getLastSequenceNo();
|
||||
boolean getStartVisitOnlineStatus();
|
||||
void saveStartVisitOnlineStatus(boolean status);
|
||||
boolean getNeedSyncStatus();
|
||||
void saveNeedSyncStatus(boolean status);
|
||||
String[] getLastOfflineChangePlan();
|
||||
void saveLastChangePlanOffline(String oldPlanTask,String newPlanTask);
|
||||
|
||||
//remote data source
|
||||
void startVisit(RequestStartVisit request,Result<ResponseStartVisit> result);
|
||||
void changePlan(RequestChangePlan request,Result<ResponseChangePlan> result);
|
||||
|
||||
//result callback
|
||||
public interface Result<T>{
|
||||
void onResult(T result);
|
||||
void onError(String error);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.Menu;
|
||||
import com.adins.mss.dao.MenuDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class MenuDataAccess {
|
||||
|
||||
private MenuDataAccess() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 menuDao dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static MenuDao getMenuDao(Context context) {
|
||||
return getDaoSession(context).getMenuDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add menu as entity
|
||||
*
|
||||
* @param context
|
||||
* @param menu
|
||||
*/
|
||||
public static void add(Context context, Menu menu) {
|
||||
getMenuDao(context).insert(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* add menu as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param menuList
|
||||
*/
|
||||
public static void add(Context context, List<Menu> menuList) {
|
||||
getMenuDao(context).insertInTx(menuList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, Menu menu) {
|
||||
getMenuDao(context).insertOrReplaceInTx(menu);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, List<Menu> menuList) {
|
||||
getMenuDao(context).insertOrReplaceInTx(menuList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getMenuDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menu
|
||||
* @param context
|
||||
*/
|
||||
public static void delete(Context context, Menu menu) {
|
||||
getMenuDao(context).deleteInTx(menu);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by user
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
*/
|
||||
public static void delete(Context context, String uuidUser) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_user.eq(uuidUser));
|
||||
qb.build();
|
||||
getMenuDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menu
|
||||
* @param context
|
||||
*/
|
||||
public static void update(Context context, Menu menu) {
|
||||
getMenuDao(context).updateInTx(menu);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_user = param
|
||||
*
|
||||
* @param context
|
||||
* @param uuidUser
|
||||
* @return
|
||||
*/
|
||||
public static List<Menu> getAll(Context context, String uuidUser) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_user.eq(uuidUser));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* get one menu by menu uuid
|
||||
*
|
||||
* @param context
|
||||
* @param uuidMenu
|
||||
* @return
|
||||
*/
|
||||
public static Menu getOne(Context context, String uuidMenu) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_menu.eq(uuidMenu));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
if (!qb.list().isEmpty()) {
|
||||
return qb.list().get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHaveRescheduleMenu(Context context) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_menu.eq(Global.MENU_RESCHEDULE_SURVEY));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
return qb.list().size() > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//new
|
||||
public static boolean isHaveReVisitMenu(Context context) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_menu.eq(Global.MENU_REVISIT_COLLECTION));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
return qb.list().size() > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHaveVerificationBranchMenu(Context context) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_menu.eq(Global.MENU_VERIFICATION_BRANCH));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
return qb.list().size() > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHaveApprovalBranchMenu(Context context) {
|
||||
QueryBuilder<Menu> qb = getMenuDao(context).queryBuilder();
|
||||
qb.where(MenuDao.Properties.Uuid_menu.eq(Global.MENU_APPROVAL_BRANCH));
|
||||
qb.build();
|
||||
if (qb.list() != null) {
|
||||
return qb.list().size() > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.adins.mss.odr.followup;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/27/2017.
|
||||
*/
|
||||
|
||||
public interface OnCheckedListener {
|
||||
void onChecked(String groupTask);
|
||||
void onUnchecked(String groupTask);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.adins.mss.base.todolist.form;
|
||||
|
||||
import com.adins.mss.base.todolist.form.helper.TaskFilterParam;
|
||||
import com.adins.mss.base.todolist.form.helper.TaskPlanFilterObservable;
|
||||
|
||||
public interface TaskListTabInteractor {
|
||||
void goToTab(int index);
|
||||
TaskPlanFilterObservable<TaskFilterParam> getFilterObservable();
|
||||
|
||||
public interface TabPage{
|
||||
String getTabPageName();
|
||||
void onEnterPage();
|
||||
void onLeavePage();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.adins.mss.base.dynamicform.form.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 11/10/2016.
|
||||
*/
|
||||
|
||||
public class CriteriaParameter implements Serializable {
|
||||
@SerializedName("parameters")
|
||||
private List<Parameter> parameters;
|
||||
|
||||
public List<Parameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(List<Parameter> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package com.adins.mss.base.api;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.models.ChangePasswordRequestModel;
|
||||
import com.adins.mss.base.models.ChangePasswordResponseModel;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.net.HttpClient;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
/**
|
||||
* Created by adityapurwa on 30/03/15.
|
||||
*/
|
||||
public class ChangePasswordApi {
|
||||
private final Context context;
|
||||
private final Activity activity;
|
||||
private final HttpClient http;
|
||||
private ChangePasswordApiCallback callback;
|
||||
|
||||
public ChangePasswordApi(Activity context) {
|
||||
this.activity = context;
|
||||
this.context = context;
|
||||
this.http = new HttpClient(context);
|
||||
}
|
||||
|
||||
public ChangePasswordApiCallback getCallback() {
|
||||
return callback;
|
||||
}
|
||||
|
||||
public void setCallback(ChangePasswordApiCallback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public void execute(final ChangePasswordRequestModel request) {
|
||||
|
||||
new AsyncTask<Void, Void, ChangePasswordResponseModel>() {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(context, "", context.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChangePasswordResponseModel doInBackground(Void... params) {
|
||||
try {
|
||||
if (Tool.isInternetconnected(context)) {
|
||||
String json = GsonHelper.toJson(request);
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
String url = GlobalData.getSharedGlobalData().getURL_CHANGEPASSWORD();
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
errMessage = e.getMessage();
|
||||
FireCrash.log(e);
|
||||
}
|
||||
String body = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
body = serverResult.getResult();
|
||||
ChangePasswordResponseModel result = null;
|
||||
try {
|
||||
result = GsonHelper.fromJson(body, ChangePasswordResponseModel.class);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
errMessage = e.getMessage();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if(serverResult != null && serverResult.getResult() != null)
|
||||
errMessage = serverResult.getResult();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
errMessage = context.getString(R.string.no_internet_connection);
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
if (Global.IS_DEV)
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ChangePasswordResponseModel result) {
|
||||
super.onPostExecute(result);
|
||||
if (progressDialog.isShowing()) {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
if (errMessage != null && getCallback() != null){
|
||||
getCallback().onFailed(errMessage);
|
||||
}else{
|
||||
getCallback().onFailed(context.getString(R.string.error_unknown));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (result.getStatus().getCode() == 0) {
|
||||
if (getCallback() != null) getCallback().onSuccess();
|
||||
} else {
|
||||
if (getCallback() != null) {
|
||||
if (result.getStatus().getMessage() != null)
|
||||
getCallback().onFailed(result.getStatus().getMessage());
|
||||
else
|
||||
getCallback().onFailed(String.valueOf(result.getStatus().getCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<View
|
||||
android:id="@+id/actionbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/tv_dark" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="6dp"
|
||||
android:layout_below="@+id/actionbar" >
|
||||
|
||||
<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="vertical"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="#eeeeee" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_nama" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_nama"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="#eeeeee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView02"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_alamat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView01"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_alamat"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="3dp"
|
||||
android:padding="3dp"
|
||||
android:background="#eeeeee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView04"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_rt_rw" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView03"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_rt_rw"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="#eeeeee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView06"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_kabupaten" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView05"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_kabupaten"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="#eeeeee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView08"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_kode_pos" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView07"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_kode_pos"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="#eeeeee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/review_label_reputasi_konsumen" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView09"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dummy_review_label_reputasi_konsumen"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="6dp"
|
||||
android:text="@string/btnSubmit" />
|
||||
|
||||
</RelativeLayout>
|
Binary file not shown.
After Width: | Height: | Size: 734 B |
Loading…
Add table
Add a link
Reference in a new issue