mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +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,338 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.timeline.MapsViewer;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.model.JsonRequestDetailOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.adins.mss.odr.tool.ImageThumbnail;
|
||||
import com.adins.mss.odr.tool.getImageTask;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class OrderAssignmentResult extends Activity implements OnClickListener{
|
||||
String nomorOrder;
|
||||
TableLayout detailTable;
|
||||
Button btnLookupCMO;
|
||||
Button btnSubmit;
|
||||
RelativeLayout bottomLayout;
|
||||
int taskType;
|
||||
String flag;
|
||||
String uuid_task_h;
|
||||
TextView txtCMO;
|
||||
TextView txtNotes;
|
||||
Map<ImageThumbnail, String> thumbnailMapping = new HashMap<ImageThumbnail, String>();
|
||||
List<ResponseServer> list;
|
||||
String assignId;
|
||||
public static ImageThumbnail targetThumbnail = null;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
setContentView(R.layout.orderassignment_result_layout);
|
||||
nomorOrder = getIntent().getExtras().getString(Global.BUND_KEY_ORDERNO);
|
||||
taskType = getIntent().getExtras().getInt(Global.BUND_KEY_TASK_TYPE);
|
||||
uuid_task_h = getIntent().getExtras().getString(Global.BUND_KEY_UUID_TASKH);
|
||||
flag = flagParamForType(taskType);
|
||||
initialize();
|
||||
new GetRequestDataDetail(nomorOrder, flag).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this, getString(R.string.screen_name_order_assignment_result), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try {
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
if (null == locale) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
}
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
private String flagParamForType(int taskType2) {
|
||||
switch (taskType) {
|
||||
case Global.TASK_ORDER_ASSIGNMENT:
|
||||
return "assign";
|
||||
case Global.TASK_ORDER_REASSIGNMENT:
|
||||
return "reassign";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
protected void initialize() {
|
||||
// TODO Auto-generated method stub
|
||||
detailTable = (TableLayout)findViewById(R.id.orderDetailTable);
|
||||
btnLookupCMO = (Button)findViewById(R.id.btnLookupCMO);
|
||||
btnSubmit = (Button)findViewById(R.id.btnSubmit);
|
||||
txtCMO = (TextView)findViewById(R.id.txtCMO);
|
||||
txtNotes = (TextView)findViewById(R.id.txtNotes);
|
||||
bottomLayout = (RelativeLayout)findViewById(R.id.Bottomlayout);
|
||||
}
|
||||
|
||||
public class GetRequestDataDetail extends AsyncTask<Void, Void, String> {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage = null;
|
||||
private String flag;
|
||||
private String nomorOrder;
|
||||
|
||||
public GetRequestDataDetail(String nomorOrder, String flag) {
|
||||
this.nomorOrder = nomorOrder;
|
||||
this.flag = flag;
|
||||
}
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(OrderAssignmentResult.this,
|
||||
"", getString(R.string.progressWait), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
String result = null;
|
||||
JsonRequestDetailOrder request = new JsonRequestDetailOrder();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
// request.setNomor_order(this.nomorOrder);
|
||||
request.setUuid_task_h(uuid_task_h);
|
||||
// request.setFlag(this.flag);
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DETAIL_ORDER();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getApplicationContext(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
// result = "{\"listResponseServer\":[{\"key\":\"Nama\",\"value\":\"Gigin Gnanjar\",\"flag\":\"0\"},{\"key\":\"Alamat\",\"value\":\"Kebon Jeruk\",\"flag\":\"0\"},{\"key\":\"Foto Rumah\",\"value\":\"123456\",\"flag\":\"1\"},{\"key\":\"Location\",\"value\":\"-6.198076,106.763137\",\"flag\":\"2\"}],\"status\":{\"code\":0}}";
|
||||
result = serverResult.getResult();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(String result){
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if("".equals(result)){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getApplicationContext());
|
||||
dialogBuilder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(getString(R.string.msgUnavaibleLocationCheckIn))
|
||||
.show();
|
||||
}else{
|
||||
loadDataDetailFromServer(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void loadDataDetailFromServer(String result){
|
||||
|
||||
int no =1;
|
||||
LayoutParams lpSpace =new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
LayoutParams lpQuestion =new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f);
|
||||
LayoutParams lpNo =new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.4f);
|
||||
|
||||
try {
|
||||
JsonResponseServer resultOrder = GsonHelper.fromJson(result, JsonResponseServer.class);
|
||||
list = resultOrder.getListResponseServer();
|
||||
for(ResponseServer responseServer : list){
|
||||
String question = responseServer.getKey();
|
||||
String answer = responseServer.getValue();
|
||||
String flag = responseServer.getFlag();
|
||||
|
||||
LinearLayout row = new LinearLayout(this);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
|
||||
if (no%2 == 0) row.setBackgroundResource(R.color.tv_normal);
|
||||
else row.setBackgroundColor(Color.WHITE);
|
||||
|
||||
TextView lblNo = new TextView(this);
|
||||
lblNo.setText(no+ ". ");
|
||||
lblNo.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
lblNo.setLayoutParams(lpNo);
|
||||
row.addView(lblNo);
|
||||
|
||||
TextView lblQuestion = new TextView(this);
|
||||
lblQuestion.setText(question);
|
||||
lblQuestion.setLayoutParams(lpQuestion);
|
||||
row.addView(lblQuestion);
|
||||
|
||||
TextView lblSpace = new TextView(this);
|
||||
lblSpace.setText(" : ");
|
||||
lblSpace.setLayoutParams(lpSpace);
|
||||
row.addView(lblSpace);
|
||||
if(flag.equals(Global.FLAG_FOR_IMAGE)){
|
||||
int w = 200;//GlobalData.getSharedGlobalData().getThumbnailWidth();
|
||||
int h = 160;//GlobalData.getSharedGlobalData().getThumbnailHeight();
|
||||
int density = getResources().getDisplayMetrics().densityDpi;
|
||||
if(density==DisplayMetrics.DENSITY_LOW){
|
||||
w = 80;
|
||||
h = 50;
|
||||
}else if(density==DisplayMetrics.DENSITY_MEDIUM){
|
||||
w = 120;
|
||||
h = 90;
|
||||
}
|
||||
final ImageThumbnail thumb = new ImageThumbnail(this, w, h);
|
||||
thumb.setOnClickListener(this);
|
||||
thumb.setLayoutParams(lpQuestion);
|
||||
thumbnailMapping.put(thumb, answer);
|
||||
row.addView(thumb);
|
||||
}else if(flag.equals(Global.FLAG_FOR_LOCATION)){
|
||||
final ImageThumbnail thumb = new ImageThumbnail(this, 90, 90);
|
||||
thumb.setImageResource(R.drawable.ic_absent);
|
||||
thumb.setOnClickListener(this);
|
||||
thumb.setLayoutParams(lpQuestion);
|
||||
thumbnailMapping.put(thumb, answer);
|
||||
row.addView(thumb);
|
||||
}else{
|
||||
TextView lblAnswer = new TextView(this);
|
||||
lblAnswer.setText(answer);
|
||||
lblAnswer.setLayoutParams(lpQuestion);
|
||||
row.addView(lblAnswer);
|
||||
}
|
||||
detailTable.addView(row);
|
||||
no++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
public void doSubmit(View view){
|
||||
if(txtCMO.getText().toString()!=null){
|
||||
String notes = txtNotes.getText().toString();
|
||||
SubmitAssignTask task = new SubmitAssignTask(this, notes, uuid_task_h, assignId, flag);
|
||||
task.execute();
|
||||
}else{
|
||||
Toast.makeText(getApplicationContext(), getString(R.string.select_cmo),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
public void doLookupCMO(View view){
|
||||
Intent intent = new Intent(this, LookupAssignment.class);
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString(Global.BUND_KEY_TASK, flag);
|
||||
extras.putString(Global.BUND_KEY_UUID_TASKH, uuid_task_h);
|
||||
intent.putExtras(extras);
|
||||
startActivityForResult(intent, Global.REQUEST_CODE_LOOKUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == Global.REQUEST_CODE_LOOKUP){ //it's the one we request from the beginning
|
||||
String value = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_VALUE);
|
||||
assignId = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_ID);
|
||||
String job = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_JOB);
|
||||
txtCMO.setText(job+" - "+value);
|
||||
txtCMO.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageThumbnail imgThumbnail = null;
|
||||
try {
|
||||
imgThumbnail = (ImageThumbnail) v;
|
||||
if (imgThumbnail.getResultImg() != null){
|
||||
try {
|
||||
Bitmap image = Utils.byteToBitmap(imgThumbnail.getResultImg());
|
||||
DialogManager.showImageDialog(this, image);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
String fieldKey = thumbnailMapping.get(v);
|
||||
String[] latLng = Tool.split(fieldKey, ",");
|
||||
if(latLng.length>1){
|
||||
String lat=latLng[0];
|
||||
String lng=latLng[1];
|
||||
Intent intent = new Intent(this, MapsViewer.class);
|
||||
intent.putExtra("latitude", lat);
|
||||
intent.putExtra("longitude", lng);
|
||||
startActivity(intent);
|
||||
}else{
|
||||
if (nomorOrder != null && !"".equals(nomorOrder)){
|
||||
targetThumbnail = (ImageThumbnail)v; //store thumbnail for further reference after connection finish
|
||||
|
||||
List<NameValuePair> params = new ArrayList<NameValuePair>();
|
||||
params.add(new BasicNameValuePair(Global.BUND_KEY_UUID_TASKH, uuid_task_h));
|
||||
params.add(new BasicNameValuePair(Global.BUND_KEY_QUESTIONID, fieldKey));
|
||||
new getImageTask(this,params).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, getString(R.string.path_no_received), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,628 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 05/09/2016.
|
||||
*/
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListener;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This implementation of {@link androidx.recyclerview.widget.RecyclerView.ItemAnimator} provides basic
|
||||
* animations on remove, add, and move events that happen to the items in
|
||||
* a RecyclerView.
|
||||
*
|
||||
* @see androidx.recyclerview.widget.RecyclerView#setItemAnimator(androidx.recyclerview.widget.RecyclerView.ItemAnimator)
|
||||
*/
|
||||
public abstract class BaseItemAnimator extends SimpleItemAnimator {
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Default Item Animator
|
||||
//------------------------------------------------------------
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Constructor
|
||||
//------------------------------------------------------------
|
||||
/**
|
||||
* RecyclerView
|
||||
*/
|
||||
protected RecyclerView mRecyclerView;
|
||||
protected ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
protected ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
protected ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
protected ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
private ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
private ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
public BaseItemAnimator(RecyclerView recyclerView) {
|
||||
mRecyclerView = recyclerView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runPendingAnimations() {
|
||||
boolean removalsPending = !mPendingRemovals.isEmpty();
|
||||
boolean movesPending = !mPendingMoves.isEmpty();
|
||||
boolean changesPending = !mPendingChanges.isEmpty();
|
||||
boolean additionsPending = !mPendingAdditions.isEmpty();
|
||||
if (!removalsPending && !movesPending && !additionsPending && !changesPending) {
|
||||
// nothing to animate
|
||||
return;
|
||||
}
|
||||
// First, remove stuff
|
||||
for (RecyclerView.ViewHolder holder : mPendingRemovals) {
|
||||
animateRemoveImpl(holder);
|
||||
}
|
||||
mPendingRemovals.clear();
|
||||
// Next, move stuff
|
||||
if (movesPending) {
|
||||
final ArrayList<MoveInfo> moves = new ArrayList<>();
|
||||
moves.addAll(mPendingMoves);
|
||||
mMovesList.add(moves);
|
||||
mPendingMoves.clear();
|
||||
Runnable mover = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (MoveInfo moveInfo : moves) {
|
||||
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
|
||||
moveInfo.toX, moveInfo.toY);
|
||||
}
|
||||
moves.clear();
|
||||
mMovesList.remove(moves);
|
||||
}
|
||||
};
|
||||
if (removalsPending) {
|
||||
View view = moves.get(0).holder.itemView;
|
||||
ViewCompat.postOnAnimationDelayed(view, mover, getRemoveDuration());
|
||||
} else {
|
||||
mover.run();
|
||||
}
|
||||
}
|
||||
// Next, change stuff, to run in parallel with move animations
|
||||
if (changesPending) {
|
||||
final ArrayList<ChangeInfo> changes = new ArrayList<>();
|
||||
changes.addAll(mPendingChanges);
|
||||
mChangesList.add(changes);
|
||||
mPendingChanges.clear();
|
||||
Runnable changer = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (ChangeInfo change : changes) {
|
||||
animateChangeImpl(change);
|
||||
}
|
||||
changes.clear();
|
||||
mChangesList.remove(changes);
|
||||
}
|
||||
};
|
||||
if (removalsPending) {
|
||||
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
|
||||
ViewCompat.postOnAnimationDelayed(holder.itemView, changer, getRemoveDuration());
|
||||
} else {
|
||||
changer.run();
|
||||
}
|
||||
}
|
||||
// Next, add stuff
|
||||
if (additionsPending) {
|
||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
||||
additions.addAll(mPendingAdditions);
|
||||
mAdditionsList.add(additions);
|
||||
mPendingAdditions.clear();
|
||||
Runnable adder = new Runnable() {
|
||||
public void run() {
|
||||
for (RecyclerView.ViewHolder holder : additions) {
|
||||
animateAddImpl(holder);
|
||||
}
|
||||
additions.clear();
|
||||
mAdditionsList.remove(additions);
|
||||
}
|
||||
};
|
||||
if (removalsPending || movesPending || changesPending) {
|
||||
long removeDuration = removalsPending ? getRemoveDuration() : 0;
|
||||
long moveDuration = movesPending ? getMoveDuration() : 0;
|
||||
long changeDuration = changesPending ? getChangeDuration() : 0;
|
||||
long totalDelay = removeDuration + Math.max(moveDuration, changeDuration);
|
||||
View view = additions.get(0).itemView;
|
||||
ViewCompat.postOnAnimationDelayed(view, adder, totalDelay);
|
||||
} else {
|
||||
adder.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateAdd(final RecyclerView.ViewHolder holder) {
|
||||
resetAnimation(holder);
|
||||
prepareAnimateAdd(holder);
|
||||
ViewCompat.setAlpha(holder.itemView, 0);
|
||||
mPendingAdditions.add(holder);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void prepareAnimateAdd(final RecyclerView.ViewHolder holder);
|
||||
|
||||
protected abstract void animateAddImpl(final RecyclerView.ViewHolder holder);
|
||||
|
||||
@Override
|
||||
public boolean animateRemove(final RecyclerView.ViewHolder holder) {
|
||||
resetAnimation(holder);
|
||||
mPendingRemovals.add(holder);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void animateRemoveImpl(final RecyclerView.ViewHolder holder);
|
||||
|
||||
@Override
|
||||
public boolean animateMove(final RecyclerView.ViewHolder holder, int fromX, int fromY,
|
||||
int toX, int toY) {
|
||||
final View view = holder.itemView;
|
||||
fromX += ViewCompat.getTranslationX(holder.itemView);
|
||||
fromY += ViewCompat.getTranslationY(holder.itemView);
|
||||
resetAnimation(holder);
|
||||
int deltaX = toX - fromX;
|
||||
int deltaY = toY - fromY;
|
||||
if (deltaX == 0 && deltaY == 0) {
|
||||
dispatchMoveFinished(holder);
|
||||
return false;
|
||||
}
|
||||
if (deltaX != 0) {
|
||||
ViewCompat.setTranslationX(view, -deltaX);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
ViewCompat.setTranslationY(view, -deltaY);
|
||||
}
|
||||
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void animateMoveImpl(final RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
|
||||
final View view = holder.itemView;
|
||||
final int deltaX = toX - fromX;
|
||||
final int deltaY = toY - fromY;
|
||||
if (deltaX != 0) {
|
||||
ViewCompat.animate(view).translationX(0);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
ViewCompat.animate(view).translationY(0);
|
||||
}
|
||||
// TODO: make EndActions end listeners instead, since end actions aren't called when
|
||||
// vpas are canceled (and can't end them. why?)
|
||||
// need listener functionality in VPACompat for this. Ick.
|
||||
final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
|
||||
mMoveAnimations.add(holder);
|
||||
animation.setDuration(getMoveDuration()).setListener(new VpaListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(View view) {
|
||||
dispatchMoveStarting(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(View view) {
|
||||
if (deltaX != 0) {
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(View view) {
|
||||
animation.setListener(null);
|
||||
dispatchMoveFinished(holder);
|
||||
mMoveAnimations.remove(holder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
|
||||
int fromX, int fromY, int toX, int toY) {
|
||||
if (oldHolder == newHolder) {
|
||||
// Don't know how to run change animations when the same view holder is re-used.
|
||||
// run a move animation to handle position changes.
|
||||
return animateMove(oldHolder, fromX, fromY, toX, toY);
|
||||
}
|
||||
final float prevTranslationX = ViewCompat.getTranslationX(oldHolder.itemView);
|
||||
final float prevTranslationY = ViewCompat.getTranslationY(oldHolder.itemView);
|
||||
final float prevAlpha = ViewCompat.getAlpha(oldHolder.itemView);
|
||||
resetAnimation(oldHolder);
|
||||
int deltaX = (int) (toX - fromX - prevTranslationX);
|
||||
int deltaY = (int) (toY - fromY - prevTranslationY);
|
||||
// recover prev translation state after ending animation
|
||||
ViewCompat.setTranslationX(oldHolder.itemView, prevTranslationX);
|
||||
ViewCompat.setTranslationY(oldHolder.itemView, prevTranslationY);
|
||||
ViewCompat.setAlpha(oldHolder.itemView, prevAlpha);
|
||||
if (newHolder != null) {
|
||||
// carry over translation values
|
||||
resetAnimation(newHolder);
|
||||
ViewCompat.setTranslationX(newHolder.itemView, -deltaX);
|
||||
ViewCompat.setTranslationY(newHolder.itemView, -deltaY);
|
||||
ViewCompat.setAlpha(newHolder.itemView, 0);
|
||||
}
|
||||
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void animateChangeImpl(final ChangeInfo changeInfo) {
|
||||
final RecyclerView.ViewHolder holder = changeInfo.oldHolder;
|
||||
final View view = holder == null ? null : holder.itemView;
|
||||
final RecyclerView.ViewHolder newHolder = changeInfo.newHolder;
|
||||
final View newView = newHolder != null ? newHolder.itemView : null;
|
||||
if (view != null) {
|
||||
final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view).setDuration(
|
||||
getChangeDuration());
|
||||
mChangeAnimations.add(changeInfo.oldHolder);
|
||||
oldViewAnim.translationX((float)(changeInfo.toX - changeInfo.fromX));
|
||||
oldViewAnim.translationY((float)(changeInfo.toY - changeInfo.fromY));
|
||||
oldViewAnim.alpha(0).setListener(new VpaListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(View view) {
|
||||
dispatchChangeStarting(changeInfo.oldHolder, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(View view) {
|
||||
oldViewAnim.setListener(null);
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
dispatchChangeFinished(changeInfo.oldHolder, true);
|
||||
mChangeAnimations.remove(changeInfo.oldHolder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (newView != null) {
|
||||
final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView);
|
||||
mChangeAnimations.add(changeInfo.newHolder);
|
||||
newViewAnimation.translationX(0).translationY(0).setDuration(getChangeDuration()).
|
||||
alpha(1).setListener(new VpaListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(View view) {
|
||||
dispatchChangeStarting(changeInfo.newHolder, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(View view) {
|
||||
newViewAnimation.setListener(null);
|
||||
ViewCompat.setAlpha(newView, 1);
|
||||
ViewCompat.setTranslationX(newView, 0);
|
||||
ViewCompat.setTranslationY(newView, 0);
|
||||
dispatchChangeFinished(changeInfo.newHolder, false);
|
||||
mChangeAnimations.remove(changeInfo.newHolder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void endChangeAnimation(List<ChangeInfo> infoList, RecyclerView.ViewHolder item) {
|
||||
for (int i = infoList.size() - 1; i >= 0; i--) {
|
||||
ChangeInfo changeInfo = infoList.get(i);
|
||||
if (endChangeAnimationIfNecessary(changeInfo, item)) {
|
||||
if (changeInfo.oldHolder == null && changeInfo.newHolder == null) {
|
||||
infoList.remove(changeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void endChangeAnimationIfNecessary(ChangeInfo changeInfo) {
|
||||
if (changeInfo.oldHolder != null) {
|
||||
endChangeAnimationIfNecessary(changeInfo, changeInfo.oldHolder);
|
||||
}
|
||||
if (changeInfo.newHolder != null) {
|
||||
endChangeAnimationIfNecessary(changeInfo, changeInfo.newHolder);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerView.ViewHolder item) {
|
||||
boolean oldItem = false;
|
||||
if (changeInfo.newHolder == item) {
|
||||
changeInfo.newHolder = null;
|
||||
} else if (changeInfo.oldHolder == item) {
|
||||
changeInfo.oldHolder = null;
|
||||
oldItem = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
ViewCompat.setAlpha(item.itemView, 1);
|
||||
ViewCompat.setTranslationX(item.itemView, 0);
|
||||
ViewCompat.setTranslationY(item.itemView, 0);
|
||||
dispatchChangeFinished(item, oldItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimation(RecyclerView.ViewHolder item) {
|
||||
final View view = item.itemView;
|
||||
// this will trigger end callback which should set properties to their target values.
|
||||
ViewCompat.animate(view).cancel();
|
||||
// TODO if some other animations are chained to end, how do we cancel them as well?
|
||||
for (int i = mPendingMoves.size() - 1; i >= 0; i--) {
|
||||
MoveInfo moveInfo = mPendingMoves.get(i);
|
||||
if (moveInfo.holder == item) {
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
dispatchMoveFinished(item);
|
||||
mPendingMoves.remove(i);
|
||||
}
|
||||
}
|
||||
endChangeAnimation(mPendingChanges, item);
|
||||
if (mPendingRemovals.remove(item)) {
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
dispatchRemoveFinished(item);
|
||||
}
|
||||
if (mPendingAdditions.remove(item)) {
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
dispatchAddFinished(item);
|
||||
}
|
||||
|
||||
for (int i = mChangesList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<ChangeInfo> changes = mChangesList.get(i);
|
||||
endChangeAnimation(changes, item);
|
||||
if (changes.isEmpty()) {
|
||||
mChangesList.remove(i);
|
||||
}
|
||||
}
|
||||
for (int i = mMovesList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<MoveInfo> moves = mMovesList.get(i);
|
||||
for (int j = moves.size() - 1; j >= 0; j--) {
|
||||
MoveInfo moveInfo = moves.get(j);
|
||||
if (moveInfo.holder == item) {
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
dispatchMoveFinished(item);
|
||||
moves.remove(j);
|
||||
if (moves.isEmpty()) {
|
||||
mMovesList.remove(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = mAdditionsList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
|
||||
if (additions.remove(item)) {
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
dispatchAddFinished(item);
|
||||
if (additions.isEmpty()) {
|
||||
mAdditionsList.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// animations should be ended by the cancel above.
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
if (mRemoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mRemoveAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
if (mAddAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mAddAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
if (mChangeAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mChangeAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
if (mMoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mMoveAnimations list");
|
||||
}
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
|
||||
private void resetAnimation(RecyclerView.ViewHolder holder) {
|
||||
clearInterpolator(holder.itemView);
|
||||
endAnimation(holder);
|
||||
}
|
||||
|
||||
protected void clearInterpolator(View v) {
|
||||
ViewCompat.setAlpha(v, 1.0F);
|
||||
ViewCompat.setScaleY(v, 1.0F);
|
||||
ViewCompat.setScaleX(v, 1.0F);
|
||||
ViewCompat.setTranslationY(v, 0.0F);
|
||||
ViewCompat.setTranslationX(v, 0.0F);
|
||||
ViewCompat.setRotation(v, 0.0F);
|
||||
ViewCompat.setRotationY(v, 0.0F);
|
||||
ViewCompat.setRotationX(v, 0.0F);
|
||||
ViewCompat.setPivotX(v, (float) ((double)v.getMeasuredWidth() / 2));
|
||||
ViewCompat.animate(v).setInterpolator((Interpolator) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return (!mPendingAdditions.isEmpty() ||
|
||||
!mPendingChanges.isEmpty() ||
|
||||
!mPendingMoves.isEmpty() ||
|
||||
!mPendingRemovals.isEmpty() ||
|
||||
!mMoveAnimations.isEmpty() ||
|
||||
!mRemoveAnimations.isEmpty() ||
|
||||
!mAddAnimations.isEmpty() ||
|
||||
!mChangeAnimations.isEmpty() ||
|
||||
!mMovesList.isEmpty() ||
|
||||
!mAdditionsList.isEmpty() ||
|
||||
!mChangesList.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the state of currently pending and running animations. If there are none
|
||||
* pending/running, call {@link #dispatchAnimationsFinished()} to notify any
|
||||
* listeners.
|
||||
*/
|
||||
protected void dispatchFinishedWhenDone() {
|
||||
if (!isRunning()) {
|
||||
dispatchAnimationsFinished();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimations() {
|
||||
int count = mPendingMoves.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
MoveInfo item = mPendingMoves.get(i);
|
||||
View view = item.holder.itemView;
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
dispatchMoveFinished(item.holder);
|
||||
mPendingMoves.remove(i);
|
||||
}
|
||||
count = mPendingRemovals.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
RecyclerView.ViewHolder item = mPendingRemovals.get(i);
|
||||
dispatchRemoveFinished(item);
|
||||
mPendingRemovals.remove(i);
|
||||
}
|
||||
count = mPendingAdditions.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
RecyclerView.ViewHolder item = mPendingAdditions.get(i);
|
||||
View view = item.itemView;
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
dispatchAddFinished(item);
|
||||
mPendingAdditions.remove(i);
|
||||
}
|
||||
count = mPendingChanges.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
endChangeAnimationIfNecessary(mPendingChanges.get(i));
|
||||
}
|
||||
mPendingChanges.clear();
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int listCount = mMovesList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<MoveInfo> moves = mMovesList.get(i);
|
||||
count = moves.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
MoveInfo moveInfo = moves.get(j);
|
||||
RecyclerView.ViewHolder item = moveInfo.holder;
|
||||
View view = item.itemView;
|
||||
ViewCompat.setTranslationY(view, 0);
|
||||
ViewCompat.setTranslationX(view, 0);
|
||||
dispatchMoveFinished(moveInfo.holder);
|
||||
moves.remove(j);
|
||||
if (moves.isEmpty()) {
|
||||
mMovesList.remove(moves);
|
||||
}
|
||||
}
|
||||
}
|
||||
listCount = mAdditionsList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
|
||||
count = additions.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
RecyclerView.ViewHolder item = additions.get(j);
|
||||
View view = item.itemView;
|
||||
ViewCompat.setAlpha(view, 1);
|
||||
dispatchAddFinished(item);
|
||||
additions.remove(j);
|
||||
if (additions.isEmpty()) {
|
||||
mAdditionsList.remove(additions);
|
||||
}
|
||||
}
|
||||
}
|
||||
listCount = mChangesList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<ChangeInfo> changes = mChangesList.get(i);
|
||||
count = changes.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
endChangeAnimationIfNecessary(changes.get(j));
|
||||
if (changes.isEmpty()) {
|
||||
mChangesList.remove(changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancelAll(mRemoveAnimations);
|
||||
cancelAll(mMoveAnimations);
|
||||
cancelAll(mAddAnimations);
|
||||
cancelAll(mChangeAnimations);
|
||||
|
||||
dispatchAnimationsFinished();
|
||||
}
|
||||
|
||||
void cancelAll(List<RecyclerView.ViewHolder> viewHolders) {
|
||||
for (int i = viewHolders.size() - 1; i >= 0; i--) {
|
||||
ViewCompat.animate(viewHolders.get(i).itemView).cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private static class MoveInfo {
|
||||
public RecyclerView.ViewHolder holder;
|
||||
public int fromX, fromY, toX, toY;
|
||||
|
||||
private MoveInfo(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
|
||||
this.holder = holder;
|
||||
this.fromX = fromX;
|
||||
this.fromY = fromY;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ChangeInfo {
|
||||
public RecyclerView.ViewHolder oldHolder, newHolder;
|
||||
public int fromX, fromY, toX, toY;
|
||||
|
||||
private ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder) {
|
||||
this.oldHolder = oldHolder;
|
||||
this.newHolder = newHolder;
|
||||
}
|
||||
|
||||
private ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
|
||||
int fromX, int fromY, int toX, int toY) {
|
||||
this(oldHolder, newHolder);
|
||||
this.fromX = fromX;
|
||||
this.fromY = fromY;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChangeInfo{" +
|
||||
"oldHolder=" + oldHolder +
|
||||
", newHolder=" + newHolder +
|
||||
", fromX=" + fromX +
|
||||
", fromY=" + fromY +
|
||||
", toX=" + toX +
|
||||
", toY=" + toY +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
protected static class VpaListenerAdapter implements ViewPropertyAnimatorListener {
|
||||
@Override
|
||||
public void onAnimationStart(View view) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(View view) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(View view) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#f06a4d"
|
||||
android:endColor="#ab2002"
|
||||
android:angle="270" />
|
||||
<corners
|
||||
android:radius="0dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,22 @@
|
|||
package com.adins.mss.coll.closingtask.models;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 6/6/2016.
|
||||
*/
|
||||
public class ClosingTaskListResponse extends MssResponseType {
|
||||
@SerializedName("taskList")
|
||||
private List<ClosingTaskEntity> taskList;
|
||||
|
||||
public List<ClosingTaskEntity> getTaskList() {
|
||||
return taskList;
|
||||
}
|
||||
|
||||
public void setTaskList(List<ClosingTaskEntity> taskList) {
|
||||
this.taskList = taskList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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.util;
|
||||
|
||||
/**
|
||||
* An implementation of {@link android.util.Property} to be used specifically with fields of type
|
||||
* <code>float</code>. This type-specific subclass enables performance benefit by allowing
|
||||
* calls to a {@link #set(Object, Float) set()} function that takes the primitive
|
||||
* <code>float</code> type and avoids autoboxing and other overhead associated with the
|
||||
* <code>Float</code> class.
|
||||
*
|
||||
* @param <T> The class on which the Property is declared.
|
||||
* @hide
|
||||
*/
|
||||
public abstract class FloatProperty<T> extends Property<T, Float> {
|
||||
|
||||
public FloatProperty(String name) {
|
||||
super(Float.class, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* A type-specific override of the {@link #set(Object, Float)} that is faster when dealing
|
||||
* with fields of type <code>float</code>.
|
||||
*/
|
||||
public abstract void setValue(T object, float value);
|
||||
|
||||
@Override
|
||||
final public void set(T object, Float value) {
|
||||
setValue(object, value);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.adins.mss.foundation.questiongenerator.form.QuestionView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/questionMultipleLayout">
|
||||
<TextView
|
||||
android:id="@+id/questionMultipleLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="o. Label"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/questionMultipleEmpty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lookup_not_found"
|
||||
android:padding="10dp"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/multipleQuestionListLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="5dp"/>
|
||||
<EditText
|
||||
android:id="@+id/questionMultipleDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
</com.adins.mss.foundation.questiongenerator.form.QuestionView>
|
|
@ -0,0 +1,281 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.adins.mss.base.AppContext;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.dynamicform.form.DynamicQuestionActivity;
|
||||
import com.adins.mss.base.dynamicform.form.questions.DatePickerFragment;
|
||||
import com.adins.mss.base.dynamicform.form.questions.TimePickerFragment;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
|
||||
import com.github.jjobes.slidedatetimepicker.SlideDateTimeListener;
|
||||
import com.github.jjobes.slidedatetimepicker.SlideDateTimePicker;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 31/08/2016.
|
||||
*/
|
||||
public class DateTimeQuestionViewHolder extends RecyclerView.ViewHolder
|
||||
implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
|
||||
public static final int TYPE_DATE = 1;
|
||||
public static final int TYPE_TIME = 2;
|
||||
public static final int TYPE_DATE_TIME = 3;
|
||||
|
||||
Context mContext;
|
||||
public QuestionView mView;
|
||||
public TextView mQuestionLabel;
|
||||
public EditText mQuestionAnswer;
|
||||
public Button mButtonSetDate;
|
||||
public QuestionBean bean;
|
||||
private SlideDateTimeListener dateTimeListener;
|
||||
|
||||
public DateTimeQuestionViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionDtmLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDtmLabel);
|
||||
mQuestionAnswer = (EditText) itemView.findViewById(R.id.questionDtmAnswer);
|
||||
mButtonSetDate = (Button) itemView.findViewById(R.id.btnSetDtm);
|
||||
setDateTimeListener();
|
||||
}
|
||||
|
||||
public DateTimeQuestionViewHolder(Context context, View itemView) {
|
||||
super(itemView);
|
||||
mContext = context;
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionDtmLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDtmLabel);
|
||||
mQuestionAnswer = (EditText) itemView.findViewById(R.id.questionDtmAnswer);
|
||||
mButtonSetDate = (Button) itemView.findViewById(R.id.btnSetDtm);
|
||||
setDateTimeListener();
|
||||
}
|
||||
|
||||
private void setDateTimeListener() {
|
||||
dateTimeListener = new SlideDateTimeListener() {
|
||||
@Override
|
||||
public void onDateTimeSet(Date date) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(date.getTime());
|
||||
cal.set(cal.SECOND, 0);
|
||||
SimpleDateFormat mFormatter = new SimpleDateFormat(Global.DATE_TIME_STR_FORMAT);
|
||||
String dt = mFormatter.format(cal.getTime());
|
||||
mQuestionAnswer.setText(dt);
|
||||
String format = Global.DATE_TIME_STR_FORMAT;
|
||||
Date date2 = null;
|
||||
try {
|
||||
date2 = Formatter.parseDate(dt, format);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String finalAnswer = Formatter.formatDate(date2, Global.DATE_STR_FORMAT_GSON);
|
||||
if (bean.getAnswer() != null && !bean.getAnswer().equals(finalAnswer)) {
|
||||
bean.setIsCanChange(true);
|
||||
bean.setChange(true);
|
||||
} else {
|
||||
bean.setChange(false);
|
||||
}
|
||||
bean.setAnswer(finalAnswer);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void bind(final QuestionBean item, int number) {
|
||||
bean = item;
|
||||
String answerType = bean.getAnswer_type();
|
||||
int type = TYPE_DATE;
|
||||
String questionLabel = number + ". " + bean.getQuestion_label();
|
||||
String format = null;
|
||||
String btnLabel = null;
|
||||
String answer = bean.getAnswer();
|
||||
|
||||
mQuestionLabel.setText(questionLabel);
|
||||
|
||||
View.OnClickListener listener = null;
|
||||
|
||||
if (Global.AT_DATE.equals(answerType)) {
|
||||
type = TYPE_DATE;
|
||||
format = Global.DATE_STR_FORMAT;
|
||||
btnLabel = mContext.getString(R.string.btnDate);
|
||||
listener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
DatePickerFragment datePickerFragment = new DatePickerFragment(DateTimeQuestionViewHolder.this);
|
||||
datePickerFragment.show(DynamicQuestionActivity.fragmentManager, "TYPE_DATE");
|
||||
}
|
||||
};
|
||||
} else if (Global.AT_TIME.equals(answerType)) {
|
||||
type = TYPE_TIME;
|
||||
format = Global.TIME_STR_FORMAT;
|
||||
btnLabel = mContext.getString(R.string.btnTime);
|
||||
listener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
TimePickerFragment timePickerFragment = new TimePickerFragment((DateTimeQuestionViewHolder.this));
|
||||
timePickerFragment.show(DynamicQuestionActivity.fragmentManager, "TYPE_TIME");
|
||||
}
|
||||
};
|
||||
} else if (Global.AT_DATE_TIME.equals(answerType)) {
|
||||
type = TYPE_DATE_TIME;
|
||||
// format = Global.DATE_TIMESEC_STR_FORMAT;
|
||||
format = Global.DATE_TIME_STR_FORMAT;
|
||||
btnLabel = mContext.getString(R.string.btnDate);
|
||||
listener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
new SlideDateTimePicker.Builder(DynamicQuestionActivity.fragmentManager)
|
||||
.setListener(dateTimeListener)
|
||||
.setInitialDate(new Date())
|
||||
.setIs24HourTime(true)
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
type = TYPE_DATE;
|
||||
format = Global.DATE_STR_FORMAT;
|
||||
btnLabel = mContext.getString(R.string.btnDate);
|
||||
listener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
DatePickerFragment datePickerFragment = new DatePickerFragment(DateTimeQuestionViewHolder.this);
|
||||
datePickerFragment.show(DynamicQuestionActivity.fragmentManager, "TYPE_DATE");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (answer != null && !answer.isEmpty()) {
|
||||
try {
|
||||
Date date = null;
|
||||
if (type == TYPE_TIME) {
|
||||
date = Formatter.parseDate(answer, Global.TIME_STR_FORMAT2);
|
||||
} else {
|
||||
String newFormat = Global.DATE_STR_FORMAT;
|
||||
//cek jawaban untuk penjagaan kondisi kondisi yang tidak diinginkan
|
||||
if (answer.length() == 8) {
|
||||
if (answer.contains("-")) {
|
||||
newFormat = Global.DATE_STR_FORMAT1;
|
||||
} else {
|
||||
newFormat = Global.DATE_STR_FORMAT2;
|
||||
}
|
||||
} else if (answer.length() == 9 || answer.length() == 10 || answer.length() == 11) {
|
||||
if ((answer.length() == 9 || answer.length() == 10) && answer.contains("-")) {
|
||||
newFormat = Global.DATE_STR_FORMAT1;
|
||||
} else if ((answer.length() == 11) && answer.contains("-")) {
|
||||
newFormat = Global.DATE_STR_FORMAT5;
|
||||
} else if (answer.contains(" ")) {
|
||||
newFormat = Global.DATE_STR_FORMAT3;
|
||||
} else if (answer.contains("/")) {
|
||||
newFormat = Global.DATE_STR_FORMAT;
|
||||
}
|
||||
} else if (answer.length() == 12) {
|
||||
newFormat = Global.DATE_STR_FORMAT4;
|
||||
} else if (answer.length() == 14) {
|
||||
newFormat = Global.DATE_STR_FORMAT_GSON;
|
||||
}
|
||||
else {
|
||||
newFormat = Global.DATE_TIMESEC_STR_FORMAT;
|
||||
}
|
||||
date = Formatter.parseDate(answer, newFormat);
|
||||
}
|
||||
answer = Formatter.formatDate(date, format);
|
||||
mQuestionAnswer.setText(answer);
|
||||
} catch (Exception ex) {
|
||||
FireCrash.log(ex);
|
||||
try {
|
||||
if (answer != null && answer.length() > 0) {
|
||||
try {
|
||||
long dtLong = Formatter.stringToDate(answer);
|
||||
Date date = new Date(dtLong);
|
||||
if (date != null) {
|
||||
answer = Formatter.formatDate(date, format);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
if (answer != null && answer.length() > 0) {
|
||||
mQuestionAnswer.setText(answer);
|
||||
} else {
|
||||
mQuestionAnswer.setText(format);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
mQuestionAnswer.setText(format);
|
||||
}
|
||||
mButtonSetDate.setText(btnLabel);
|
||||
// mButtonSetDate.setOnClickListener(listener);
|
||||
if (bean.isReadOnly()) {
|
||||
mButtonSetDate.setEnabled(false);
|
||||
mButtonSetDate.setVisibility(View.GONE);
|
||||
mQuestionAnswer.setEnabled(false);
|
||||
} else {
|
||||
mButtonSetDate.setEnabled(true);
|
||||
mButtonSetDate.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mButtonSetDate.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||
String month = Tool.appendZeroForDateTime(monthOfYear, true);
|
||||
String dt = Tool.appendZeroForDateTime(dayOfMonth, false) + "/" + month + "/" + year;
|
||||
mQuestionAnswer.setText(dt);
|
||||
String format = Global.DATE_STR_FORMAT;
|
||||
Date date = null;
|
||||
try {
|
||||
date = Formatter.parseDate(dt, format);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String finalAnswer = Formatter.formatDate(date, Global.DATE_STR_FORMAT_GSON);
|
||||
if (bean.getAnswer() != null && !bean.getAnswer().equals(finalAnswer)) {
|
||||
bean.setIsCanChange(true);
|
||||
bean.setChange(true);
|
||||
} else {
|
||||
if (view.isShown())
|
||||
bean.setChange(false);
|
||||
}
|
||||
bean.setAnswer(finalAnswer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
String hour = Tool.appendZeroForDateTime(hourOfDay, false);
|
||||
String min = Tool.appendZeroForDateTime(minute, false);
|
||||
String dt = hour + ":" + min;
|
||||
mQuestionAnswer.setText(dt);
|
||||
String format = Global.TIME_STR_FORMAT;
|
||||
Date date = null;
|
||||
try {
|
||||
date = Formatter.parseDate(dt, format);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String finalAnswer = Formatter.formatDate(date, Global.TIME_STR_FORMAT2);
|
||||
if (bean.getAnswer() != null && !bean.getAnswer().equals(finalAnswer)) {
|
||||
bean.setIsCanChange(true);
|
||||
bean.setChange(true);
|
||||
} else {
|
||||
bean.setChange(false);
|
||||
}
|
||||
bean.setAnswer(finalAnswer);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_grayscale">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:background="@drawable/actionbar_background">
|
||||
</View>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/summary_kunjungan"
|
||||
android:textSize="16sp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="0">
|
||||
|
||||
<TableRow android:background="#FDD">
|
||||
<TextView android:layout_column="0"
|
||||
android:text="@string/label_tanggal"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"/>
|
||||
<TextView android:layout_column="1"
|
||||
android:text="@string/dummy_tanggal"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"
|
||||
android:gravity="right"
|
||||
android:id="@+id/tanggal"/>
|
||||
</TableRow>
|
||||
<TableRow android:background="#FFF">
|
||||
<TextView android:layout_column="0"
|
||||
android:text="@string/label_collector"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"/>
|
||||
<TextView android:layout_column="1"
|
||||
android:text="@string/dummy_collector"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"
|
||||
android:gravity="right"
|
||||
android:id="@+id/collector"/>
|
||||
</TableRow>
|
||||
<TableRow android:background="#FDD">
|
||||
<TextView android:layout_column="0"
|
||||
android:text="@string/label_total_collected"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"/>
|
||||
<TextView android:layout_column="1"
|
||||
android:text="@string/dummy_total_collected"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"
|
||||
android:gravity="right"
|
||||
android:id="@+id/totalToBeCollected"/>
|
||||
</TableRow>
|
||||
<TableRow android:background="#FFF">
|
||||
<TextView android:layout_column="0"
|
||||
android:text="@string/label_total_paid"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"/>
|
||||
<TextView android:layout_column="1"
|
||||
android:text="@string/dummy_total_paid"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"
|
||||
android:gravity="right"
|
||||
android:id="@+id/totalPaid"/>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,182 @@
|
|||
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 "TR_PRINTRESULT".
|
||||
*/
|
||||
public class PrintResult {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_print_result")
|
||||
private String uuid_print_result;
|
||||
@SerializedName("dtm_crt_server")
|
||||
private java.util.Date dtm_crt_server;
|
||||
@SerializedName("label")
|
||||
private String label;
|
||||
@SerializedName("value")
|
||||
private String value;
|
||||
@SerializedName("print_type_id")
|
||||
private String print_type_id;
|
||||
@SerializedName("usr_crt")
|
||||
private String usr_crt;
|
||||
@SerializedName("dtm_crt")
|
||||
private java.util.Date dtm_crt;
|
||||
@SerializedName("uuid_task_h")
|
||||
private String uuid_task_h;
|
||||
|
||||
/** Used to resolve relations */
|
||||
private transient DaoSession daoSession;
|
||||
|
||||
/** Used for active entity operations. */
|
||||
private transient PrintResultDao myDao;
|
||||
|
||||
private User user;
|
||||
private String user__resolvedKey;
|
||||
|
||||
|
||||
public PrintResult() {
|
||||
}
|
||||
|
||||
public PrintResult(String uuid_print_result) {
|
||||
this.uuid_print_result = uuid_print_result;
|
||||
}
|
||||
|
||||
public PrintResult(String uuid_print_result, java.util.Date dtm_crt_server, String label, String value, String print_type_id, String usr_crt, java.util.Date dtm_crt, String uuid_task_h) {
|
||||
this.uuid_print_result = uuid_print_result;
|
||||
this.dtm_crt_server = dtm_crt_server;
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.print_type_id = print_type_id;
|
||||
this.usr_crt = usr_crt;
|
||||
this.dtm_crt = dtm_crt;
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
}
|
||||
|
||||
/** called by internal mechanisms, do not call yourself. */
|
||||
public void __setDaoSession(DaoSession daoSession) {
|
||||
this.daoSession = daoSession;
|
||||
myDao = daoSession != null ? daoSession.getPrintResultDao() : null;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_print_result() {
|
||||
return uuid_print_result;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_print_result(String uuid_print_result) {
|
||||
this.uuid_print_result = uuid_print_result;
|
||||
}
|
||||
|
||||
public java.util.Date getDtm_crt_server() {
|
||||
return dtm_crt_server;
|
||||
}
|
||||
|
||||
public void setDtm_crt_server(java.util.Date dtm_crt_server) {
|
||||
this.dtm_crt_server = dtm_crt_server;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getPrint_type_id() {
|
||||
return print_type_id;
|
||||
}
|
||||
|
||||
public void setPrint_type_id(String print_type_id) {
|
||||
this.print_type_id = print_type_id;
|
||||
}
|
||||
|
||||
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 getUuid_task_h() {
|
||||
return uuid_task_h;
|
||||
}
|
||||
|
||||
public void setUuid_task_h(String uuid_task_h) {
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
}
|
||||
|
||||
/** To-one relationship, resolved on first access. */
|
||||
public User getUser() {
|
||||
String __key = this.uuid_task_h;
|
||||
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_task_h = user == null ? null : user.getUuid_user();
|
||||
user__resolvedKey = uuid_task_h;
|
||||
}
|
||||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue