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,89 @@
package com.services;
import android.app.ActivityManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import com.adins.mss.base.R;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
/**
* Created by loise on 12/21/2017.
*/
public class ForegroundServiceNotification {
private static final int NOTIFICATION_ID = 1094;
public static final String NOTIFICATION_CHANNEL_ID = "10002";
private static Notification notification;
public static Notification getNotification(Context context) {
if (notification == null) {
notification = new NotificationCompat.Builder(context)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(context.getString(R.string.application_is_running))
.setSmallIcon(R.drawable.icon_notif_new)
.setPriority(5)
.setChannelId(NOTIFICATION_CHANNEL_ID)
.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "NOTIFICATION_CHANNEL_NAME", importance);
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.createNotificationChannel(mChannel);
}
}
return notification;
}
public static int getNotificationId() {
return NOTIFICATION_ID;
}
public static void startForegroundService(Service service) {
ObscuredSharedPreferences sharedPref = ObscuredSharedPreferences.getPrefs(service.getApplicationContext(),
"GlobalData", Context.MODE_PRIVATE);
boolean hasLogged = sharedPref.getBoolean(Global.IDF_HAS_LOGGED, false);
if (hasLogged){
service.startForeground(getNotificationId(), getNotification(service.getApplication().getBaseContext()));
} else {
service.stopForeground(true);
}
}
public static void stopForegroundService(Service service) {
service.stopForeground(true);
}
public static void restartForegroundService(Service service) {
if (isServiceAvailable(service.getApplication().getBaseContext(), service.getClass())) {
stopForegroundService(service);
}
startForegroundService(service);
}
public static boolean isServiceAvailable(Context context, Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (manager != null) {
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equalsIgnoreCase(service.service.getClassName())) {
return true;
}
}
}
return false;
}
}

View file

