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,49 @@
package com.adins.mss.base.dynamicform;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
public class JsonResponsePdfDocument extends MssResponseType {
@SerializedName("success")
private String success;
@SerializedName("status_code")
private String statusCode;
@SerializedName("message")
private String message;
@SerializedName("data")
private String data;
public String getSuccess() {
return success;
}
public void setSuccess(String success) {
this.success = success;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke android:color="@color/fontColorWhite" android:width="2dp" />
<gradient
android:startColor="@color/gradient_start"
android:endColor="@color/gradient_end"
android:angle="270" />
<size android:width="150dp" android:height="150dp"/>
</shape>
</item>
</selector>

View file

@ -0,0 +1,191 @@
package com.adins.mss.base.dynamictheme;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.adins.mss.base.GlobalData;
import com.adins.mss.dao.*;
import com.adins.mss.foundation.db.dataaccess.ThemeDataAccess;
import com.adins.mss.foundation.db.dataaccess.ThemeItemDataAccess;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
/**
* Created by intishar.fa on 04/09/2018.
*/
public class ThemeLoader {
private Context context;
Thread loadThread;
Handler handler;
DynamicTheme serverTheme;
public interface ColorSetLoaderCallback{
void onHasLoaded(DynamicTheme dynamicTheme);
void onHasLoaded(DynamicTheme dynamicTheme, boolean needUpdate);
}
public ThemeLoader(Context context) {
//mRemoteConfig = FirebaseRemoteConfig.getInstance();
this.context = context;
/*// Create a Remote Config Setting to enable developer mode, which you can use to increase
// the number of fetches available per hour during development. See Best Practices in the
// README for more information.
// [START enable_dev_mode]
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(true)
.build();
mRemoteConfig.setConfigSettings(configSettings);*/
}
public void loadThemeFromUrl(final String themeUrl, final ColorSetLoaderCallback callbackObj) {
if(themeUrl == null) {
callbackObj.onHasLoaded(null,false);
return;
}
handler = new Handler(Looper.getMainLooper());
loadThread = new Thread(new Runnable() {
@Override
public void run() {
HttpURLConnection httpConn = null;
try {
URL url = new URL(themeUrl);
httpConn = (HttpURLConnection) url.openConnection();
int responseCode = httpConn.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStreamReader inputStreamReader = new InputStreamReader(httpConn.getInputStream());
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder builder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null){
builder.append(line);
}
bufferedReader.close();
String jsonTheme = builder.toString();
serverTheme = new Gson().fromJson(jsonTheme,DynamicTheme.class);
handler.post(new Runnable() {//run on main thread
@Override
public void run() {
if(loadThread != null)
loadThread.interrupt();
checkVersion(serverTheme,callbackObj);//execute in main thread
}
});
}
else {
handler.post(new Runnable() {//run on main thread
@Override
public void run() {
if(loadThread != null)
loadThread.interrupt();
callbackObj.onHasLoaded(null,false);
}
});
}
} catch (Exception e) {
e.printStackTrace();
if(httpConn != null)
httpConn.disconnect();
handler.post(new Runnable() {//run on main thread
@Override
public void run() {
if(loadThread != null)
loadThread.interrupt();
callbackObj.onHasLoaded(null,false);
}
});
}
finally {
if(httpConn != null)
httpConn.disconnect();
}
}
});
loadThread.start();
/*long cacheExpiration = 0;
//expire the cache immediately for development mode.
if (mRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mRemoteConfig.fetch(cacheExpiration)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> task) {
if (task.isSuccessful()) {
// task successful. Activate the fetched data
mRemoteConfig.activateFetched();
String colorSetJson = mRemoteConfig.getString("color_set_config");
DynamicTheme serverTheme = new Gson().fromJson(colorSetJson,DynamicTheme.class);
checkVersion(serverTheme,callbackObj);
} else {
System.out.println("Cannot fetch remote config.");
}
}
});*/
}
private void checkVersion(DynamicTheme serverColorSet, ColorSetLoaderCallback callbackObj){
List<Theme> themeList = ThemeDataAccess.getThemeByApplicationType(context,
GlobalData.getSharedGlobalData().getApplication());
int savedVersion = -1;
if(themeList != null && themeList.size() > 0){
savedVersion = Integer.parseInt(themeList.get(0).getVersion());
}
boolean needUpdate;
//check version from server, compare with saved dynamictheme version
int serverVersion = serverColorSet.getVersion();
if(serverVersion > savedVersion){//if there is new version from server
saveColorSet(serverColorSet);//overwrite current saved dynamictheme
needUpdate = true;
}
else{
needUpdate = false;
}
callbackObj.onHasLoaded(serverColorSet,needUpdate);
}
public void saveColorSet(DynamicTheme dynamicTheme){
Theme themeObj = DynamicTheme.toThemeDao(context,dynamicTheme);
List<com.adins.mss.dao.ThemeItem> themeItemList = DynamicTheme.toThemeItemList(context,themeObj.getUuid_theme()
,dynamicTheme.getThemeItemList());
ThemeItemDataAccess.deleteAllItemByUuidTheme(context,
themeObj.getUuid_theme());//first, delete all theme item corresponded to uuid_theme
ThemeDataAccess.addOrReplace(context,themeObj);
ThemeItemDataAccess.addOrReplace(context,themeItemList);
}
public void loadSavedColorSet(ColorSetLoaderCallback callbackObj){
DynamicTheme colorSet = null;
List<Theme> themeList = null;
String applicationType = GlobalData.getSharedGlobalData().getApplication();
if(applicationType != null && !applicationType.equals(""))
themeList = ThemeDataAccess.getThemeByApplicationType(context,applicationType);
else
themeList = ThemeDataAccess.getAll(context);
if(themeList != null && themeList.size() > 0){
String uuid_theme = themeList.get(0).getUuid_theme();
List<com.adins.mss.dao.ThemeItem> themeItemList = ThemeItemDataAccess.getAllByUuidTheme(context,uuid_theme);
if(themeItemList != null && themeItemList.size() > 0){
Theme theme = themeItemList.get(0).getTheme();
colorSet = new DynamicTheme(theme,themeItemList);
}
}
callbackObj.onHasLoaded(colorSet);
}
}

