add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

View file

@ -0,0 +1,134 @@
package com.adins.mss.base.loyalti.monthlypointacquisition;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.loyalti.model.LoyaltyPointsRequest;
import com.adins.mss.base.loyalti.model.LoyaltyPointsResponse;
import com.adins.mss.base.loyalti.monthlypointacquisition.contract.ILoyaltyPointsDataSource;
import com.adins.mss.base.util.GsonHelper;
import com.adins.mss.base.util.Utility;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.GeneralParameter;
import com.adins.mss.dao.GeneralParameterDao;
import com.adins.mss.foundation.db.DaoOpenHelper;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import java.util.List;
import de.greenrobot.dao.query.QueryBuilder;
public class LoyaltyPointsDataSource implements ILoyaltyPointsDataSource {
private Context context;//use app context
private Handler handler;
public LoyaltyPointsDataSource(Application application) {
this.context = application;
handler = new Handler(Looper.getMainLooper());
}
@Override
public void requestPointsData(LoyaltyPointsRequest reqData, ReqPointsListener listener) {
if(listener == null)
return;
RequestPointsTask requestPointsTask = new RequestPointsTask(reqData,listener);
Thread thread = new Thread(requestPointsTask);
thread.start();
}
@Override
public List<GeneralParameter> getJobsGenParam(List<String> jobs) {
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
GeneralParameterDao dao = DaoOpenHelper.getDaoSession(context).getGeneralParameterDao();
QueryBuilder qb = dao.queryBuilder();
qb.where(GeneralParameterDao.Properties.Uuid_user.eq(uuidUser)
,GeneralParameterDao.Properties.Gs_value.in(jobs));
qb.build();
return qb.list();
}
private class RequestPointsTask implements Runnable {
private LoyaltyPointsRequest request;
private ReqPointsListener listener;
public RequestPointsTask(LoyaltyPointsRequest request, ReqPointsListener listener) {
this.request = request;
this.listener = listener;
}
@Override
public void run() {
//request to ws here. wait for ws
String jsonReq = GsonHelper.toJson(request);
String url = GlobalData.getSharedGlobalData().getURL_LOYALTY_DETAIL_POINT();
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
HttpConnectionResult serverResult = null;
//Firebase Performance Trace HTTP Request
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, jsonReq);
try {
serverResult = httpConn.requestToServer(url, jsonReq, Global.DEFAULTCONNECTIONTIMEOUT);
Utility.metricStop(networkMetric, serverResult);
} catch (final Exception e) {
e.printStackTrace();
handler.post(
new Runnable() {
@Override
public void run() {
listener.onFailed(e.getMessage());
}
}
);
return;
}
if(serverResult.getStatusCode() != 200){
final String result = serverResult.getResult();
handler.post(
new Runnable() {
@Override
public void run() {
listener.onFailed(result);
}
}
);
return;
}
final LoyaltyPointsResponse response = GsonHelper.fromJson(serverResult.getResult(), LoyaltyPointsResponse.class);
if (response.getStatus().getCode() != 0) {
handler.post(new Runnable() {
@Override
public void run() {
listener.onFailed(response.getStatus().getMessage());
}
});
return;
}
handler.post(new Runnable() {
@Override
public void run() {
listener.onSuccess(response);
}
});
}
}
}

View file

@ -0,0 +1,19 @@
package com.adins.mss.coll.models;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.gson.annotations.SerializedName;
public class ReceiptHistoryRequest extends MssRequestType {
@SerializedName("agreementNo")
public String agreementNo;
public String getAgreementNo() {
return agreementNo;
}
public void setAgreementNo(String agreementNo) {
this.agreementNo = agreementNo;
}
}

View file

@ -0,0 +1,19 @@
package com.adins.mss.base.synchronize;
/**
* Created by kusnendi.muhamad on 26/07/2017.
*/
public interface ProgressListener {
public void onUpdatedValue(float value);
public void onSyncScheme(boolean value);
public void onSyncQuestion(boolean value);
public void onSyncLookup(boolean value);
public void onSyncHoliday(boolean value);
public void onSyncPaymentChannel(boolean value);
}

View file

@ -0,0 +1,109 @@
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_TASK_H_SEQUENCE".
*/
public class TaskHSequence {
@SerializedName("sequence")
private int sequence;
@SerializedName("uuid_task_h")
private String uuid_task_h;
/** Used to resolve relations */
private transient DaoSession daoSession;
/** Used for active entity operations. */
private transient TaskHSequenceDao myDao;
private TaskH taskH;
private String taskH__resolvedKey;
public TaskHSequence() {
}
public TaskHSequence(int sequence, String uuid_task_h) {
this.sequence = sequence;
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.getTaskHSequenceDao() : null;
}
public int getSequence() {
return sequence;
}
public void setSequence(int sequence) {
this.sequence = sequence;
}
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 TaskH getTaskH() {
String __key = this.uuid_task_h;
if (taskH__resolvedKey == null || taskH__resolvedKey != __key) {
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
TaskHDao targetDao = daoSession.getTaskHDao();
TaskH taskHNew = targetDao.load(__key);
synchronized (this) {
taskH = taskHNew;
taskH__resolvedKey = __key;
}
}
return taskH;
}
public void setTaskH(TaskH taskH) {
synchronized (this) {
this.taskH = taskH;
uuid_task_h = taskH == null ? null : taskH.getUuid_task_h();
taskH__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: 9.2 KiB

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/listIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/ic_01">
</ImageView>
<TextView android:id="@+id/listTitle"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#0b5d66"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/listIcon"
android:gravity="left"
android:background="@drawable/ic_01">
</TextView>
<TextView android:id="@+id/listDescription"
android:layout_below="@+id/listTitle"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#0b5d66"
android:layout_width="fill_parent"
android:layout_toRightOf="@+id/listIcon"
android:gravity="left"
android:background="@drawable/ic_01">
</TextView>
</RelativeLayout>