@ -0,0 +1,22 @@
package com.services;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class JsonResponseRetrieveTaskList extends MssResponseType {
@SerializedName("listTaskList")
List<TaskH> listTaskList;
public List<TaskH> getListTaskList() {
return listTaskList;
}
public void setListTaskList(List<TaskH> listTaskList) {
this.listTaskList = listTaskList;
}
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="1.0" android:toXScale="0.3"
android:fromYScale="1.0" android:toYScale="0.3"
android:pivotX="50%" android:pivotY="0%"
android:duration="@android:integer/config_shortAnimTime"
/>
<alpha
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_shortAnimTime"
/>
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1,38 @@
package com.adins.mss.foundation.UserHelp.Bean.Dummy;
public class UserHelpPropertiesDummy {
private String text;
String jobstatus;
boolean square;
public UserHelpPropertiesDummy() {
}
public UserHelpPropertiesDummy(String text) {
this.text = text;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getJobStatus() {
return jobstatus;
}
public void setJobStatus(String jobStatus) {
this.jobstatus = jobStatus;
}
public boolean isSquare() {
return square;
}
public void setSquare(boolean square) {
this.square = square;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate android:fromDegrees="360"
android:toDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="800"
android:repeatMode="restart"
android:repeatCount="infinite"
android:interpolator="@android:anim/cycle_interpolator"/>
</set>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/padding_small"
android:paddingBottom="@dimen/padding_small"
android:paddingHorizontal="10dp">
<View
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="1dp"
android:layout_weight="1"
android:background="#838383"/>
</TableRow>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gradient_end"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z"/>
</vector>

View file

@ -0,0 +1,21 @@
## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Feb 11 14:01:52 ICT 2016
org.gradle.jvmargs=-Xmx5120M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true

View file

@ -0,0 +1,270 @@
package com.adins.mss.base.todolist.form;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.todolist.ToDoList;
import com.adins.mss.base.util.LocaleHelper;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.LocationInfo;
import com.adins.mss.dao.TaskH;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import org.w3c.dom.Document;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.Random;
import lib.gegemobile.gddlibrary.GoogleDirection;
import lib.gegemobile.gddlibrary.GoogleDirection.OnDirectionResponseListener;
import lib.gegemobile.gddlibrary.GoogleDistanceMatrix;
import lib.gegemobile.gddlibrary.GoogleDistanceMatrix.DistanceResponseJson;
import lib.gegemobile.gddlibrary.GoogleDistanceMatrix.OnDistanceResponseListener;
public class ViewMapActivityWithDirection extends FragmentActivity implements OnMapReadyCallback {
private static List<TaskH> listTaskH;
SupportMapFragment mapFragment;
Button btnDirection;
Button btnAnimate;
CheckBox cbAvoidTolls;
TextView txtDistance;
TextView txtTime;
LinearLayout resultLayout;
boolean isAvoidTolls = false;
List<LatLng> taskPositions = new ArrayList<>();
LatLng EndPoint = null;
List<LatLng> waypoints = new ArrayList<>();
HashMap<LatLng, Integer> distances = new HashMap<>();
int largestDistance = 0;
GoogleDirection gd;
GoogleDistanceMatrix gdm;
Document mDoc;
private GoogleMap mGoogleMap;
private LatLng locationPoint;
private Random rnd = new Random();
public List<TaskH> getListTaskH() {
return listTaskH;
}
public static void setListTaskH(List<TaskH> value) {
ViewMapActivityWithDirection.listTaskH = value;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps_layout_with_direction);
btnDirection = (Button) findViewById(R.id.buttonDirection);
btnAnimate = (Button) findViewById(R.id.buttonAnimate);
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.maps);
if (savedInstanceState == null) {
mapFragment.setRetainInstance(true);
} else {
mapFragment.getMapAsync(ViewMapActivityWithDirection.this);
}
initialize();
initializeDirection();
}
@Override
protected void attachBaseContext(Context newBase) {
Context context = newBase;
Locale locale;
try{
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
context = LocaleHelper.wrap(newBase, locale);
} catch (Exception e) {
locale = new Locale(LocaleHelper.ENGLSIH);
context = LocaleHelper.wrap(newBase, locale);
} finally {
super.attachBaseContext(context);
}
}
private void initializeDirection() {
cbAvoidTolls = (CheckBox) findViewById(R.id.cbAvoidTolls);
txtDistance = (TextView) findViewById(R.id.textDistance);
txtTime = (TextView) findViewById(R.id.textTime);
resultLayout = (LinearLayout) findViewById(R.id.ResultValue);
cbAvoidTolls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
isAvoidTolls = isChecked;
}
});
btnDirection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setVisibility(View.GONE);
gdm.setLogging(true);
gdm.request(locationPoint, taskPositions, GoogleDirection.MODE_DRIVING, isAvoidTolls);
btnAnimate.setVisibility(View.VISIBLE);
}
});
btnAnimate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rnd = new Random();
int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
gd.animateDirection(mGoogleMap, gd.getDirection(mDoc), GoogleDirection.SPEED_NORMAL
, true, true, true, false, null, false, true, new PolylineOptions().width(3).color(color));
}
});
gd = new GoogleDirection(this);
gd.setOnDirectionResponseListener(new OnDirectionResponseListener() {
public void onResponse(String status, Document doc, GoogleDirection gd) {
mDoc = doc;
resultLayout.setVisibility(View.VISIBLE);
mGoogleMap.addPolyline(gd.getPolyline(doc, 3, Color.RED));
String str = gd.getAllTotalDistanceText(doc);
String time = gd.getAllTotalDurationText(doc);
txtDistance.setText(str);
txtTime.setText(time);
}
});
gdm = new GoogleDistanceMatrix(this);
gdm.setOnDistanceResponseListener(new OnDistanceResponseListener() {
@Override
public void onResponse(String status, DistanceResponseJson json,
GoogleDistanceMatrix gdm) {
if (gdm != null) {
for (int i = 0; i < taskPositions.size(); i++) {
int timer = gdm.getDurationValue(json, 0, i);
distances.put(taskPositions.get(i), timer);
}
for (Entry<LatLng, Integer> result : distances.entrySet()) {
if (largestDistance == 0 || largestDistance < result.getValue()) {
largestDistance = result.getValue();
}
if (largestDistance == result.getValue())
EndPoint = result.getKey();
}
for (Entry<LatLng, Integer> result : distances.entrySet()) {
if (EndPoint != null && EndPoint != result.getKey())
waypoints.add(result.getKey());
}
gd.setLogging(true);
gd.request(locationPoint, EndPoint, waypoints, GoogleDirection.MODE_DRIVING, isAvoidTolls);
}
}
});
}
private void initialize() {
if (mGoogleMap == null) {
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.maps)).getMapAsync(this);
if (mGoogleMap != null) {
setupMaps();
}
}
if (getListTaskH() == null)
setListTaskH(ToDoList.getListTaskInPriority(getApplicationContext(), ToDoList.SEARCH_BY_ALL, null));
if (getListTaskH() != null && !getListTaskH().isEmpty()) {
for (TaskH task : getListTaskH()) {
try {
double latitude = Double.parseDouble(task.getLatitude());
double longitude = Double.parseDouble(task.getLongitude());
LatLng latLng = new LatLng(latitude, longitude);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title(task.getCustomer_name());
markerOptions.snippet(task.getCustomer_phone() + "\r\n" + task.getCustomer_address());
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
mGoogleMap.addMarker(markerOptions);
mGoogleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.marker, null);
TextView infoTitle = (TextView) v.findViewById(R.id.infoTitle);
infoTitle.setText(marker.getTitle());
TextView infoSnippet = (TextView) v.findViewById(R.id.infoSnippet);
infoSnippet.setText(marker.getSnippet());
return v;
}
});
taskPositions.add(latLng);
} catch (Exception e) {
FireCrash.log(e);
}
}
}
taskPositions.add(new LatLng(-6.201071, 106.766674));
taskPositions.add(new LatLng(-6.200223, 106.765252));
taskPositions.add(new LatLng(-6.198845, 106.761106));
taskPositions.add(new LatLng(-6.193935, 106.763401));
taskPositions.add(new LatLng(-6.201945, 106.762071));
taskPositions.add(new LatLng(-6.197922, 106.763393));
taskPositions.add(new LatLng(-6.195699, 106.763559));
for (LatLng latLng : taskPositions) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
mGoogleMap.addMarker(markerOptions);
}
}
private void setupMaps() {
try {
LocationInfo info = Global.LTM.getCurrentLocation(Global.FLAG_LOCATION_CAMERA);
double mLatitude = Double.parseDouble(info.getLatitude());
double mLongitude = Double.parseDouble(info.getLongitude());
locationPoint = new LatLng(mLatitude, mLongitude);
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(locationPoint, 12));
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(locationPoint);
markerOptions.title("My Location");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
mGoogleMap.addMarker(markerOptions);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
}
}

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/detailProduk"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
app:cardBackgroundColor="@color/bgColorWhite"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
app:contentPadding="5dp">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/imgProdDetail"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_image" />
<LinearLayout
android:id="@+id/linearDescProdDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/txtProdName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wuling Confero 1.5"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txtProdDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Warna : Hitam" />
</LinearLayout>
<Button
android:id="@+id/btnViewBrosure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/button_background"
android:text="View Brochure"
android:textColor="@color/fontColorWhite" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.cardview.widget.CardView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

View file

@ -0,0 +1,65 @@
/*
* Copyright 2010 Kevin Gaudin
*
* 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 org.acra.collector;
import android.content.Context;
import android.content.pm.PackageManager;
import org.acra.ACRA;
import java.lang.reflect.Method;
import static org.acra.ACRA.LOG_TAG;
/**
* Features declared as available on the device. Available only with API level > 5.
*
* @author Kevin Gaudin
*/
final class DeviceFeaturesCollector {
public static String getFeatures(Context ctx) {
if (Compatibility.getAPILevel() < 5) {
return "Data available only with API Level >= 5";
}
final StringBuilder result = new StringBuilder();
try {
final PackageManager pm = ctx.getPackageManager();
final Method getSystemAvailableFeatures = PackageManager.class.getMethod("getSystemAvailableFeatures", (Class[]) null);
final Object[] features = (Object[]) getSystemAvailableFeatures.invoke(pm);
for (final Object feature : features) {
final String featureName = (String) feature.getClass().getField("name").get(feature);
if (featureName != null) {
result.append(featureName);
} else {
final Method getGlEsVersion = feature.getClass().getMethod("getGlEsVersion", (Class[]) null);
final String glEsVersion = (String) getGlEsVersion.invoke(feature);
result.append("glEsVersion = ");
result.append(glEsVersion);
}
result.append("\n");
}
} catch (Throwable e) {
ACRA.log.w(LOG_TAG, "Couldn't retrieve DeviceFeatures for " + ctx.getPackageName(), e);
result.append("Could not retrieve data: ");
result.append(e.getMessage());
}
return result.toString();
}
}

View file

@ -0,0 +1,20 @@
package com.adins.mss.coll.models;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.gson.annotations.SerializedName;
/**
* Created by adityapurwa on 06/05/15.
*/
public class InstallmentScheduleRequest extends MssRequestType {
@SerializedName("taskId")
public String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
}