View file

@ -0,0 +1,27 @@
package com.adins.mss.foundation.print;
public class SentencesSato {
String sentence;
int lenghtSentemce;
public SentencesSato() {
}
public String getSentence() {
return sentence;
}
public void setSentence(String sentence) {
this.sentence = sentence;
}
public int getLenghtSentemce() {
return lenghtSentemce;
}
public void setLenghtSentemce(int lenghtSentemce) {
this.lenghtSentemce = lenghtSentemce;
}
}

View file

@ -0,0 +1,370 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f1ed"
android:clipToPadding="false"
tools:context=".loyalti.monthlypointacquisition.MonthlyPointsChartView">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/chartHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:visibility="invisible"
app:layout_constraintLeft_toRightOf="@id/guideline1"
app:layout_constraintRight_toLeftOf="@id/guideline2"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/headerVerticalGuideline"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<androidx.cardview.widget.CardView
android:id="@+id/cardTotalPoin"
android:layout_width="0dp"
android:layout_height="105dp"
android:layout_marginTop="20dp"
android:layout_marginRight="6dp"
android:elevation="6dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toStartOf="@+id/headerVerticalGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:text="@string/total_points"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/totalPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3000"
android:textSize="23sp"
android:textStyle="bold" />
<!--<ImageView-->
<!--android:id="@+id/upDownTotalPoints"-->
<!--android:layout_width="12dp"-->
<!--android:layout_height="12dp"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_marginStart="10dp"-->
<!--android:src="@drawable/arrowupgreen" />-->
<TextView
android:id="@+id/rataTotalPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="+30"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardDailyAverage"
android:layout_width="0dp"
android:layout_height="105dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="6dp"
android:elevation="6dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/headerVerticalGuideline"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:text="@string/daily_avg_period"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/dailyAveragePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="293"
android:textSize="23sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardCurrentMonth"
android:layout_width="0dp"
android:layout_height="105dp"
android:layout_marginTop="6dp"
android:layout_marginRight="6dp"
android:elevation="6dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toStartOf="@+id/headerVerticalGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardTotalPoin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:text="@string/current_month_point"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/currentMonthPoint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="150"
android:textSize="23sp"
android:textStyle="bold" />
<!--<ImageView-->
<!--android:id="@+id/upDownCurrentMonth"-->
<!--android:layout_width="12dp"-->
<!--android:layout_height="12dp"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_marginStart="10dp"-->
<!--android:src="@drawable/arrowupgreen" />-->
<TextView
android:id="@+id/rataCurrentMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="+10"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardAverageMonth"
android:layout_width="0dp"
android:layout_height="105dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="6dp"
android:elevation="6dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/headerVerticalGuideline"
app:layout_constraintTop_toBottomOf="@id/cardDailyAverage">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:text="@string/daily_avg_month"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/dailyAverageMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30"
android:textSize="23sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/upDownAverageMonth"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="bottom"
android:layout_marginStart="10dp"
android:layout_marginBottom="4dp"
android:src="@drawable/arrowupgreen" />
<TextView
android:id="@+id/rataAverageMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="3dp"
android:text="10"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.05"/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.95"/>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:cardCornerRadius="10dp"
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/guideline1"
app:layout_constraintRight_toLeftOf="@id/guideline2"
app:layout_constraintTop_toBottomOf="@+id/chartHeader">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/chartContent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/yAxisTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/monthly_points"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/monthlyChart"
android:layout_width="match_parent"
android:layout_height="500dp"
app:layout_constraintTop_toBottomOf="@id/yAxisTitle"
tools:layout_editor_absoluteX="0dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/legendsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/monthlyChart">
<com.adins.mss.base.loyalti.barchart.NonScrollListView
android:id="@+id/legendPoints"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:divider="@null"
android:dividerHeight="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.65" />
<com.adins.mss.base.loyalti.barchart.NonScrollListView
android:id="@+id/legendRanks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:divider="@null"
android:dividerHeight="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.35" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>