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

View file

@ -0,0 +1,714 @@
/*
* Copyright (C) 2011 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.adins.libs.nineoldandroids.view;
import android.view.View;
import android.view.animation.Interpolator;
import com.adins.libs.nineoldandroids.animation.Animator;
import com.adins.libs.nineoldandroids.animation.ValueAnimator;
import com.adins.libs.nineoldandroids.view.animation.AnimatorProxy;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
class ViewPropertyAnimatorPreHC extends ViewPropertyAnimator {
/**
* Constants used to associate a property being requested and the mechanism used to set
* the property (this class calls directly into View to set the properties in question).
*/
private static final int NONE = 0x0000;
private static final int TRANSLATION_X = 0x0001;
private static final int TRANSLATION_Y = 0x0002;
private static final int SCALE_X = 0x0004;
private static final int SCALE_Y = 0x0008;
private static final int ROTATION = 0x0010;
private static final int ROTATION_X = 0x0020;
private static final int ROTATION_Y = 0x0040;
private static final int X = 0x0080;
private static final int Y = 0x0100;
private static final int ALPHA = 0x0200;
private static final int TRANSFORM_MASK = TRANSLATION_X | TRANSLATION_Y | SCALE_X | SCALE_Y |
ROTATION | ROTATION_X | ROTATION_Y | X | Y;
/**
* Proxy animation class which will allow us access to post-Honeycomb properties that were not
* otherwise available.
*/
private final AnimatorProxy mProxy;
/**
* A WeakReference holding the View whose properties are being animated by this class. This is
* set at construction time.
*/
private final WeakReference<View> mView;
/**
* This list holds the properties that have been asked to animate. We allow the caller to
* request several animations prior to actually starting the underlying animator. This
* enables us to run one single animator to handle several properties in parallel. Each
* property is tossed onto the pending list until the animation actually starts (which is
* done by posting it onto mView), at which time the pending list is cleared and the properties
* on that list are added to the list of properties associated with that animator.
*/
ArrayList<NameValuesHolder> mPendingAnimations = new ArrayList<NameValuesHolder>();
/**
* The duration of the underlying Animator object. By default, we don't set the duration
* on the Animator and just use its default duration. If the duration is ever set on this
* Animator, then we use the duration that it was set to.
*/
private long mDuration;
/**
* A flag indicating whether the duration has been set on this object. If not, we don't set
* the duration on the underlying Animator, but instead just use its default duration.
*/
private boolean mDurationSet = false;
/**
* The startDelay of the underlying Animator object. By default, we don't set the startDelay
* on the Animator and just use its default startDelay. If the startDelay is ever set on this
* Animator, then we use the startDelay that it was set to.
*/
private long mStartDelay = 0;
/**
* A flag indicating whether the startDelay has been set on this object. If not, we don't set
* the startDelay on the underlying Animator, but instead just use its default startDelay.
*/
private boolean mStartDelaySet = false;
/**
* The interpolator of the underlying Animator object. By default, we don't set the interpolator
* on the Animator and just use its default interpolator. If the interpolator is ever set on
* this Animator, then we use the interpolator that it was set to.
*/
private /*Time*/ Interpolator mInterpolator;
/**
* A flag indicating whether the interpolator has been set on this object. If not, we don't set
* the interpolator on the underlying Animator, but instead just use its default interpolator.
*/
private boolean mInterpolatorSet = false;
/**
* Listener for the lifecycle events of the underlying
*/
private Animator.AnimatorListener mListener = null;
/**
* This listener is the mechanism by which the underlying Animator causes changes to the
* properties currently being animated, as well as the cleanup after an animation is
* complete.
*/
private AnimatorEventListener mAnimatorEventListener = new AnimatorEventListener();
/**
* This list tracks the list of properties being animated by any particular animator.
* In most situations, there would only ever be one animator running at a time. But it is
* possible to request some properties to animate together, then while those properties
* are animating, to request some other properties to animate together. The way that
* works is by having this map associate the group of properties being animated with the
* animator handling the animation. On every update event for an Animator, we ask the
* map for the associated properties and set them accordingly.
*/
private HashMap<Animator, PropertyBundle> mAnimatorMap =
new HashMap<Animator, PropertyBundle>();
/**
* The mechanism by which the user can request several properties that are then animated
* together works by posting this Runnable to start the underlying Animator. Every time
* a property animation is requested, we cancel any previous postings of the Runnable
* and re-post it. This means that we will only ever run the Runnable (and thus start the
* underlying animator) after the caller is done setting the properties that should be
* animated together.
*/
private Runnable mAnimationStarter = new Runnable() {
@Override
public void run() {
startAnimation();
}
};
/**
* Constructor, called by View. This is private by design, as the user should only
* get a ViewPropertyAnimator by calling View.animate().
*
* @param view The View associated with this ViewPropertyAnimator
*/
ViewPropertyAnimatorPreHC(View view) {
mView = new WeakReference<View>(view);
mProxy = AnimatorProxy.wrap(view);
}
/**
* Sets the duration for the underlying animator that animates the requested properties.
* By default, the animator uses the default value for ValueAnimator. Calling this method
* will cause the declared value to be used instead.
*
* @param duration The length of ensuing property animations, in milliseconds. The value
* cannot be negative.
* @return This object, allowing calls to methods in this class to be chained.
*/
public ViewPropertyAnimator setDuration(long duration) {
if (duration < 0) {
throw new IllegalArgumentException("Animators cannot have negative duration: " +
duration);
}
mDurationSet = true;
mDuration = duration;
return this;
}
/**
* Returns the current duration of property animations. If the duration was set on this
* object, that value is returned. Otherwise, the default value of the underlying Animator
* is returned.
*
* @return The duration of animations, in milliseconds.
* @see #setDuration(long)
*/
public long getDuration() {
if (mDurationSet) {
return mDuration;
} else {
// Just return the default from ValueAnimator, since that's what we'd get if
// the value has not been set otherwise
return new ValueAnimator().getDuration();
}
}
@Override
public long getStartDelay() {
if (mStartDelaySet) {
return mStartDelay;
} else {
// Just return the default from ValueAnimator (0), since that's what we'd get if
// the value has not been set otherwise
return 0;
}
}
@Override
public ViewPropertyAnimator setStartDelay(long startDelay) {
if (startDelay < 0) {
throw new IllegalArgumentException("Animators cannot have negative duration: " +
startDelay);
}
mStartDelaySet = true;
mStartDelay = startDelay;
return this;
}
@Override
public ViewPropertyAnimator setInterpolator(/*Time*/Interpolator interpolator) {
mInterpolatorSet = true;
mInterpolator = interpolator;
return this;
}
@Override
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
mListener = listener;
return this;
}
@Override
public void start() {
startAnimation();
}
@Override
public void cancel() {
if (mAnimatorMap.size() > 0) {
HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
(HashMap<Animator, PropertyBundle>) mAnimatorMap.clone();
Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
for (Animator runningAnim : animatorSet) {
runningAnim.cancel();
}
}
mPendingAnimations.clear();
View v = mView.get();
if (v != null) {
v.removeCallbacks(mAnimationStarter);
}
}
@Override
public ViewPropertyAnimator x(float value) {
animateProperty(X, value);
return this;
}
@Override
public ViewPropertyAnimator xBy(float value) {
animatePropertyBy(X, value);
return this;
}
@Override
public ViewPropertyAnimator y(float value) {
animateProperty(Y, value);
return this;
}
@Override
public ViewPropertyAnimator yBy(float value) {
animatePropertyBy(Y, value);
return this;
}
@Override
public ViewPropertyAnimator rotation(float value) {
animateProperty(ROTATION, value);
return this;
}
@Override
public ViewPropertyAnimator rotationBy(float value) {
animatePropertyBy(ROTATION, value);
return this;
}
@Override
public ViewPropertyAnimator rotationX(float value) {
animateProperty(ROTATION_X, value);
return this;
}
@Override
public ViewPropertyAnimator rotationXBy(float value) {
animatePropertyBy(ROTATION_X, value);
return this;
}
@Override
public ViewPropertyAnimator rotationY(float value) {
animateProperty(ROTATION_Y, value);
return this;
}
@Override
public ViewPropertyAnimator rotationYBy(float value) {
animatePropertyBy(ROTATION_Y, value);
return this;
}
@Override
public ViewPropertyAnimator translationX(float value) {
animateProperty(TRANSLATION_X, value);
return this;
}
@Override
public ViewPropertyAnimator translationXBy(float value) {
animatePropertyBy(TRANSLATION_X, value);
return this;
}
@Override
public ViewPropertyAnimator translationY(float value) {
animateProperty(TRANSLATION_Y, value);
return this;
}
@Override
public ViewPropertyAnimator translationYBy(float value) {
animatePropertyBy(TRANSLATION_Y, value);
return this;
}
@Override
public ViewPropertyAnimator scaleX(float value) {
animateProperty(SCALE_X, value);
return this;
}
@Override
public ViewPropertyAnimator scaleXBy(float value) {
animatePropertyBy(SCALE_X, value);
return this;
}
@Override
public ViewPropertyAnimator scaleY(float value) {
animateProperty(SCALE_Y, value);
return this;
}
@Override
public ViewPropertyAnimator scaleYBy(float value) {
animatePropertyBy(SCALE_Y, value);
return this;
}
@Override
public ViewPropertyAnimator alpha(float value) {
animateProperty(ALPHA, value);
return this;
}
@Override
public ViewPropertyAnimator alphaBy(float value) {
animatePropertyBy(ALPHA, value);
return this;
}
/**
* Starts the underlying Animator for a set of properties. We use a single animator that
* simply runs from 0 to 1, and then use that fractional value to set each property
* value accordingly.
*/
private void startAnimation() {
ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
ArrayList<NameValuesHolder> nameValueList =
(ArrayList<NameValuesHolder>) mPendingAnimations.clone();
mPendingAnimations.clear();
int propertyMask = 0;
int propertyCount = nameValueList.size();
for (int i = 0; i < propertyCount; ++i) {
NameValuesHolder nameValuesHolder = nameValueList.get(i);
propertyMask |= nameValuesHolder.mNameConstant;
}
mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
animator.addUpdateListener(mAnimatorEventListener);
animator.addListener(mAnimatorEventListener);
if (mStartDelaySet) {
animator.setStartDelay(mStartDelay);
}
if (mDurationSet) {
animator.setDuration(mDuration);
}
if (mInterpolatorSet) {
animator.setInterpolator(mInterpolator);
}
animator.start();
}
/**
* Utility function, called by the various x(), y(), etc. methods. This stores the
* constant name for the property along with the from/delta values that will be used to
* calculate and set the property during the animation. This structure is added to the
* pending animations, awaiting the eventual start() of the underlying animator. A
* Runnable is posted to start the animation, and any pending such Runnable is canceled
* (which enables us to end up starting just one animator for all of the properties
* specified at one time).
*
* @param constantName The specifier for the property being animated
* @param toValue The value to which the property will animate
*/
private void animateProperty(int constantName, float toValue) {
float fromValue = getValue(constantName);
float deltaValue = toValue - fromValue;
animatePropertyBy(constantName, fromValue, deltaValue);
}
/**
* Utility function, called by the various xBy(), yBy(), etc. methods. This method is
* just like animateProperty(), except the value is an offset from the property's
* current value, instead of an absolute "to" value.
*
* @param constantName The specifier for the property being animated
* @param byValue The amount by which the property will change
*/
private void animatePropertyBy(int constantName, float byValue) {
float fromValue = getValue(constantName);
animatePropertyBy(constantName, fromValue, byValue);
}
/**
* Utility function, called by animateProperty() and animatePropertyBy(), which handles the
* details of adding a pending animation and posting the request to start the animation.
*
* @param constantName The specifier for the property being animated
* @param startValue The starting value of the property
* @param byValue The amount by which the property will change
*/
private void animatePropertyBy(int constantName, float startValue, float byValue) {
// First, cancel any existing animations on this property
if (mAnimatorMap.size() > 0) {
Animator animatorToCancel = null;
Set<Animator> animatorSet = mAnimatorMap.keySet();
for (Animator runningAnim : animatorSet) {
PropertyBundle bundle = mAnimatorMap.get(runningAnim);
if (bundle.cancel(constantName)) {
// property was canceled - cancel the animation if it's now empty
// Note that it's safe to break out here because every new animation
// on a property will cancel a previous animation on that property, so
// there can only ever be one such animation running.
if (bundle.mPropertyMask == NONE) {
// the animation is no longer changing anything - cancel it
animatorToCancel = runningAnim;
break;
}
}
}
if (animatorToCancel != null) {
animatorToCancel.cancel();
}
}
NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue);
mPendingAnimations.add(nameValuePair);
View v = mView.get();
if (v != null) {
v.removeCallbacks(mAnimationStarter);
v.post(mAnimationStarter);
}
}
/**
* This method handles setting the property values directly in the View object's fields.
* propertyConstant tells it which property should be set, value is the value to set
* the property to.
*
* @param propertyConstant The property to be set
* @param value The value to set the property to
*/
private void setValue(int propertyConstant, float value) {
//final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
//info.mTranslationX = value;
mProxy.setTranslationX(value);
break;
case TRANSLATION_Y:
//info.mTranslationY = value;
mProxy.setTranslationY(value);
break;
case ROTATION:
//info.mRotation = value;
mProxy.setRotation(value);
break;
case ROTATION_X:
//info.mRotationX = value;
mProxy.setRotationX(value);
break;
case ROTATION_Y:
//info.mRotationY = value;
mProxy.setRotationY(value);
break;
case SCALE_X:
//info.mScaleX = value;
mProxy.setScaleX(value);
break;
case SCALE_Y:
//info.mScaleY = value;
mProxy.setScaleY(value);
break;
case X:
//info.mTranslationX = value - mView.mLeft;
mProxy.setX(value);
break;
case Y:
//info.mTranslationY = value - mView.mTop;
mProxy.setY(value);
break;
case ALPHA:
//info.mAlpha = value;
mProxy.setAlpha(value);
break;
}
}
/**
* This method gets the value of the named property from the View object.
*
* @param propertyConstant The property whose value should be returned
* @return float The value of the named property
*/
private float getValue(int propertyConstant) {
//final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
//return info.mTranslationX;
return mProxy.getTranslationX();
case TRANSLATION_Y:
//return info.mTranslationY;
return mProxy.getTranslationY();
case ROTATION:
//return info.mRotation;
return mProxy.getRotation();
case ROTATION_X:
//return info.mRotationX;
return mProxy.getRotationX();
case ROTATION_Y:
//return info.mRotationY;
return mProxy.getRotationY();
case SCALE_X:
//return info.mScaleX;
return mProxy.getScaleX();
case SCALE_Y:
//return info.mScaleY;
return mProxy.getScaleY();
case X:
//return mView.mLeft + info.mTranslationX;
return mProxy.getX();
case Y:
//return mView.mTop + info.mTranslationY;
return mProxy.getY();
case ALPHA:
//return info.mAlpha;
return mProxy.getAlpha();
}
return 0;
}
/**
* This class holds information about the overall animation being run on the set of
* properties. The mask describes which properties are being animated and the
* values holder is the list of all property/value objects.
*/
private static class PropertyBundle {
int mPropertyMask;
ArrayList<NameValuesHolder> mNameValuesHolder;
PropertyBundle(int propertyMask, ArrayList<NameValuesHolder> nameValuesHolder) {
mPropertyMask = propertyMask;
mNameValuesHolder = nameValuesHolder;
}
/**
* Removes the given property from being animated as a part of this
* PropertyBundle. If the property was a part of this bundle, it returns
* true to indicate that it was, in fact, canceled. This is an indication
* to the caller that a cancellation actually occurred.
*
* @param propertyConstant The property whose cancellation is requested.
* @return true if the given property is a part of this bundle and if it
* has therefore been canceled.
*/
boolean cancel(int propertyConstant) {
if ((mPropertyMask & propertyConstant) != 0 && mNameValuesHolder != null) {
int count = mNameValuesHolder.size();
for (int i = 0; i < count; ++i) {
NameValuesHolder nameValuesHolder = mNameValuesHolder.get(i);
if (nameValuesHolder.mNameConstant == propertyConstant) {
mNameValuesHolder.remove(i);
mPropertyMask &= ~propertyConstant;
return true;
}
}
}
return false;
}
}
/**
* This is the information we need to set each property during the animation.
* mNameConstant is used to set the appropriate field in View, and the from/delta
* values are used to calculate the animated value for a given animation fraction
* during the animation.
*/
private static class NameValuesHolder {
int mNameConstant;
float mFromValue;
float mDeltaValue;
NameValuesHolder(int nameConstant, float fromValue, float deltaValue) {
mNameConstant = nameConstant;
mFromValue = fromValue;
mDeltaValue = deltaValue;
}
}
/**
* Utility class that handles the various Animator events. The only ones we care
* about are the end event (which we use to clean up the animator map when an animator
* finishes) and the update event (which we use to calculate the current value of each
* property and then set it on the view object).
*/
private class AnimatorEventListener
implements Animator.AnimatorListener, ValueAnimator.AnimatorUpdateListener {
@Override
public void onAnimationStart(Animator animation) {
if (mListener != null) {
mListener.onAnimationStart(animation);
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (mListener != null) {
mListener.onAnimationCancel(animation);
}
}
@Override
public void onAnimationRepeat(Animator animation) {
if (mListener != null) {
mListener.onAnimationRepeat(animation);
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (mListener != null) {
mListener.onAnimationEnd(animation);
}
mAnimatorMap.remove(animation);
// If the map is empty, it means all animation are done or canceled, so the listener
// isn't needed anymore. Not nulling it would cause it to leak any objects used in
// its implementation
if (mAnimatorMap.isEmpty()) {
mListener = null;
}
}
/**
* Calculate the current value for each property and set it on the view. Invalidate
* the view object appropriately, depending on which properties are being animated.
*
* @param animation The animator associated with the properties that need to be
* set. This animator holds the animation fraction which we will use to calculate
* the current value of each property.
*/
@Override
public void onAnimationUpdate(ValueAnimator animation) {
// alpha requires slightly different treatment than the other (transform) properties.
// The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
// logic is dependent on how the view handles an internal call to onSetAlpha().
// We track what kinds of properties are set, and how alpha is handled when it is
// set, and perform the invalidation steps appropriately.
//boolean alphaHandled = false;
//mView.invalidateParentCaches();
float fraction = animation.getAnimatedFraction();
PropertyBundle propertyBundle = mAnimatorMap.get(animation);
int propertyMask = propertyBundle.mPropertyMask;
if ((propertyMask & TRANSFORM_MASK) != 0) {
View v = mView.get();
if (v != null) {
v.invalidate(/*false*/);
}
}
ArrayList<NameValuesHolder> valueList = propertyBundle.mNameValuesHolder;
if (valueList != null) {
int count = valueList.size();
for (int i = 0; i < count; ++i) {
NameValuesHolder values = valueList.get(i);
float value = values.mFromValue + fraction * values.mDeltaValue;
//if (values.mNameConstant == ALPHA) {
// alphaHandled = mView.setAlphaNoInvalidation(value);
//} else {
setValue(values.mNameConstant, value);
//}
}
}
/*if ((propertyMask & TRANSFORM_MASK) != 0) {
mView.mTransformationInfo.mMatrixDirty = true;
mView.mPrivateFlags |= View.DRAWN; // force another invalidation
}*/
// invalidate(false) in all cases except if alphaHandled gets set to true
// via the call to setAlphaNoInvalidation(), above
View v = mView.get();
if (v != null) {
v.invalidate(/*alphaHandled*/);
}
}
}
}

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textReviewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/questionNoLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0. "
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/questionTextLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/questionNoLabel"
android:text="Label"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<RelativeLayout
android:id="@+id/answerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/questionTextLabel"
android:layout_gravity="center"
android:layout_toEndOf="@+id/questionNoLabel"
android:layout_toRightOf="@+id/questionNoLabel"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:weightSum="1">
<TextView
android:id="@+id/questionTextAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Answer"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<ImageView
android:id="@+id/imgLocationAnswer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="10dp"
android:scaleType="centerInside"
android:src="@drawable/ic_absent"
android:visibility="gone"/>
</RelativeLayout>
<Button
android:id="@+id/callPhoneNumber"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_above="@id/answerLine"
android:layout_marginRight="8dp"
android:layout_marginBottom="5dp"
android:background="@drawable/call_button_background"
android:gravity="center"
android:padding="5dp"
android:scaleType="centerInside"
android:text="Call"
android:textColor="#ffff"
android:textSize="12sp"
android:visibility="gone"/>
<View
android:id="@+id/answerLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/answerLayout"
android:layout_marginBottom="5dp"
android:background="@color/timelineLine"/>
</RelativeLayout>

View file

@ -0,0 +1,130 @@
package com.adins.mss.foundation.http;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.adins.mss.base.AppContext;
import com.adins.mss.base.GlobalData;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.User;
import com.adins.mss.foundation.phone.TelephonyInfo;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Class to generate AuditDataType with all needed data, if any. It's recommended to generate once and store to
* singleton/global if used frequently
*
* @author glen.iglesias
*/
public class AuditDataTypeGenerator {
public AuditDataTypeGenerator() {
}
/**
* Generate AuditDataType object with specified username
*
* @param callerId to be set in the generated AuditDataType object
* @return generated AuditDataType with specified username and loaded audit data
*/
public static AuditDataType generateAuditDataType(String callerId) {
// TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
AuditDataType auditDataType = new AuditDataType();
//TODO
String os = "ANDROID";
String osVersion = String.valueOf(android.os.Build.VERSION.SDK_INT);
String deviceId = GlobalData.getSharedGlobalData().getImei();
String androidId = GlobalData.getSharedGlobalData().getAndroidId();
String deviceModel = Build.MODEL;
String application = GlobalData.getSharedGlobalData().getApplication();
if (application == null) application = "";
String applicationVersion = Global.APP_VERSION;
String language = GlobalData.getSharedGlobalData().getLocale();
auditDataType.setCallerId(callerId);
auditDataType.setOs(os);
auditDataType.setOsVersion(osVersion);
auditDataType.setDeviceId(deviceId);
auditDataType.setDeviceModel(deviceModel);
auditDataType.setApplication(application);
auditDataType.setApplicationVersion(applicationVersion);
auditDataType.setLocale(language);
auditDataType.setAndroidId(androidId);
return auditDataType;
}
/**
* Like generateAuditDataType, this method generate a new AuditDataType, but use active user uuid instead of parameter
*
* @return generated AuditDataType with active user uuid and loaded audit data
*/
public static AuditDataType generateActiveUserAuditData() {
User user = GlobalData.getSharedGlobalData().getUser();
String uuid = "";
if (user != null) {
uuid = user.getUuid_user();
}
AuditDataType auditData = generateAuditDataType(uuid);
return auditData;
}
/**
* Read IMEI from device using TelephonyManager provided by Android SDK
*
* @param context used to get TelephonyManager
* @return IMEI obtained from TelephonyManager
*/
public static String getImeiFromDevice(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId();
return imei;
}
public static Map<String, String> getListImeiFromDevice(Context context) {
TelephonyInfo tm = TelephonyInfo.getInstance(context);
Map<String, String> imeiMap = new LinkedHashMap<>();
String imei;
if(Build.VERSION.SDK_INT > 28){
imei = getAndroidId();
}else {
imei = tm.getImeiSIM1();
}
imeiMap.put(MssRequestType.UN_KEY_IMEI, imei);
if (tm.isDualSIM()) {
String imei2 = tm.getImeiSIM2();
imeiMap.put(MssRequestType.UN_KEY_IMEI2, imei2);
}
return imeiMap;
}
public static String getAndroidId() {
return Settings.Secure.getString(AppContext.getInstance().getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
}
// /**
// * @return
// */
// public static AuditDataType generateAuditDataType(){
// String callerId = "";
// //user might be empty
// try{
// callerId = GlobalData.getSharedGlobalData().getUser().getLogin_id();
// }
// catch(Exception e){
// }
// AuditDataType auditDataType = generateAuditDataType(callerId);
// return auditDataType;
// }
}

View file

@ -0,0 +1,18 @@
package com.adins.mss.coll.commons;
import android.app.AlertDialog;
import android.content.Context;
/**
* Created by Aditya Purwa on 3/4/2015.
*/
public class Dialogger {
public static void error(Context context, Exception ex, String extraReason) {
new AlertDialog.Builder(context)
.setTitle("Error")
.setMessage(ex.getMessage() + "\r\n" + extraReason)
.setIcon(android.R.drawable.ic_dialog_alert)
.create()
.show();
}
}

View file

@ -0,0 +1,378 @@
/*
* java.util.Properties.java modified by Kevin Gaudin to allow usage of enums as keys.
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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;
import android.content.Context;
import org.acra.collector.CollectorUtil;
import org.acra.collector.CrashReportData;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.util.Map;
/**
* Stores a crash reports data with {@link org.acra.ReportField} enum values as keys.
* This is basically the source of {@link java.util.Properties} adapted to extend an
* EnumMap instead of Hashtable and with a few tweaks to avoid losing crazy
* amounts of android time in the generation of a date comment when storing to
* file.
*/
final class CrashReportPersister {
private static final int NONE = 0, SLASH = 1, UNICODE = 2, CONTINUE = 3, KEY_DONE = 4, IGNORE = 5;
private static final String LINE_SEPARATOR = "\n";
private final Context context;
CrashReportPersister(Context context) {
this.context = context;
}
/**
* Loads properties from the specified {@code InputStream}. The encoding is
* ISO8859-1.
*
* @param fileName Name of the report file from which to load the CrashData.
* @return CrashReportData read from the supplied InputStream.
* @throws java.io.IOException if error occurs during reading from the {@code InputStream}.
*/
public CrashReportData load(String fileName) throws IOException {
final FileInputStream in = context.openFileInput(fileName);
if (in == null) {
throw new IllegalArgumentException("Invalid crash report fileName : " + fileName);
}
try {
final BufferedInputStream bis = new BufferedInputStream(in, ACRAConstants.DEFAULT_BUFFER_SIZE_IN_BYTES);
bis.mark(Integer.MAX_VALUE);
final boolean isEbcdic = isEbcdic(bis);
bis.reset();
if (!isEbcdic) {
return load(new InputStreamReader(bis, "ISO8859-1")); //$NON-NLS-1$
} else {
return load(new InputStreamReader(bis)); //$NON-NLS-1$
}
} finally {
in.close();
}
}
/**
* Stores the mappings in this Properties to the specified OutputStream,
* putting the specified comment at the beginning. The output from this
* method is suitable for being read by the load() method.
*
* @param crashData CrashReportData to save.
* @param fileName Name of the file to which to store the CrashReportData.
* @throws java.io.IOException if the CrashReportData could not be written to the OutputStream.
*/
public void store(CrashReportData crashData, String fileName) throws IOException {
final OutputStream out = context.openFileOutput(fileName, Context.MODE_PRIVATE);
try {
final StringBuilder buffer = new StringBuilder(200);
final OutputStreamWriter writer = new OutputStreamWriter(out, "ISO8859_1"); //$NON-NLS-1$
for (final Map.Entry<ReportField, String> entry : crashData.entrySet()) {
final String key = entry.getKey().toString();
dumpString(buffer, key, true);
buffer.append('=');
dumpString(buffer, entry.getValue(), false);
buffer.append(LINE_SEPARATOR);
writer.write(buffer.toString());
buffer.setLength(0);
}
writer.flush();
} finally {
out.close();
}
}
private boolean isEbcdic(BufferedInputStream in) throws IOException {
byte b;
while ((b = (byte) in.read()) != -1) {
if (b == 0x23 || b == 0x0a || b == 0x3d) {// ascii: newline/#/=
return false;
}
if (b == 0x15) {// EBCDIC newline
return true;
}
}
// we found no ascii newline, '#', neither '=', relative safe to
// consider it
// as non-ascii, the only exception will be a single line with only
// key(no value and '=')
// in this case, it should be no harm to read it in default charset
return false;
}
/**
* Loads properties from the specified InputStream. The properties are of
* the form <code>key=value</code>, one property per line. It may be not
* encode as 'ISO-8859-1'.The {@code Properties} file is interpreted
* according to the following rules:
* <ul>
* <li>Empty lines are ignored.</li>
* <li>Lines starting with either a "#" or a "!" are comment lines and are
* ignored.</li>
* <li>A backslash at the end of the line escapes the following newline
* character ("\r", "\n", "\r\n"). If there's a whitespace after the
* backslash it will just escape that whitespace instead of concatenating
* the lines. This does not apply to comment lines.</li>
* <li>A property line consists of the key, the space between the key and
* the value, and the value. The key goes up to the first whitespace, "=" or
* ":" that is not escaped. The space between the key and the value contains
* either one whitespace, one "=" or one ":" and any number of additional
* whitespaces before and after that character. The value starts with the
* first character after the space between the key and the value.</li>
* <li>Following escape sequences are recognized: "\ ", "\\", "\r", "\n",
* "\!", "\#", "\t", "\b", "\f", and "&#92;uXXXX" (unicode character).</li>
* </ul>
*
* @param reader Reader from which to read the properties of this CrashReportData.
* @return CrashReportData read from the supplied Reader.
* @throws java.io.IOException if the properties could not be read.
* @since 1.6
*/
private synchronized CrashReportData load(Reader reader) throws IOException {
int mode = NONE, unicode = 0, count = 0;
char nextChar, buf[] = new char[40];
int offset = 0, keyLength = -1, intVal;
boolean firstChar = true;
final CrashReportData crashData = new CrashReportData();
final BufferedReader br = new BufferedReader(reader, ACRAConstants.DEFAULT_BUFFER_SIZE_IN_BYTES);
while (true) {
intVal = br.read();
if (intVal == -1) {
break;
}
nextChar = (char) intVal;
if (offset == buf.length) {
final char[] newBuf = new char[buf.length * 2];
System.arraycopy(buf, 0, newBuf, 0, offset);
buf = newBuf;
}
if (mode == UNICODE) {
final int digit = Character.digit(nextChar, 16);
if (digit >= 0) {
unicode = (unicode << 4) + digit;
if (++count < 4) {
continue;
}
} else if (count <= 4) {
// luni.09=Invalid Unicode sequence: illegal character
throw new IllegalArgumentException("luni.09");
}
mode = NONE;
buf[offset++] = (char) unicode;
if (nextChar != '\n' && nextChar != '\u0085') {
continue;
}
}
if (mode == SLASH) {
mode = NONE;
switch (nextChar) {
case '\r':
mode = CONTINUE; // Look for a following \n
continue;
case '\u0085':
case '\n':
mode = IGNORE; // Ignore whitespace on the next line
continue;
case 'b':
nextChar = '\b';
break;
case 'f':
nextChar = '\f';
break;
case 'n':
nextChar = '\n';
break;
case 'r':
nextChar = '\r';
break;
case 't':
nextChar = '\t';
break;
case 'u':
mode = UNICODE;
unicode = count = 0;
continue;
}
} else {
switch (nextChar) {
case '#':
case '!':
if (firstChar) {
while (true) {
intVal = br.read();
if (intVal == -1) {
break;
}
nextChar = (char) intVal; // & 0xff
// not
// required
if (nextChar == '\r' || nextChar == '\n' || nextChar == '\u0085') {
break;
}
}
continue;
}
break;
case '\n':
if (mode == CONTINUE) { // Part of a \r\n sequence
mode = IGNORE; // Ignore whitespace on the next line
continue;
}
// fall into the next case
case '\u0085':
case '\r':
mode = NONE;
firstChar = true;
if (offset > 0 || (offset == 0 && keyLength == 0)) {
if (keyLength == -1) {
keyLength = offset;
}
final String temp = new String(buf, 0, offset);
crashData.put(Enum.valueOf(ReportField.class, temp.substring(0, keyLength)), temp.substring(keyLength));
}
keyLength = -1;
offset = 0;
continue;
case '\\':
if (mode == KEY_DONE) {
keyLength = offset;
}
mode = SLASH;
continue;
case ':':
case '=':
if (keyLength == -1) { // if parsing the key
mode = NONE;
keyLength = offset;
continue;
}
break;
}
if (Character.isWhitespace(nextChar)) {
if (mode == CONTINUE) {
mode = IGNORE;
}
// if key length == 0 or value length == 0
if (offset == 0 || offset == keyLength || mode == IGNORE) {
continue;
}
if (keyLength == -1) { // if parsing the key
mode = KEY_DONE;
continue;
}
}
if (mode == IGNORE || mode == CONTINUE) {
mode = NONE;
}
}
firstChar = false;
if (mode == KEY_DONE) {
keyLength = offset;
mode = NONE;
}
buf[offset++] = nextChar;
}
if (mode == UNICODE && count <= 4) {
// luni.08=Invalid Unicode sequence: expected format \\uxxxx
throw new IllegalArgumentException("luni.08");
}
if (keyLength == -1 && offset > 0) {
keyLength = offset;
}
if (keyLength >= 0) {
final String temp = new String(buf, 0, offset);
final ReportField key = Enum.valueOf(ReportField.class, temp.substring(0, keyLength));
String value = temp.substring(keyLength);
if (mode == SLASH) {
value += "\u0000";
}
crashData.put(key, value);
}
CollectorUtil.safeClose(reader);
return crashData;
}
/**
* Constructs a new {@code Properties} object.
*
* @param buffer StringBuilder to populate with the supplied property.
* @param string String to append to the buffer.
* @param key Whether the String is a key value or not.
*/
private void dumpString(StringBuilder buffer, String string, boolean key) {
int i = 0;
if (!key && i < string.length() && string.charAt(i) == ' ') {
buffer.append("\\ "); //$NON-NLS-1$
i++;
}
for (; i < string.length(); i++) {
char ch = string.charAt(i);
switch (ch) {
case '\t':
buffer.append("\\t"); //$NON-NLS-1$
break;
case '\n':
buffer.append("\\n"); //$NON-NLS-1$
break;
case '\f':
buffer.append("\\f"); //$NON-NLS-1$
break;
case '\r':
buffer.append("\\r"); //$NON-NLS-1$
break;
default:
if ("\\#!=:".indexOf(ch) >= 0 || (key && ch == ' ')) {
buffer.append('\\');
}
if (ch >= ' ' && ch <= '~') {
buffer.append(ch);
} else {
final String hex = Integer.toHexString(ch);
buffer.append("\\u"); //$NON-NLS-1$
for (int j = 0; j < 4 - hex.length(); j++) {
buffer.append("0"); //$NON-NLS-1$
}
buffer.append(hex);
}
}
}
}
}

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<com.adins.mss.foundation.questiongenerator.form.QuestionView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/questionSummaryLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/questionSummaryLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0. label" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.appcompat.widget.AppCompatSpinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/questionSummaryDropdown"
android:spinnerMode="dropdown"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:background="@drawable/dropdown_background"
android:padding="5dp"/>
<ImageView
android:id="@+id/img1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_expand"
android:layout_alignRight="@+id/questionSummaryDropdown"
android:layout_alignBottom="@+id/questionSummaryDropdown"
android:layout_alignTop="@+id/questionSummaryDropdown"
android:layout_marginRight="10dp"
android:tint="@color/gradient_end"/>
</RelativeLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/questionSummaryAnswerLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="1">
</TableLayout>
</HorizontalScrollView>
<TextView
android:id="@+id/questionInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/no_answer_found"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
</com.adins.mss.foundation.questiongenerator.form.QuestionView>

View file

@ -0,0 +1,235 @@
package com.adins.mss.dao;
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_LOOKUP".
*/
public class Lookup {
/** Not-null value. */
@SerializedName("uuid_lookup")
private String uuid_lookup;
@SerializedName("option_id")
private String option_id;
@SerializedName("code")
private String code;
@SerializedName("value")
private String value;
@SerializedName("filter1")
private String filter1;
@SerializedName("filter2")
private String filter2;
@SerializedName("filter3")
private String filter3;
@SerializedName("filter4")
private String filter4;
@SerializedName("filter5")
private String filter5;
@SerializedName("sequence")
private Integer sequence;
@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_question_set")
private String uuid_question_set;
@SerializedName("lov_group")
private String lov_group;
@SerializedName("is_active")
private String is_active;
@SerializedName("is_deleted")
private String is_deleted;
@SerializedName("flag")
private String flag_hardsync;
public Lookup() {
}
public Lookup(String uuid_lookup) {
this.uuid_lookup = uuid_lookup;
}
public Lookup(String uuid_lookup, String option_id, String code, String value, String filter1, String filter2, String filter3, String filter4, String filter5, Integer sequence, String usr_crt, java.util.Date dtm_crt, String usr_upd, java.util.Date dtm_upd, String uuid_question_set, String lov_group, String is_active, String is_deleted, String flag_hardsync) {
this.uuid_lookup = uuid_lookup;
this.option_id = option_id;
this.code = code;
this.value = value;
this.filter1 = filter1;
this.filter2 = filter2;
this.filter3 = filter3;
this.filter4 = filter4;
this.filter5 = filter5;
this.sequence = sequence;
this.usr_crt = usr_crt;
this.dtm_crt = dtm_crt;
this.usr_upd = usr_upd;
this.dtm_upd = dtm_upd;
this.uuid_question_set = uuid_question_set;
this.lov_group = lov_group;
this.is_active = is_active;
this.is_deleted = is_deleted;
this.flag_hardsync = flag_hardsync;
}
/** Not-null value. */
public String getUuid_lookup() {
return uuid_lookup;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setUuid_lookup(String uuid_lookup) {
this.uuid_lookup = uuid_lookup;
}
public String getOption_id() {
return option_id;
}
public void setOption_id(String option_id) {
this.option_id = option_id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getFilter1() {
return filter1;
}
public void setFilter1(String filter1) {
this.filter1 = filter1;
}
public String getFilter2() {
return filter2;
}
public void setFilter2(String filter2) {
this.filter2 = filter2;
}
public String getFilter3() {
return filter3;
}
public void setFilter3(String filter3) {
this.filter3 = filter3;
}
public String getFilter4() {
return filter4;
}
public void setFilter4(String filter4) {
this.filter4 = filter4;
}
public String getFilter5() {
return filter5;
}
public void setFilter5(String filter5) {
this.filter5 = filter5;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
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_question_set() {
return uuid_question_set;
}
public void setUuid_question_set(String uuid_question_set) {
this.uuid_question_set = uuid_question_set;
}
public String getLov_group() {
return lov_group;
}
public void setLov_group(String lov_group) {
this.lov_group = lov_group;
}
public String getIs_active() {
return is_active;
}
public void setIs_active(String is_active) {
this.is_active = is_active;
}
public String getIs_deleted() {
return is_deleted;
}
public void setIs_deleted(String is_deleted) {
this.is_deleted = is_deleted;
}
public String getFlag_hardsync() {
return flag_hardsync;
}
public void setFlag_hardsync(String flag_hardsync) {
this.flag_hardsync = flag_hardsync;
}
}

View file

@ -0,0 +1,77 @@
/***
* Excerpted from "Hello, Android",
* published by The Pragmatic Bookshelf.
* Copyrights apply to this code. It may not be used to create training material,
* courses, books, articles, and the like. Contact us if you are in doubt.
* We make no guarantees that this code is fit for any purpose.
* Visit http://www.pragmaticprogrammer.com/titles/eband3 for more book information.
***/
package com.adins.mss.foundation.image;
import android.os.Build;
import android.view.MotionEvent;
import com.adins.mss.foundation.camerainapp.helper.Logger;
public class WrapMotionEvent {
protected MotionEvent event;
protected WrapMotionEvent(MotionEvent event) {
this.event = event;
}
static public WrapMotionEvent wrap(MotionEvent event) {
// Use Build.VERSION.SDK_INT if you don't have to support Cupcake
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
Logger.d("WrapMotionEvent", "Using Eclair version");
return new EclairMotionEvent(event);
} else {
Logger.d("WrapMotionEvent", "Using Cupcake/Donut version");
return new WrapMotionEvent(event);
}
}
public int getAction() {
return event.getAction();
}
public float getX() {
return event.getX();
}
public float getX(int pointerIndex) {
verifyPointerIndex(pointerIndex);
return getX();
}
public float getY() {
return event.getY();
}
public float getY(int pointerIndex) {
verifyPointerIndex(pointerIndex);
return getY();
}
public int getPointerCount() {
return 1;
}
public int getPointerId(int pointerIndex) {
verifyPointerIndex(pointerIndex);
return 0;
}
private void verifyPointerIndex(int pointerIndex) {
if (pointerIndex > 0) {
throw new IllegalArgumentException(
"Invalid pointer index for Donut/Cupcake");
}
}
}

View file

@ -0,0 +1,51 @@
/*
* 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.app.Application;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Bundle;
/**
* Equivalent of {@link ActivityLifecycleCallbacks} to be used with
* {@link ApplicationHelper#registerActivityLifecycleCallbacks(Application, ActivityLifecycleCallbacksCompat)} and
* {@link ApplicationHelper#unregisterActivityLifecycleCallbacks(Application, ActivityLifecycleCallbacksCompat)}.
*/
public interface ActivityLifecycleCallbacksCompat {
void onActivityCreated(Activity activity, Bundle savedInstanceState);
void onActivityStarted(Activity activity);
void onActivityResumed(Activity activity);
void onActivityPaused(Activity activity);
void onActivityStopped(Activity activity);
void onActivitySaveInstanceState(Activity activity, Bundle outState);
void onActivityDestroyed(Activity activity);
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/list_anim"
android:animationOrder="normal"
android:delay="0.5" />

View file

@ -0,0 +1,203 @@
package com.soundcloud.android.crop;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import java.util.ArrayList;
public class CropImageView extends ImageViewTouchBase {
ArrayList<HighlightView> highlightViews = new ArrayList<HighlightView>();
HighlightView motionHighlightView;
Context context;
private float lastX;
private float lastY;
private int motionEdge;
@SuppressWarnings("UnusedDeclaration")
public CropImageView(Context context) {
super(context);
}
@SuppressWarnings("UnusedDeclaration")
public CropImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@SuppressWarnings("UnusedDeclaration")
public CropImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (bitmapDisplayed.getBitmap() != null) {
for (HighlightView hv : highlightViews) {
hv.matrix.set(getUnrotatedMatrix());
hv.invalidate();
if (hv.hasFocus()) {
centerBasedOnHighlightView(hv);
}
}
}
}
@Override
protected void zoomTo(float scale, float centerX, float centerY) {
super.zoomTo(scale, centerX, centerY);
for (HighlightView hv : highlightViews) {
hv.matrix.set(getUnrotatedMatrix());
hv.invalidate();
}
}
@Override
protected void zoomIn() {
super.zoomIn();
for (HighlightView hv : highlightViews) {
hv.matrix.set(getUnrotatedMatrix());
hv.invalidate();
}
}
@Override
protected void zoomOut() {
super.zoomOut();
for (HighlightView hv : highlightViews) {
hv.matrix.set(getUnrotatedMatrix());
hv.invalidate();
}
}
@Override
protected void postTranslate(float deltaX, float deltaY) {
super.postTranslate(deltaX, deltaY);
for (HighlightView hv : highlightViews) {
hv.matrix.postTranslate(deltaX, deltaY);
hv.invalidate();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
CropImageActivity cropImageActivity = (CropImageActivity) context;
if (cropImageActivity.isSaving()) {
return false;
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (HighlightView hv : highlightViews) {
int edge = hv.getHit(event.getX(), event.getY());
if (edge != HighlightView.GROW_NONE) {
motionEdge = edge;
motionHighlightView = hv;
lastX = event.getX();
lastY = event.getY();
motionHighlightView.setMode((edge == HighlightView.MOVE)
? HighlightView.ModifyMode.Move
: HighlightView.ModifyMode.Grow);
break;
}
}
break;
case MotionEvent.ACTION_UP:
if (motionHighlightView != null) {
centerBasedOnHighlightView(motionHighlightView);
motionHighlightView.setMode(HighlightView.ModifyMode.None);
}
motionHighlightView = null;
break;
case MotionEvent.ACTION_MOVE:
if (motionHighlightView != null) {
motionHighlightView.handleMotion(motionEdge, event.getX()
- lastX, event.getY() - lastY);
lastX = event.getX();
lastY = event.getY();
ensureVisible(motionHighlightView);
}
break;
}
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
center(true, true);
break;
case MotionEvent.ACTION_MOVE:
// if we're not zoomed then there's no point in even allowing
// the user to move the image around. This call to center puts
// it back to the normalized location (with false meaning don't
// animate).
if (getScale() == 1F) {
center(true, true);
}
break;
}
return true;
}
// Pan the displayed image to make sure the cropping rectangle is visible.
private void ensureVisible(HighlightView hv) {
Rect r = hv.drawRect;
int panDeltaX1 = Math.max(0, getLeft() - r.left);
int panDeltaX2 = Math.min(0, getRight() - r.right);
int panDeltaY1 = Math.max(0, getTop() - r.top);
int panDeltaY2 = Math.min(0, getBottom() - r.bottom);
int panDeltaX = panDeltaX1 != 0 ? panDeltaX1 : panDeltaX2;
int panDeltaY = panDeltaY1 != 0 ? panDeltaY1 : panDeltaY2;
if (panDeltaX != 0 || panDeltaY != 0) {
panBy(panDeltaX, panDeltaY);
}
}
// If the cropping rectangle's size changed significantly, change the
// view's center and scale according to the cropping rectangle.
private void centerBasedOnHighlightView(HighlightView hv) {
Rect drawRect = hv.drawRect;
float width = drawRect.width();
float height = drawRect.height();
float thisWidth = getWidth();
float thisHeight = getHeight();
float z1 = thisWidth / width * .6F;
float z2 = thisHeight / height * .6F;
float zoom = Math.min(z1, z2);
zoom = zoom * this.getScale();
zoom = Math.max(1F, zoom);
if ((Math.abs(zoom - getScale()) / zoom) > .1) {
float[] coordinates = new float[]{hv.cropRect.centerX(), hv.cropRect.centerY()};
getUnrotatedMatrix().mapPoints(coordinates);
zoomTo(zoom, coordinates[0], coordinates[1], 300F);
}
ensureVisible(hv);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for (HighlightView mHighlightView : highlightViews) {
mHighlightView.draw(canvas);
}
}
public void add(HighlightView hv) {
highlightViews.add(hv);
invalidate();
}
}

View file

@ -0,0 +1,29 @@
package com.adins.mss.foundation.oauth2;
import com.google.gson.annotations.SerializedName;
/**
* Created by gigin.ginanjar on 13/05/2016.
*/
public class OauthErrorResponse {
@SerializedName("error")
public String error;
@SerializedName("error_description")
public String error_description;
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getError_description() {
return error_description;
}
public void setError_description(String error_description) {
this.error_description = error_description;
}
}

View file

@ -0,0 +1,85 @@
package com.adins.mss.coll.fragments;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.util.GsonHelper;
import com.adins.mss.coll.R;
import com.adins.mss.coll.models.GuidelineAdapter;
import com.adins.mss.coll.models.GuidelineFaqRequest;
import com.adins.mss.coll.models.loyaltymodels.DocumentListDetail;
import com.adins.mss.coll.models.loyaltymodels.GuidelineFaqResponse;
import com.adins.mss.constant.Global;
//import com.adins.mss.foundation.formatter.Base64;
import com.adins.mss.foundation.formatter.Tool;
import android.util.Base64;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.List;
public class GuidelineFaqFragment extends Fragment {
RecyclerView guidelinesList;
private static final String ARG_DOCUMENTS = "documents";
private GuidelineAdapter guidelineAdapter;
private List<DocumentListDetail> documentList;
public static GuidelineFaqFragment newInstance(List<DocumentListDetail> documentListDetails) {
GuidelineFaqFragment fragment = new GuidelineFaqFragment();
Bundle args = new Bundle();
args.putSerializable(ARG_DOCUMENTS, (Serializable) documentListDetails);
fragment.setArguments(args);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_guideline_faq, container, false);
guidelinesList = view.findViewById(R.id.guidelineRV);
getActivity().setTitle(getString(R.string.title_mn_guideline_faq));
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if(getArguments() != null){
documentList = (List<DocumentListDetail>) getArguments().getSerializable(ARG_DOCUMENTS);
}
if(documentList != null){
guidelineAdapter = new GuidelineAdapter(documentList, getContext());
guidelinesList.setLayoutManager(new LinearLayoutManager(getContext()));
guidelinesList.setAdapter(guidelineAdapter);
}
}
}