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,160 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,346 @@
|
|||
package com.adins.libs.nineoldandroids.view.animation;
|
||||
|
||||
import android.graphics.Camera;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Transformation;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* A proxy class to allow for modifying post-3.0 view properties on all pre-3.0
|
||||
* platforms. <strong>DO NOT</strong> wrap your views with this class if you
|
||||
* are using {@code ObjectAnimator} as it will handle that itself.
|
||||
*/
|
||||
public final class AnimatorProxy extends Animation {
|
||||
/**
|
||||
* Whether or not the current running platform needs to be proxied.
|
||||
*/
|
||||
public static final boolean NEEDS_PROXY = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
|
||||
|
||||
private static final WeakHashMap<View, AnimatorProxy> PROXIES =
|
||||
new WeakHashMap<View, AnimatorProxy>();
|
||||
private final WeakReference<View> mView;
|
||||
private final Camera mCamera = new Camera();
|
||||
private final RectF mBefore = new RectF();
|
||||
private final RectF mAfter = new RectF();
|
||||
private final Matrix mTempMatrix = new Matrix();
|
||||
private boolean mHasPivot;
|
||||
private float mAlpha = 1;
|
||||
private float mPivotX;
|
||||
private float mPivotY;
|
||||
private float mRotationX;
|
||||
private float mRotationY;
|
||||
private float mRotationZ;
|
||||
private float mScaleX = 1;
|
||||
private float mScaleY = 1;
|
||||
private float mTranslationX;
|
||||
private float mTranslationY;
|
||||
private AnimatorProxy(View view) {
|
||||
setDuration(0); //perform transformation immediately
|
||||
setFillAfter(true); //persist transformation beyond duration
|
||||
view.setAnimation(this);
|
||||
mView = new WeakReference<View>(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a proxy to allow for modifying post-3.0 view properties on all
|
||||
* pre-3.0 platforms. <strong>DO NOT</strong> wrap your views if you are
|
||||
* using {@code ObjectAnimator} as it will handle that itself.
|
||||
*
|
||||
* @param view View to wrap.
|
||||
* @return Proxy to post-3.0 properties.
|
||||
*/
|
||||
public static AnimatorProxy wrap(View view) {
|
||||
AnimatorProxy proxy = PROXIES.get(view);
|
||||
// This checks if the proxy already exists and whether it still is the animation of the given view
|
||||
if (proxy == null || proxy != view.getAnimation()) {
|
||||
proxy = new AnimatorProxy(view);
|
||||
PROXIES.put(view, proxy);
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return mAlpha;
|
||||
}
|
||||
|
||||
public void setAlpha(float alpha) {
|
||||
if (mAlpha != alpha) {
|
||||
mAlpha = alpha;
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
view.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getPivotX() {
|
||||
return mPivotX;
|
||||
}
|
||||
|
||||
public void setPivotX(float pivotX) {
|
||||
if (!mHasPivot || mPivotX != pivotX) {
|
||||
prepareForUpdate();
|
||||
mHasPivot = true;
|
||||
mPivotX = pivotX;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getPivotY() {
|
||||
return mPivotY;
|
||||
}
|
||||
|
||||
public void setPivotY(float pivotY) {
|
||||
if (!mHasPivot || mPivotY != pivotY) {
|
||||
prepareForUpdate();
|
||||
mHasPivot = true;
|
||||
mPivotY = pivotY;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getRotation() {
|
||||
return mRotationZ;
|
||||
}
|
||||
|
||||
public void setRotation(float rotation) {
|
||||
if (mRotationZ != rotation) {
|
||||
prepareForUpdate();
|
||||
mRotationZ = rotation;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getRotationX() {
|
||||
return mRotationX;
|
||||
}
|
||||
|
||||
public void setRotationX(float rotationX) {
|
||||
if (mRotationX != rotationX) {
|
||||
prepareForUpdate();
|
||||
mRotationX = rotationX;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getRotationY() {
|
||||
return mRotationY;
|
||||
}
|
||||
|
||||
public void setRotationY(float rotationY) {
|
||||
if (mRotationY != rotationY) {
|
||||
prepareForUpdate();
|
||||
mRotationY = rotationY;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getScaleX() {
|
||||
return mScaleX;
|
||||
}
|
||||
|
||||
public void setScaleX(float scaleX) {
|
||||
if (mScaleX != scaleX) {
|
||||
prepareForUpdate();
|
||||
mScaleX = scaleX;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getScaleY() {
|
||||
return mScaleY;
|
||||
}
|
||||
|
||||
public void setScaleY(float scaleY) {
|
||||
if (mScaleY != scaleY) {
|
||||
prepareForUpdate();
|
||||
mScaleY = scaleY;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public int getScrollX() {
|
||||
View view = mView.get();
|
||||
if (view == null) {
|
||||
return 0;
|
||||
}
|
||||
return view.getScrollX();
|
||||
}
|
||||
|
||||
public void setScrollX(int value) {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
view.scrollTo(value, view.getScrollY());
|
||||
}
|
||||
}
|
||||
|
||||
public int getScrollY() {
|
||||
View view = mView.get();
|
||||
if (view == null) {
|
||||
return 0;
|
||||
}
|
||||
return view.getScrollY();
|
||||
}
|
||||
|
||||
public void setScrollY(int value) {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
view.scrollTo(view.getScrollX(), value);
|
||||
}
|
||||
}
|
||||
|
||||
public float getTranslationX() {
|
||||
return mTranslationX;
|
||||
}
|
||||
|
||||
public void setTranslationX(float translationX) {
|
||||
if (mTranslationX != translationX) {
|
||||
prepareForUpdate();
|
||||
mTranslationX = translationX;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getTranslationY() {
|
||||
return mTranslationY;
|
||||
}
|
||||
|
||||
public void setTranslationY(float translationY) {
|
||||
if (mTranslationY != translationY) {
|
||||
prepareForUpdate();
|
||||
mTranslationY = translationY;
|
||||
invalidateAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
View view = mView.get();
|
||||
if (view == null) {
|
||||
return 0;
|
||||
}
|
||||
return view.getLeft() + mTranslationX;
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
setTranslationX(x - view.getLeft());
|
||||
}
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
View view = mView.get();
|
||||
if (view == null) {
|
||||
return 0;
|
||||
}
|
||||
return view.getTop() + mTranslationY;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
setTranslationY(y - view.getTop());
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareForUpdate() {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
computeRect(mBefore, view);
|
||||
}
|
||||
}
|
||||
|
||||
private void invalidateAfterUpdate() {
|
||||
View view = mView.get();
|
||||
if (view == null || view.getParent() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final RectF after = mAfter;
|
||||
computeRect(after, view);
|
||||
after.union(mBefore);
|
||||
|
||||
((View) view.getParent()).invalidate(
|
||||
(int) Math.floor(after.left),
|
||||
(int) Math.floor(after.top),
|
||||
(int) Math.ceil(after.right),
|
||||
(int) Math.ceil(after.bottom));
|
||||
}
|
||||
|
||||
private void computeRect(final RectF r, View view) {
|
||||
// compute current rectangle according to matrix transformation
|
||||
final float w = view.getWidth();
|
||||
final float h = view.getHeight();
|
||||
|
||||
// use a rectangle at 0,0 to make sure we don't run into issues with scaling
|
||||
r.set(0, 0, w, h);
|
||||
|
||||
final Matrix m = mTempMatrix;
|
||||
m.reset();
|
||||
transformMatrix(m, view);
|
||||
mTempMatrix.mapRect(r);
|
||||
|
||||
r.offset(view.getLeft(), view.getTop());
|
||||
|
||||
// Straighten coords if rotations flipped them
|
||||
if (r.right < r.left) {
|
||||
final float f = r.right;
|
||||
r.right = r.left;
|
||||
r.left = f;
|
||||
}
|
||||
if (r.bottom < r.top) {
|
||||
final float f = r.top;
|
||||
r.top = r.bottom;
|
||||
r.bottom = f;
|
||||
}
|
||||
}
|
||||
|
||||
private void transformMatrix(Matrix m, View view) {
|
||||
final float w = view.getWidth();
|
||||
final float h = view.getHeight();
|
||||
final boolean hasPivot = mHasPivot;
|
||||
final float pX = hasPivot ? mPivotX : w / 2f;
|
||||
final float pY = hasPivot ? mPivotY : h / 2f;
|
||||
|
||||
final float rX = mRotationX;
|
||||
final float rY = mRotationY;
|
||||
final float rZ = mRotationZ;
|
||||
if ((rX != 0) || (rY != 0) || (rZ != 0)) {
|
||||
final Camera camera = mCamera;
|
||||
camera.save();
|
||||
camera.rotateX(rX);
|
||||
camera.rotateY(rY);
|
||||
camera.rotateZ(-rZ);
|
||||
camera.getMatrix(m);
|
||||
camera.restore();
|
||||
m.preTranslate(-pX, -pY);
|
||||
m.postTranslate(pX, pY);
|
||||
}
|
||||
|
||||
final float sX = mScaleX;
|
||||
final float sY = mScaleY;
|
||||
if ((sX != 1.0f) || (sY != 1.0f)) {
|
||||
m.postScale(sX, sY);
|
||||
final float sPX = -(pX / w) * ((sX * w) - w);
|
||||
final float sPY = -(pY / h) * ((sY * h) - h);
|
||||
m.postTranslate(sPX, sPY);
|
||||
}
|
||||
|
||||
m.postTranslate(mTranslationX, mTranslationY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
t.setAlpha(mAlpha);
|
||||
transformMatrix(t.getMatrix(), view);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package com.adins.mss.base.loyalti.monthlypointacquisition;
|
||||
|
||||
import com.adins.mss.base.loyalti.model.GroupPointData;
|
||||
import com.adins.mss.base.loyalti.model.LoyaltyPointsRequest;
|
||||
import com.adins.mss.base.loyalti.monthlypointacquisition.contract.ILoyaltyPointsDataSource;
|
||||
import com.adins.mss.constant.Global;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class MonthlyPointsLogic {
|
||||
private ILoyaltyPointsDataSource dataSource;
|
||||
private String competitionStartDate;
|
||||
private int displayYear;
|
||||
|
||||
public MonthlyPointsLogic(ILoyaltyPointsDataSource dataSource, String competitionStartDate, int displayYear) {
|
||||
this.dataSource = dataSource;
|
||||
this.competitionStartDate = competitionStartDate;
|
||||
this.displayYear = displayYear;
|
||||
}
|
||||
|
||||
public MonthlyPointsLogic(ILoyaltyPointsDataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
public void getMonthlyPointsData(LoyaltyPointsRequest reqData, ILoyaltyPointsDataSource.ReqPointsListener listener){
|
||||
dataSource.requestPointsData(reqData,listener);
|
||||
}
|
||||
|
||||
public int getTotalPoints(List<GroupPointData> dataSet){
|
||||
if(dataSet == null)
|
||||
return 0;
|
||||
int totalPoints = 0;
|
||||
int[] totalPerIdx = new int[dataSet.size()];
|
||||
int sum = 0;
|
||||
for(int i=0; i<totalPerIdx.length; i++){
|
||||
sum = 0;
|
||||
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||
int point = Integer.parseInt(dataSet.get(i).pointDetails.get(stack).point);
|
||||
sum += point;
|
||||
}
|
||||
totalPerIdx[i] = sum;
|
||||
totalPoints += totalPerIdx[i];
|
||||
}
|
||||
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
public float getAvgPoint(List<GroupPointData> dataSet){
|
||||
if(dataSet == null)
|
||||
return 0;
|
||||
float totalPoints = 0;
|
||||
int avg = 0;
|
||||
int[] totalPerIdx = new int[dataSet.size()];
|
||||
int sum = 0;
|
||||
for(int i=0; i<totalPerIdx.length; i++){
|
||||
sum = 0;
|
||||
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||
int point = Integer.parseInt(dataSet.get(i).pointDetails.get(stack).point);
|
||||
sum += point;
|
||||
}
|
||||
totalPerIdx[i] = sum;
|
||||
totalPoints += totalPerIdx[i];
|
||||
}
|
||||
|
||||
int divideMonths = getTotalMonthsYear();
|
||||
avg = Math.round(totalPoints/divideMonths);
|
||||
return avg;
|
||||
}
|
||||
|
||||
private int getTotalMonthsYear(){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
//current date
|
||||
calendar.setTime(new Date());
|
||||
int currMonth = calendar.get(Calendar.MONTH);
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
|
||||
int maxMonths = 0;
|
||||
//tentukan bulan maksimum
|
||||
if(currYear == displayYear){
|
||||
//tahun berjalan
|
||||
maxMonths = currMonth;
|
||||
}else {
|
||||
//sudah lewat
|
||||
calendar.set(Calendar.YEAR,displayYear);
|
||||
maxMonths = calendar.getActualMaximum(Calendar.MONTH);
|
||||
}
|
||||
|
||||
//competition start date
|
||||
DateFormat dateFormat = new SimpleDateFormat(Global.DATE_STR_FORMAT1);
|
||||
Date startCompDate = null;
|
||||
try {
|
||||
startCompDate = dateFormat.parse(competitionStartDate);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(startCompDate == null)
|
||||
return 1;
|
||||
|
||||
calendar.setTime(startCompDate);
|
||||
int cYear = calendar.get(Calendar.YEAR);
|
||||
int cMonth = calendar.get(Calendar.MONTH);
|
||||
|
||||
//hitung bulan maksimum berdasarkan tanggal kompetisi mulai
|
||||
if(displayYear == cYear){
|
||||
maxMonths = (maxMonths - cMonth) + 1;
|
||||
}
|
||||
|
||||
return maxMonths;
|
||||
}
|
||||
|
||||
public int getMaxPoint(List<GroupPointData> dataSet){
|
||||
if(dataSet == null)
|
||||
return 0;
|
||||
|
||||
int max = 0;
|
||||
int[] totalPerIdx = new int[dataSet.size()];
|
||||
int sum = 0;
|
||||
for(int i=0; i<totalPerIdx.length; i++){
|
||||
sum = 0;
|
||||
for (int stack=0; stack<dataSet.get(i).pointDetails.size(); stack++){
|
||||
int point = Integer.parseInt(dataSet.get(i).pointDetails.get(stack).point);
|
||||
sum += point;
|
||||
}
|
||||
totalPerIdx[i] = sum;
|
||||
}
|
||||
|
||||
Arrays.sort(totalPerIdx);
|
||||
max = totalPerIdx[totalPerIdx.length -1];
|
||||
return max;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,301 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import java.util.List;
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import de.greenrobot.dao.DaoException;
|
||||
|
||||
import com.adins.mss.base.util.ExcludeFromGson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
|
||||
/**
|
||||
* Entity mapped to table "TR_MOBILECONTENT_H".
|
||||
*/
|
||||
public class MobileContentH {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_mobile_content_h")
|
||||
private String uuid_mobile_content_h;
|
||||
@SerializedName("content_name")
|
||||
private String content_name;
|
||||
@SerializedName("last_update")
|
||||
private java.util.Date last_update;
|
||||
@SerializedName("content_description")
|
||||
private String content_description;
|
||||
@SerializedName("usr_crt")
|
||||
private String usr_crt;
|
||||
@SerializedName("dtm_crt")
|
||||
private java.util.Date dtm_crt;
|
||||
@SerializedName("usr_upd")
|
||||
private String usr_upd;
|
||||
@SerializedName("dtm_upd")
|
||||
private java.util.Date dtm_upd;
|
||||
@SerializedName("uuid_user")
|
||||
private String uuid_user;
|
||||
@SerializedName("uuid_parent_content")
|
||||
private String uuid_parent_content;
|
||||
@SerializedName("start_date")
|
||||
private java.util.Date start_date;
|
||||
@SerializedName("end_date")
|
||||
private java.util.Date end_date;
|
||||
|
||||
/** Used to resolve relations */
|
||||
private transient DaoSession daoSession;
|
||||
|
||||
/** Used for active entity operations. */
|
||||
private transient MobileContentHDao myDao;
|
||||
|
||||
private MobileContentH mobileContentH;
|
||||
private String mobileContentH__resolvedKey;
|
||||
|
||||
private User user;
|
||||
private String user__resolvedKey;
|
||||
|
||||
private List<MobileContentD> mobileContentDList;
|
||||
private List<MobileContentH> mobileContentHList;
|
||||
|
||||
public MobileContentH() {
|
||||
}
|
||||
|
||||
public MobileContentH(String uuid_mobile_content_h) {
|
||||
this.uuid_mobile_content_h = uuid_mobile_content_h;
|
||||
}
|
||||
|
||||
public MobileContentH(String uuid_mobile_content_h, String content_name, java.util.Date last_update, String content_description, String usr_crt, java.util.Date dtm_crt, String usr_upd, java.util.Date dtm_upd, String uuid_user, String uuid_parent_content, java.util.Date start_date, java.util.Date end_date) {
|
||||
this.uuid_mobile_content_h = uuid_mobile_content_h;
|
||||
this.content_name = content_name;
|
||||
this.last_update = last_update;
|
||||
this.content_description = content_description;
|
||||
this.usr_crt = usr_crt;
|
||||
this.dtm_crt = dtm_crt;
|
||||
this.usr_upd = usr_upd;
|
||||
this.dtm_upd = dtm_upd;
|
||||
this.uuid_user = uuid_user;
|
||||
this.uuid_parent_content = uuid_parent_content;
|
||||
this.start_date = start_date;
|
||||
this.end_date = end_date;
|
||||
}
|
||||
|
||||
/** called by internal mechanisms, do not call yourself. */
|
||||
public void __setDaoSession(DaoSession daoSession) {
|
||||
this.daoSession = daoSession;
|
||||
myDao = daoSession != null ? daoSession.getMobileContentHDao() : null;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_mobile_content_h() {
|
||||
return uuid_mobile_content_h;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_mobile_content_h(String uuid_mobile_content_h) {
|
||||
this.uuid_mobile_content_h = uuid_mobile_content_h;
|
||||
}
|
||||
|
||||
public String getContent_name() {
|
||||
return content_name;
|
||||
}
|
||||
|
||||
public void setContent_name(String content_name) {
|
||||
this.content_name = content_name;
|
||||
}
|
||||
|
||||
public java.util.Date getLast_update() {
|
||||
return last_update;
|
||||
}
|
||||
|
||||
public void setLast_update(java.util.Date last_update) {
|
||||
this.last_update = last_update;
|
||||
}
|
||||
|
||||
public String getContent_description() {
|
||||
return content_description;
|
||||
}
|
||||
|
||||
public void setContent_description(String content_description) {
|
||||
this.content_description = content_description;
|
||||
}
|
||||
|
||||
public String getUsr_crt() {
|
||||
return usr_crt;
|
||||
}
|
||||
|
||||
public void setUsr_crt(String usr_crt) {
|
||||
this.usr_crt = usr_crt;
|
||||
}
|
||||
|
||||
public java.util.Date getDtm_crt() {
|
||||
return dtm_crt;
|
||||
}
|
||||
|
||||
public void setDtm_crt(java.util.Date dtm_crt) {
|
||||
this.dtm_crt = dtm_crt;
|
||||
}
|
||||
|
||||
public String getUsr_upd() {
|
||||
return usr_upd;
|
||||
}
|
||||
|
||||
public void setUsr_upd(String usr_upd) {
|
||||
this.usr_upd = usr_upd;
|
||||
}
|
||||
|
||||
public java.util.Date getDtm_upd() {
|
||||
return dtm_upd;
|
||||
}
|
||||
|
||||
public void setDtm_upd(java.util.Date dtm_upd) {
|
||||
this.dtm_upd = dtm_upd;
|
||||
}
|
||||
|
||||
public String getUuid_user() {
|
||||
return uuid_user;
|
||||
}
|
||||
|
||||
public void setUuid_user(String uuid_user) {
|
||||
this.uuid_user = uuid_user;
|
||||
}
|
||||
|
||||
public String getUuid_parent_content() {
|
||||
return uuid_parent_content;
|
||||
}
|
||||
|
||||
public void setUuid_parent_content(String uuid_parent_content) {
|
||||
this.uuid_parent_content = uuid_parent_content;
|
||||
}
|
||||
|
||||
public java.util.Date getStart_date() {
|
||||
return start_date;
|
||||
}
|
||||
|
||||
public void setStart_date(java.util.Date start_date) {
|
||||
this.start_date = start_date;
|
||||
}
|
||||
|
||||
public java.util.Date getEnd_date() {
|
||||
return end_date;
|
||||
}
|
||||
|
||||
public void setEnd_date(java.util.Date end_date) {
|
||||
this.end_date = end_date;
|
||||
}
|
||||
|
||||
/** To-one relationship, resolved on first access. */
|
||||
public MobileContentH getMobileContentH() {
|
||||
String __key = this.uuid_parent_content;
|
||||
if (mobileContentH__resolvedKey == null || mobileContentH__resolvedKey != __key) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
MobileContentHDao targetDao = daoSession.getMobileContentHDao();
|
||||
MobileContentH mobileContentHNew = targetDao.load(__key);
|
||||
synchronized (this) {
|
||||
mobileContentH = mobileContentHNew;
|
||||
mobileContentH__resolvedKey = __key;
|
||||
}
|
||||
}
|
||||
return mobileContentH;
|
||||
}
|
||||
|
||||
public void setMobileContentH(MobileContentH mobileContentH) {
|
||||
synchronized (this) {
|
||||
this.mobileContentH = mobileContentH;
|
||||
uuid_parent_content = mobileContentH == null ? null : mobileContentH.getUuid_mobile_content_h();
|
||||
mobileContentH__resolvedKey = uuid_parent_content;
|
||||
}
|
||||
}
|
||||
|
||||
/** To-one relationship, resolved on first access. */
|
||||
public User getUser() {
|
||||
String __key = this.uuid_user;
|
||||
if (user__resolvedKey == null || user__resolvedKey != __key) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
UserDao targetDao = daoSession.getUserDao();
|
||||
User userNew = targetDao.load(__key);
|
||||
synchronized (this) {
|
||||
user = userNew;
|
||||
user__resolvedKey = __key;
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
synchronized (this) {
|
||||
this.user = user;
|
||||
uuid_user = user == null ? null : user.getUuid_user();
|
||||
user__resolvedKey = uuid_user;
|
||||
}
|
||||
}
|
||||
|
||||
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
|
||||
public List<MobileContentD> getMobileContentDList() {
|
||||
if (mobileContentDList == null) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
MobileContentDDao targetDao = daoSession.getMobileContentDDao();
|
||||
List<MobileContentD> mobileContentDListNew = targetDao._queryMobileContentH_MobileContentDList(uuid_mobile_content_h);
|
||||
synchronized (this) {
|
||||
if(mobileContentDList == null) {
|
||||
mobileContentDList = mobileContentDListNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobileContentDList;
|
||||
}
|
||||
|
||||
/** Resets a to-many relationship, making the next get call to query for a fresh result. */
|
||||
public synchronized void resetMobileContentDList() {
|
||||
mobileContentDList = null;
|
||||
}
|
||||
|
||||
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
|
||||
public List<MobileContentH> getMobileContentHList() {
|
||||
if (mobileContentHList == null) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
MobileContentHDao targetDao = daoSession.getMobileContentHDao();
|
||||
List<MobileContentH> mobileContentHListNew = targetDao._queryMobileContentH_MobileContentHList(uuid_mobile_content_h);
|
||||
synchronized (this) {
|
||||
if(mobileContentHList == null) {
|
||||
mobileContentHList = mobileContentHListNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobileContentHList;
|
||||
}
|
||||
|
||||
/** Resets a to-many relationship, making the next get call to query for a fresh result. */
|
||||
public synchronized void resetMobileContentHList() {
|
||||
mobileContentHList = null;
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.update(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.refresh(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* This source is part of the
|
||||
* _____ ___ ____
|
||||
* __ / / _ \/ _ | / __/___ _______ _
|
||||
* / // / , _/ __ |/ _/_/ _ \/ __/ _ `/
|
||||
* \___/_/|_/_/ |_/_/ (_)___/_/ \_, /
|
||||
* /___/
|
||||
* repository.
|
||||
*
|
||||
* Copyright (C) 2013 Benoit 'BoD' Lubek (BoD@JRAF.org)
|
||||
* Copyright (C) 2006 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 org.acra.jraf.android.util.activitylifecyclecallbackscompat;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* This adapter class provides empty implementations of the methods from {@link ActivityLifecycleCallbacksCompat}.
|
||||
* Any custom listener that cares only about a subset of the methods of this listener can simply subclass this
|
||||
* adapter class instead of implementing the interface directly.
|
||||
*/
|
||||
public class ActivityLifecycleCallbacksAdapter implements ActivityLifecycleCallbacksCompat {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import de.greenrobot.dao.DaoException;
|
||||
|
||||
import com.adins.mss.base.util.ExcludeFromGson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
|
||||
/**
|
||||
* Entity mapped to table "MS_KOMPETISI".
|
||||
*/
|
||||
public class Kompetisi {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_kompetisi")
|
||||
private String uuid_kompetisi;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_CODE")
|
||||
private String membershipProgramCode;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_NAME")
|
||||
private String membershipProgramName;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_PRIORITY")
|
||||
private String membershipProgramPriorityCode;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_STATUS")
|
||||
private String membershipProgramStatus;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_EXPIRED_DATE")
|
||||
private String membershipProgramExpiredDate;
|
||||
@SerializedName("MEMBERSHIP_PROGRAM_START_DATE")
|
||||
private String membershipProgramStartDate;
|
||||
@SerializedName("GRACE_PERIODE")
|
||||
private String gracePeriode;
|
||||
@SerializedName("LOGO")
|
||||
private String membershipProgramLogo;
|
||||
@SerializedName("uuid_user")
|
||||
private String uuid_user;
|
||||
|
||||
/** Used to resolve relations */
|
||||
private transient DaoSession daoSession;
|
||||
|
||||
/** Used for active entity operations. */
|
||||
private transient KompetisiDao myDao;
|
||||
|
||||
private User user;
|
||||
private String user__resolvedKey;
|
||||
|
||||
|
||||
public Kompetisi() {
|
||||
}
|
||||
|
||||
public Kompetisi(String uuid_kompetisi) {
|
||||
this.uuid_kompetisi = uuid_kompetisi;
|
||||
}
|
||||
|
||||
public Kompetisi(String uuid_kompetisi, String membershipProgramCode, String membershipProgramName, String membershipProgramPriorityCode, String membershipProgramStatus, String membershipProgramExpiredDate, String membershipProgramStartDate, String gracePeriode, String membershipProgramLogo, String uuid_user) {
|
||||
this.uuid_kompetisi = uuid_kompetisi;
|
||||
this.membershipProgramCode = membershipProgramCode;
|
||||
this.membershipProgramName = membershipProgramName;
|
||||
this.membershipProgramPriorityCode = membershipProgramPriorityCode;
|
||||
this.membershipProgramStatus = membershipProgramStatus;
|
||||
this.membershipProgramExpiredDate = membershipProgramExpiredDate;
|
||||
this.membershipProgramStartDate = membershipProgramStartDate;
|
||||
this.gracePeriode = gracePeriode;
|
||||
this.membershipProgramLogo = membershipProgramLogo;
|
||||
this.uuid_user = uuid_user;
|
||||
}
|
||||
|
||||
/** called by internal mechanisms, do not call yourself. */
|
||||
public void __setDaoSession(DaoSession daoSession) {
|
||||
this.daoSession = daoSession;
|
||||
myDao = daoSession != null ? daoSession.getKompetisiDao() : null;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_kompetisi() {
|
||||
return uuid_kompetisi;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_kompetisi(String uuid_kompetisi) {
|
||||
this.uuid_kompetisi = uuid_kompetisi;
|
||||
}
|
||||
|
||||
public String getMembershipProgramCode() {
|
||||
return membershipProgramCode;
|
||||
}
|
||||
|
||||
public void setMembershipProgramCode(String membershipProgramCode) {
|
||||
this.membershipProgramCode = membershipProgramCode;
|
||||
}
|
||||
|
||||
public String getMembershipProgramName() {
|
||||
return membershipProgramName;
|
||||
}
|
||||
|
||||
public void setMembershipProgramName(String membershipProgramName) {
|
||||
this.membershipProgramName = membershipProgramName;
|
||||
}
|
||||
|
||||
public String getMembershipProgramPriorityCode() {
|
||||
return membershipProgramPriorityCode;
|
||||
}
|
||||
|
||||
public void setMembershipProgramPriorityCode(String membershipProgramPriorityCode) {
|
||||
this.membershipProgramPriorityCode = membershipProgramPriorityCode;
|
||||
}
|
||||
|
||||
public String getMembershipProgramStatus() {
|
||||
return membershipProgramStatus;
|
||||
}
|
||||
|
||||
public void setMembershipProgramStatus(String membershipProgramStatus) {
|
||||
this.membershipProgramStatus = membershipProgramStatus;
|
||||
}
|
||||
|
||||
public String getMembershipProgramExpiredDate() {
|
||||
return membershipProgramExpiredDate;
|
||||
}
|
||||
|
||||
public void setMembershipProgramExpiredDate(String membershipProgramExpiredDate) {
|
||||
this.membershipProgramExpiredDate = membershipProgramExpiredDate;
|
||||
}
|
||||
|
||||
public String getMembershipProgramStartDate() {
|
||||
return membershipProgramStartDate;
|
||||
}
|
||||
|
||||
public void setMembershipProgramStartDate(String membershipProgramStartDate) {
|
||||
this.membershipProgramStartDate = membershipProgramStartDate;
|
||||
}
|
||||
|
||||
public String getGracePeriode() {
|
||||
return gracePeriode;
|
||||
}
|
||||
|
||||
public void setGracePeriode(String gracePeriode) {
|
||||
this.gracePeriode = gracePeriode;
|
||||
}
|
||||
|
||||
public String getMembershipProgramLogo() {
|
||||
return membershipProgramLogo;
|
||||
}
|
||||
|
||||
public void setMembershipProgramLogo(String membershipProgramLogo) {
|
||||
this.membershipProgramLogo = membershipProgramLogo;
|
||||
}
|
||||
|
||||
public String getUuid_user() {
|
||||
return uuid_user;
|
||||
}
|
||||
|
||||
public void setUuid_user(String uuid_user) {
|
||||
this.uuid_user = uuid_user;
|
||||
}
|
||||
|
||||
/** To-one relationship, resolved on first access. */
|
||||
public User getUser() {
|
||||
String __key = this.uuid_user;
|
||||
if (user__resolvedKey == null || user__resolvedKey != __key) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
UserDao targetDao = daoSession.getUserDao();
|
||||
User userNew = targetDao.load(__key);
|
||||
synchronized (this) {
|
||||
user = userNew;
|
||||
user__resolvedKey = __key;
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
synchronized (this) {
|
||||
this.user = user;
|
||||
uuid_user = user == null ? null : user.getUuid_user();
|
||||
user__resolvedKey = uuid_user;
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.update(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.refresh(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.DigitalReceiptQuestionViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.QuestionGroupViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ReviewImageViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ReviewLookupDukcapilViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ReviewLookupViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ReviewLuOnlineQuestionViewHolder;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ReviewTextViewHolder;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter.IsRvMobileQuestion;
|
||||
import static com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter.isTextOnlineQuestion;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 06/09/2016.
|
||||
*/
|
||||
public class QuestionReviewAdapter extends ExpandableRecyclerView.Adapter<RecyclerView.ViewHolder, QuestionGroupViewHolder, QuestionBean, String> {
|
||||
private static final int FADE_DURATION = 300; // in milliseconds
|
||||
private final LinkedHashMap<String, List<QuestionBean>> mValues;
|
||||
private final List<String> mGroups;
|
||||
private final FragmentActivity mActivity;
|
||||
private final int VIEW_TYPE_LOADING = 999;
|
||||
public ScrollingLinearLayoutManager linearLayoutManager;
|
||||
public ExpandableRecyclerView mRecyclerView;
|
||||
private OnQuestionClickListener mListener;
|
||||
|
||||
public QuestionReviewAdapter(FragmentActivity activity, ExpandableRecyclerView recyclerView, List<String> groups, LinkedHashMap<String, List<QuestionBean>> items, OnQuestionClickListener listener) {
|
||||
mActivity = activity;
|
||||
mValues = items;
|
||||
mListener = listener;
|
||||
mGroups = groups;
|
||||
mRecyclerView = recyclerView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupItemCount() {
|
||||
return mGroups.size() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildItemCount(int group) {
|
||||
return mValues.get(mGroups.get(group)).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupItem(int position) {
|
||||
return mGroups.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestionBean getChildItem(int group, int position) {
|
||||
return mValues.get(getGroupItem(group)).get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QuestionGroupViewHolder onCreateGroupViewHolder(ViewGroup parent) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_group_layout, parent, false);
|
||||
return new QuestionGroupViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindGroupViewHolder(QuestionGroupViewHolder holder, int group) {
|
||||
super.onBindGroupViewHolder(holder, group);
|
||||
String qGroup = "";
|
||||
try {
|
||||
qGroup = getGroupItem(group);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
|
||||
holder.bind(qGroup);
|
||||
setFadeAnimation(holder.itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.ViewHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
|
||||
if (QuestionViewAdapter.IsTextQuestion(viewType) || isTextOnlineQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsDropdownQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsMultipleQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsImageQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_image_layout, parent, false);
|
||||
return new ReviewImageViewHolder(view, mActivity, mListener);
|
||||
} else if (QuestionViewAdapter.IsRadioQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsLocationQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsDrawingQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_image_layout, parent, false);
|
||||
return new ReviewImageViewHolder(view, mActivity, mListener);
|
||||
} else if (QuestionViewAdapter.IsDateTimeQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsTextWithSuggestionQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
} else if (QuestionViewAdapter.IsLookupQuestion(viewType)) {
|
||||
if(Integer.parseInt(Global.AT_LOOKUP_DUKCAPIL) == viewType){
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_review_lookup_dukcapil_layout, parent, false);
|
||||
return new ReviewLookupDukcapilViewHolder(view, mActivity, mListener);
|
||||
}else{
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_question_review_lookup_layout, parent, false);
|
||||
return new ReviewLookupViewHolder(view, mActivity, mListener);
|
||||
}
|
||||
} else if (QuestionViewAdapter.IsValidationQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(view, mListener);
|
||||
} else if (QuestionViewAdapter.IsRvMobileQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(view, mListener);
|
||||
} else if (QuestionViewAdapter.IsLuOnlineQuestion(viewType)) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_review_lu_online_layout, parent, false);
|
||||
return new ReviewLuOnlineQuestionViewHolder(view, mActivity, mListener);
|
||||
} else if(QuestionViewAdapter.IsButtonViewUrlQuestion(viewType)){
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_review_text_layout, parent, false);
|
||||
return new ReviewTextViewHolder(mActivity, view, mListener);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildItemViewType(int group, int position) {
|
||||
int viewType = Integer.valueOf(getChildItem(group, position).getAnswer_type());
|
||||
return getChildItem(group, position) == null ? VIEW_TYPE_LOADING : viewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindChildViewHolder(RecyclerView.ViewHolder mHolder, int group, int position) {
|
||||
super.onBindChildViewHolder(mHolder, group, position);
|
||||
if (mHolder instanceof ReviewTextViewHolder) {
|
||||
final ReviewTextViewHolder holder = (ReviewTextViewHolder) mHolder;
|
||||
holder.bind(getChildItem(group, position), group, position + 1);
|
||||
} else if (mHolder instanceof ReviewImageViewHolder) {
|
||||
final ReviewImageViewHolder holder = (ReviewImageViewHolder) mHolder;
|
||||
holder.bind(getChildItem(group, position), group, position + 1);
|
||||
} else if (mHolder instanceof ReviewLookupViewHolder) {
|
||||
final ReviewLookupViewHolder holder = (ReviewLookupViewHolder) mHolder;
|
||||
holder.bind(getChildItem(group, position), group, position + 1);
|
||||
} else if (mHolder instanceof ReviewLuOnlineQuestionViewHolder) {
|
||||
final ReviewLuOnlineQuestionViewHolder holder = (ReviewLuOnlineQuestionViewHolder) mHolder;
|
||||
holder.bind(getChildItem(group, position), group, position + 1);
|
||||
}
|
||||
setFadeAnimation(mHolder.itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
|
||||
super.onViewDetachedFromWindow(holder);
|
||||
holder.itemView.clearAnimation();
|
||||
}
|
||||
|
||||
private void setFadeAnimation(View view) {
|
||||
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim.setDuration(FADE_DURATION);
|
||||
view.startAnimation(anim);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue