mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,9 @@
|
|||
package com.adins.mss.coll.interfaces.callback;
|
||||
|
||||
/**
|
||||
* Created by intishar.fa on 15/01/2019.
|
||||
*/
|
||||
|
||||
public interface SaveDataInstallmentCallback {
|
||||
void onSaveFinished(boolean result);
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.PrintResult;
|
||||
import com.adins.mss.dao.PrintResultDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class PrintResultDataAccess {
|
||||
|
||||
// private static DaoOpenHelper daoOpenHelper;
|
||||
|
||||
/**
|
||||
* use to generate dao session that you can access modelDao
|
||||
*
|
||||
* @param context --> context from activity
|
||||
* @return
|
||||
*/
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
/*if(daoOpenHelper==null){
|
||||
// if(daoOpenHelper.getDaoSession()==null)
|
||||
daoOpenHelper = new DaoOpenHelper(context);
|
||||
}
|
||||
DaoSession daoSeesion = daoOpenHelper.getDaoSession();
|
||||
return daoSeesion;*/
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get printResult dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static PrintResultDao getPrintResulDao(Context context) {
|
||||
return getDaoSession(context).getPrintResultDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
/*if(daoOpenHelper!=null){
|
||||
daoOpenHelper.closeAll();
|
||||
daoOpenHelper = null;
|
||||
}*/
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add printResult as entity
|
||||
*
|
||||
* @param context
|
||||
* @param printResult
|
||||
*/
|
||||
public static void add(Context context, PrintResult printResult) {
|
||||
getPrintResulDao(context).insertInTx(printResult);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* add printResult as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param printResultList
|
||||
*/
|
||||
public static void add(Context context, List<PrintResult> printResultList) {
|
||||
getPrintResulDao(context).insertInTx(printResultList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getPrintResulDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param printResult
|
||||
*/
|
||||
public static void delete(Context context, PrintResult printResult) {
|
||||
getPrintResulDao(context).delete(printResult);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by keyTaskH
|
||||
*
|
||||
* @param context
|
||||
* @param keyTaskH
|
||||
*/
|
||||
public static void delete(Context context, String keyTaskH) {
|
||||
QueryBuilder<PrintResult> qb = getPrintResulDao(context).queryBuilder();
|
||||
qb.where(PrintResultDao.Properties.Uuid_task_h.eq(keyTaskH));
|
||||
qb.build();
|
||||
getPrintResulDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param printResult
|
||||
*/
|
||||
public static void update(Context context, PrintResult printResult) {
|
||||
getPrintResulDao(context).update(printResult);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_task_h = param
|
||||
*
|
||||
* @param context
|
||||
* @param keyTaskH
|
||||
* @return
|
||||
*/
|
||||
public static List<PrintResult> getAll(Context context, String keyTaskH) {
|
||||
QueryBuilder<PrintResult> qb = getPrintResulDao(context).queryBuilder();
|
||||
qb.where(PrintResultDao.Properties.Uuid_task_h.eq(keyTaskH));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* select printResult per
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 180 KiB |
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:fromXScale="0.3" android:toXScale="1.0"
|
||||
android:fromYScale="0.3" android:toYScale="1.0"
|
||||
android:pivotX="50%" android:pivotY="0%"
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
/>
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
/>
|
||||
</set>
|
|
@ -0,0 +1,22 @@
|
|||
package com.adins.mss.odr.model;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by adityapurwa on 11/03/15.
|
||||
*/
|
||||
public class SynchronizeResponse<T> extends MssResponseType {
|
||||
@SerializedName("listSync")
|
||||
private List<T> listSync;
|
||||
|
||||
public List<T> getListSync() {
|
||||
return listSync;
|
||||
}
|
||||
|
||||
public void setListSync(List<T> listSync) {
|
||||
this.listSync = listSync;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
||||
<item android:drawable="@color/theme_accent" android:state_selected="true"/>
|
||||
<item android:drawable="@color/theme_accent" android:state_pressed="true"/>
|
||||
<item android:drawable="@color/card"/>
|
||||
</selector>
|
|
@ -0,0 +1,138 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.dynamicform.DynamicFormActivity;
|
||||
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 07/10/2016.
|
||||
*/
|
||||
|
||||
public class LookupQuestionViewHolder extends RecyclerView.ViewHolder {
|
||||
public QuestionView mView;
|
||||
public TextView mQuestionLabel;
|
||||
public TextView mQuestionAnswer;
|
||||
public TextView mTxtSelectedAnswer;
|
||||
public Button mButtonChooseLookup;
|
||||
public TableLayout criteriaTableLayout;
|
||||
public QuestionBean bean;
|
||||
public FragmentActivity mActivity;
|
||||
public OnQuestionClickListener mListener;
|
||||
private int group;
|
||||
private int position;
|
||||
|
||||
public LookupQuestionViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionLookupLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionLookupLabel);
|
||||
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionLookupAnswer);
|
||||
mTxtSelectedAnswer = (TextView) itemView.findViewById(R.id.txtSelectedAnswer);
|
||||
mButtonChooseLookup = (Button) itemView.findViewById(R.id.btnChooseLookup);
|
||||
criteriaTableLayout = (TableLayout) itemView.findViewById(R.id.questionLookupAnswerLayout);
|
||||
}
|
||||
|
||||
public LookupQuestionViewHolder(View itemView, FragmentActivity activity, OnQuestionClickListener listener) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionLookupLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionLookupLabel);
|
||||
mQuestionAnswer = (TextView) itemView.findViewById(R.id.questionLookupAnswer);
|
||||
mButtonChooseLookup = (Button) itemView.findViewById(R.id.btnChooseLookup);
|
||||
mTxtSelectedAnswer = (TextView) itemView.findViewById(R.id.txtSelectedAnswer);
|
||||
criteriaTableLayout = (TableLayout) itemView.findViewById(R.id.questionLookupAnswerLayout);
|
||||
mActivity = activity;
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public void bind(final QuestionBean item, final int group, final int number) {
|
||||
bean = item;
|
||||
this.group = group;
|
||||
position = number - 1;
|
||||
String qLabel = number + ". " + bean.getQuestion_label();
|
||||
|
||||
mQuestionLabel.setText(qLabel);
|
||||
|
||||
mButtonChooseLookup.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mListener.onLookupSelectedListener(bean, group, position);
|
||||
}
|
||||
});
|
||||
criteriaTableLayout.removeAllViews();
|
||||
if (bean.getAnswer() != null && !bean.getAnswer().isEmpty()) {
|
||||
mTxtSelectedAnswer.setVisibility(View.VISIBLE);
|
||||
mButtonChooseLookup.setText(mActivity.getString(R.string.change_answer));
|
||||
criteriaTableLayout.setVisibility(View.VISIBLE);
|
||||
mQuestionAnswer.setText(bean.getAnswer());
|
||||
String[] values = Tool.split(bean.getAnswer(), Global.DELIMETER_ROW);
|
||||
String[] lookupCode = Tool.split(values[0], Global.DELIMETER_DATA_LOOKUP);
|
||||
String[] lookupValue = null;
|
||||
if (values.length > 1)
|
||||
lookupValue = Tool.split(values[1], Global.DELIMETER_DATA_LOOKUP);
|
||||
StringBuilder lovCode = new StringBuilder();
|
||||
StringBuilder lovValue = new StringBuilder();
|
||||
for (int i = 0; i < lookupCode.length; i++) {
|
||||
TableRow row = (TableRow) LayoutInflater.from(mActivity).inflate(R.layout.lookup_criteria_row, criteriaTableLayout, false);
|
||||
String code = lookupCode[i];
|
||||
if (lovCode.length() != 0)
|
||||
lovCode.append("\n");
|
||||
lovCode.append(code);
|
||||
if (lookupValue != null) {
|
||||
String value = lookupValue[i] != null ? lookupValue[i] : "";
|
||||
if (lovValue.length() != 0)
|
||||
lovValue.append("\n");
|
||||
lovValue.append(value);
|
||||
|
||||
TextView textDesc = (TextView) row.findViewById(R.id.fieldValue);
|
||||
textDesc.setText(value);
|
||||
}
|
||||
if (i % 2 == 0) {
|
||||
row.setBackgroundResource(R.color.tv_gray_light);
|
||||
} else if (i % 2 == 1) {
|
||||
row.setBackgroundResource(R.color.tv_gray);
|
||||
}
|
||||
criteriaTableLayout.addView(row);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
mTxtSelectedAnswer.setVisibility(View.GONE);
|
||||
mButtonChooseLookup.setText(mActivity.getString(R.string.chooseLookup));
|
||||
criteriaTableLayout.setVisibility(View.GONE);
|
||||
mQuestionAnswer.setText("");
|
||||
}
|
||||
|
||||
if (bean.isReadOnly()) {
|
||||
mButtonChooseLookup.setVisibility(View.GONE);
|
||||
mButtonChooseLookup.setEnabled(false);
|
||||
} else {
|
||||
mButtonChooseLookup.setVisibility(View.VISIBLE);
|
||||
mButtonChooseLookup.setEnabled(true);
|
||||
}
|
||||
|
||||
if (DynamicFormActivity.getIsVerified() || DynamicFormActivity.getIsApproval())
|
||||
mButtonChooseLookup.setVisibility(View.GONE);
|
||||
else {
|
||||
mButtonChooseLookup.setVisibility(View.VISIBLE);
|
||||
if (bean.isReadOnly()) {
|
||||
mButtonChooseLookup.setVisibility(View.GONE);
|
||||
mButtonChooseLookup.setEnabled(false);
|
||||
} else {
|
||||
mButtonChooseLookup.setVisibility(View.VISIBLE);
|
||||
mButtonChooseLookup.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?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/questionDrawingLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/questionDrawingLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0. label" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgDrawing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@android:drawable/ic_menu_edit" />
|
||||
</LinearLayout>
|
||||
</com.adins.mss.foundation.questiongenerator.form.QuestionView>
|
|
@ -0,0 +1,68 @@
|
|||
package com.adins.mss.base.api;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.models.CheckResubmitRequest;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by eric.sn on 4/5/2017.
|
||||
*/
|
||||
|
||||
public class CheckResubmitApi {
|
||||
private final Context context;
|
||||
|
||||
public CheckResubmitApi(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public MssResponseType request(String uuidtaskH) throws IOException {
|
||||
CheckResubmitRequest request = new CheckResubmitRequest();
|
||||
request.setUuidTaskH(uuidtaskH);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String requestJson = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_CHECK_RESUBMIT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, requestJson);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, requestJson, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
String responseJson = "";
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
responseJson = serverResult.getResult();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
// bong 21 mei 15 - add or replace to local database
|
||||
MssResponseType checkResubmitResp = GsonHelper.fromJson(responseJson, MssResponseType.class);
|
||||
return checkResubmitResp;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue