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
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
|
@ -0,0 +1,30 @@
|
|||
package com.adins.mss.foundation.oauth2;
|
||||
|
||||
|
||||
public class OAuthConstants {
|
||||
|
||||
public static final String ACCESS_TOKEN = "access_token";
|
||||
public static final String CLIENT_ID = "client_id";
|
||||
public static final String CLIENT_SECRET = "client_secret";
|
||||
public static final String REFRESH_TOKEN = "refresh_token";
|
||||
public static final String USERNAME = "username";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String AUTHENTICATION_SERVER_URL = "authentication_server_url";
|
||||
public static final String RESOURCE_SERVER_URL = "resource_server_url";
|
||||
public static final String GRANT_TYPE = "grant_type";
|
||||
public static final String SCOPE = "scope";
|
||||
public static final String AUTHORIZATION = "Authorization";
|
||||
public static final String BEARER = "Bearer";
|
||||
public static final String BASIC = "Basic";
|
||||
public static final String JSON_CONTENT = "application/json";
|
||||
public static final String XML_CONTENT = "application/xml";
|
||||
public static final String URL_ENCODED_CONTENT = "application/x-www-form-urlencoded";
|
||||
public static final String EXPIRES_IN = "expires_in";
|
||||
public static final String TOKEN_TYPE = "token_type";
|
||||
public static final int HTTP_OK = 200;
|
||||
public static final int HTTP_FORBIDDEN = 403;
|
||||
public static final int HTTP_UNAUTHORIZED = 401;
|
||||
public static final int HTTP_BAD_REQUEST = 400;
|
||||
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,29 @@
|
|||
package com.adins.mss.base.models;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SyncParamSuccessRequest extends MssRequestType {
|
||||
|
||||
@SerializedName("uuid_user")
|
||||
private String uuidUser;
|
||||
@SerializedName("dtm_success")
|
||||
private String dtmSuccess;
|
||||
|
||||
public String getUuidUser() {
|
||||
return uuidUser;
|
||||
}
|
||||
|
||||
public void setUuidUser(String uuidUser) {
|
||||
this.uuidUser = uuidUser;
|
||||
}
|
||||
|
||||
public String getDtmSuccess() {
|
||||
return dtmSuccess;
|
||||
}
|
||||
|
||||
public void setDtmSuccess(String dtmSuccess) {
|
||||
this.dtmSuccess = dtmSuccess;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.InputType;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.adins.mss.base.AppContext;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.dynamicform.DynamicFormActivity;
|
||||
import com.adins.mss.base.dynamicform.JsonRequestDigitalReceipt;
|
||||
import com.adins.mss.base.dynamicform.JsonResponseDigitalReceipt;
|
||||
import com.adins.mss.base.dynamicform.form.questions.QuestionViewAdapter;
|
||||
import com.adins.mss.base.util.EventBusHelper;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.AuditDataType;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by noerhayati.dm on 8/1/2018.
|
||||
*/
|
||||
|
||||
public class DigitalReceiptQuestionViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public FragmentActivity mActivity;
|
||||
public QuestionView mView;
|
||||
public TextView mQuestionLabel;
|
||||
public EditText mQuestionAnswer;
|
||||
public Button mButtonRequest;
|
||||
public QuestionBean bean;
|
||||
public String resultRvMOBILE;
|
||||
private ProgressDialog progressDialog;
|
||||
private String tempText;
|
||||
private String errorMessage;
|
||||
private Integer maxDefaultRetry = 1;
|
||||
|
||||
public DigitalReceiptQuestionViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionDigitalReceiptLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDigitalReceiptLabel);
|
||||
mQuestionAnswer = (EditText) itemView.findViewById(R.id.questionDigitalReceiptAnswer);
|
||||
mButtonRequest = (Button) itemView.findViewById(R.id.btnGetDigitalReceipt);
|
||||
}
|
||||
|
||||
public DigitalReceiptQuestionViewHolder(View itemView, FragmentActivity activity) {
|
||||
super(itemView);
|
||||
mActivity = activity;
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionDigitalReceiptLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionDigitalReceiptLabel);
|
||||
mQuestionAnswer = (EditText) itemView.findViewById(R.id.questionDigitalReceiptAnswer);
|
||||
mButtonRequest = (Button) itemView.findViewById(R.id.btnGetDigitalReceipt);
|
||||
}
|
||||
|
||||
public void bind(final QuestionBean item, final int number) {
|
||||
bean = item;
|
||||
String questionLabel = number + ". " + bean.getQuestion_label();
|
||||
String answer = bean.getAnswer();
|
||||
View.OnClickListener clickListener;
|
||||
|
||||
mQuestionLabel.setText(questionLabel);
|
||||
mQuestionAnswer.setSingleLine(true);
|
||||
mQuestionAnswer.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
|
||||
if (bean.isRelevanted()) {
|
||||
mQuestionAnswer.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
}
|
||||
|
||||
mQuestionAnswer.setSingleLine(false);
|
||||
mQuestionAnswer.setCursorVisible(false);
|
||||
mQuestionAnswer.setEnabled(false);
|
||||
|
||||
if (answer != null && !answer.isEmpty()) {
|
||||
mQuestionAnswer.setText(answer);
|
||||
mButtonRequest.setVisibility(View.GONE);
|
||||
} else {
|
||||
mQuestionAnswer.setText(null);
|
||||
}
|
||||
|
||||
tempText = bean.getAnswer() != null ? bean.getAnswer() : "";
|
||||
|
||||
if (QuestionViewAdapter.IsRvMobileQuestion(Integer.valueOf(bean.getAnswer_type()))) {
|
||||
String lastAnswer = mQuestionAnswer.getText().toString().trim();
|
||||
if (tempText.equals(lastAnswer)) {
|
||||
bean.setBtnCheckClicked(true);
|
||||
}
|
||||
}
|
||||
|
||||
clickListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
EventBusHelper.post(bean);
|
||||
bean.setBtnCheckClicked(true);
|
||||
String number = mQuestionAnswer.getText().toString().trim();
|
||||
GetDigitalReceiptMobile rvMobileTask = new GetDigitalReceiptMobile(mActivity, number);
|
||||
rvMobileTask.execute();
|
||||
}
|
||||
};
|
||||
|
||||
mButtonRequest.setOnClickListener(clickListener);
|
||||
}
|
||||
|
||||
private class GetDigitalReceiptMobile extends AsyncTask<Void, Void, JsonResponseDigitalReceipt> {
|
||||
public FragmentActivity activity;
|
||||
private String number;
|
||||
|
||||
public GetDigitalReceiptMobile(FragmentActivity activity, String number) {
|
||||
this.activity = activity;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(mActivity, "", mActivity.getString(R.string.please_wait_rv_mobile), true);
|
||||
progressDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonResponseDigitalReceipt doInBackground(Void... params) {
|
||||
|
||||
JsonResponseDigitalReceipt responseDigitalReceipt = null;
|
||||
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
JsonRequestDigitalReceipt requestDigitalReceipt = new JsonRequestDigitalReceipt();
|
||||
AuditDataType auditData = GlobalData.getSharedGlobalData().getAuditData();
|
||||
requestDigitalReceipt.setAudit(auditData);
|
||||
requestDigitalReceipt.addImeiAndroidIdToUnstructured();
|
||||
requestDigitalReceipt.setUuidUser(GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(mActivity, encrypt, decrypt);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DIGITAL_RECEIPT();
|
||||
HttpConnectionResult serverResult;
|
||||
|
||||
try {
|
||||
String json = GsonHelper.toJson(requestDigitalReceipt);
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
responseDigitalReceipt = GsonHelper.fromJson(serverResult.getResult(), JsonResponseDigitalReceipt.class);
|
||||
} catch (Exception e) {
|
||||
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("errorGetMessageFromServer", Tool.getSystemDateTime().toLocaleString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat convert json dari server"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ACRA.getErrorReporter().putCustomData("errorRequestToServer", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("errorRequestToServer", Tool.getSystemDateTime().toLocaleString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat request ke server"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
errorMessage = AppContext.getAppContext().getString(R.string.no_internet_connection);
|
||||
}
|
||||
|
||||
if (responseDigitalReceipt != null) {
|
||||
if (1 == responseDigitalReceipt.getStatus().getCode()) {
|
||||
return responseDigitalReceipt;
|
||||
} else {
|
||||
String message = responseDigitalReceipt.getStatus().getMessage();
|
||||
errorMessage = message;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonResponseDigitalReceipt results) {
|
||||
super.onPostExecute(results);
|
||||
DynamicFormActivity.header.setPts_date(new Date());
|
||||
TaskHDataAccess.addOrReplace(activity, DynamicFormActivity.header.getTaskH());
|
||||
if (errorMessage != null) {
|
||||
if (errorMessage.equals(AppContext.getAppContext().getString(R.string.no_internet_connection).toString())) {
|
||||
Toast.makeText(mActivity, AppContext.getAppContext().getString(R.string.no_internet_connection).toString(), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(mActivity, errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
errorMessage = null;
|
||||
} else {
|
||||
if (results != null) {
|
||||
resultRvMOBILE = results.getRvNumberMobile();
|
||||
mQuestionAnswer.setText(resultRvMOBILE);
|
||||
mButtonRequest.setVisibility(View.GONE);
|
||||
bean.setAnswer(resultRvMOBILE);
|
||||
EventBusHelper.post(results);
|
||||
}
|
||||
}
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.foundation.http;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 7/25/2016.
|
||||
*/
|
||||
public class ForceLogoutResponse {
|
||||
private String message;
|
||||
|
||||
public ForceLogoutResponse() {
|
||||
|
||||
}
|
||||
|
||||
public ForceLogoutResponse(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
package com.adins.mss.base.dynamicform.form.questions.viewholder;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.questiongenerator.OptionAnswerBean;
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
import com.adins.mss.foundation.questiongenerator.form.QuestionView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 01/09/2016.
|
||||
*/
|
||||
public class RadioQuestionViewHolder extends RecyclerView.ViewHolder implements TextWatcher {
|
||||
public QuestionView mView;
|
||||
public TextView mQuestionLabel;
|
||||
public TextView mRadioEmpty;
|
||||
public RadioGroup mRadioLayout;
|
||||
public EditText mDescription;
|
||||
public QuestionBean bean;
|
||||
public FragmentActivity mActivity;
|
||||
protected List<OptionAnswerBean> options;
|
||||
protected LinearLayout.LayoutParams defLayout = new LinearLayout.LayoutParams(
|
||||
MATCH_PARENT, WRAP_CONTENT);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public RadioQuestionViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionRadioLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionRadioLabel);
|
||||
mRadioEmpty = (TextView) itemView.findViewById(R.id.questionRadioEmpty);
|
||||
mRadioLayout = (RadioGroup) itemView.findViewById(R.id.radioQuestionList);
|
||||
mDescription = (EditText) itemView.findViewById(R.id.questionRadioDescription);
|
||||
}
|
||||
|
||||
public RadioQuestionViewHolder(View itemView, FragmentActivity activity) {
|
||||
super(itemView);
|
||||
mView = (QuestionView) itemView.findViewById(R.id.questionRadioLayout);
|
||||
mQuestionLabel = (TextView) itemView.findViewById(R.id.questionRadioLabel);
|
||||
mRadioEmpty = (TextView) itemView.findViewById(R.id.questionRadioEmpty);
|
||||
mRadioLayout = (RadioGroup) itemView.findViewById(R.id.radioQuestionList);
|
||||
mDescription = (EditText) itemView.findViewById(R.id.questionRadioDescription);
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
public void bind(final QuestionBean item, int number) {
|
||||
bean = item;
|
||||
options = bean.getOptionAnswers();
|
||||
String qLabel = number + ". " + bean.getQuestion_label();
|
||||
mQuestionLabel.setText(qLabel);
|
||||
if (bean.isReadOnly()) {
|
||||
mRadioLayout.setClickable(false);
|
||||
mRadioLayout.setEnabled(false);
|
||||
} else {
|
||||
mRadioLayout.setClickable(true);
|
||||
mRadioLayout.setEnabled(true);
|
||||
}
|
||||
mRadioLayout.removeAllViews();
|
||||
mRadioLayout.clearCheck();
|
||||
int i = 0;
|
||||
if (options != null && !options.isEmpty()) {
|
||||
for (OptionAnswerBean optBean : options) {
|
||||
RadioButton rb = new RadioButton(mActivity);
|
||||
rb.setText(optBean.getValue());
|
||||
if (optBean.isSelected()) {
|
||||
rb.setSelected(true);
|
||||
rb.setChecked(true);
|
||||
} else {
|
||||
rb.setSelected(false);
|
||||
rb.setChecked(false);
|
||||
}
|
||||
rb.setId(i);
|
||||
rb.setEnabled(true);
|
||||
if (bean.isReadOnly()) {
|
||||
rb.setEnabled(false);
|
||||
}
|
||||
mRadioLayout.addView(rb, defLayout);
|
||||
i++;
|
||||
}
|
||||
|
||||
mRadioEmpty.setVisibility(View.GONE);
|
||||
} else {
|
||||
mRadioEmpty.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mRadioLayout.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (group != null && group.getCheckedRadioButtonId() != -1) {
|
||||
if (!bean.isReadOnly()) {
|
||||
List<OptionAnswerBean> tempSelectedItems = bean.getSelectedOptionAnswers();
|
||||
OptionAnswerBean newSelectedItem = options.get(checkedId);
|
||||
if (tempSelectedItems != null && !tempSelectedItems.isEmpty()) {
|
||||
if(!bean.isChange()) {
|
||||
if (tempSelectedItems.get(0).getUuid_lookup() != null
|
||||
&& !tempSelectedItems.get(0).getUuid_lookup().equals(newSelectedItem.getUuid_lookup())) {
|
||||
mView.setChanged(true);
|
||||
bean.setChange(true);
|
||||
} else {
|
||||
bean.setChange(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bean.setChange(false);
|
||||
}
|
||||
} else {
|
||||
bean.setChange(false);
|
||||
}
|
||||
saveSelectedOptionToBean();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (Global.AT_RADIO_W_DESCRIPTION.equals(bean.getAnswer_type()))
|
||||
enableDescription(true);
|
||||
else
|
||||
enableDescription(false);
|
||||
mDescription.addTextChangedListener(this);
|
||||
selectSavedOptionsFromBeans(bean.getSelectedOptionAnswers());
|
||||
}
|
||||
|
||||
private void selectSavedOptionsFromBeans(List<OptionAnswerBean> beans) {
|
||||
if (beans == null) return;
|
||||
|
||||
for (OptionAnswerBean optAnsBean : beans) {
|
||||
String lovCode = optAnsBean.getCode();
|
||||
String description = null;
|
||||
if (Global.AT_RADIO_W_DESCRIPTION.equals(bean.getAnswer_type())) {
|
||||
description = bean.getAnswer();
|
||||
}
|
||||
selectOption(lovCode, description);
|
||||
}
|
||||
}
|
||||
|
||||
private void selectOption(String lovCode, String description) {
|
||||
int indexOfOption = -1;
|
||||
int i = 0;
|
||||
for (OptionAnswerBean optAnsBean : options) {
|
||||
if (lovCode.equals(optAnsBean.getCode())) {
|
||||
indexOfOption = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (indexOfOption > -1) {
|
||||
mRadioLayout.check(i);
|
||||
|
||||
if (description != null) {
|
||||
enableDescription(true);
|
||||
mDescription.setText(description);
|
||||
}
|
||||
} else {
|
||||
mRadioLayout.clearCheck();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableDescription(boolean enable) {
|
||||
if (enable) {
|
||||
if (null != bean.getMax_length() ) {
|
||||
InputFilter[] inputFilters = {new InputFilter.LengthFilter(
|
||||
bean.getMax_length() == 0 ? Global.DEFAULT_MAX_LENGTH : bean.getMax_length())};
|
||||
mDescription.setFilters(inputFilters);
|
||||
}
|
||||
mDescription.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDescription.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveSelectedOptionToBean() {
|
||||
int selectedRadioId = mRadioLayout.getCheckedRadioButtonId();
|
||||
if (selectedRadioId == -1) {
|
||||
setSelectedOptionAnswer(null);
|
||||
} else {
|
||||
OptionAnswerBean selectedItem = options.get(selectedRadioId);
|
||||
//check description if any
|
||||
if (mDescription.getVisibility() == View.VISIBLE && !mDescription.getText().toString().trim().isEmpty()) {
|
||||
String description = mDescription.getText().toString();
|
||||
|
||||
bean.setAnswer(description);
|
||||
} else {
|
||||
bean.setAnswer(null);
|
||||
}
|
||||
|
||||
if (selectedItem != null) setSelectedOptionAnswer(selectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void setSelectedOptionAnswer(OptionAnswerBean option) {
|
||||
List<OptionAnswerBean> selectedOptionAnswers = new ArrayList<>();
|
||||
for (OptionAnswerBean mBean : options) {
|
||||
mBean.setSelected(false);
|
||||
}
|
||||
if (option != null) {
|
||||
option.setSelected(true);
|
||||
selectedOptionAnswers.add(option);
|
||||
bean.setLovCode(option.getCode());
|
||||
bean.setLookupId(option.getUuid_lookup());
|
||||
} else {
|
||||
bean.setLovCode(null);
|
||||
bean.setLookupId(null);
|
||||
}
|
||||
bean.setSelectedOptionAnswers(selectedOptionAnswers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
//EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
//EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (mDescription.getVisibility() == View.VISIBLE)
|
||||
saveSelectedOptionToBean();
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,91 @@
|
|||
package com.adins.mss.svy.reassignment;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author gigin.ginanjar
|
||||
*
|
||||
*/
|
||||
public class JsonRequestCheckOrder extends MssRequestType{
|
||||
@SerializedName("order_number")
|
||||
String order_number;
|
||||
@SerializedName("start_date")
|
||||
String start_date;
|
||||
@SerializedName("end_date")
|
||||
String end_date;
|
||||
@SerializedName("status")
|
||||
String status;
|
||||
@SerializedName("flag")
|
||||
String flag;
|
||||
|
||||
/**
|
||||
* Gets the flag
|
||||
*/
|
||||
public String getFlag() {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag
|
||||
*/
|
||||
public void setFlag(String value) {
|
||||
this.flag = value;
|
||||
}
|
||||
/**
|
||||
* Gets the orderNumber
|
||||
*/
|
||||
public String getOrderNumber() {
|
||||
return this.order_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the orderNumber
|
||||
*/
|
||||
public void setOrderNumber(String value) {
|
||||
this.order_number = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the startDate
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return this.start_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the startDate
|
||||
*/
|
||||
public void setStartDate(String value) {
|
||||
this.start_date = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the endDate
|
||||
*/
|
||||
public String getEndDate() {
|
||||
return this.end_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the endDate
|
||||
*/
|
||||
public void setEndDate(String value) {
|
||||
this.end_date = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status
|
||||
*/
|
||||
public void setStatus(String value) {
|
||||
this.status = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.core.content.FileProvider;
|
||||
import android.util.Base64;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
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.odr.BuildConfig;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/30/2017.
|
||||
*/
|
||||
|
||||
public class LoadPdf extends AsyncTask<Void, Void, String> {
|
||||
private FragmentActivity activity;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private String result;
|
||||
private String uuid;
|
||||
|
||||
public LoadPdf(FragmentActivity activity, String uuid) {
|
||||
this.activity = activity;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
LoadPdfRequest request = new LoadPdfRequest();
|
||||
request.setUuidCatalogue(uuid);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CATALOGUE_PDF();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadPdfResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadPdfResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
result = response.getCataloguePdf();
|
||||
if (result != null && !result.isEmpty()) {
|
||||
// Catalogue catalogue = CatalogueDataAccess.getOne(activity, uuid);
|
||||
// catalogue.setCatalogue_file(result);
|
||||
// CatalogueDataAccess.addOrReplace(activity, catalogue);
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
GetFilePathAndStatus filepath = getFile(result, "catalogue", "pdf");
|
||||
File file = new File(filepath.filePath);
|
||||
Uri uri;
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
uri = FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".fileprovider", file);
|
||||
} else
|
||||
uri = Uri.fromFile(file);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.setDataAndType(uri, "application/pdf");
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static GetFilePathAndStatus getFile(String base64, String filename, String extension){
|
||||
GetFilePathAndStatus getFilePathAndStatus = new GetFilePathAndStatus();
|
||||
|
||||
try(FileOutputStream os = new FileOutputStream(getReportPath(filename,extension), false)) {
|
||||
byte[] pdfAsBytes = Base64.decode(base64, 0);
|
||||
os.write(pdfAsBytes);
|
||||
os.flush();
|
||||
getFilePathAndStatus.filStatus = true;
|
||||
getFilePathAndStatus.filePath = getReportPath(filename, extension);
|
||||
return getFilePathAndStatus;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
getFilePathAndStatus.filStatus = false;
|
||||
getFilePathAndStatus.filePath = getReportPath(filename, extension);
|
||||
return getFilePathAndStatus;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getReportPath(String filename,String extension) {
|
||||
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "ParentFolder/Report");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String uriSting = (file.getAbsolutePath() + "/" + filename + "."+extension);
|
||||
return uriSting;
|
||||
|
||||
}
|
||||
public static class GetFilePathAndStatus{
|
||||
public boolean filStatus;
|
||||
public String filePath;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/LinearLayout1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bgColor">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
app:titleTextAppearance="?android:attr/textAppearanceSmall"
|
||||
android:titleTextColor="@color/fontColorWhite"
|
||||
android:background="@drawable/header" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/toolbar"
|
||||
android:layout_above="@id/btnSubmit"
|
||||
android:layout_marginBottom="60dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="5dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/formName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:drawableLeft="@drawable/ic_form_color"
|
||||
android:drawablePadding="5dp"
|
||||
android:padding="5dp"
|
||||
android:text="@string/form_name"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/gradient_end"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/formName"
|
||||
android:orientation="vertical">
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/formName"
|
||||
android:layout_weight="0.5">
|
||||
<TableLayout
|
||||
android:id="@+id/orderDetailTable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:stretchColumns="1" />
|
||||
</ScrollView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/Bottomlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLookupCMO"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="doLookupCMO"
|
||||
android:text="@string/btnLookupCMO"
|
||||
android:background="@drawable/button_background"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="5dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/assignmentNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/btnLookupCMO"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/lblNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customer_notes_hint"
|
||||
android:drawableLeft="@drawable/ic_form_color"
|
||||
android:drawablePadding="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<EditText
|
||||
android:id="@+id/txtNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="@drawable/edit_text_selector"
|
||||
android:minLines="3"
|
||||
android:hint="@string/requiredField"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="doSubmit"
|
||||
android:text="@string/btnSubmit"
|
||||
android:background="@drawable/button_background"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,32 @@
|
|||
package com.adins.mss.foundation.dialog.gitonway.lib.effects;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.adins.libs.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
/*
|
||||
* Copyright 2014 litao
|
||||
* https://github.com/sd6352051/NiftyDialogEffects
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
public class FlipV extends BaseEffects {
|
||||
|
||||
@Override
|
||||
protected void setupAnimation(View view) {
|
||||
getAnimatorSet().playTogether(
|
||||
ObjectAnimator.ofFloat(view, "rotationX", -90, 0).setDuration(mDuration)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bgColor">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/taskHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="5dp"
|
||||
app:cardElevation="5dp"
|
||||
android:layout_margin="3dp"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/txtStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="Status"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:drawableLeft="@drawable/ic_info"
|
||||
android:drawablePadding="5dp" />
|
||||
<TextView
|
||||
android:id="@+id/txtProduct"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="Product"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:drawableLeft="@drawable/ic_product"
|
||||
android:drawablePadding="5dp" />
|
||||
<TextView
|
||||
android:id="@+id/txtId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="OpportunityID"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:drawableLeft="@drawable/ic_form_color"
|
||||
android:drawablePadding="5dp" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</RelativeLayout>
|
Loading…
Add table
Add a link
Reference in a new issue