add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/fontColorWhite"
android:pathData="M12.5,6.9c1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-0.53,0.12 -1.03,0.3 -1.48,0.54l1.47,1.47c0.41,-0.17 0.91,-0.27 1.51,-0.27zM5.33,4.06L4.06,5.33 7.5,8.77c0,2.08 1.56,3.21 3.91,3.91l3.51,3.51c-0.34,0.48 -1.05,0.91 -2.42,0.91 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c0.96,-0.18 1.82,-0.55 2.45,-1.12l2.22,2.22 1.27,-1.27L5.33,4.06z"/>
</vector>

View file

@ -0,0 +1,391 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* 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 com.soundcloud.android.crop;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.ImageView;
/*
* Modified from original in AOSP.
*/
abstract class ImageViewTouchBase extends ImageView {
private static final float SCALE_RATE = 1.25F;
// The current bitmap being displayed.
protected final RotateBitmap bitmapDisplayed = new RotateBitmap(null, 0);
// This is the final matrix which is computed as the concatentation
// of the base matrix and the supplementary matrix.
private final Matrix displayMatrix = new Matrix();
// Temporary buffer used for getting the values out of a matrix.
private final float[] matrixValues = new float[9];
// This is the base transformation which is used to show the image
// initially. The current computation for this shows the image in
// it's entirety, letterboxing as needed. One could choose to
// show the image as cropped instead.
//
// This matrix is recomputed when we go from the thumbnail image to
// the full size image.
protected Matrix baseMatrix = new Matrix();
// This is the supplementary transformation which reflects what
// the user has done in terms of zooming and panning.
//
// This matrix remains the same when we go from the thumbnail image
// to the full size image.
protected Matrix suppMatrix = new Matrix();
protected Handler handler = new Handler();
int thisWidth = -1;
int thisHeight = -1;
float maxZoom;
private Runnable onLayoutRunnable;
private Recycler recycler;
public ImageViewTouchBase(Context context) {
super(context);
init();
}
public ImageViewTouchBase(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public ImageViewTouchBase(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public void setRecycler(Recycler recycler) {
this.recycler = recycler;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
thisWidth = right - left;
thisHeight = bottom - top;
Runnable r = onLayoutRunnable;
if (r != null) {
onLayoutRunnable = null;
r.run();
}
if (bitmapDisplayed.getBitmap() != null) {
getProperBaseMatrix(bitmapDisplayed, baseMatrix, true);
setImageMatrix(getImageViewMatrix());
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
event.startTracking();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {
if (getScale() > 1.0f) {
// If we're zoomed in, pressing Back jumps out to show the
// entire image, otherwise Back returns the user to the gallery
zoomTo(1.0f);
return true;
}
}
return super.onKeyUp(keyCode, event);
}
@Override
public void setImageBitmap(Bitmap bitmap) {
setImageBitmap(bitmap, 0);
}
private void setImageBitmap(Bitmap bitmap, int rotation) {
super.setImageBitmap(bitmap);
Drawable d = getDrawable();
if (d != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//ignored
} else {
d.setDither(true);
}
}
Bitmap old = bitmapDisplayed.getBitmap();
bitmapDisplayed.setBitmap(bitmap);
bitmapDisplayed.setRotation(rotation);
if (old != null && old != bitmap && recycler != null) {
recycler.recycle(old);
}
}
public void clear() {
setImageBitmapResetBase(null, true);
}
// This function changes bitmap, reset base matrix according to the size
// of the bitmap, and optionally reset the supplementary matrix
public void setImageBitmapResetBase(final Bitmap bitmap, final boolean resetSupp) {
setImageRotateBitmapResetBase(new RotateBitmap(bitmap, 0), resetSupp);
}
public void setImageRotateBitmapResetBase(final RotateBitmap bitmap, final boolean resetSupp) {
final int viewWidth = getWidth();
if (viewWidth <= 0) {
onLayoutRunnable = new Runnable() {
public void run() {
setImageRotateBitmapResetBase(bitmap, resetSupp);
}
};
return;
}
if (bitmap.getBitmap() != null) {
getProperBaseMatrix(bitmap, baseMatrix, true);
setImageBitmap(bitmap.getBitmap(), bitmap.getRotation());
} else {
baseMatrix.reset();
setImageBitmap(null);
}
if (resetSupp) {
suppMatrix.reset();
}
setImageMatrix(getImageViewMatrix());
maxZoom = calculateMaxZoom();
}
// Center as much as possible in one or both axis. Centering is
// defined as follows: if the image is scaled down below the
// view's dimensions then center it (literally). If the image
// is scaled larger than the view and is translated out of view
// then translate it back into view (i.e. eliminate black bars).
protected void center(boolean horizontal, boolean vertical) {
final Bitmap bitmap = bitmapDisplayed.getBitmap();
if (bitmap == null) {
return;
}
Matrix m = getImageViewMatrix();
RectF rect = new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight());
m.mapRect(rect);
float height = rect.height();
float width = rect.width();
float deltaX = 0, deltaY = 0;
if (vertical) {
int viewHeight = getHeight();
if (height < viewHeight) {
deltaY = (viewHeight - height) / 2 - rect.top;
} else if (rect.top > 0) {
deltaY = -rect.top;
} else if (rect.bottom < viewHeight) {
deltaY = getHeight() - rect.bottom;
}
}
if (horizontal) {
int viewWidth = getWidth();
if (width < viewWidth) {
deltaX = (viewWidth - width) / 2 - rect.left;
} else if (rect.left > 0) {
deltaX = -rect.left;
} else if (rect.right < viewWidth) {
deltaX = viewWidth - rect.right;
}
}
postTranslate(deltaX, deltaY);
setImageMatrix(getImageViewMatrix());
}
private void init() {
setScaleType(ImageView.ScaleType.MATRIX);
}
protected float getValue(Matrix matrix, int whichValue) {
matrix.getValues(matrixValues);
return matrixValues[whichValue];
}
// Get the scale factor out of the matrix.
protected float getScale(Matrix matrix) {
return getValue(matrix, Matrix.MSCALE_X);
}
protected float getScale() {
return getScale(suppMatrix);
}
// Setup the base matrix so that the image is centered and scaled properly.
private void getProperBaseMatrix(RotateBitmap bitmap, Matrix matrix, boolean includeRotation) {
float viewWidth = getWidth();
float viewHeight = getHeight();
float w = bitmap.getWidth();
float h = bitmap.getHeight();
matrix.reset();
// We limit up-scaling to 3x otherwise the result may look bad if it's a small icon
float widthScale = Math.min(viewWidth / w, 3.0f);
float heightScale = Math.min(viewHeight / h, 3.0f);
float scale = Math.min(widthScale, heightScale);
if (includeRotation) {
matrix.postConcat(bitmap.getRotateMatrix());
}
matrix.postScale(scale, scale);
matrix.postTranslate((viewWidth - w * scale) / 2F, (viewHeight - h * scale) / 2F);
}
// Combine the base matrix and the supp matrix to make the final matrix
protected Matrix getImageViewMatrix() {
// The final matrix is computed as the concatentation of the base matrix
// and the supplementary matrix
displayMatrix.set(baseMatrix);
displayMatrix.postConcat(suppMatrix);
return displayMatrix;
}
public Matrix getUnrotatedMatrix() {
Matrix unrotated = new Matrix();
getProperBaseMatrix(bitmapDisplayed, unrotated, false);
unrotated.postConcat(suppMatrix);
return unrotated;
}
protected float calculateMaxZoom() {
if (bitmapDisplayed.getBitmap() == null) {
return 1F;
}
float fw = (float) bitmapDisplayed.getWidth() / (float) thisWidth;
float fh = (float) bitmapDisplayed.getHeight() / (float) thisHeight;
return Math.max(fw, fh) * 4; // 400%
}
protected void zoomTo(float scale, float centerX, float centerY) {
if (scale > maxZoom) {
scale = maxZoom;
}
float oldScale = getScale();
float deltaScale = scale / oldScale;
suppMatrix.postScale(deltaScale, deltaScale, centerX, centerY);
setImageMatrix(getImageViewMatrix());
center(true, true);
}
protected void zoomTo(final float scale, final float centerX,
final float centerY, final float durationMs) {
final float incrementPerMs = (scale - getScale()) / durationMs;
final float oldScale = getScale();
final long startTime = System.currentTimeMillis();
handler.post(new Runnable() {
public void run() {
long now = System.currentTimeMillis();
float currentMs = Math.min(durationMs, now - startTime);
float target = oldScale + (incrementPerMs * currentMs);
zoomTo(target, centerX, centerY);
if (currentMs < durationMs) {
handler.post(this);
}
}
});
}
protected void zoomTo(float scale) {
float cx = getWidth() / 2F;
float cy = getHeight() / 2F;
zoomTo(scale, cx, cy);
}
protected void zoomIn() {
zoomIn(SCALE_RATE);
}
protected void zoomOut() {
zoomOut(SCALE_RATE);
}
protected void zoomIn(float rate) {
if (getScale() >= maxZoom) {
return; // Don't let the user zoom into the molecular level
}
if (bitmapDisplayed.getBitmap() == null) {
return;
}
float cx = getWidth() / 2F;
float cy = getHeight() / 2F;
suppMatrix.postScale(rate, rate, cx, cy);
setImageMatrix(getImageViewMatrix());
}
protected void zoomOut(float rate) {
if (bitmapDisplayed.getBitmap() == null) {
return;
}
float cx = getWidth() / 2F;
float cy = getHeight() / 2F;
// Zoom out to at most 1x
Matrix tmp = new Matrix(suppMatrix);
tmp.postScale(1F / rate, 1F / rate, cx, cy);
if (getScale(tmp) < 1F) {
suppMatrix.setScale(1F, 1F, cx, cy);
} else {
suppMatrix.postScale(1F / rate, 1F / rate, cx, cy);
}
setImageMatrix(getImageViewMatrix());
center(true, true);
}
protected void postTranslate(float dx, float dy) {
suppMatrix.postTranslate(dx, dy);
}
protected void panBy(float dx, float dy) {
postTranslate(dx, dy);
setImageMatrix(getImageViewMatrix());
}
// ImageViewTouchBase will pass a Bitmap to the Recycler if it has finished
// its use of that Bitmap
public interface Recycler {
public void recycle(Bitmap b);
}
}

View file

@ -0,0 +1,26 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:orientation="vertical" >
<androidx.viewpager.widget.ViewPager
android:id="@+id/newsImage"
android:background="@drawable/button_background"
android:layout_width="match_parent"
android:layout_height="300dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:orientation="vertical" >
<TextView
android:id="@+id/newsDesc"
android:layout_margin="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dummy_news_desc"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,89 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/dialog2_bg">
<LinearLayout
android:id="@+id/byDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/dtm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="@string/select_reschedule_time"
android:textColor="@color/gradient_end"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<EditText
android:id="@+id/txtDtm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/btnDtm"
android:layout_marginRight="10dp"
android:layout_marginLeft="5dp"
android:padding="5dp"
android:background="@drawable/dropdown_background"
android:editable="false"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_centerVertical="true"/>
<ImageButton
android:id="@+id/btnDtm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="@drawable/transparent_bg"
android:src="@drawable/icon_calendar"
android:elevation="5dp"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="30dp">
<Button
android:id="@+id/btnCancel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="0.5"
android:layout_marginRight="2dp"
android:background="@drawable/button_background"
android:text="@string/btnCancel"
android:textColor="@color/fontColorWhite"
android:textAppearance="?android:attr/textAppearanceSmall"
android:gravity="center_vertical|center_horizontal"/>
<Button
android:id="@+id/btnReschedule"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="0.5"
android:layout_marginLeft="2dp"
android:background="@drawable/button_background"
android:text="@string/btnReschedule"
android:textColor="@color/fontColorWhite"
android:textAppearance="?android:attr/textAppearanceSmall"
android:gravity="center_vertical|center_horizontal"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,32 @@
package com.adins.mss.foundation.dialog.gitonway.lib.effects;
import android.view.View;
import com.adins.libs.nineoldandroids.animation.ObjectAnimator;
/*
* Copyright 2014 litao
* https://github.com/sd6352051/NiftyDialogEffects
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class Shake extends BaseEffects {
@Override
protected void setupAnimation(View view) {
getAnimatorSet().playTogether(
ObjectAnimator.ofFloat(view, "translationX", 0, .10f, -25, .26f, 25, .42f, -25, .58f, 25, .74f, -25, .90f, 1, 0).setDuration(mDuration)
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,8 @@
package com.adins.mss.coll.api;
/**
* Created by adityapurwa on 12/03/15.
*/
public interface SynchronizationMapper<T> {
public void map(String property, String value, T target);
}

View file

@ -0,0 +1,616 @@
package com.adins.mss.base.todolist;
import android.content.Context;
import android.util.Log;
import android.widget.ArrayAdapter;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.NewMainActivity;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
import com.adins.mss.base.mainmenu.MainMenuActivity;
import com.adins.mss.base.todo.Task;
import com.adins.mss.base.todolist.form.PriorityTabFragment;
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.QuestionSet;
import com.adins.mss.dao.Scheme;
import com.adins.mss.dao.TaskD;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.db.dataaccess.QuestionSetDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author bong.rk
*/
public class ToDoList {
// Bong Dec 10th, 2014 - to determine query list
/* SEARCH TYPE */
public static final int SEARCH_BY_TASK_ID = 1;
public static final int SEARCH_BY_ALL = 3;
public static final int SEARCH_BY_PRIORITY_HIGH = 1;
public static final int SEARCH_BY_PRIORITY_NORMAL = 2;
public static final int SEARCH_BY_PRIORITY_LOW = 3;
public static final int SEARCH_BY_STATUS_PENDING = 4;
public static final int SEARCH_BY_STATUS_UPLOADING = 5;
public static final int SEARCH_BY_STATUS_DRAFT = 6;
public static final int SEARCH_BY_BATCH_ID = 7;
public static final int SEARCH_BY_ALL_SENT = 8;
// Bong Dec 11th, 2014 - to determine query while refresh taskList
public static final int TASK_LIST_PRIORITY = 1;
public static final int TASK_LIST_STATUS = 2;
public static List<SurveyHeaderBean> listOfSurveyStatus;
private static List<TaskH> listTask;
private static int searchType;
private static String searchContent;
private Context context;
private String userId;
public ToDoList(Context context) {
this.context = context;
if (GlobalData.getSharedGlobalData().getUser() == null)
NewMainActivity.InitializeGlobalDataIfError(context);
userId = GlobalData.getSharedGlobalData().getUser().getUuid_user();
}
public static List<TaskH> getListTaskInPriority(Context context, int searchType, String searchContent) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
if (uuid_user == null) {
try {
NewMainActivity.InitializeGlobalDataIfError(context);
} catch (Exception e) {
FireCrash.log(e);
}
uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
}
if (searchContent == null || "".equals(searchContent) || searchContent.length() == 0)
return listTask = TaskHDataAccess.getAllTaskInPriority(context, uuid_user)
;
else if (searchType == SEARCH_BY_TASK_ID)
return listTask = TaskHDataAccess.getAllTaskInPriorityByTask(context, uuid_user, searchContent)
;
else if (searchType == SEARCH_BY_ALL)
return listTask = TaskHDataAccess.getAllTaskInPriorityByAll(context, uuid_user, searchContent)
;
else {
return listTask = TaskHDataAccess.getAllTaskInPriorityByCustomer(context, uuid_user, searchContent);
}
}
public static List<TaskH> getListTaskInSequence(Context context) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
if (uuid_user == null) {
try {
NewMainActivity.InitializeGlobalDataIfError(context);
} catch (Exception e) {
FireCrash.log(e);
}
uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
}
return listTask = TaskHDataAccess.getAllTaskInPriority(context, uuid_user);
}
/**
* Return task list which has been queried
*
* @return
*/
public static List<TaskH> getListTask() {
return listTask;
}
public static long getCounterTaskList(Context context) {
long counter = 0;
try {
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
long counterPriority = TaskHDataAccess.getTaskInPriorityCounter(context, uuidUser);
long counterStatus = TaskHDataAccess.getTaskInStatusCounter(context, uuidUser);
counter = counterPriority + counterStatus;
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static long getAllCounter(Context context) {
long counter = 0;
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
try {
long counterPriority = TaskHDataAccess.getTaskInPriorityCounter(context, uuidUser);
long counterStatus = TaskHDataAccess.getTaskInStatusCounter(context, uuidUser);
long counterVerify = getCounterVerificationTask(context);
long counterApproval = getCounterApprovalTask(context);
long counterVerifyBranch = getCounterVerificationTaskByBranch(context);
long counterApprovalBranch = getCounterApprovalTaskByBranch(context);
long counterAssignmentTask = getCounterAssignment(context);
counter = counterPriority + counterStatus;
if (MainMenuActivity.mnSVYApproval != null)
counter += counterApproval;
if (MainMenuActivity.mnSVYVerify != null)
counter += counterVerify;
if (MainMenuActivity.mnSVYApprovalByBranch != null)
counter += counterApprovalBranch;
if (MainMenuActivity.mnSVYVerifyByBranch != null)
counter += counterVerifyBranch;
if (MainMenuActivity.mnSVYAssignment != null)
counter += counterAssignmentTask;
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static long getCounterAssignment(Context context) {
if (NewMainActivity.mnSurveyAssign == null) return 0;
long counter = 0;
try {
counter = Long.parseLong(String.valueOf(GlobalData.getSharedGlobalData().getCounterAssignment()));
} catch (Exception e) {
FireCrash.log(e);
// empty
}
return counter;
}
public static long getCounterVerificationTask(Context context) {
long counter = 0;
try {
counter = TaskHDataAccess.getVerificationTaskCounterByUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static long getCounterApprovalTask(Context context) {
long counter = 0;
try {
counter = TaskHDataAccess.getApprovalTaskCounterByUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
e.getMessage();
}
return counter;
}
public static long getCounterVerificationTaskByBranch(Context context) {
long counter = 0;
try {
counter = TaskHDataAccess.getVerificationTaskCounterByBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static long getCounterApprovalTaskByBranch(Context context) {
long counter = 0;
try {
counter = TaskHDataAccess.getApprovalTaskCounterByBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static long getCounterStatusTask(Context context) {
long counter = 0;
try {
counter = TaskHDataAccess.getTaskInStatusCounter(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static void addSurveyToList(SurveyHeaderBean bean, boolean removeOld) {
List<SurveyHeaderBean> tempList = new ArrayList<>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
if (removeOld) {
int idx = 0;
for (SurveyHeaderBean headerBean : getListOfSurveyStatus()) {
try {
if (bean.getTask_id().equals(headerBean.getTask_id())) {
getListOfSurveyStatus().remove(idx);
break;
}
} catch (Exception e) {
FireCrash.log(e);
}
idx++;
}
}
getListOfSurveyStatus().add(getListOfSurveyStatus().size(), bean);
tempList.addAll(getListOfSurveyStatus());
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static void refreshSurveyToList() {
List<SurveyHeaderBean> tempList = new ArrayList<SurveyHeaderBean>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
tempList.addAll(getListOfSurveyStatus());
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static void removeSurveyFromList(String taskId) {
List<SurveyHeaderBean> tempList = new ArrayList<SurveyHeaderBean>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
int idx = 0;
for (SurveyHeaderBean headerBean : getListOfSurveyStatus()) {
if (taskId.equals(headerBean.getTask_id())) {
getListOfSurveyStatus().remove(idx);
break;
}
idx++;
}
tempList.addAll(getListOfSurveyStatus());
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static void updateStatusSurvey(String taskId, String status, int imageLeft) {
List<SurveyHeaderBean> tempList = new ArrayList<SurveyHeaderBean>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
for (SurveyHeaderBean headerBean : getListOfSurveyStatus()) {
if (taskId.equals(headerBean.getTask_id())) {
headerBean.setStatus(status);
headerBean.setImageLeft(imageLeft);
}
tempList.add(headerBean);
}
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static void updatePrioritySurvey(String taskId, String priority) {
List<SurveyHeaderBean> tempList = new ArrayList<SurveyHeaderBean>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
int idx = 0;
for (SurveyHeaderBean headerBean : getListOfSurveyStatus()) {
if (taskId.equals(headerBean.getTask_id())) {
headerBean.setPriority(priority);
break;
}
idx++;
}
tempList.addAll(getListOfSurveyStatus());
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static void updateTaskIdStatusSurvey(String taskId, String newTaskID) {
List<SurveyHeaderBean> tempList = new ArrayList<>();
if (getListOfSurveyStatus() == null)
setListOfSurveyStatus(new ArrayList<SurveyHeaderBean>());
int idx = 0;
for (SurveyHeaderBean headerBean : getListOfSurveyStatus()) {
if (taskId.equals(headerBean.getTask_id())) {
headerBean.setTask_id(newTaskID);
break;
}
idx++;
}
tempList.addAll(getListOfSurveyStatus());
setListOfSurveyStatus(null);
setListOfSurveyStatus(tempList);
}
public static boolean isOldTask(TaskH h) {
return !(h.getStatus().equals(TaskHDataAccess.STATUS_SEND_INIT) ||
h.getStatus().equals(TaskHDataAccess.STATUS_TASK_APPROVAL) ||
h.getStatus().equals(TaskHDataAccess.STATUS_TASK_VERIFICATION));
}
public List<TaskH> getListTask(int searchType, String uuidScheme, int ptpPosition, String tenorFrom, String tenorTo, String osFrom, String osTo, String custName) {
ToDoList.searchType = searchType;
return listTask = TaskHDataAccess.getTaskByFilter(context, uuidScheme,searchType, ptpPosition, tenorFrom, tenorTo, osFrom, osTo, custName);
}
/**
* This method is used to get task list according to search by and search content.
* All task in this method will be shown if they have not been submitted or
* have not been downloaded yet from server or not new task.
*
* @param searchType
* @param searchContent
* @return
*/
public List<TaskH> getListTaskInStatus(int searchType, String searchContent) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
if (searchContent == null || "".equals(searchContent) || searchContent.length() == 0)
return listTask = TaskHDataAccess.getAllTaskInStatus(context, userId)
;
else if (searchType == SEARCH_BY_TASK_ID)
return listTask = TaskHDataAccess.getAllTaskInStatusByTask(context, userId, searchContent)
;
else if (searchType == SEARCH_BY_ALL)
return listTask = TaskHDataAccess.getAllTaskInStatusByAll(context, userId, searchContent)
;
else {
return listTask = TaskHDataAccess.getAllTaskInStatusByCustomer(context, userId, searchContent);
}
}
public List<TaskH> getListTaskInStatusForMultiUser(int searchType, String searchContent) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
if(searchContent==null || "".equals(searchContent) || searchContent.length()==0)
return listTask = TaskHDataAccess.getAllTaskInStatusForMultiUser(context)
;
else if(searchType==SEARCH_BY_TASK_ID)
return listTask = TaskHDataAccess.getAllTaskInStatusByTaskForMultiUser(context, searchContent)
;
else if(searchType==SEARCH_BY_ALL)
return listTask = TaskHDataAccess.getAllTaskInStatusByAllForMultiUser(context, searchContent)
;
else if(searchType==SEARCH_BY_ALL_SENT)
return listTask = TaskHDataAccess.getAllTaskSentByAllForMultiUser(context, searchContent)
;
else if(searchType==SEARCH_BY_BATCH_ID)
return listTask = TaskHDataAccess.getAllTaskInStatusByBatchIdForMultiUser(context, searchContent)
;
else{
return listTask = TaskHDataAccess.getAllTaskInStatusByCustomerForMultiUser(context, searchContent);
}
// return listTask;
}
/**
* This method is used to get task list according to search by and search content.
* All task in this method will be shown if they are new task or they have been downloaded from server.
*
* @param searchType
* @param searchContent
* @return
*/
public List<TaskH> getListTaskInPriority(int searchType, String searchContent) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
if (searchContent == null || "".equals(searchContent) || searchContent.length() == 0)
return listTask = TaskHDataAccess.getAllTaskInPriority(context, userId)
;
else if (searchType == SEARCH_BY_TASK_ID)
return listTask = TaskHDataAccess.getAllTaskInPriorityByTask(context, userId, searchContent)
;
else if (searchType == SEARCH_BY_ALL)
return listTask = TaskHDataAccess.getAllTaskInPriorityByAll(context, userId, searchContent)
;
else {
return listTask = TaskHDataAccess.getAllTaskInPriorityByCustomer(context, userId, searchContent);
}
}
public List<TaskH> getListTaskInPriority(int searchType, String searchContent, String uuidScheme) {
ToDoList.searchType = searchType;
ToDoList.searchContent = searchContent;
if (uuidScheme.equals(PriorityTabFragment.uuidSchemeDummy)) {
return listTask = TaskHDataAccess.getAllTaskInPriority(context, userId);
} else if (searchContent == null || "".equals(searchContent) || searchContent.length() == 0)
return listTask = TaskHDataAccess.getAllTaskInPriorityByScheme(context, userId, uuidScheme);
else if (searchType == SEARCH_BY_TASK_ID)
return listTask = TaskHDataAccess.getAllTaskInPriorityByTaskAndScheme(context, userId, searchContent, uuidScheme);
else if (searchType == SEARCH_BY_ALL)
return listTask = TaskHDataAccess.getAllTaskInPriorityByAllAndScheme(context, userId, searchContent, uuidScheme);
else {
return listTask = TaskHDataAccess.getAllTaskInPriorityByCustomerAndScheme(context, userId, searchContent, uuidScheme);
}
}
public List<TaskH> getListTaskInHighPriority() {
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInHighPriority(context, uuid_user);
}
public List<TaskH> getListTaskInNormalPriority() {
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInNormalPriority(context, uuid_user);
}
public List<TaskH> getListTaskInLowPriority() {
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInLowPriority(context, uuid_user);
}
public List<TaskH> getListTaskInHighPriority(String uuidSCheme) {
if (uuidSCheme.equals(PriorityTabFragment.uuidSchemeDummy)) {
return getListTaskInHighPriority();
}
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInHighPriorityByScheme(context, uuid_user, uuidSCheme);
}
public List<TaskH> getListTaskInNormalPriority(String uuidScheme) {
if (uuidScheme.equals(PriorityTabFragment.uuidSchemeDummy)) {
return getListTaskInNormalPriority();
}
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInNormalPriorityByScheme(context, uuid_user, uuidScheme);
}
public List<TaskH> getListTaskInLowPriority(String uuidScheme) {
if (uuidScheme.equals(PriorityTabFragment.uuidSchemeDummy)) {
return getListTaskInLowPriority();
}
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
return listTask = TaskHDataAccess.getAllTaskInLowPriorityByScheme(context, uuid_user, uuidScheme);
}
/**
* This method will redisplay all task list according to search by and search content.
*
* @param menuBar
* @return
*/
public List<TaskH> doRefresh(int menuBar) {
if (menuBar == TASK_LIST_PRIORITY)
return getListTaskInPriority(searchType, searchContent);
else if (menuBar == TASK_LIST_STATUS)
return getListTaskInStatus(searchType, searchContent);
else return listTask;
}
/**
* This method will get status from a spesific taskId.
*
* @param taskId
* @return
*/
public String getStatus(String taskId) {
String statusTask = null;
TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
statusTask = taskH.getStatus();
return statusTask;
}
public TaskH getOneTaskFromServer(Scheme scheme) {
RequestOneTaskBean rotb = new RequestOneTaskBean();
rotb.setSchemeId(scheme.getForm_id());
rotb.setAudit(GlobalData.getSharedGlobalData().getAuditData());
rotb.addImeiAndroidIdToUnstructured();
String json = GsonHelper.toJson(rotb);
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
HttpConnectionResult result = null;
//Firebase Performance Trace HTTP Request
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(GlobalData.getSharedGlobalData().getURL_GET_TASKLIST(), FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, json);
try {
result = httpConn.requestToServer(GlobalData.getSharedGlobalData().getURL_GET_TASKLIST(), json);
Utility.metricStop(networkMetric, result);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
if(result == null){
return null;
}
JsonOneTask jot = GsonHelper.fromJson(result.getResult(), JsonOneTask.class);
TaskHDataAccess.addOrReplace(context, jot.getOneTaskH());
return jot.getOneTaskH();
}
/**
* This method is used to retrieve list of TaskH from server
*
* @return
*/
public List<TaskH> getListTaskFromServer() {
RequestTaskListBean rtlb = new RequestTaskListBean();
rtlb.setUserId(userId);
rtlb.setAudit(GlobalData.getSharedGlobalData().getAuditData());
rtlb.addImeiAndroidIdToUnstructured();
// to JSON
String json = GsonHelper.toJson(rtlb);
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
HttpConnectionResult result = null;
//Firebase Performance Trace HTTP Request
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(GlobalData.getSharedGlobalData().getURL_GET_TASKLIST(), FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, json);
try {
result = httpConn.requestToServer(GlobalData.getSharedGlobalData().getURL_GET_TASKLIST(), json, Global.DEFAULTCONNECTIONTIMEOUT);
Utility.metricStop(networkMetric, result);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
if(result == null){
return new ArrayList<>();
}
JsonTaskList jtl = GsonHelper.fromJson(result.getResult(), JsonTaskList.class);
TaskHDataAccess.addOrReplace(context, jtl.getListTaskH());
return jtl.getListTaskH();
}
public long getCounterAllPriority() {
long counter = 0;
try {
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
counter = TaskHDataAccess.getTaskInPriorityCounter(context, uuidUser);
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public long getCounterHighPriority() {
long counter = 0;
try {
counter = getListTaskInHighPriority().size();
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public long getCounterNormalPriority() {
long counter = 0;
try {
counter = getListTaskInNormalPriority().size();
} catch (Exception e) {
FireCrash.log(e);
}
return counter;
}
public static List<SurveyHeaderBean> getListOfSurveyStatus() {
return listOfSurveyStatus;
}
public static void setListOfSurveyStatus(List<SurveyHeaderBean> listOfSurveyStatus) {
ToDoList.listOfSurveyStatus = listOfSurveyStatus;
}
}

View file

@ -0,0 +1,64 @@
package com.adins.mss.svy.tool;
import android.content.Context;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import java.util.List;
public class Constants {
public static final int START_DATE_DIALOG_ID=0;
public static final int END_DATE_DIALOG_ID=1;
public static final String KEY_START_DATE="start date";
public static final String KEY_END_DATE="end date";
public static final String KEY_DATE="date";
public static List<TaskH> listOfVerifiedTask;
public static List<TaskH> listOfApprovalTask;
public static long getCounterVerificationTask(Context context){
long counter=0;
try {
counter = TaskHDataAccess.getVerificationTaskCounterByUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
return counter;
}
public static long getCounterApprovalTask(Context context){
long counter=0;
try {
counter = TaskHDataAccess.getApprovalTaskCounterByUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
return counter;
}
public static long getCounterVerificationTaskByBranch(Context context){
long counter=0;
try {
counter = TaskHDataAccess.getVerificationTaskCounterByBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
return counter;
}
public static long getCounterApprovalTaskByBranch(Context context){
long counter=0;
try {
counter = TaskHDataAccess.getApprovalTaskCounterByBranch(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
return counter;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B