initial
This commit is contained in:
9
OnTime_Driver_live/.gitignore
vendored
Normal file
9
OnTime_Driver_live/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/libraries
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
1
OnTime_Driver_live/app/.gitignore
vendored
Normal file
1
OnTime_Driver_live/app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
94
OnTime_Driver_live/app/build.gradle
Normal file
94
OnTime_Driver_live/app/build.gradle
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'realm-android'
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "id.ontime.driver"
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
// Use default debug keystore on this machine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileSdk 33
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "id.ontime.driver"
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 33
|
||||||
|
versionCode 10
|
||||||
|
versionName '1.1.0'
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
multiDexEnabled true
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
productFlavors {
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
|
||||||
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
})
|
||||||
|
implementation('com.mikepenz:fastadapter:2.0.0@aar') {
|
||||||
|
transitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//noinspection GradleCompatible
|
||||||
|
implementation 'com.google.android.gms:play-services-location:19.0.1'
|
||||||
|
implementation 'com.google.android.libraries.places:places:2.5.0'
|
||||||
|
implementation 'com.google.android.gms:play-services-maps:18.0.2'
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:20.1.0'
|
||||||
|
implementation 'com.google.firebase:firebase-database:20.0.3'
|
||||||
|
implementation 'com.google.firebase:firebase-storage:20.0.0'
|
||||||
|
implementation 'com.google.firebase:firebase-core:20.1.0'
|
||||||
|
implementation 'com.google.firebase:firebase-messaging:20.2.0'
|
||||||
|
implementation 'com.google.firebase:firebase-auth:19.3.1'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
|
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
|
||||||
|
implementation 'com.google.guava:guava:25.0-android'
|
||||||
|
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
||||||
|
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
|
||||||
|
implementation 'me.relex:circleindicator:1.2.1@aar'
|
||||||
|
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
|
||||||
|
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
|
||||||
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
|
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
|
||||||
|
implementation 'com.mobsandgeeks:android-saripaar:2.0.3'
|
||||||
|
implementation 'net.the4thdimension:audio-wife:1.0.3'
|
||||||
|
implementation 'org.greenrobot:eventbus:3.0.0'
|
||||||
|
implementation 'com.makeramen:roundedimageview:2.2.1'
|
||||||
|
implementation 'com.squareup.picasso:picasso:2.5.2'
|
||||||
|
implementation 'com.github.siyamed:android-shape-imageview:0.9.3'
|
||||||
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||||
|
implementation 'com.github.yesterselga:country-picker-android:1.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
|
implementation 'com.wdullaer:materialdatetimepicker:3.2.0'
|
||||||
|
implementation 'org.jsoup:jsoup:1.11.3'
|
||||||
|
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
10
OnTime_Driver_live/app/butterknife-proguard-rules.pro
Normal file
10
OnTime_Driver_live/app/butterknife-proguard-rules.pro
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# ButterKnife config start
|
||||||
|
# Retain generated class which implement Unbinder.
|
||||||
|
-keep public class * implements butterknife.Unbinder { public <init>(...); }
|
||||||
|
|
||||||
|
# Prevent obfuscation of types which use ButterKnife annotations since the simple name
|
||||||
|
# is used to reflectively look up the generated ViewBinding.
|
||||||
|
-keep class butterknife.*
|
||||||
|
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
|
||||||
|
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
|
||||||
|
# ButterKnife config end
|
||||||
31
OnTime_Driver_live/app/guava-proguard-rules.pro
Normal file
31
OnTime_Driver_live/app/guava-proguard-rules.pro
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Configuration for Guava 18.0
|
||||||
|
#
|
||||||
|
# disagrees with instructions provided by Guava project: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava
|
||||||
|
|
||||||
|
-keep class com.google.common.io.Resources {
|
||||||
|
public static <methods>;
|
||||||
|
}
|
||||||
|
-keep class com.google.common.collect.Lists {
|
||||||
|
public static ** reverse(**);
|
||||||
|
}
|
||||||
|
-keep class com.google.common.base.Charsets {
|
||||||
|
public static <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class com.google.common.base.Joiner {
|
||||||
|
public static com.google.common.base.Joiner on(java.lang.String);
|
||||||
|
public ** join(...);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
|
||||||
|
-keep class com.google.common.cache.LocalCache$ReferenceEntry
|
||||||
|
|
||||||
|
# http://stackoverflow.com/questions/9120338/proguard-configuration-for-guava-with-obfuscation-and-optimization
|
||||||
|
-dontwarn javax.annotation.**
|
||||||
|
-dontwarn javax.inject.**
|
||||||
|
-dontwarn sun.misc.Unsafe
|
||||||
|
|
||||||
|
# Guava 19.0
|
||||||
|
-dontwarn java.lang.ClassValue
|
||||||
|
-dontwarn com.google.j2objc.annotations.Weak
|
||||||
|
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
||||||
7
OnTime_Driver_live/app/okhttp3-proguard-rules.pro
Normal file
7
OnTime_Driver_live/app/okhttp3-proguard-rules.pro
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# OkHttp
|
||||||
|
-keepattributes Signature
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
-keep class okhttp3.** { *; }
|
||||||
|
-keep interface okhttp3.** { *; }
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
-dontwarn okio.**
|
||||||
141
OnTime_Driver_live/app/proguard-rules.pro
vendored
Normal file
141
OnTime_Driver_live/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in D:\bradhawk\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
#-dontwarn ourdevelopsgoeks.**
|
||||||
|
|
||||||
|
# This is a configuration file for ProGuard.
|
||||||
|
# http://proguard.sourceforge.net/index.html#manual/usage.html
|
||||||
|
-dontusemixedcaseclassnames
|
||||||
|
-dontskipnonpubliclibraryclasses
|
||||||
|
-verbose
|
||||||
|
|
||||||
|
#-dontwarn retrofit2.**
|
||||||
|
#-keep class retrofit2.** { *; }
|
||||||
|
#-keepattributes Signature
|
||||||
|
#-keepattributes Exceptions
|
||||||
|
#
|
||||||
|
-dontwarn com.squareup.picasso.**
|
||||||
|
#-keep class co.squareup.picasso.** { *; }
|
||||||
|
#
|
||||||
|
#-dontwarn co.google.common.**
|
||||||
|
#-keep class co.google.common.** { *; }
|
||||||
|
#
|
||||||
|
#-dontwarn okio.**
|
||||||
|
#-keep class okio.** { *; }
|
||||||
|
#
|
||||||
|
#-dontwarn android.**
|
||||||
|
#-keep class android.** { *; }
|
||||||
|
#
|
||||||
|
#-dontwarn android.content.**
|
||||||
|
#-keep class android.content.** { *; }
|
||||||
|
##
|
||||||
|
#-dontwarn android.graphics.**
|
||||||
|
#-keep class android.graphics.** { *; }
|
||||||
|
##
|
||||||
|
#-dontwarn android.util.**
|
||||||
|
#-keep class android.util.** { *; }
|
||||||
|
##
|
||||||
|
#-dontwarn android.view.**
|
||||||
|
#-keep class android.view.** { *; }
|
||||||
|
#
|
||||||
|
-dontwarn com.balqisstuido.goeks.**
|
||||||
|
-keep class ourdevelops.goeks.** { *; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
## Optimization is turned off by default. Dex does not like code run
|
||||||
|
## through the ProGuard optimize and preverify steps (and performs some
|
||||||
|
## of these optimizations on its own).
|
||||||
|
##-dontoptimize
|
||||||
|
##-dontpreverify
|
||||||
|
#
|
||||||
|
## If you want to enable optimization, you should include the
|
||||||
|
## following:
|
||||||
|
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
|
||||||
|
#-optimizationpasses 5
|
||||||
|
#-allowaccessmodification
|
||||||
|
##
|
||||||
|
## Note that you cannot just include these flags in your own
|
||||||
|
## configuration file; if you are including this file, optimization
|
||||||
|
## will be turned off. You'll need to either edit this file, or
|
||||||
|
## duplicate the contents of this file and remove the include of this
|
||||||
|
## file from your project's proguard.config path property.
|
||||||
|
#
|
||||||
|
#-keep public class * extends android.app.Activity
|
||||||
|
#-keep public class * extends android.app.Application
|
||||||
|
#-keep public class * extends android.app.Service
|
||||||
|
#-keep public class * extends android.content.BroadcastReceiver
|
||||||
|
#-keep public class * extends android.content.ContentProvider
|
||||||
|
#-keep public class * extends android.app.backup.BackupAgent
|
||||||
|
#-keep public class * extends android.preference.Preference
|
||||||
|
#-keep public class * extends android.support.v4.app.Fragment
|
||||||
|
#-keep public class * extends android.support.v4.app.DialogFragment
|
||||||
|
#-keep public class * extends co.actionbarsherlock.app.SherlockListFragment
|
||||||
|
#-keep public class * extends co.actionbarsherlock.app.SherlockFragment
|
||||||
|
#-keep public class * extends co.actionbarsherlock.app.SherlockFragmentActivity
|
||||||
|
#-keep public class * extends android.app.Fragment
|
||||||
|
#-keep public class co.android.vending.licensing.ILicensingService
|
||||||
|
#
|
||||||
|
## For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
|
||||||
|
#-keepclasseswithmembernames class * {
|
||||||
|
# native <methods>;
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keep public class * extends android.view.View {
|
||||||
|
# public <init>(android.content.Context);
|
||||||
|
# public <init>(android.content.Context, android.util.AttributeSet);
|
||||||
|
# public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||||
|
# public void set*(...);
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keepclasseswithmembers class * {
|
||||||
|
# public <init>(android.content.Context, android.util.AttributeSet);
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keepclasseswithmembers class * {
|
||||||
|
# public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keepclassmembers class * extends android.app.Activity {
|
||||||
|
# public void *(android.view.View);
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
|
||||||
|
#-keepclassmembers enum * {
|
||||||
|
# public static **[] values();
|
||||||
|
# public static ** valueOf(java.lang.String);
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keep class * implements android.os.Parcelable {
|
||||||
|
# public static final android.os.Parcelable$Creator *;
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keepclassmembers class **.R$* {
|
||||||
|
# public static <fields>;
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#-keep class android.support.v4.app.** { *; }
|
||||||
|
#-keep interface android.support.v4.app.** { *; }
|
||||||
|
#-keep class co.actionbarsherlock.** { *; }
|
||||||
|
#-keep interface co.actionbarsherlock.** { *; }
|
||||||
|
## The support library contains references to newer platform versions.
|
||||||
|
## Don't warn about those in case this app is linking against an older
|
||||||
|
## platform version. We know about them, and they are safe.
|
||||||
|
#-dontwarn android.support.**
|
||||||
|
#-dontwarn co.google.ads.**
|
||||||
20
OnTime_Driver_live/app/release/output-metadata.json
Normal file
20
OnTime_Driver_live/app/release/output-metadata.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "id.ontime.driver",
|
||||||
|
"variantName": "release",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"attributes": [],
|
||||||
|
"versionCode": 10,
|
||||||
|
"versionName": "1.1.0",
|
||||||
|
"outputFile": "app-release.apk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"elementType": "File"
|
||||||
|
}
|
||||||
10
OnTime_Driver_live/app/retrofit-proguard-rules.pro
Normal file
10
OnTime_Driver_live/app/retrofit-proguard-rules.pro
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Platform calls Class.forName on types which do not exist on Android to determine platform.
|
||||||
|
-dontnote retrofit2.Platform
|
||||||
|
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
|
||||||
|
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
|
||||||
|
# Platform used when running on Java 8 VMs. Will not be used at runtime.
|
||||||
|
-dontwarn retrofit2.Platform$Java8
|
||||||
|
# Retain generic type information for use by reflection by converters and adapters.
|
||||||
|
-keepattributes Signature
|
||||||
|
# Retain declared checked exceptions for use by a Proxy instance.
|
||||||
|
-keepattributes Exceptions
|
||||||
2
OnTime_Driver_live/app/saripaar-proguard-rules.pro
Normal file
2
OnTime_Driver_live/app/saripaar-proguard-rules.pro
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
-keep class com.mobsandgeeks.saripaar.** {*;}
|
||||||
|
-keep @com.mobsandgeeks.saripaar.annotation.ValidateUsing class * {*;}
|
||||||
176
OnTime_Driver_live/app/src/main/AndroidManifest.xml
Normal file
176
OnTime_Driver_live/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="id.ontime.driver"
|
||||||
|
android:installLocation="auto">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.camera" />
|
||||||
|
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name="id.ontime.driver.constants.BaseApp"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:largeHeap="true"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:supportsRtl="false"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
tools:replace="android:supportsRtl"
|
||||||
|
tools:targetApi="n">
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.ConfirmWAActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.NewOrderActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||||
|
|
||||||
|
<receiver android:name="id.ontime.driver.utils.MyLocationService" />
|
||||||
|
|
||||||
|
<service android:name="id.ontime.driver.utils.api.service.MessagingService"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.WalletActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar"/>
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.ChatActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar"/>
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.WithdrawActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone"
|
||||||
|
android:exported="false"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.SplashActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:noHistory="true"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.IntroActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.TopupSaldoActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.PrivacyActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.RegisterActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.OrderDetailActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.EditKendaraanActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.ChangepassActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.EditProfileActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/noActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.LoginActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.LupapassActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Login_phone"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name="id.ontime.driver.activity.MainActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:permission="com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIGN_IN"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
|
tools:replace="android:launchMode" />
|
||||||
|
|
||||||
|
<service android:name="com.google.firebase.components.ComponentDiscoveryService"
|
||||||
|
android:exported="false"/>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
|
||||||
|
android:value="com.google.firebase.components.ComponentRegistrar" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
|
||||||
|
android:value="com.google.firebase.components.ComponentRegistrar" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
|
||||||
|
android:value="com.google.firebase.components.ComponentRegistrar" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.geo.API_KEY"
|
||||||
|
android:value="@string/google_maps_key" />
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths" />
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<uses-library
|
||||||
|
android:name="org.apache.http.legacy"
|
||||||
|
android:required="false" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
BIN
OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Bold.ttf
Normal file
BIN
OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Bold.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Bold.ttf
Normal file
BIN
OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Bold.ttf
Normal file
Binary file not shown.
BIN
OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Light.ttf
Normal file
BIN
OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Light.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
OnTime_Driver_live/app/src/main/ic_launcher-playstore.png
Normal file
BIN
OnTime_Driver_live/app/src/main/ic_launcher-playstore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,169 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
|
||||||
|
public
|
||||||
|
class
|
||||||
|
AutoCompleteTextViewSFProDisplayRegular
|
||||||
|
extends
|
||||||
|
androidx.appcompat.widget.AppCompatAutoCompleteTextView
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
AutoCompleteTextViewSFProDisplayRegular(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
AutoCompleteTextViewSFProDisplayRegular(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
AutoCompleteTextViewSFProDisplayRegular(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_SemiBold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
|
||||||
|
public
|
||||||
|
class
|
||||||
|
Button_SF_Pro_Display_Medium
|
||||||
|
extends
|
||||||
|
androidx.appcompat.widget.AppCompatButton
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
Button_SF_Pro_Display_Medium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
Button_SF_Pro_Display_Medium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
Button_SF_Pro_Display_Medium(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_Bold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
|
||||||
|
public
|
||||||
|
class
|
||||||
|
EditTextSFProDisplayMedium
|
||||||
|
extends
|
||||||
|
androidx.appcompat.widget.AppCompatEditText
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayMedium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayMedium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayMedium(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_Bold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
|
||||||
|
public
|
||||||
|
class
|
||||||
|
EditTextSFProDisplayRegular
|
||||||
|
extends
|
||||||
|
androidx.appcompat.widget.AppCompatEditText
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayRegular(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayRegular(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
EditTextSFProDisplayRegular(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_SemiBold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.annotation.SuppressLint;
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
import
|
||||||
|
android.widget.RadioButton;
|
||||||
|
|
||||||
|
@SuppressLint("AppCompatCustomView")
|
||||||
|
public
|
||||||
|
class
|
||||||
|
RadioButton_SF_Pro_Display_Medium
|
||||||
|
extends
|
||||||
|
RadioButton
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
RadioButton_SF_Pro_Display_Medium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
RadioButton_SF_Pro_Display_Medium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
RadioButton_SF_Pro_Display_Medium(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_Bold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import
|
||||||
|
android.content.Context;
|
||||||
|
import
|
||||||
|
android.graphics.Typeface;
|
||||||
|
import
|
||||||
|
android.util.AttributeSet;
|
||||||
|
|
||||||
|
public
|
||||||
|
class
|
||||||
|
TextViewSFProDisplayMedium
|
||||||
|
extends
|
||||||
|
androidx.appcompat.widget.AppCompatTextView
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
TextViewSFProDisplayMedium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs,
|
||||||
|
int
|
||||||
|
defStyle)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs,
|
||||||
|
defStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
TextViewSFProDisplayMedium(Context
|
||||||
|
context,
|
||||||
|
AttributeSet
|
||||||
|
attrs)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context,
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public
|
||||||
|
TextViewSFProDisplayMedium(Context
|
||||||
|
context)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
void
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if
|
||||||
|
(!isInEditMode())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(),
|
||||||
|
"fonts/Montserrat_Bold.ttf"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package
|
||||||
|
customfonts;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
public class TextViewSFProDisplayRegular extends androidx.appcompat.widget.AppCompatTextView {
|
||||||
|
|
||||||
|
public TextViewSFProDisplayRegular(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
public TextViewSFProDisplayRegular(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
public TextViewSFProDisplayRegular(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
private void init() {
|
||||||
|
if (!isInEditMode()) {
|
||||||
|
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Montserrat_SemiBold.ttf"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.json.ChangePassRequestJson;
|
||||||
|
import id.ontime.driver.json.LoginResponseJson;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.models.FirebaseToken;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class ChangepassActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
ImageView backbtn;
|
||||||
|
Button submit;
|
||||||
|
EditText pass, passbaru;
|
||||||
|
TextView notiftext;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
String disableback;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_changepassword);
|
||||||
|
|
||||||
|
backbtn = findViewById(R.id.back_btn_verify);
|
||||||
|
submit = findViewById(R.id.buttonconfirm);
|
||||||
|
pass = findViewById(R.id.password);
|
||||||
|
passbaru = findViewById(R.id.newpassword);
|
||||||
|
notiftext = findViewById(R.id.textnotif2);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif2);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
|
||||||
|
disableback = "false";
|
||||||
|
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (pass.getText().toString().isEmpty()) {
|
||||||
|
notif("old password cant be empty!");
|
||||||
|
} else if (passbaru.getText().toString().isEmpty()) {
|
||||||
|
notif("please input your new password!");
|
||||||
|
} else {
|
||||||
|
get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void get() {
|
||||||
|
progressshow();
|
||||||
|
ChangePassRequestJson request = new ChangePassRequestJson();
|
||||||
|
User loginuser = BaseApp.getInstance(ChangepassActivity.this).getLoginUser();
|
||||||
|
request.setNotelepon(loginuser.getNoTelepon());
|
||||||
|
request.setPassword(pass.getText().toString());
|
||||||
|
request.setNewPassword(passbaru.getText().toString());
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, request.getNotelepon(), request.getPassword());
|
||||||
|
service.changepass(request).enqueue(new Callback<LoginResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<LoginResponseJson> call,@NonNull Response<LoginResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("found")) {
|
||||||
|
|
||||||
|
User user = response.body().getData().get(0);
|
||||||
|
saveUser(user);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif(response.body().getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<LoginResponseJson> call,@NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
notiftext.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveUser(User user) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.copyToRealm(user);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(ChangepassActivity.this).setLoginUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageEvent(FirebaseToken response) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(FirebaseToken.class);
|
||||||
|
realm.copyToRealm(response);
|
||||||
|
realm.commitTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
|
||||||
|
public class ConfirmWAActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
EditText nominaltopup, namabank, norekening, nama, nohp;
|
||||||
|
Button submit;
|
||||||
|
TextView notif;
|
||||||
|
ImageView backbtn, images;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
String disableback;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_confirm_wa);
|
||||||
|
disableback = "false";
|
||||||
|
nominaltopup = findViewById(R.id.nominaltopup);
|
||||||
|
namabank = findViewById(R.id.namabank);
|
||||||
|
norekening = findViewById(R.id.norekening);
|
||||||
|
nama = findViewById(R.id.nama);
|
||||||
|
nohp = findViewById(R.id.nohp);
|
||||||
|
backbtn = findViewById(R.id.back_btn);
|
||||||
|
submit = findViewById(R.id.submit);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif);
|
||||||
|
notif = findViewById(R.id.textnotif);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
images = findViewById(R.id.imagebackground);
|
||||||
|
|
||||||
|
submit.setOnClickListener(v -> {
|
||||||
|
String isinominal = nominaltopup.getText().toString();
|
||||||
|
String isinamabank = namabank.getText().toString();
|
||||||
|
String isinorekening = norekening.getText().toString();
|
||||||
|
String isinama = nama.getText().toString();
|
||||||
|
String isinohp = nohp.getText().toString();
|
||||||
|
|
||||||
|
// boolean installed = appInstalledOrNot("co.whatsapp");
|
||||||
|
// if (installed) {
|
||||||
|
SettingPreference sp = new SettingPreference(v.getContext());
|
||||||
|
String phoneNumber = sp.getSetting()[7];
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setData(Uri.parse("https://api.whatsapp.com/send?phone=" + "+62" + phoneNumber + "&text=Hai admin, Saya mau Konfirmasi TOPUP saldo Driver %0A%0AJumlah Topup : " + isinominal + "%0ANama Bank : " + isinamabank +"%0ANo. Rekening saya: " + isinorekening + " %0AAtas Nama : " + isinama + " %0ANo. HP terdaftar : " +isinohp));
|
||||||
|
startActivity(intent);
|
||||||
|
// }else{
|
||||||
|
// Toast.makeText( ConfirmWAActivity.this, "install whatsapp agar bisa menghubungi team Admin", Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
|
||||||
|
});
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* private boolean appInstalledOrNot(String url) {
|
||||||
|
PackageManager packageManager = getPackageManager();
|
||||||
|
boolean app_installed;
|
||||||
|
try {
|
||||||
|
packageManager.getPackageInfo(url, packageManager.GET_ACTIVITIES);
|
||||||
|
app_installed = true;
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
app_installed = false;
|
||||||
|
}
|
||||||
|
return app_installed;
|
||||||
|
} */
|
||||||
|
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.json.LoginResponseJson;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.EditKendaraanRequestJson;
|
||||||
|
import id.ontime.driver.models.FirebaseToken;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class EditKendaraanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
ImageView backbtn;
|
||||||
|
|
||||||
|
EditText brand, type, platnomor, warna;
|
||||||
|
TextView notiftext;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
String disableback;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_editkendaraan);
|
||||||
|
User driver = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
backbtn = findViewById(R.id.back_btn_verify);
|
||||||
|
|
||||||
|
brand = findViewById(R.id.brand);
|
||||||
|
type = findViewById(R.id.type);
|
||||||
|
platnomor = findViewById(R.id.platnomor);
|
||||||
|
warna = findViewById(R.id.color);
|
||||||
|
notiftext = findViewById(R.id.textnotif2);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif2);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
|
||||||
|
disableback = "false";
|
||||||
|
brand.setText(driver.getMerek());
|
||||||
|
type.setText(driver.getTipe());
|
||||||
|
platnomor.setText(driver.getNomorkendaraan());
|
||||||
|
warna.setText(driver.getWarna());
|
||||||
|
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void get() {
|
||||||
|
progressshow();
|
||||||
|
EditKendaraanRequestJson request = new EditKendaraanRequestJson();
|
||||||
|
User loginuser = BaseApp.getInstance(EditKendaraanActivity.this).getLoginUser();
|
||||||
|
request.setNoTelepon(loginuser.getNoTelepon());
|
||||||
|
request.setId(loginuser.getId());
|
||||||
|
request.setId_kendaraan(loginuser.getIdk());
|
||||||
|
request.setMerek(brand.getText().toString());
|
||||||
|
request.setTipe(type.getText().toString());
|
||||||
|
request.setNo_kendaraan(platnomor.getText().toString());
|
||||||
|
request.setWarna(warna.getText().toString());
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, request.getNoTelepon(), loginuser.getPassword());
|
||||||
|
service.editKendaraan(request).enqueue(new Callback<LoginResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<LoginResponseJson> call, @NonNull Response<LoginResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
|
||||||
|
User user = response.body().getData().get(0);
|
||||||
|
saveUser(user);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif(response.body().getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<LoginResponseJson> call, @NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
notiftext.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveUser(User user) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.copyToRealm(user);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(EditKendaraanActivity.this).setLoginUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageEvent(FirebaseToken response) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(FirebaseToken.class);
|
||||||
|
realm.copyToRealm(response);
|
||||||
|
realm.commitTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,503 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.cardview.widget.CardView;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Base64;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.json.LoginResponseJson;
|
||||||
|
import id.ontime.driver.json.EditprofileRequestJson;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||||
|
import com.ybs.countrypicker.CountryPicker;
|
||||||
|
import com.ybs.countrypicker.CountryPickerListener;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.exifinterface.media.ExifInterface;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class EditProfileActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
ImageView foto, gantifoto, backbtn, backButtonverify;
|
||||||
|
EditText phone, nama, email;
|
||||||
|
TextView tanggal, countryCode, textnotif;
|
||||||
|
Button submit;
|
||||||
|
RelativeLayout rlnotif;
|
||||||
|
private SimpleDateFormat dateFormatter, dateFormatterview;
|
||||||
|
byte[] imageByteArray;
|
||||||
|
Bitmap decoded;
|
||||||
|
String dateview, disableback, onsubmit;
|
||||||
|
private final int GALLERY = 7;
|
||||||
|
private final int CAMERA = 8;
|
||||||
|
private BottomSheetDialog mBottomSheetDialog;
|
||||||
|
private BottomSheetBehavior mBehavior;
|
||||||
|
|
||||||
|
String country_iso_code = "en";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_editprofile);
|
||||||
|
View bottom_sheet = findViewById(R.id.bottom_sheet);
|
||||||
|
mBehavior = BottomSheetBehavior.from(bottom_sheet);
|
||||||
|
foto = findViewById(R.id.foto);
|
||||||
|
gantifoto = findViewById(R.id.editfoto);
|
||||||
|
backbtn = findViewById(R.id.back_btn);
|
||||||
|
phone = findViewById(R.id.phonenumber);
|
||||||
|
nama = findViewById(R.id.nama);
|
||||||
|
email = findViewById(R.id.email);
|
||||||
|
tanggal = findViewById(R.id.tanggal);
|
||||||
|
submit = findViewById(R.id.submit);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif);
|
||||||
|
textnotif = findViewById(R.id.textnotif);
|
||||||
|
countryCode = findViewById(R.id.countrycode);
|
||||||
|
backButtonverify = findViewById(R.id.back_btn_verify);
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
onsubmit = "true";
|
||||||
|
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
PicassoTrustAll.getInstance(this)
|
||||||
|
.load(Constants.IMAGESDRIVER + loginUser.getFotodriver())
|
||||||
|
.placeholder(R.drawable.image_placeholder)
|
||||||
|
.resize(250, 250)
|
||||||
|
.into(foto);
|
||||||
|
|
||||||
|
phone.setText(loginUser.getPhone());
|
||||||
|
nama.setText(loginUser.getFullnama());
|
||||||
|
email.setText(loginUser.getEmail());
|
||||||
|
dateview = loginUser.getTglLahir();
|
||||||
|
countryCode.setText(loginUser.getCountrycode());
|
||||||
|
|
||||||
|
gantifoto.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
selectImage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
foto.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
selectImage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
countryCode.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("WrongConstant")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final CountryPicker picker = CountryPicker.newInstance("Select Country");
|
||||||
|
picker.setListener(new CountryPickerListener() {
|
||||||
|
@Override
|
||||||
|
public void onSelectCountry(String name, String code, String dialCode, int flagDrawableResID) {
|
||||||
|
countryCode.setText(dialCode);
|
||||||
|
picker.dismiss();
|
||||||
|
country_iso_code = code;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
picker.setStyle(R.style.countrypicker_style, R.style.countrypicker_style);
|
||||||
|
picker.show(getSupportFragmentManager(), "Select Country");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Date myDate = null;
|
||||||
|
dateFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||||
|
dateFormatterview = new SimpleDateFormat("dd MMM yyyy", Locale.US);
|
||||||
|
try {
|
||||||
|
if (loginUser.getTglLahir() != null) {
|
||||||
|
myDate = dateFormatter.parse(loginUser.getTglLahir());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String finalDate = dateFormatterview.format(Objects.requireNonNull(myDate));
|
||||||
|
tanggal.setText(finalDate);
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
|
||||||
|
final String emailvalidate = email.getText().toString();
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(phone.getText().toString())) {
|
||||||
|
|
||||||
|
notif(getString(R.string.phoneempty));
|
||||||
|
|
||||||
|
} else if (TextUtils.isEmpty(nama.getText().toString())) {
|
||||||
|
|
||||||
|
notif("Name cant be empty");
|
||||||
|
|
||||||
|
} else if (TextUtils.isEmpty(email.getText().toString())) {
|
||||||
|
|
||||||
|
notif(getString(R.string.emailempty));
|
||||||
|
|
||||||
|
} else if (TextUtils.isEmpty(tanggal.getText().toString())) {
|
||||||
|
|
||||||
|
notif("birthday cant be empty!");
|
||||||
|
|
||||||
|
} else if (!emailvalidate.matches(emailPattern)) {
|
||||||
|
|
||||||
|
notif("wrong email format!");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (onsubmit.equals("true")) {
|
||||||
|
submit.setText(getString(R.string.waiting_pleaseWait));
|
||||||
|
submit.setBackground(getResources().getDrawable(R.drawable.rounded_corners_button));
|
||||||
|
editprofile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tanggal.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showTanggal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
disableback = "false";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showTanggal() {
|
||||||
|
|
||||||
|
DatePickerDialog datePicker = DatePickerDialog.newInstance(
|
||||||
|
new DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.set(Calendar.YEAR, year);
|
||||||
|
calendar.set(Calendar.MONTH, monthOfYear);
|
||||||
|
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||||
|
long date_ship_millis = calendar.getTimeInMillis();
|
||||||
|
tanggal.setText(dateFormatterview.format(date_ship_millis));
|
||||||
|
dateview = dateFormatter.format(date_ship_millis);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
datePicker.setThemeDark(false);
|
||||||
|
datePicker.setAccentColor(getResources().getColor(R.color.colorgradient));
|
||||||
|
datePicker.show(getFragmentManager(), "Datepickerdialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
textnotif.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploadfoto-------------start.
|
||||||
|
*/
|
||||||
|
private boolean check_ReadStoragepermission() {
|
||||||
|
if (ContextCompat.checkSelfPermission(this.getApplicationContext(),
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
Constants.permission_Read_data);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
private void selectImage() {
|
||||||
|
boolean pick = true;
|
||||||
|
if (pick) {
|
||||||
|
if (!checkCameraPermission()) {
|
||||||
|
requestCameraPermission();
|
||||||
|
} else PickImage();
|
||||||
|
} else {
|
||||||
|
if (!checkStoragePermission()) {
|
||||||
|
requestStoragePermission();
|
||||||
|
} else PickImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickImage() {
|
||||||
|
|
||||||
|
if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
|
mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("InflateParams") final View mDialog = getLayoutInflater().inflate(R.layout.sheet_upload, null);
|
||||||
|
CardView Galery = mDialog.findViewById(R.id.ll_gallery_intent);
|
||||||
|
CardView Camera = mDialog.findViewById(R.id.ll_camera_intent);
|
||||||
|
|
||||||
|
Galery.setOnClickListener(v -> choosePhotoFromGallery());
|
||||||
|
Camera.setOnClickListener(v -> takePhotoFromCamera());
|
||||||
|
|
||||||
|
mBottomSheetDialog = new BottomSheetDialog(this);
|
||||||
|
mBottomSheetDialog.setContentView(mDialog);
|
||||||
|
mBottomSheetDialog.show();
|
||||||
|
// mBottomSheetDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
mBottomSheetDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
mBottomSheetDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
|
||||||
|
mBottomSheetDialog.getWindow().setGravity(Gravity.BOTTOM);
|
||||||
|
|
||||||
|
|
||||||
|
mBottomSheetDialog.setOnDismissListener(dialog -> mBottomSheetDialog = null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void choosePhotoFromGallery() {
|
||||||
|
Intent galleryIntent = new Intent(Intent.ACTION_PICK,
|
||||||
|
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
|
||||||
|
startActivityForResult(galleryIntent, GALLERY);
|
||||||
|
mBottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void takePhotoFromCamera() {
|
||||||
|
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
startActivityForResult(intent, CAMERA);
|
||||||
|
mBottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
private void requestStoragePermission() {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
private void requestCameraPermission() {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkStoragePermission() {
|
||||||
|
if (ContextCompat.checkSelfPermission(this.getApplicationContext(),
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
Constants.permission_Read_data);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkCameraPermission() {
|
||||||
|
boolean res1 = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
boolean res2 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
return res1 && res2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath(Uri uri) {
|
||||||
|
String result = null;
|
||||||
|
String[] proj = {MediaStore.Images.Media.DATA};
|
||||||
|
Cursor cursor = this.getContentResolver().query(uri, proj, null, null, null);
|
||||||
|
if (cursor != null) {
|
||||||
|
if (cursor.moveToFirst()) {
|
||||||
|
int column_index = cursor.getColumnIndexOrThrow(proj[0]);
|
||||||
|
result = cursor.getString(column_index);
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
if (result == null) {
|
||||||
|
result = "Not found";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (resultCode == RESULT_CANCELED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Uri contentURI = data.getData();
|
||||||
|
if (requestCode == GALLERY) {
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), contentURI);
|
||||||
|
String path = saveImage(bitmap);
|
||||||
|
foto.setImageBitmap(bitmap);
|
||||||
|
// Toast.makeText(this, "Image Saved!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "Failed!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (requestCode == CAMERA) {
|
||||||
|
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
|
||||||
|
foto.setImageBitmap(thumbnail);
|
||||||
|
saveImage(thumbnail);
|
||||||
|
// Toast.makeText(this, "Image Saved!", Toast.LENGTH_SHORT).show();
|
||||||
|
/*Intent i = new Intent(this,MainActivity.class);
|
||||||
|
i.putExtra("imagepath", contentURI.toString());
|
||||||
|
startActivity(i);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String saveImage(Bitmap myBitmap) {
|
||||||
|
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||||
|
myBitmap.compress(Bitmap.CompressFormat.JPEG, 90, bytes);
|
||||||
|
imageByteArray = bytes.toByteArray();
|
||||||
|
decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(bytes.toByteArray()));
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStringImage(Bitmap bmp) {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
bmp.compress(Bitmap.CompressFormat.JPEG, 20, baos);
|
||||||
|
imageByteArray = baos.toByteArray();
|
||||||
|
return Base64.encodeToString(imageByteArray, Base64.DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editprofile() {
|
||||||
|
onsubmit = "false";
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
EditprofileRequestJson request = new EditprofileRequestJson();
|
||||||
|
request.setFullNama(nama.getText().toString());
|
||||||
|
request.setEmail(email.getText().toString());
|
||||||
|
request.setEmaillama(loginUser.getEmail());
|
||||||
|
request.setId(loginUser.getId());
|
||||||
|
request.setNoTelepon(countryCode.getText().toString().replace("+", "") + phone.getText().toString());
|
||||||
|
request.setPhone(phone.getText().toString());
|
||||||
|
request.setCountrycode(countryCode.getText().toString());
|
||||||
|
request.setPhonelama(loginUser.getNoTelepon());
|
||||||
|
if (imageByteArray != null) {
|
||||||
|
request.setFotopelangganlama(loginUser.getFotodriver());
|
||||||
|
request.setFotopelanggan(getStringImage(decoded));
|
||||||
|
}
|
||||||
|
request.setTglLahir(dateview);
|
||||||
|
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||||
|
service.editProfile(request).enqueue(new Callback<LoginResponseJson>() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<LoginResponseJson> call, @NonNull Response<LoginResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
User user = response.body().getData().get(0);
|
||||||
|
saveUser(user);
|
||||||
|
finish();
|
||||||
|
onsubmit = "true";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
onsubmit = "true";
|
||||||
|
submit.setText("Submit");
|
||||||
|
submit.setBackground(getResources().getDrawable(R.drawable.button_round_1));
|
||||||
|
notif(response.body().getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onsubmit = "true";
|
||||||
|
submit.setText("Submit");
|
||||||
|
submit.setBackground(getResources().getDrawable(R.drawable.button_round_1));
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<LoginResponseJson> call, @NonNull Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void saveUser(User user) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.copyToRealm(user);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(EditProfileActivity.this).setLoginUser(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.utils.AppIntroPagerAdapter;
|
||||||
|
import id.ontime.driver.utils.ProjectUtils;
|
||||||
|
import id.ontime.driver.utils.SharedPrefrence;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
public class IntroActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {
|
||||||
|
ViewPager mViewPager;
|
||||||
|
private AppIntroPagerAdapter mAdapter;
|
||||||
|
private LinearLayout viewPagerCountDots;
|
||||||
|
private int dotsCount;
|
||||||
|
private ImageView[] dots;
|
||||||
|
public SharedPrefrence preference;
|
||||||
|
private Context mContext;
|
||||||
|
Button buttonSign;
|
||||||
|
int[] mResources = {R.drawable.slide_one, R.drawable.slide_two, R.drawable.slide_three};
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
ProjectUtils.Fullscreen(IntroActivity.this);
|
||||||
|
setContentView(R.layout.activity_intro);
|
||||||
|
mContext = IntroActivity.this;
|
||||||
|
preference = SharedPrefrence.getInstance(mContext);
|
||||||
|
removeNotif();
|
||||||
|
buttonSign = findViewById(R.id.tombolstar);
|
||||||
|
buttonSign.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent i = new Intent(IntroActivity.this, LoginActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mViewPager = findViewById(R.id.viewpager);
|
||||||
|
viewPagerCountDots = findViewById(R.id.viewPagerCountDots);
|
||||||
|
|
||||||
|
|
||||||
|
mAdapter = new AppIntroPagerAdapter(IntroActivity.this, mContext, mResources);
|
||||||
|
mViewPager.setAdapter(mAdapter);
|
||||||
|
mViewPager.setCurrentItem(0);
|
||||||
|
mViewPager.setOnPageChangeListener(this);
|
||||||
|
setPageViewIndicator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
private void setPageViewIndicator() {
|
||||||
|
|
||||||
|
Log.d("###setPageViewIndicator", " : called");
|
||||||
|
dotsCount = mAdapter.getCount();
|
||||||
|
dots = new ImageView[dotsCount];
|
||||||
|
|
||||||
|
for (int i = 0; i < dotsCount; i++) {
|
||||||
|
dots[i] = new ImageView(mContext);
|
||||||
|
dots[i].setImageDrawable(getResources().getDrawable(R.drawable.nonselecteditem_dot));
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
25,
|
||||||
|
25
|
||||||
|
);
|
||||||
|
|
||||||
|
params.setMargins(4, 20, 4, 0);
|
||||||
|
|
||||||
|
final int presentPosition = i;
|
||||||
|
dots[presentPosition].setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
mViewPager.setCurrentItem(presentPosition);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
viewPagerCountDots.addView(dots[i], params);
|
||||||
|
}
|
||||||
|
|
||||||
|
dots[0].setImageDrawable(getResources().getDrawable(R.drawable.selecteditem_dot));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
Log.e("###onPageSelected, pos ", String.valueOf(position));
|
||||||
|
for (int i = 0; i < dotsCount; i++) {
|
||||||
|
dots[i].setImageDrawable(getResources().getDrawable(R.drawable.nonselecteditem_dot));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dots[position].setImageDrawable(getResources().getDrawable(R.drawable.selecteditem_dot));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scrollPage(int position) {
|
||||||
|
mViewPager.setCurrentItem(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
clickDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clickDone() {
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setIcon(R.mipmap.ic_launcher)
|
||||||
|
.setTitle(getString(R.string.app_name))
|
||||||
|
.setMessage(getString(R.string.exit))
|
||||||
|
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
private void removeNotif() {
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||||
|
Objects.requireNonNull(notificationManager).cancel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,568 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.ViewFlipper;
|
||||||
|
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.FirebaseException;
|
||||||
|
import com.google.firebase.FirebaseTooManyRequestsException;
|
||||||
|
import com.google.firebase.auth.AuthResult;
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
|
||||||
|
import com.google.firebase.auth.PhoneAuthCredential;
|
||||||
|
import com.google.firebase.auth.PhoneAuthProvider;
|
||||||
|
|
||||||
|
import com.google.firebase.iid.FirebaseInstanceId;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.FirebaseToken;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.NetworkUtils;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.LoginRequestJson;
|
||||||
|
import id.ontime.driver.json.LoginResponseJson;
|
||||||
|
import com.ybs.countrypicker.CountryPicker;
|
||||||
|
import com.ybs.countrypicker.CountryPickerListener;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private String phoneVerificationId;
|
||||||
|
private PhoneAuthProvider.OnVerificationStateChangedCallbacks verificationCallbacks;
|
||||||
|
private PhoneAuthProvider.ForceResendingToken resendToken;
|
||||||
|
private FirebaseAuth fbAuth;
|
||||||
|
EditText phoneText, password, numOne, numTwo, numThree, numFour, numFive, numSix, email;
|
||||||
|
TextView countryCode, sendTo, privacypolicy, textnotif, daftar, textnotif2, lupapass;
|
||||||
|
Button buttonLogin, confirmButton;
|
||||||
|
ImageView backButton, backButtonverify;
|
||||||
|
ViewFlipper viewFlipper;
|
||||||
|
String phoneNumber, disableback;
|
||||||
|
FirebaseAuth mAuth;
|
||||||
|
RelativeLayout rlprogress, rlnotif, rlnotif2, rldaftar;
|
||||||
|
String verify;
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences;
|
||||||
|
String country_iso_code = "en";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_login);
|
||||||
|
try {
|
||||||
|
fbAuth = FirebaseAuth.getInstance();
|
||||||
|
mAuth = FirebaseAuth.getInstance();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
fbAuth = null;
|
||||||
|
mAuth = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
numOne = findViewById(R.id.numone);
|
||||||
|
numTwo = findViewById(R.id.numtwo);
|
||||||
|
numThree = findViewById(R.id.numthree);
|
||||||
|
numFour = findViewById(R.id.numfour);
|
||||||
|
numFive = findViewById(R.id.numfive);
|
||||||
|
numSix = findViewById(R.id.numsix);
|
||||||
|
privacypolicy = findViewById(R.id.privacypolice);
|
||||||
|
daftar = findViewById(R.id.clickdaftar);
|
||||||
|
rldaftar = findViewById(R.id.rldaftar);
|
||||||
|
lupapass = findViewById(R.id.lupapass);
|
||||||
|
|
||||||
|
phoneText = findViewById(R.id.phonenumber);
|
||||||
|
email = findViewById(R.id.email);
|
||||||
|
countryCode = findViewById(R.id.countrycode);
|
||||||
|
buttonLogin = findViewById(R.id.buttonlogin);
|
||||||
|
backButton = findViewById(R.id.back_btn);
|
||||||
|
confirmButton = findViewById(R.id.buttonconfirm);
|
||||||
|
sendTo = findViewById(R.id.sendtotxt);
|
||||||
|
viewFlipper = findViewById(R.id.viewflipper);
|
||||||
|
backButtonverify = findViewById(R.id.back_btn_verify);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
password = findViewById(R.id.password);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif);
|
||||||
|
textnotif = findViewById(R.id.textnotif);
|
||||||
|
rlnotif2 = findViewById(R.id.rlnotif2);
|
||||||
|
textnotif2 = findViewById(R.id.textnotif2);
|
||||||
|
|
||||||
|
sharedPreferences = getSharedPreferences(Constants.PREF_NAME, MODE_PRIVATE);
|
||||||
|
|
||||||
|
String priv = getResources().getString(R.string.privacy);
|
||||||
|
privacypolicy.setText(Html.fromHtml(priv));
|
||||||
|
|
||||||
|
|
||||||
|
verify = "false";
|
||||||
|
|
||||||
|
buttonLogin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String emailText = email != null ? email.getText().toString() : "";
|
||||||
|
String phonetext = phoneText.getText().toString();
|
||||||
|
String pass = password.getText().toString();
|
||||||
|
boolean hasEmail = !TextUtils.isEmpty(emailText);
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(pass)) {
|
||||||
|
notif(getString(R.string.passempty));
|
||||||
|
} else if (!hasEmail && TextUtils.isEmpty(phonetext)) {
|
||||||
|
notif(getString(R.string.phonepass));
|
||||||
|
} else {
|
||||||
|
if (NetworkUtils.isConnected(LoginActivity.this)) {
|
||||||
|
verify = hasEmail ? "true" : "false";
|
||||||
|
if (!hasEmail) {
|
||||||
|
phoneNumber = countryCode.getText().toString() + phonetext;
|
||||||
|
}
|
||||||
|
progressshow();
|
||||||
|
onSignInClick();
|
||||||
|
} else {
|
||||||
|
progresshide();
|
||||||
|
notif(getString(R.string.text_noInternet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
countryCode.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("WrongConstant")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final CountryPicker picker = CountryPicker.newInstance("Select Country");
|
||||||
|
picker.setListener(new CountryPickerListener() {
|
||||||
|
@Override
|
||||||
|
public void onSelectCountry(String name, String code, String dialCode, int flagDrawableResID) {
|
||||||
|
countryCode.setText(dialCode);
|
||||||
|
picker.dismiss();
|
||||||
|
country_iso_code = code;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
picker.setStyle(R.style.countrypicker_style, R.style.countrypicker_style);
|
||||||
|
picker.show(getSupportFragmentManager(), "Select Country");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lupapass.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(LoginActivity.this, LupapassActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
daftar.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(LoginActivity.this, RegisterActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
privacypolicy.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(LoginActivity.this, PrivacyActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
backButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
backButtonverify.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
confirmButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
verifyCode(viewFlipper);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
disableback = "false";
|
||||||
|
codenumber();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
textnotif.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif2(String text) {
|
||||||
|
rlnotif2.setVisibility(View.VISIBLE);
|
||||||
|
textnotif2.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void codenumber() {
|
||||||
|
|
||||||
|
numOne.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
if (numOne.getText().toString().length() == 0) {
|
||||||
|
numTwo.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
numTwo.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
if (numTwo.getText().toString().length() == 0) {
|
||||||
|
numThree.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
numThree.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
if (numThree.getText().toString().length() == 0) {
|
||||||
|
numFour.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
numFour.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
if (numFour.getText().toString().length() == 0) {
|
||||||
|
numFive.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
numFive.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
if (numFive.getText().toString().length() == 0) {
|
||||||
|
numSix.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Nextbtn(View view) {
|
||||||
|
phoneNumber = countryCode.getText().toString() + phoneText.getText().toString();
|
||||||
|
String ccode = countryCode.getText().toString();
|
||||||
|
|
||||||
|
if ((!TextUtils.isEmpty(phoneNumber) && !TextUtils.isEmpty(ccode)) && phoneNumber.length() > 5) {
|
||||||
|
progressshow();
|
||||||
|
Send_Number_tofirebase(phoneNumber);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif(getString(R.string.wrongnumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Send_Number_tofirebase(String phoneNumber) {
|
||||||
|
setUpVerificatonCallbacks();
|
||||||
|
PhoneAuthProvider.getInstance().verifyPhoneNumber(
|
||||||
|
phoneNumber,
|
||||||
|
120,
|
||||||
|
TimeUnit.SECONDS,
|
||||||
|
this,
|
||||||
|
verificationCallbacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpVerificatonCallbacks() {
|
||||||
|
verificationCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
|
||||||
|
@Override
|
||||||
|
public void onVerificationCompleted(@NonNull PhoneAuthCredential credential) {
|
||||||
|
signInWithPhoneAuthCredential(credential);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVerificationFailed(@NonNull FirebaseException e) {
|
||||||
|
progresshide();
|
||||||
|
android.util.Log.d("respon", e.toString());
|
||||||
|
notif2("Verifikasi Gagal!");
|
||||||
|
if (e instanceof FirebaseAuthInvalidCredentialsException) {
|
||||||
|
notif2("wrong code!");
|
||||||
|
} else if (e instanceof FirebaseTooManyRequestsException) {
|
||||||
|
notif2("Too Many Requests, please try with other phone number!");
|
||||||
|
notif("Too Many Requests, please try with other phone number!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider.ForceResendingToken token) {
|
||||||
|
phoneVerificationId = verificationId;
|
||||||
|
resendToken = token;
|
||||||
|
sendTo.setText("Send To ( " + phoneNumber + " )");
|
||||||
|
progresshide();
|
||||||
|
viewFlipper.setInAnimation(LoginActivity.this, R.anim.from_right);
|
||||||
|
viewFlipper.setOutAnimation(LoginActivity.this, R.anim.to_left);
|
||||||
|
viewFlipper.setDisplayedChild(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void verifyCode(View view) {
|
||||||
|
backButton.setVisibility(View.GONE);
|
||||||
|
rldaftar.setVisibility(View.GONE);
|
||||||
|
String code = "" + numOne.getText().toString() + numTwo.getText().toString() + numThree.getText().toString() + numFour.getText().toString() + numFive.getText().toString() + numSix.getText().toString();
|
||||||
|
if (!code.equals("")) {
|
||||||
|
progressshow();
|
||||||
|
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(phoneVerificationId, code);
|
||||||
|
signInWithPhoneAuthCredential(credential);
|
||||||
|
} else {
|
||||||
|
notif2("kode verifikasi masih kosong");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
|
||||||
|
fbAuth.signInWithCredential(credential)
|
||||||
|
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||||
|
if (task.isSuccessful()) {
|
||||||
|
//Getuser();
|
||||||
|
verify = "true";
|
||||||
|
onSignInClick();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
progresshide();
|
||||||
|
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
|
||||||
|
notif2("wrong code!");
|
||||||
|
} else if (task.getException() instanceof FirebaseTooManyRequestsException) {
|
||||||
|
notif2("Too Many Requests, please try with other phone number!");
|
||||||
|
notif("Too Many Requests, please try with other phone number!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void resendCode(View view) {
|
||||||
|
|
||||||
|
setUpVerificatonCallbacks();
|
||||||
|
PhoneAuthProvider.getInstance().verifyPhoneNumber(
|
||||||
|
phoneNumber,
|
||||||
|
120,
|
||||||
|
TimeUnit.SECONDS,
|
||||||
|
this,
|
||||||
|
verificationCallbacks,
|
||||||
|
resendToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSignInClick() {
|
||||||
|
progressshow();
|
||||||
|
LoginRequestJson request = new LoginRequestJson();
|
||||||
|
String emailText = email != null ? email.getText().toString().trim() : "";
|
||||||
|
String phoneDigits = phoneText.getText().toString().trim();
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(emailText)) {
|
||||||
|
request.setEmail(emailText);
|
||||||
|
request.setNotelepon("");
|
||||||
|
} else {
|
||||||
|
request.setEmail(null);
|
||||||
|
request.setNotelepon(countryCode.getText().toString().replace("+", "") + phoneDigits);
|
||||||
|
}
|
||||||
|
request.setPassword(password.getText().toString());
|
||||||
|
try {
|
||||||
|
FirebaseInstanceId token = FirebaseInstanceId.getInstance();
|
||||||
|
request.setRegId(token.getToken());
|
||||||
|
} catch (Exception e) {
|
||||||
|
request.setRegId(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
String basicUser = !TextUtils.isEmpty(emailText) ? emailText : request.getNotelepon();
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, basicUser, request.getPassword());
|
||||||
|
service.login(request).enqueue(new Callback<LoginResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<LoginResponseJson> call, @NonNull Response<LoginResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
LoginResponseJson body = response.body();
|
||||||
|
if (body != null && body.getMessage().equalsIgnoreCase("found")) {
|
||||||
|
User user = body.getData().get(0);
|
||||||
|
saveUser(user);
|
||||||
|
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
notif(getString(R.string.phoneemailwrong));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<LoginResponseJson> call, @NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == RegisterActivity.SIGNUP_ID) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
if (verify.equals("true")) {
|
||||||
|
User user = (User) data.getSerializableExtra(RegisterActivity.USER_KEY);
|
||||||
|
saveUser(user);
|
||||||
|
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveUser(User user) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.copyToRealm(user);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(LoginActivity.this).setLoginUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageEvent(FirebaseToken response) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(FirebaseToken.class);
|
||||||
|
realm.copyToRealm(response);
|
||||||
|
realm.commitTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.json.LoginRequestJson;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.LoginResponseJson;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class LupapassActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
ImageView backbtn;
|
||||||
|
Button submit;
|
||||||
|
TextView email, notiftext;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
String disableback;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_lupapassword);
|
||||||
|
|
||||||
|
backbtn = findViewById(R.id.back_btn_verify);
|
||||||
|
submit = findViewById(R.id.buttonconfirm);
|
||||||
|
email = findViewById(R.id.email);
|
||||||
|
notiftext = findViewById(R.id.textnotif2);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif2);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
|
||||||
|
disableback = "false";
|
||||||
|
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (email.getText().toString().isEmpty()) {
|
||||||
|
notif(getString(R.string.emailempty));
|
||||||
|
} else {
|
||||||
|
get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void get() {
|
||||||
|
progressshow();
|
||||||
|
LoginRequestJson request = new LoginRequestJson();
|
||||||
|
request.setEmail(email.getText().toString());
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, request.getEmail(), "12345");
|
||||||
|
service.forgot(request).enqueue(new Callback<LoginResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<LoginResponseJson> call, @NonNull Response<LoginResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("found")) {
|
||||||
|
notif("email send!");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif(getString(R.string.phoneemailwrong));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<LoginResponseJson> call, @NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
notiftext.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
|
import com.google.android.gms.location.LocationRequest;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||||
|
import com.google.android.material.navigation.NavigationBarView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.constants.VersionChecker;
|
||||||
|
import id.ontime.driver.fragment.HomeFragment;
|
||||||
|
import id.ontime.driver.fragment.OrderFragment;
|
||||||
|
import id.ontime.driver.json.GetHomeRequestJson;
|
||||||
|
import id.ontime.driver.json.GetHomeResponseJson;
|
||||||
|
import id.ontime.driver.json.UpdateLocationRequestJson;
|
||||||
|
import id.ontime.driver.utils.MyLocationService;
|
||||||
|
import id.ontime.driver.fragment.HistoryFragment;
|
||||||
|
import id.ontime.driver.fragment.MessageFragment;
|
||||||
|
import id.ontime.driver.fragment.ProfileFragment;
|
||||||
|
import id.ontime.driver.json.ResponseJson;
|
||||||
|
import id.ontime.driver.models.TransaksiModel;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
long mBackPressed;
|
||||||
|
|
||||||
|
|
||||||
|
public static String apikey;
|
||||||
|
|
||||||
|
LinearLayout mAdViewLayout;
|
||||||
|
RelativeLayout toolbar;
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
public static MainActivity mainActivity;
|
||||||
|
private FragmentManager fragmentManager;
|
||||||
|
BottomNavigationView navigation;
|
||||||
|
int previousSelect = 0;
|
||||||
|
SettingPreference sp;
|
||||||
|
OrderFragment orderFragment;
|
||||||
|
HomeFragment homeFragment;
|
||||||
|
LocationRequest locationRequest;
|
||||||
|
RelativeLayout rlprogress;
|
||||||
|
FusedLocationProviderClient fusedLocationProviderClient;
|
||||||
|
boolean canceled;
|
||||||
|
|
||||||
|
public static MainActivity getInstance() {
|
||||||
|
return mainActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
|
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||||
|
Menu menu = navigation.getMenu();
|
||||||
|
menu.findItem(R.id.home).setIcon(R.drawable.ic_home);
|
||||||
|
menu.findItem(R.id.order).setIcon(R.drawable.ic_transaksi);
|
||||||
|
menu.findItem(R.id.chat).setIcon(R.drawable.ic_pesan);
|
||||||
|
menu.findItem(R.id.profile).setIcon(R.drawable.ic_profil);
|
||||||
|
|
||||||
|
TransaksiModel transaksi = new TransaksiModel();
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == R.id.home) {
|
||||||
|
canceled = false;
|
||||||
|
navigationItemSelected(0);
|
||||||
|
item.setIcon(R.drawable.ic_home_s);
|
||||||
|
gethome();
|
||||||
|
toolbar.setVisibility(View.VISIBLE);
|
||||||
|
return true;
|
||||||
|
} else if (itemId == R.id.order) {
|
||||||
|
canceled = true;
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
HistoryFragment listFragment = new HistoryFragment();
|
||||||
|
navigationItemSelected(1);
|
||||||
|
item.setIcon(R.drawable.ic_transaksi_s);
|
||||||
|
loadFrag2(listFragment, getString(R.string.menu_home), fragmentManager, transaksi, "", "");
|
||||||
|
toolbar.setVisibility(View.VISIBLE);
|
||||||
|
return true;
|
||||||
|
} else if (itemId == R.id.chat) {
|
||||||
|
canceled = true;
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
MessageFragment pesanFragment = new MessageFragment();
|
||||||
|
navigationItemSelected(2);
|
||||||
|
item.setIcon(R.drawable.ic_pesan_s);
|
||||||
|
loadFrag2(pesanFragment, getString(R.string.menu_chat), fragmentManager, transaksi, "", "");
|
||||||
|
toolbar.setVisibility(View.VISIBLE);
|
||||||
|
return true;
|
||||||
|
} else if (itemId == R.id.profile) {
|
||||||
|
canceled = true;
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
ProfileFragment profilFragment = new ProfileFragment();
|
||||||
|
navigationItemSelected(3);
|
||||||
|
item.setIcon(R.drawable.ic_profil_s);
|
||||||
|
loadFrag2(profilFragment, getString(R.string.menu_profile), fragmentManager, transaksi, "", "");
|
||||||
|
toolbar.setVisibility(View.VISIBLE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
mAdViewLayout = findViewById(R.id.adView);
|
||||||
|
fragmentManager = getSupportFragmentManager();
|
||||||
|
navigation = findViewById(R.id.navigation);
|
||||||
|
sp = new SettingPreference(this);
|
||||||
|
orderFragment = new OrderFragment();
|
||||||
|
homeFragment = new HomeFragment();
|
||||||
|
navigation.setLabelVisibilityMode(NavigationBarView.LABEL_VISIBILITY_LABELED);
|
||||||
|
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
navigation.setItemIconTintList(null);
|
||||||
|
Menu menu = navigation.getMenu();
|
||||||
|
toolbar = findViewById(R.id.rltoolbar);
|
||||||
|
toolbar.setVisibility(View.VISIBLE);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
menu.findItem(R.id.home).setIcon(R.drawable.ic_home_s);
|
||||||
|
canceled = false;
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
Constants.TOKEN = loginUser.getToken();
|
||||||
|
Constants.USERID = loginUser.getId();
|
||||||
|
apikey = getString(R.string.google_maps_key);
|
||||||
|
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
try {
|
||||||
|
packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Constants.versionname = Objects.requireNonNull(packageInfo).versionName;
|
||||||
|
updatelocation();
|
||||||
|
gethome();
|
||||||
|
if (sp.getSetting()[19].equals("2") || sp.getSetting()[19].equals("3")) {
|
||||||
|
navigation.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
navigation.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Check_version();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Check_version(){
|
||||||
|
VersionChecker versionChecker = new VersionChecker(this);
|
||||||
|
versionChecker.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
int count = this.getSupportFragmentManager().getBackStackEntryCount();
|
||||||
|
if (count == 0) {
|
||||||
|
if (mBackPressed + 2000 > System.currentTimeMillis()) {
|
||||||
|
super.onBackPressed();
|
||||||
|
} else {
|
||||||
|
clickDone();
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clickDone() {
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setIcon(R.mipmap.ic_launcher)
|
||||||
|
.setTitle(getString(R.string.app_name))
|
||||||
|
.setMessage(getString(R.string.exit))
|
||||||
|
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gethome() {
|
||||||
|
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
GetHomeRequestJson param = new GetHomeRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setPhone(loginUser.getNoTelepon());
|
||||||
|
userService.home(param).enqueue(new Callback<GetHomeResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<GetHomeResponseJson> call, @NonNull final Response<GetHomeResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
Constants.CURRENCY = response.body().getCurrency();
|
||||||
|
sp.updateCurrency(response.body().getCurrency());
|
||||||
|
sp.updateabout(response.body().getAboutus());
|
||||||
|
sp.updateemail(response.body().getEmail());
|
||||||
|
sp.updatephone(response.body().getPhone());
|
||||||
|
sp.updateweb(response.body().getWebsite());
|
||||||
|
sp.updatempstatus(response.body().getMpstatus());
|
||||||
|
sp.updatempactive(response.body().getMpactive());
|
||||||
|
sp.updateMobilepulsausername(response.body().getMobilepulsausername());
|
||||||
|
sp.updateMobilepulsaapikey(response.body().getMobilepulsaapikey());
|
||||||
|
sp.updateStatusdriver(response.body().getDriverstatus());
|
||||||
|
|
||||||
|
TransaksiModel transaksifake = new TransaksiModel();
|
||||||
|
if (!canceled) {
|
||||||
|
if (response.body().getDriverstatus().equals("3") || response.body().getDriverstatus().equals("2")) {
|
||||||
|
TransaksiModel transaksi = response.body().getTransaksi().get(0);
|
||||||
|
navigation.setVisibility(View.GONE);
|
||||||
|
loadFrag2(orderFragment, getString(R.string.menu_home), fragmentManager, transaksi, response.body().getSaldo(), response.body().getDriverstatus());
|
||||||
|
} else {
|
||||||
|
navigation.setVisibility(View.VISIBLE);
|
||||||
|
loadFrag2(homeFragment, getString(R.string.menu_home), fragmentManager, transaksifake, response.body().getSaldo(), response.body().getDriverstatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
User user = response.body().getDatadriver().get(0);
|
||||||
|
saveUser(user);
|
||||||
|
if (mainActivity != null) {
|
||||||
|
Realm realm = BaseApp.getInstance(MainActivity.this).getRealmInstance();
|
||||||
|
User loginUser = BaseApp.getInstance(MainActivity.this).getLoginUser();
|
||||||
|
realm.beginTransaction();
|
||||||
|
loginUser.setWalletSaldo(Long.parseLong(response.body().getSaldo()));
|
||||||
|
realm.commitTransaction();
|
||||||
|
}
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
Realm realm = BaseApp.getInstance(MainActivity.this).getRealmInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(MainActivity.this).setLoginUser(null);
|
||||||
|
startActivity(new Intent(MainActivity.this, IntroActivity.class)
|
||||||
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||||
|
finish();
|
||||||
|
Toast.makeText(MainActivity.this, "Your account has been suspended, please contact admin!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<GetHomeResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveUser(User user) {
|
||||||
|
Realm realm = Realm.getDefaultInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.copyToRealm(user);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(MainActivity.this).setLoginUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadFrag2(Fragment f1, String name, FragmentManager fm, TransaksiModel transaksi, String saldo, String status) {
|
||||||
|
for (int i = 0; i < fm.getBackStackEntryCount(); ++i) {
|
||||||
|
fm.popBackStack();
|
||||||
|
}
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("id_pelanggan", transaksi.getIdPelanggan());
|
||||||
|
args.putString("id_transaksi", transaksi.getId());
|
||||||
|
args.putString("response", String.valueOf(transaksi.status));
|
||||||
|
args.putString("saldo", saldo);
|
||||||
|
args.putString("status", status);
|
||||||
|
f1.setArguments(args);
|
||||||
|
FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
ft.replace(R.id.Container, f1, name);
|
||||||
|
ft.commitAllowingStateLoss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void navigationItemSelected(int position) {
|
||||||
|
previousSelect = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
private void updatelocation() {
|
||||||
|
buildlocation();
|
||||||
|
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fusedLocationProviderClient.requestLocationUpdates(locationRequest, getPendingIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
private PendingIntent getPendingIntent() {
|
||||||
|
Intent intent = new Intent(this, MyLocationService.class);
|
||||||
|
intent.setAction(MyLocationService.ACTION_PROCESS_UPDATE);
|
||||||
|
return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_MUTABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildlocation() {
|
||||||
|
locationRequest = new LocationRequest();
|
||||||
|
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||||
|
locationRequest.setInterval(5000);
|
||||||
|
locationRequest.setFastestInterval(3000);
|
||||||
|
locationRequest.setSmallestDisplacement(10f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Updatelocationdata(final Location location) {
|
||||||
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
onLocationChanged(location);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
if (location != null) {
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||||
|
UpdateLocationRequestJson param = new UpdateLocationRequestJson();
|
||||||
|
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setLatitude(String.valueOf(location.getLatitude()));
|
||||||
|
param.setLongitude(String.valueOf(location.getLongitude()));
|
||||||
|
param.setBearing(String.valueOf(location.getBearing()));
|
||||||
|
|
||||||
|
service.updatelocation(param).enqueue(new Callback<ResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<ResponseJson> call, @NonNull Response<ResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
Log.e("location", response.message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull retrofit2.Call<ResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,374 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.media.RingtoneManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Vibrator;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.json.AcceptRequestJson;
|
||||||
|
import id.ontime.driver.json.AcceptResponseJson;
|
||||||
|
import id.ontime.driver.utils.api.FCMHelper;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.fcm.FCMMessage;
|
||||||
|
import id.ontime.driver.models.OrderFCM;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
|
||||||
|
public class NewOrderActivity extends AppCompatActivity {
|
||||||
|
private static final int REQUEST_PERMISSION_LOCATION = 991;
|
||||||
|
private static final int REQUEST_PERMISSION_CALL = 992;
|
||||||
|
|
||||||
|
TextView layanantext;
|
||||||
|
LinearLayout sendDetailLayout;
|
||||||
|
TextView produk;
|
||||||
|
TextView sendername;
|
||||||
|
TextView receivername;
|
||||||
|
Button senderphone;
|
||||||
|
Button receiverphone;
|
||||||
|
TextView layanandesctext;
|
||||||
|
TextView pickuptext;
|
||||||
|
TextView destinationtext;
|
||||||
|
TextView estimatetext;
|
||||||
|
TextView distancetext;
|
||||||
|
TextView costtext;
|
||||||
|
TextView pricetext;
|
||||||
|
TextView totaltext;
|
||||||
|
ImageView icon;
|
||||||
|
TextView timer;
|
||||||
|
TextView time;
|
||||||
|
TextView distancetextes;
|
||||||
|
TextView costtextes;
|
||||||
|
Button cancel;
|
||||||
|
Button order;
|
||||||
|
RelativeLayout rlprogress;
|
||||||
|
LinearLayout lldestination;
|
||||||
|
LinearLayout lldistance;
|
||||||
|
|
||||||
|
String waktuorder,iconfitur, layanan, layanandesc, alamatasal, alamattujuan, estimasitime, hargatotal, cost, distance, idtrans, regid, orderfitur,tokenmerchant,idpelanggan,idtransmerchant;
|
||||||
|
String wallett;
|
||||||
|
MediaPlayer BG;
|
||||||
|
Vibrator v;
|
||||||
|
SettingPreference sp;
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_new_order);
|
||||||
|
layanantext = findViewById(R.id.layanan);
|
||||||
|
sendDetailLayout = findViewById(R.id.senddetail);
|
||||||
|
produk = findViewById(R.id.produk);
|
||||||
|
sendername = findViewById(R.id.sendername);
|
||||||
|
receivername = findViewById(R.id.receivername);
|
||||||
|
senderphone = findViewById(R.id.senderphone);
|
||||||
|
receiverphone = findViewById(R.id.receiverphone);
|
||||||
|
layanandesctext = findViewById(R.id.layanandes);
|
||||||
|
pickuptext = findViewById(R.id.pickUpText);
|
||||||
|
destinationtext = findViewById(R.id.destinationText);
|
||||||
|
estimatetext = findViewById(R.id.fitur);
|
||||||
|
distancetext = findViewById(R.id.distance);
|
||||||
|
costtext = findViewById(R.id.cost);
|
||||||
|
pricetext = findViewById(R.id.price);
|
||||||
|
totaltext = findViewById(R.id.totaltext);
|
||||||
|
icon = findViewById(R.id.image);
|
||||||
|
timer = findViewById(R.id.timer);
|
||||||
|
time = findViewById(R.id.time);
|
||||||
|
distancetextes = findViewById(R.id.distancetext);
|
||||||
|
costtextes = findViewById(R.id.costtext);
|
||||||
|
cancel = findViewById(R.id.cancel);
|
||||||
|
order = findViewById(R.id.order);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
lldestination = findViewById(R.id.lldestination);
|
||||||
|
lldistance = findViewById(R.id.lldistance);
|
||||||
|
setScreenOnFlags();
|
||||||
|
sp = new SettingPreference(this);
|
||||||
|
sp.updateNotif("ON");
|
||||||
|
Intent intent = getIntent();
|
||||||
|
iconfitur = intent.getStringExtra("icon");
|
||||||
|
layanan = intent.getStringExtra("layanan");
|
||||||
|
layanandesc = intent.getStringExtra("layanandesc");
|
||||||
|
alamatasal = intent.getStringExtra("alamat_asal");
|
||||||
|
alamattujuan = intent.getStringExtra("alamat_tujuan");
|
||||||
|
estimasitime = intent.getStringExtra("estimasi_time");
|
||||||
|
hargatotal = intent.getStringExtra("harga");
|
||||||
|
cost = intent.getStringExtra("biaya");
|
||||||
|
distance = intent.getStringExtra("distance");
|
||||||
|
idtrans = intent.getStringExtra("id_transaksi");
|
||||||
|
regid = intent.getStringExtra("reg_id");
|
||||||
|
wallett = intent.getStringExtra("pakai_wallet");
|
||||||
|
orderfitur = intent.getStringExtra("order_fitur");
|
||||||
|
tokenmerchant = intent.getStringExtra("token_merchant");
|
||||||
|
idpelanggan = intent.getStringExtra("id_pelanggan");
|
||||||
|
idtransmerchant = intent.getStringExtra("id_trans_merchant");
|
||||||
|
waktuorder = intent.getStringExtra("waktu_order");
|
||||||
|
if (orderfitur.equalsIgnoreCase("3")) {
|
||||||
|
lldestination.setVisibility(View.GONE);
|
||||||
|
lldistance.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (orderfitur.equalsIgnoreCase("2")) {
|
||||||
|
sendDetailLayout.setVisibility(View.VISIBLE);
|
||||||
|
//getData();
|
||||||
|
}
|
||||||
|
if (orderfitur.equalsIgnoreCase("4")) {
|
||||||
|
|
||||||
|
estimatetext.setText(estimasitime);
|
||||||
|
time.setText("Merchant");
|
||||||
|
distancetextes.setText("Delivery Fee");
|
||||||
|
costtextes.setText("Biaya Pesanan");
|
||||||
|
Utility.currencyTXT(distancetext, distance, this);
|
||||||
|
Utility.currencyTXT(costtext, cost, this);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
estimatetext.setText(estimasitime);
|
||||||
|
distancetext.setText(distance);
|
||||||
|
costtext.setText(cost);
|
||||||
|
}
|
||||||
|
System.out.println("Order MASUK"+layanan);
|
||||||
|
layanantext.setText(layanan);
|
||||||
|
layanandesctext.setText(layanandesc);
|
||||||
|
pickuptext.setText(alamatasal);
|
||||||
|
destinationtext.setText(alamattujuan);
|
||||||
|
Utility.currencyTXT(pricetext, hargatotal, this);
|
||||||
|
if (wallett.equalsIgnoreCase("true")) {
|
||||||
|
totaltext.setText("Total (SALDO)");
|
||||||
|
} else {
|
||||||
|
totaltext.setText("Total (TUNAI)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PicassoTrustAll.getInstance(this)
|
||||||
|
.load(Constants.IMAGESFITUR + iconfitur)
|
||||||
|
.placeholder(R.drawable.logo)
|
||||||
|
.resize(100, 100)
|
||||||
|
.into(icon);
|
||||||
|
cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (BG != null && BG.isPlaying()) {
|
||||||
|
BG.stop();
|
||||||
|
v.cancel();
|
||||||
|
}
|
||||||
|
timerplay.cancel();
|
||||||
|
Intent toOrder = new Intent(NewOrderActivity.this, MainActivity.class);
|
||||||
|
toOrder.addFlags(FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(toOrder);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (new SettingPreference(this).getSetting()[0].equals("OFF")) {
|
||||||
|
timerplay.start();
|
||||||
|
playSound();
|
||||||
|
removeNotif();
|
||||||
|
order.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
getaccept(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
removeNotif();
|
||||||
|
if (BG != null && BG.isPlaying()) {
|
||||||
|
BG.stop();
|
||||||
|
v.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
getaccept(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CountDownTimer timerplay = new CountDownTimer(20000, 1000) {
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
timer.setText("" + millisUntilFinished / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
public void onFinish() {
|
||||||
|
if (BG != null && BG.isPlaying()) {
|
||||||
|
BG.stop();
|
||||||
|
v.cancel();
|
||||||
|
}
|
||||||
|
timer.setText("0");
|
||||||
|
Intent toOrder = new Intent(NewOrderActivity.this, MainActivity.class);
|
||||||
|
toOrder.addFlags(FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(toOrder);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
private void playSound() {
|
||||||
|
v = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
|
||||||
|
long[] pattern = {0, 100, 700};
|
||||||
|
Objects.requireNonNull(v).vibrate(pattern, 0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
|
||||||
|
BG = MediaPlayer.create(getBaseContext(), notification);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
BG.setLooping(true);
|
||||||
|
BG.setVolume(100, 100);
|
||||||
|
BG.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
private void getaccept(boolean isAutoBid) {
|
||||||
|
if (!isAutoBid) {
|
||||||
|
if (BG != null && BG.isPlaying()) {
|
||||||
|
BG.stop();
|
||||||
|
v.cancel();
|
||||||
|
}
|
||||||
|
timerplay.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
final User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
AcceptRequestJson param = new AcceptRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setIdtrans(idtrans);
|
||||||
|
userService.accept(param).enqueue(new Callback<AcceptResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<AcceptResponseJson> call, @NonNull final Response<AcceptResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
sp.updateNotif("OFF");
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("berhasil")) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(NewOrderActivity.this, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
OrderFCM orderfcm = new OrderFCM();
|
||||||
|
orderfcm.id_driver = loginUser.getId();
|
||||||
|
orderfcm.id_transaksi = idtrans;
|
||||||
|
orderfcm.response = "2";
|
||||||
|
if (orderfitur.equalsIgnoreCase("4")) {
|
||||||
|
orderfcm.desc = "pengemudi sedang ambil pesanan";
|
||||||
|
orderfcm.id_pelanggan = idpelanggan;
|
||||||
|
orderfcm.invoice = "INV-"+idtrans+idtransmerchant;
|
||||||
|
orderfcm.ordertime = waktuorder;
|
||||||
|
sendMessageToDriver(tokenmerchant, orderfcm);
|
||||||
|
} else {
|
||||||
|
orderfcm.desc = getString(R.string.notification_start);
|
||||||
|
}
|
||||||
|
sendMessageToDriver(regid, orderfcm);
|
||||||
|
} else {
|
||||||
|
sp.updateNotif("OFF");
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(NewOrderActivity.this, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
Toast.makeText(NewOrderActivity.this, "Pesanan tidak lagi tersedia!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<AcceptResponseJson> call, @NonNull Throwable t) {
|
||||||
|
Toast.makeText(NewOrderActivity.this, "Error Koneksi!", Toast.LENGTH_SHORT).show();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
sp.updateNotif("OFF");
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(NewOrderActivity.this, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessageToDriver(final String regIDTujuan, final OrderFCM response) {
|
||||||
|
|
||||||
|
final FCMMessage message = new FCMMessage();
|
||||||
|
message.setTo(regIDTujuan);
|
||||||
|
message.setData(response);
|
||||||
|
|
||||||
|
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||||
|
Log.e("REQUEST TO DRIVER", message.getData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeNotif() {
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||||
|
Objects.requireNonNull(notificationManager).cancel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setScreenOnFlags() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
setShowWhenLocked(true);
|
||||||
|
setTurnScreenOn(true);
|
||||||
|
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
|
Objects.requireNonNull(keyguardManager).requestDismissKeyguard(this, null);
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
} else {
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
|
||||||
|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
|
||||||
|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
|
||||||
|
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,560 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||||
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
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.MapStyleOptions;
|
||||||
|
import com.google.android.gms.maps.model.Marker;
|
||||||
|
import com.google.android.gms.maps.model.MarkerOptions;
|
||||||
|
import com.google.android.gms.maps.model.Polyline;
|
||||||
|
import com.google.android.gms.maps.model.PolylineOptions;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.gmap.directions.Directions;
|
||||||
|
import id.ontime.driver.gmap.directions.Route;
|
||||||
|
import id.ontime.driver.item.ItemPesananItem;
|
||||||
|
import id.ontime.driver.utils.api.MapDirectionAPI;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.DetailRequestJson;
|
||||||
|
import id.ontime.driver.json.DetailTransResponseJson;
|
||||||
|
import id.ontime.driver.models.PelangganModel;
|
||||||
|
import id.ontime.driver.models.TransaksiModel;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.Log;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.widget.NestedScrollView;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class OrderDetailActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||||
|
|
||||||
|
LinearLayout bottomsheet;
|
||||||
|
TextView layanan;
|
||||||
|
TextView layanandesk;
|
||||||
|
LinearLayout llchat;
|
||||||
|
CircleImageView foto;
|
||||||
|
TextView pickUpText;
|
||||||
|
TextView destinationText;
|
||||||
|
TextView fiturtext;
|
||||||
|
TextView distanceText;
|
||||||
|
TextView priceText;
|
||||||
|
TextView namamerchant;
|
||||||
|
Button orderButton;
|
||||||
|
RelativeLayout rlprogress;
|
||||||
|
TextView textprogress;
|
||||||
|
ImageView phone;
|
||||||
|
ImageView chat;
|
||||||
|
LinearLayout llchatmerchant;
|
||||||
|
LinearLayout lldestination;
|
||||||
|
LinearLayout lldistance;
|
||||||
|
LinearLayout lldetailsend;
|
||||||
|
TextView produk;
|
||||||
|
TextView sendername;
|
||||||
|
TextView receivername;
|
||||||
|
Button senderphone;
|
||||||
|
Button receiverphone;
|
||||||
|
|
||||||
|
NestedScrollView scrollView;
|
||||||
|
|
||||||
|
ImageView backbutton;
|
||||||
|
LinearLayout llrating;
|
||||||
|
LinearLayout llbutton;
|
||||||
|
|
||||||
|
TextView cost;
|
||||||
|
TextView deliveryfee;
|
||||||
|
LinearLayout llorderdetail;
|
||||||
|
LinearLayout llmerchantdetail;
|
||||||
|
LinearLayout llmerchantinfo;
|
||||||
|
ShimmerFrameLayout shimmerlayanan;
|
||||||
|
ShimmerFrameLayout shimmerpickup;
|
||||||
|
ShimmerFrameLayout shimmerdestination;
|
||||||
|
ShimmerFrameLayout shimmerfitur;
|
||||||
|
ShimmerFrameLayout shimmerdistance;
|
||||||
|
ShimmerFrameLayout shimmerprice;
|
||||||
|
|
||||||
|
RecyclerView rvmerchantnear;
|
||||||
|
|
||||||
|
private GoogleMap gMap;
|
||||||
|
private static final int REQUEST_PERMISSION_LOCATION = 991;
|
||||||
|
private static final int REQUEST_PERMISSION_CALL = 992;
|
||||||
|
private GoogleApiClient googleApiClient;
|
||||||
|
private LatLng pickUpLatLng;
|
||||||
|
private LatLng destinationLatLng;
|
||||||
|
private Polyline directionLine;
|
||||||
|
private Marker pickUpMarker;
|
||||||
|
private Marker destinationMarker;
|
||||||
|
String idtrans, idpelanggan, response, fitur;
|
||||||
|
ItemPesananItem itemPesananItem;
|
||||||
|
TextView totaltext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_detail_order);
|
||||||
|
bottomsheet = findViewById(R.id.bottom_sheet);
|
||||||
|
layanan = findViewById(R.id.layanan);
|
||||||
|
layanandesk = findViewById(R.id.layanandes);
|
||||||
|
llchat = findViewById(R.id.llchat);
|
||||||
|
foto = findViewById(R.id.background);
|
||||||
|
pickUpText = findViewById(R.id.pickUpText);
|
||||||
|
destinationText = findViewById(R.id.destinationText);
|
||||||
|
fiturtext = findViewById(R.id.fitur);
|
||||||
|
distanceText = findViewById(R.id.distance);
|
||||||
|
priceText = findViewById(R.id.price);
|
||||||
|
namamerchant = findViewById(R.id.namamerchant);
|
||||||
|
orderButton = findViewById(R.id.order);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
textprogress = findViewById(R.id.textprogress);
|
||||||
|
phone = findViewById(R.id.phonenumber);
|
||||||
|
chat = findViewById(R.id.chat);
|
||||||
|
llchatmerchant = findViewById(R.id.llchatmerchant);
|
||||||
|
lldestination = findViewById(R.id.lldestination);
|
||||||
|
lldistance = findViewById(R.id.lldistance);
|
||||||
|
lldetailsend = findViewById(R.id.senddetail);
|
||||||
|
produk = findViewById(R.id.produk);
|
||||||
|
sendername = findViewById(R.id.sendername);
|
||||||
|
receivername = findViewById(R.id.receivername);
|
||||||
|
senderphone = findViewById(R.id.senderphone);
|
||||||
|
receiverphone = findViewById(R.id.receiverphone);
|
||||||
|
scrollView = findViewById(R.id.scroller);
|
||||||
|
backbutton = findViewById(R.id.back_btn);
|
||||||
|
llrating = findViewById(R.id.status);
|
||||||
|
llbutton = findViewById(R.id.llbutton);
|
||||||
|
cost = findViewById(R.id.cost);
|
||||||
|
deliveryfee = findViewById(R.id.deliveryfee);
|
||||||
|
llorderdetail = findViewById(R.id.orderdetail);
|
||||||
|
llmerchantdetail = findViewById(R.id.merchantdetail);
|
||||||
|
llmerchantinfo = findViewById(R.id.merchantinfo);
|
||||||
|
shimmerlayanan = findViewById(R.id.shimmerlayanan);
|
||||||
|
shimmerpickup = findViewById(R.id.shimmerpickup);
|
||||||
|
shimmerdestination = findViewById(R.id.shimmerdestination);
|
||||||
|
shimmerfitur = findViewById(R.id.shimmerfitur);
|
||||||
|
shimmerdistance = findViewById(R.id.shimmerdistance);
|
||||||
|
shimmerprice = findViewById(R.id.shimmerprice);
|
||||||
|
rvmerchantnear = findViewById(R.id.merchantnear);
|
||||||
|
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomsheet);
|
||||||
|
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||||
|
behavior.setPeekHeight(300);
|
||||||
|
llrating.setVisibility(View.VISIBLE);
|
||||||
|
backbutton.setVisibility(View.VISIBLE);
|
||||||
|
llbutton.setVisibility(View.GONE);
|
||||||
|
llchat.setVisibility(View.GONE);
|
||||||
|
llchatmerchant.setVisibility(View.GONE);
|
||||||
|
totaltext = findViewById(R.id.totaltext);
|
||||||
|
shimmerload();
|
||||||
|
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.mapView);
|
||||||
|
Objects.requireNonNull(mapFragment).getMapAsync(this);
|
||||||
|
if (googleApiClient == null) {
|
||||||
|
googleApiClient = new GoogleApiClient.Builder(this)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
backbutton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rvmerchantnear.setHasFixedSize(true);
|
||||||
|
rvmerchantnear.setNestedScrollingEnabled(false);
|
||||||
|
rvmerchantnear.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
idpelanggan = intent.getStringExtra("id_pelanggan");
|
||||||
|
idtrans = intent.getStringExtra("id_transaksi");
|
||||||
|
response = intent.getStringExtra("response");
|
||||||
|
|
||||||
|
if (Objects.equals(response, "2")) {
|
||||||
|
llchat.setVisibility(View.VISIBLE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_accept));
|
||||||
|
} else if (Objects.equals(response, "3")) {
|
||||||
|
llchat.setVisibility(View.VISIBLE);
|
||||||
|
orderButton.setVisibility(View.GONE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_start));
|
||||||
|
} else if (Objects.equals(response, "4")) {
|
||||||
|
scrollView.setPadding(0,0,0,10);
|
||||||
|
llchat.setVisibility(View.GONE);
|
||||||
|
orderButton.setVisibility(View.GONE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_finish));
|
||||||
|
} else if (Objects.equals(response, "5")) {
|
||||||
|
scrollView.setPadding(0,0,0,10);
|
||||||
|
llchat.setVisibility(View.GONE);
|
||||||
|
orderButton.setVisibility(View.GONE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_cancel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getData(final String idtrans, final String idpelanggan) {
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||||
|
DetailRequestJson param = new DetailRequestJson();
|
||||||
|
param.setId(idtrans);
|
||||||
|
param.setIdPelanggan(idpelanggan);
|
||||||
|
service.detailtrans(param).enqueue(new Callback<DetailTransResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<DetailTransResponseJson> call, @NonNull Response<DetailTransResponseJson> responsedata) {
|
||||||
|
if (responsedata.isSuccessful()) {
|
||||||
|
shimmertutup();
|
||||||
|
Log.e("", String.valueOf(Objects.requireNonNull(responsedata.body()).getData().get(0)));
|
||||||
|
final TransaksiModel transaksi = responsedata.body().getData().get(0);
|
||||||
|
PelangganModel pelanggan = responsedata.body().getPelanggan().get(0);
|
||||||
|
pickUpLatLng = new LatLng(transaksi.getStartLatitude(), transaksi.getStartLongitude());
|
||||||
|
destinationLatLng = new LatLng(transaksi.getEndLatitude(), transaksi.getEndLongitude());
|
||||||
|
|
||||||
|
fitur = transaksi.getOrderFitur();
|
||||||
|
|
||||||
|
switch (transaksi.getHome()) {
|
||||||
|
case "3":
|
||||||
|
lldestination.setVisibility(View.GONE);
|
||||||
|
lldistance.setVisibility(View.GONE);
|
||||||
|
fiturtext.setText(transaksi.getEstimasi());
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
llorderdetail.setVisibility(View.VISIBLE);
|
||||||
|
llmerchantdetail.setVisibility(View.VISIBLE);
|
||||||
|
llmerchantinfo.setVisibility(View.VISIBLE);
|
||||||
|
Utility.currencyTXT(deliveryfee, String.valueOf(transaksi.getHarga()), OrderDetailActivity.this);
|
||||||
|
Utility.currencyTXT(cost, String.valueOf(transaksi.getTotal_biaya()), OrderDetailActivity.this);
|
||||||
|
namamerchant.setText(transaksi.getNama_merchant());
|
||||||
|
|
||||||
|
itemPesananItem = new ItemPesananItem(responsedata.body().getItem(), R.layout.item_pesanan);
|
||||||
|
rvmerchantnear.setAdapter(itemPesananItem);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
requestRoute();
|
||||||
|
lldetailsend.setVisibility(View.VISIBLE);
|
||||||
|
produk.setText(transaksi.getNamaBarang());
|
||||||
|
sendername.setText(transaksi.namaPengirim);
|
||||||
|
receivername.setText(transaksi.namaPenerima);
|
||||||
|
|
||||||
|
senderphone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(OrderDetailActivity.this, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Call Driver");
|
||||||
|
alertDialogBuilder.setMessage("You want to call " + transaksi.getNamaPengirim() + "(" + transaksi.teleponPengirim + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(OrderDetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(OrderDetailActivity.this, new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:" + transaksi.teleponPengirim));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
receiverphone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(OrderDetailActivity.this, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Call Driver");
|
||||||
|
alertDialogBuilder.setMessage("You want to call " + transaksi.getNamaPenerima() + "(" + transaksi.teleponPenerima + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(OrderDetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(OrderDetailActivity.this, new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:" + transaksi.teleponPenerima));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pickUpMarker != null) pickUpMarker.remove();
|
||||||
|
pickUpMarker = gMap.addMarker(new MarkerOptions()
|
||||||
|
.position(pickUpLatLng)
|
||||||
|
.title("Ambil")
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pickup)));
|
||||||
|
|
||||||
|
|
||||||
|
if (destinationMarker != null) destinationMarker.remove();
|
||||||
|
destinationMarker = gMap.addMarker(new MarkerOptions()
|
||||||
|
.position(destinationLatLng)
|
||||||
|
.title("Tujuan")
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.drawable.destination)));
|
||||||
|
updateLastLocation();
|
||||||
|
parsedata(transaksi, pelanggan);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull retrofit2.Call<DetailTransResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmerload() {
|
||||||
|
shimmerlayanan.startShimmerAnimation();
|
||||||
|
shimmerpickup.startShimmerAnimation();
|
||||||
|
shimmerdestination.startShimmerAnimation();
|
||||||
|
shimmerfitur.startShimmerAnimation();
|
||||||
|
shimmerdistance.startShimmerAnimation();
|
||||||
|
shimmerprice.startShimmerAnimation();
|
||||||
|
|
||||||
|
layanan.setVisibility(View.GONE);
|
||||||
|
layanandesk.setVisibility(View.GONE);
|
||||||
|
pickUpText.setVisibility(View.GONE);
|
||||||
|
destinationText.setVisibility(View.GONE);
|
||||||
|
fiturtext.setVisibility(View.GONE);
|
||||||
|
priceText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmertutup() {
|
||||||
|
shimmerlayanan.stopShimmerAnimation();
|
||||||
|
shimmerpickup.stopShimmerAnimation();
|
||||||
|
shimmerdestination.stopShimmerAnimation();
|
||||||
|
shimmerfitur.stopShimmerAnimation();
|
||||||
|
shimmerdistance.stopShimmerAnimation();
|
||||||
|
shimmerprice.stopShimmerAnimation();
|
||||||
|
|
||||||
|
shimmerlayanan.setVisibility(View.GONE);
|
||||||
|
shimmerpickup.setVisibility(View.GONE);
|
||||||
|
shimmerdestination.setVisibility(View.GONE);
|
||||||
|
shimmerfitur.setVisibility(View.GONE);
|
||||||
|
shimmerdistance.setVisibility(View.GONE);
|
||||||
|
shimmerprice.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
layanan.setVisibility(View.VISIBLE);
|
||||||
|
layanandesk.setVisibility(View.VISIBLE);
|
||||||
|
pickUpText.setVisibility(View.VISIBLE);
|
||||||
|
destinationText.setVisibility(View.VISIBLE);
|
||||||
|
distanceText.setVisibility(View.VISIBLE);
|
||||||
|
fiturtext.setVisibility(View.VISIBLE);
|
||||||
|
priceText.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private void parsedata(TransaksiModel request, final PelangganModel pelanggan) {
|
||||||
|
requestRoute();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
pickUpLatLng = new LatLng(request.getStartLatitude(), request.getStartLongitude());
|
||||||
|
destinationLatLng = new LatLng(request.getEndLatitude(), request.getEndLongitude());
|
||||||
|
|
||||||
|
PicassoTrustAll.getInstance(this)
|
||||||
|
.load(Constants.IMAGESUSER + pelanggan.getFoto())
|
||||||
|
.placeholder(R.drawable.image_placeholder)
|
||||||
|
.into(foto);
|
||||||
|
|
||||||
|
if (request.isPakaiWallet()) {
|
||||||
|
totaltext.setText("Total (Saldo)");
|
||||||
|
} else {
|
||||||
|
totaltext.setText("Total (Tunai)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rating display is disabled because the third-party rating-view dependency
|
||||||
|
// is no longer included. You can re-enable it by wiring this value into
|
||||||
|
// a standard RatingBar or another UI component.
|
||||||
|
|
||||||
|
layanan.setText(pelanggan.getFullnama());
|
||||||
|
pickUpText.setText(request.getAlamatAsal());
|
||||||
|
destinationText.setText(request.getAlamatTujuan());
|
||||||
|
if (request.getHome().equals("4")) {
|
||||||
|
double totalbiaya = Double.parseDouble(request.getTotal_biaya());
|
||||||
|
Utility.currencyTXT(priceText, String.valueOf(request.getHarga()+ totalbiaya), this);
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(priceText, String.valueOf(request.getHarga()), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastLocation() {
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_LOCATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocationServices.FusedLocationApi.getLastLocation(
|
||||||
|
googleApiClient);
|
||||||
|
gMap.setMyLocationEnabled(true);
|
||||||
|
|
||||||
|
if (pickUpLatLng != null) {
|
||||||
|
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
|
pickUpLatLng, 15f)
|
||||||
|
);
|
||||||
|
|
||||||
|
gMap.animateCamera(CameraUpdateFactory.zoomTo(15f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private okhttp3.Callback updateRouteCallback = new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, okhttp3.Response response) throws IOException {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
final String json = Objects.requireNonNull(response.body()).string();
|
||||||
|
final String error = MapDirectionAPI.getDirectionErrorMessage(json);
|
||||||
|
if (error != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final long distance = MapDirectionAPI.getDistance(OrderDetailActivity.this, json);
|
||||||
|
final String time = MapDirectionAPI.getTimeDistance(OrderDetailActivity.this, json);
|
||||||
|
if (distance >= 0) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateLineDestination(json);
|
||||||
|
float km = ((float) (distance)) / 1000f;
|
||||||
|
String format = String.format(Locale.US, "%.1f", km);
|
||||||
|
distanceText.setText(format);
|
||||||
|
fiturtext.setText(time);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void requestRoute() {
|
||||||
|
if (pickUpLatLng != null && destinationLatLng != null) {
|
||||||
|
MapDirectionAPI.getDirection(OrderDetailActivity.this, pickUpLatLng, destinationLatLng)
|
||||||
|
.enqueue(updateRouteCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLineDestination(String json) {
|
||||||
|
Directions directions = new Directions(this);
|
||||||
|
try {
|
||||||
|
List<Route> routes = directions.parse(json);
|
||||||
|
|
||||||
|
if (directionLine != null) directionLine.remove();
|
||||||
|
if (routes.size() > 0) {
|
||||||
|
directionLine = gMap.addPolyline((new PolylineOptions())
|
||||||
|
.addAll(routes.get(0).getOverviewPolyLine())
|
||||||
|
.color(ContextCompat.getColor(this, R.color.colorgradient))
|
||||||
|
.width(8));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnected(@androidx.annotation.Nullable Bundle bundle) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionSuspended(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMapReady(GoogleMap googleMap) {
|
||||||
|
gMap = googleMap;
|
||||||
|
gMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||||
|
try {
|
||||||
|
boolean success = googleMap.setMapStyle(
|
||||||
|
MapStyleOptions.loadRawResourceStyle(
|
||||||
|
this, R.raw.style_json));
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
android.util.Log.e("", "Style parsing failed.");
|
||||||
|
}
|
||||||
|
} catch (Resources.NotFoundException e) {
|
||||||
|
android.util.Log.e("", "Can't find style. Error: ", e);
|
||||||
|
}
|
||||||
|
getData(idtrans, idpelanggan);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.json.PrivacyRequestJson;
|
||||||
|
import id.ontime.driver.json.PrivacyResponseJson;
|
||||||
|
import id.ontime.driver.models.SettingsModel;
|
||||||
|
import id.ontime.driver.utils.NetworkUtils;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class PrivacyActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
WebView webView;
|
||||||
|
ImageView backbtn;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_privacy);
|
||||||
|
webView = findViewById(R.id.webView);
|
||||||
|
backbtn = findViewById(R.id.back_btn);
|
||||||
|
webView.setBackgroundColor(Color.TRANSPARENT);
|
||||||
|
if (NetworkUtils.isConnected(PrivacyActivity.this)) {
|
||||||
|
get();
|
||||||
|
}
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void get() {
|
||||||
|
PrivacyRequestJson request = new PrivacyRequestJson();
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, "admin", "12345");
|
||||||
|
service.privacy(request).enqueue(new Callback<PrivacyResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<PrivacyResponseJson> call, @NonNull Response<PrivacyResponseJson> response) {
|
||||||
|
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("found")) {
|
||||||
|
SettingsModel model = response.body().getData().get(0);
|
||||||
|
setResult(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<PrivacyResponseJson> call, @NonNull Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setResult(SettingsModel getprivacy) {
|
||||||
|
|
||||||
|
String mimeType = "text/html";
|
||||||
|
String encoding = "utf-8";
|
||||||
|
String htmlText = getprivacy.getPrivacy();
|
||||||
|
String text = "<html dir=" + "><head>"
|
||||||
|
+ "<style type=\"text/css\">@font-face {font-family: MyFont;src: url(\"file:///android_asset/fonts/Montserrat_Regular.ttf\")}body{font-family: MyFont;color: #000000;text-align:justify;line-height:1.2}"
|
||||||
|
+ "</style></head>"
|
||||||
|
+ "<body>"
|
||||||
|
+ htmlText
|
||||||
|
+ "</body></html>";
|
||||||
|
|
||||||
|
webView.loadDataWithBaseURL(null, text, mimeType, encoding, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||||
|
if (menuItem.getItemId() == android.R.id.home) {
|
||||||
|
onBackPressed();
|
||||||
|
} else {
|
||||||
|
return super.onOptionsItemSelected(menuItem);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,158 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.android.gms.tasks.OnSuccessListener;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.fragment.EnableLlocationFragment;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
public class SplashActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
setContentView(R.layout.activity_splash);
|
||||||
|
final User user = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
removeNotif();
|
||||||
|
sharedPreferences = getSharedPreferences(Constants.PREF_NAME, MODE_PRIVATE);
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
if (user != null) {
|
||||||
|
|
||||||
|
if (ActivityCompat.checkSelfPermission(SplashActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(SplashActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
enable_location();
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (ActivityCompat.checkSelfPermission(SplashActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(SplashActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
enable_location();
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(SplashActivity.this, IntroActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GPSStatus() {
|
||||||
|
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
boolean GpsStatus = Objects.requireNonNull(locationManager).isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||||
|
if (!GpsStatus) {
|
||||||
|
Toast.makeText(this, "On Location in High Accuracy", Toast.LENGTH_SHORT).show();
|
||||||
|
startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), 2);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
GetCurrentlocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == 2) {
|
||||||
|
GPSStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void GetCurrentlocation() {
|
||||||
|
FusedLocationProviderClient mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
enable_location();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mFusedLocationClient.getLastLocation()
|
||||||
|
.addOnSuccessListener(this, new OnSuccessListener<Location>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Location location) {
|
||||||
|
// Got last known location. In some rare situations this can be null.
|
||||||
|
if (location != null) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(String.valueOf(Constants.LATITUDE), "" + location.getLatitude());
|
||||||
|
editor.putString(String.valueOf(Constants.LONGITUDE), "" + location.getLongitude());
|
||||||
|
editor.apply();
|
||||||
|
Constants.LATITUDE = location.getLatitude();
|
||||||
|
Constants.LONGITUDE = location.getLongitude();
|
||||||
|
startActivity(new Intent(SplashActivity.this, MainActivity.class));
|
||||||
|
overridePendingTransition(R.anim.from_right, R.anim.to_left);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (sharedPreferences.getString(String.valueOf(Constants.LATITUDE), "").equals("") || sharedPreferences.getString(String.valueOf(Constants.LONGITUDE), "").equals("")) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(String.valueOf(Constants.LATITUDE), "33.738045");
|
||||||
|
editor.putString(String.valueOf(Constants.LONGITUDE), "73.084488");
|
||||||
|
editor.apply();
|
||||||
|
Constants.LATITUDE = Double.valueOf("33.738045");
|
||||||
|
Constants.LONGITUDE = Double.valueOf("73.084488");
|
||||||
|
}
|
||||||
|
startActivity(new Intent(SplashActivity.this, MainActivity.class));
|
||||||
|
overridePendingTransition(R.anim.from_right, R.anim.to_left);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void enable_location() {
|
||||||
|
EnableLlocationFragment enable_llocationFragment = new EnableLlocationFragment();
|
||||||
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||||
|
transaction.setCustomAnimations(R.anim.from_right, R.anim.to_left, R.anim.from_left, R.anim.to_right);
|
||||||
|
getSupportFragmentManager().popBackStackImmediate();
|
||||||
|
transaction.replace(R.id.splash, enable_llocationFragment).addToBackStack(null).commit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeNotif() {
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||||
|
Objects.requireNonNull(notificationManager).cancel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.cardview.widget.CardView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.json.ResponseJson;
|
||||||
|
import id.ontime.driver.json.WithdrawRequestJson;
|
||||||
|
import id.ontime.driver.json.fcm.FCMMessage;
|
||||||
|
import id.ontime.driver.models.Notif;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.api.FCMHelper;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class TopupSaldoActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
EditText nominal;
|
||||||
|
CardView text1, text2, text3, text4, text5, text6;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
TextView textnotif, privacy;
|
||||||
|
Button whatsapp;
|
||||||
|
String disableback;
|
||||||
|
LinearLayout banktransfer;
|
||||||
|
private String paymentAmount;
|
||||||
|
SettingPreference sp;
|
||||||
|
ImageView backBtn;
|
||||||
|
boolean debug;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_topup);
|
||||||
|
View bottom_sheet = findViewById(R.id.bottom_sheet);
|
||||||
|
BottomSheetBehavior.from(bottom_sheet);
|
||||||
|
sp = new SettingPreference(this);
|
||||||
|
|
||||||
|
nominal = findViewById(R.id.saldo);
|
||||||
|
text1 = findViewById(R.id.text1);
|
||||||
|
text2 = findViewById(R.id.text2);
|
||||||
|
text3 = findViewById(R.id.text3);
|
||||||
|
text4 = findViewById(R.id.text4);
|
||||||
|
text5 = findViewById(R.id.text5);
|
||||||
|
text6 = findViewById(R.id.text6);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif);
|
||||||
|
textnotif = findViewById(R.id.textnotif);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
backBtn = findViewById(R.id.back_btn);
|
||||||
|
banktransfer = findViewById(R.id.banktransfer);
|
||||||
|
whatsapp = findViewById(R.id.whatsapp);
|
||||||
|
privacy = findViewById(R.id.privacy);
|
||||||
|
|
||||||
|
nominal.addTextChangedListener(Utility.currencyTW(nominal,this));
|
||||||
|
|
||||||
|
|
||||||
|
banktransfer.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!nominal.getText().toString().isEmpty()) {
|
||||||
|
sheetlist();
|
||||||
|
} else {
|
||||||
|
notif("nominal tidak boleh kosong!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
whatsapp.setOnClickListener(v -> {
|
||||||
|
Intent i = new Intent(TopupSaldoActivity.this, ConfirmWAActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
privacy.setOnClickListener(v -> {
|
||||||
|
Intent i = new Intent(TopupSaldoActivity.this, PrivacyActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
text1.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("20.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
text2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("50.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
text3.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("100.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
text4.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("200.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
text5.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("300.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
text6.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
nominal.setText("500.000");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
backBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
textnotif.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String convertAngka(String value) {
|
||||||
|
return (((((value + "")
|
||||||
|
.replaceAll(sp.getSetting()[4], ""))
|
||||||
|
.replaceAll(" ", ""))
|
||||||
|
.replaceAll(",", ""))
|
||||||
|
.replaceAll("[$.]", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sheetlist() {
|
||||||
|
Intent i = new Intent(TopupSaldoActivity.this, WithdrawActivity.class);
|
||||||
|
i.putExtra("type","topup");
|
||||||
|
i.putExtra("nominal", convertAngka(nominal.getText().toString()));
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void submit() {
|
||||||
|
progressshow();
|
||||||
|
paymentAmount = nominal.getText().toString();
|
||||||
|
final User user = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
WithdrawRequestJson request = new WithdrawRequestJson();
|
||||||
|
request.setId(user.getId());
|
||||||
|
request.setBank("midtrans");
|
||||||
|
request.setName(user.getFullnama());
|
||||||
|
request.setAmount(convertAngka(paymentAmount.replace(sp.getSetting()[4],"")));
|
||||||
|
request.setCard("1234");
|
||||||
|
request.setNotelepon(user.getNoTelepon());
|
||||||
|
request.setEmail(user.getEmail());
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, user.getNoTelepon(), user.getPassword());
|
||||||
|
service.topupmidtrans(request).enqueue(new Callback<ResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<ResponseJson> call, @NonNull Response<ResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
Intent i = new Intent(TopupSaldoActivity.this,MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
Notif notif = new Notif();
|
||||||
|
notif.title = "Topup";
|
||||||
|
notif.message = "topup berhasil";
|
||||||
|
sendNotif(user.getToken(), notif);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif("error, silahkan cek akun anda!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
notif("error!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<ResponseJson> call, @NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendNotif(final String regIDTujuan, final Notif notif) {
|
||||||
|
|
||||||
|
final FCMMessage message = new FCMMessage();
|
||||||
|
message.setTo(regIDTujuan);
|
||||||
|
message.setData(notif);
|
||||||
|
|
||||||
|
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String hashCal(String str) {
|
||||||
|
byte[] hashseq = str.getBytes();
|
||||||
|
StringBuilder hexString = new StringBuilder();
|
||||||
|
try {
|
||||||
|
MessageDigest algorithm = MessageDigest.getInstance("SHA-512");
|
||||||
|
algorithm.reset();
|
||||||
|
algorithm.update(hashseq);
|
||||||
|
byte[] messageDigest = algorithm.digest();
|
||||||
|
for (byte aMessageDigest : messageDigest) {
|
||||||
|
String hex = Integer.toHexString(0xFF & aMessageDigest);
|
||||||
|
if (hex.length() == 1) {
|
||||||
|
hexString.append("0");
|
||||||
|
}
|
||||||
|
hexString.append(hex);
|
||||||
|
}
|
||||||
|
} catch (NoSuchAlgorithmException ignored) {
|
||||||
|
}
|
||||||
|
return hexString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.item.WalletItem;
|
||||||
|
import id.ontime.driver.json.WalletRequestJson;
|
||||||
|
import id.ontime.driver.json.WalletResponseJson;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class WalletActivity extends AppCompatActivity {
|
||||||
|
ImageView backbtn;
|
||||||
|
ShimmerFrameLayout shimmer;
|
||||||
|
RecyclerView recycle;
|
||||||
|
WalletItem walletItem;
|
||||||
|
RelativeLayout rlnodata;
|
||||||
|
Button whatsapp;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_wallet);
|
||||||
|
|
||||||
|
shimmer = findViewById(R.id.shimmerwallet);
|
||||||
|
recycle = findViewById(R.id.recycle);
|
||||||
|
rlnodata = findViewById(R.id.rlnodata);
|
||||||
|
backbtn = findViewById(R.id.back_btn);
|
||||||
|
whatsapp = findViewById(R.id.whatsapp);
|
||||||
|
|
||||||
|
recycle.setHasFixedSize(true);
|
||||||
|
recycle.setLayoutManager(new GridLayoutManager(this, 1));
|
||||||
|
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
whatsapp.setOnClickListener(v -> {
|
||||||
|
Intent i = new Intent(WalletActivity.this, ConfirmWAActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
getdatawallet();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmershow() {
|
||||||
|
recycle.setVisibility(View.GONE);
|
||||||
|
shimmer.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.startShimmerAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmertutup() {
|
||||||
|
|
||||||
|
recycle.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.setVisibility(View.GONE);
|
||||||
|
shimmer.stopShimmerAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getdatawallet() {
|
||||||
|
shimmershow();
|
||||||
|
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
DriverService driverService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
WalletRequestJson param = new WalletRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
driverService.wallet(param).enqueue(new Callback<WalletResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<WalletResponseJson> call, @NonNull Response<WalletResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
shimmertutup();
|
||||||
|
walletItem = new WalletItem(WalletActivity.this, Objects.requireNonNull(response.body()).getData(), R.layout.item_wallet);
|
||||||
|
recycle.setAdapter(walletItem);
|
||||||
|
if (response.body().getData().isEmpty()) {
|
||||||
|
recycle.setVisibility(View.GONE);
|
||||||
|
rlnodata.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
recycle.setVisibility(View.VISIBLE);
|
||||||
|
rlnodata.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<WalletResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
package id.ontime.driver.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.item.BankItem;
|
||||||
|
import id.ontime.driver.json.BankResponseJson;
|
||||||
|
import id.ontime.driver.json.WithdrawRequestJson;
|
||||||
|
import id.ontime.driver.json.WithdrawResponseJson;
|
||||||
|
import id.ontime.driver.json.fcm.FCMMessage;
|
||||||
|
import id.ontime.driver.models.Notif;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.api.FCMHelper;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class WithdrawActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
EditText amount, bank, accnumber, nama;
|
||||||
|
Button submit;
|
||||||
|
TextView notif;
|
||||||
|
ImageView backbtn, images;
|
||||||
|
RelativeLayout rlnotif, rlprogress;
|
||||||
|
String disableback, type, nominal;
|
||||||
|
SettingPreference sp;
|
||||||
|
RecyclerView petunjuk;
|
||||||
|
LinearLayout llpentunjuk;
|
||||||
|
BankItem bankItem;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_withdraw);
|
||||||
|
disableback = "false";
|
||||||
|
amount = findViewById(R.id.amount);
|
||||||
|
bank = findViewById(R.id.bank);
|
||||||
|
accnumber = findViewById(R.id.accnumber);
|
||||||
|
backbtn = findViewById(R.id.back_btn);
|
||||||
|
submit = findViewById(R.id.submit);
|
||||||
|
rlnotif = findViewById(R.id.rlnotif);
|
||||||
|
notif = findViewById(R.id.textnotif);
|
||||||
|
rlprogress = findViewById(R.id.rlprogress);
|
||||||
|
nama = findViewById(R.id.namanumber);
|
||||||
|
images = findViewById(R.id.imagebackground);
|
||||||
|
sp = new SettingPreference(this);
|
||||||
|
llpentunjuk = findViewById(R.id.llpentunjuk);
|
||||||
|
petunjuk = findViewById(R.id.petunjuk);
|
||||||
|
sp = new SettingPreference(this);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
type = intent.getStringExtra("type");
|
||||||
|
|
||||||
|
if (Objects.equals(type, "topup")) {
|
||||||
|
images.setImageResource(R.drawable.atm);
|
||||||
|
images.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
|
nominal = intent.getStringExtra("nominal");
|
||||||
|
|
||||||
|
Utility.currencyTXT(amount, Objects.requireNonNull(nominal), WithdrawActivity.this);
|
||||||
|
petunjuk.setHasFixedSize(true);
|
||||||
|
petunjuk.setNestedScrollingEnabled(false);
|
||||||
|
petunjuk.setLayoutManager(new GridLayoutManager(this, 1));
|
||||||
|
getpetunjuk();
|
||||||
|
}
|
||||||
|
|
||||||
|
amount.addTextChangedListener(Utility.currencyTW(amount, this));
|
||||||
|
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
User userLogin = BaseApp.getInstance(WithdrawActivity.this).getLoginUser();
|
||||||
|
if (type.equals("withdraw")) {
|
||||||
|
if (amount.getText().toString().isEmpty()) {
|
||||||
|
notif("Jumlah tidak boleh kosong!");
|
||||||
|
} else if (Long.parseLong(amount.getText()
|
||||||
|
.toString()
|
||||||
|
.replace(".", "")
|
||||||
|
.replace(",", "")
|
||||||
|
.replace(sp.getSetting()[4], "")) > userLogin.getWalletSaldo()) {
|
||||||
|
notif("saldo Anda tidak cukup!");
|
||||||
|
} else if (bank.getText().toString().isEmpty()) {
|
||||||
|
notif("bank tidak boleh kosong!");
|
||||||
|
} else if (accnumber.getText().toString().isEmpty()) {
|
||||||
|
notif("nomor rekening tidak boleh kosong!");
|
||||||
|
} else {
|
||||||
|
submit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (amount.getText().toString().isEmpty()) {
|
||||||
|
notif("jumlah tidak boleh kosong!");
|
||||||
|
} else if (bank.getText().toString().isEmpty()) {
|
||||||
|
notif("bank tidak boleh kosong!");
|
||||||
|
} else if (accnumber.getText().toString().isEmpty()) {
|
||||||
|
notif("nomor rekening tidak boleh kosong!");
|
||||||
|
} else {
|
||||||
|
submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
backbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void submit() {
|
||||||
|
progressshow();
|
||||||
|
final User user = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
WithdrawRequestJson request = new WithdrawRequestJson();
|
||||||
|
request.setId(user.getId());
|
||||||
|
request.setBank(bank.getText().toString());
|
||||||
|
request.setName(nama.getText().toString());
|
||||||
|
request.setAmount(amount.getText().toString().replace(".", "").replace(sp.getSetting()[4], ""));
|
||||||
|
request.setCard(accnumber.getText().toString());
|
||||||
|
request.setNotelepon(user.getNoTelepon());
|
||||||
|
request.setEmail(user.getEmail());
|
||||||
|
request.setType(type);
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, user.getNoTelepon(), user.getPassword());
|
||||||
|
service.withdraw(request).enqueue(new Callback<WithdrawResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<WithdrawResponseJson> call, @NonNull Response<WithdrawResponseJson> response) {
|
||||||
|
progresshide();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
Intent intent = new Intent(WithdrawActivity.this, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
Notif notif = new Notif();
|
||||||
|
if (type.equals("withdraw")) {
|
||||||
|
notif.title = "Withdraw";
|
||||||
|
notif.message = "Permintaan penarikan telah berhasil, kami akan mengirimkan pemberitahuan setelah kami mengirim dana ke akun Anda";
|
||||||
|
} else {
|
||||||
|
notif.title = "Topup";
|
||||||
|
notif.message = "Permintaan TopUp telah berhasil, Segera Transfer dan Konfirmasi Pembayaran ke Admin";
|
||||||
|
}
|
||||||
|
sendNotif(user.getToken(), notif);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notif("error, silahkan cek data akun anda!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
notif("error!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<WithdrawResponseJson> call, @NonNull Throwable t) {
|
||||||
|
progresshide();
|
||||||
|
t.printStackTrace();
|
||||||
|
notif("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!disableback.equals("true")) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notif(String text) {
|
||||||
|
rlnotif.setVisibility(View.VISIBLE);
|
||||||
|
notif.setText(text);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
rlnotif.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressshow() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
disableback = "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progresshide() {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
disableback = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendNotif(final String regIDTujuan, final Notif notif) {
|
||||||
|
|
||||||
|
final FCMMessage message = new FCMMessage();
|
||||||
|
message.setTo(regIDTujuan);
|
||||||
|
message.setData(notif);
|
||||||
|
|
||||||
|
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getpetunjuk() {
|
||||||
|
User user = BaseApp.getInstance(this).getLoginUser();
|
||||||
|
WithdrawRequestJson request = new WithdrawRequestJson();
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, user.getNoTelepon(), user.getPassword());
|
||||||
|
service.listbank(request).enqueue(new Callback<BankResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<BankResponseJson> call, @NonNull Response<BankResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
llpentunjuk.setVisibility(View.VISIBLE);
|
||||||
|
bankItem = new BankItem(WithdrawActivity.this, Objects.requireNonNull(response.body()).getData(), R.layout.item_bank);
|
||||||
|
petunjuk.setAdapter(bankItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<BankResponseJson> call, @NonNull Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package id.ontime.driver.constants;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Application;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
|
import com.google.android.gms.location.LocationRequest;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.firebase.FirebaseApp;
|
||||||
|
import com.google.firebase.iid.FirebaseInstanceId;
|
||||||
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
import id.ontime.driver.json.UpdateLocationRequestJson;
|
||||||
|
import id.ontime.driver.utils.MyLocationService;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.ResponseJson;
|
||||||
|
import id.ontime.driver.models.FirebaseToken;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.multidex.MultiDex;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import io.realm.RealmConfiguration;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class BaseApp extends Application {
|
||||||
|
|
||||||
|
private static final int SCHEMA_VERSION = 0;
|
||||||
|
|
||||||
|
private User loginUser;
|
||||||
|
|
||||||
|
private Realm realmInstance;
|
||||||
|
|
||||||
|
public static BaseApp getInstance(Context context) {
|
||||||
|
return (BaseApp) context.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LocationRequest locationRequest;
|
||||||
|
FusedLocationProviderClient fusedLocationProviderClient;
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
Realm.init(this);
|
||||||
|
|
||||||
|
RealmConfiguration config = new RealmConfiguration.Builder()
|
||||||
|
.schemaVersion(SCHEMA_VERSION)
|
||||||
|
.deleteRealmIfMigrationNeeded()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Realm.setDefaultConfiguration(config);
|
||||||
|
|
||||||
|
// realmInstance = Realm.getInstance(config);
|
||||||
|
realmInstance = Realm.getDefaultInstance();
|
||||||
|
|
||||||
|
// Best-effort Firebase initialization and token registration for driver.
|
||||||
|
// If Firebase is not configured, ignore failures so the app can still run.
|
||||||
|
try {
|
||||||
|
FirebaseApp app = FirebaseApp.initializeApp(this);
|
||||||
|
if (app != null) {
|
||||||
|
String fcmToken = FirebaseInstanceId.getInstance().getToken();
|
||||||
|
if (fcmToken != null) {
|
||||||
|
FirebaseToken token = new FirebaseToken(fcmToken);
|
||||||
|
FirebaseMessaging.getInstance().subscribeToTopic("ouride");
|
||||||
|
FirebaseMessaging.getInstance().subscribeToTopic("driver");
|
||||||
|
|
||||||
|
realmInstance.beginTransaction();
|
||||||
|
realmInstance.delete(FirebaseToken.class);
|
||||||
|
realmInstance.copyToRealm(token);
|
||||||
|
realmInstance.commitTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
updatelocation();
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachBaseContext(Context base) {
|
||||||
|
super.attachBaseContext(base);
|
||||||
|
MultiDex.install(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getLoginUser() {
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginUser(User loginUser) {
|
||||||
|
this.loginUser = loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Realm getRealmInstance() {
|
||||||
|
return realmInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void start() {
|
||||||
|
Realm realm = getRealmInstance();
|
||||||
|
User user = realm.where(User.class).findFirst();
|
||||||
|
if (user != null) {
|
||||||
|
setLoginUser(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
private void updatelocation() {
|
||||||
|
buildlocation();
|
||||||
|
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fusedLocationProviderClient.requestLocationUpdates(locationRequest, getPendingIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
private PendingIntent getPendingIntent() {
|
||||||
|
Intent intent = new Intent(this, MyLocationService.class);
|
||||||
|
intent.setAction(MyLocationService.ACTION_PROCESS_UPDATE);
|
||||||
|
return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_MUTABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildlocation() {
|
||||||
|
locationRequest = new LocationRequest();
|
||||||
|
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||||
|
locationRequest.setInterval(5000);
|
||||||
|
locationRequest.setFastestInterval(3000);
|
||||||
|
locationRequest.setSmallestDisplacement(10f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Updatelocationdata(final Location location) {
|
||||||
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
onLocationChanged(location);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
if (location != null) {
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||||
|
UpdateLocationRequestJson param = new UpdateLocationRequestJson();
|
||||||
|
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setLatitude(String.valueOf(location.getLatitude()));
|
||||||
|
param.setLongitude(String.valueOf(location.getLongitude()));
|
||||||
|
param.setBearing(String.valueOf(location.getBearing()));
|
||||||
|
|
||||||
|
service.updatelocation(param).enqueue(new Callback<ResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<ResponseJson> call, @NonNull Response<ResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
Log.e("location", response.message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull retrofit2.Call<ResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package id.ontime.driver.constants;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
private static final String BASE_URL = "https://apitest.semestaterpadu.my.id/";
|
||||||
|
public static final String URL = "https://panic.on-time.id/"; //panicButton
|
||||||
|
public static final String CONNECTION = BASE_URL + "api/";
|
||||||
|
public static final String IMAGESFITUR = BASE_URL + "images/fitur/";
|
||||||
|
public static final String IMAGESBANK = BASE_URL + "images/bank/";
|
||||||
|
public static final String IMAGESDRIVER = BASE_URL + "images/fotodriver/";
|
||||||
|
public static final String IMAGESUSER = BASE_URL + "images/pelanggan/";
|
||||||
|
public static final String IMAGESMERCHANT = BASE_URL + "images/merchant/";
|
||||||
|
public static String CURRENCY = "";
|
||||||
|
|
||||||
|
public static Double LATITUDE;
|
||||||
|
public static Double LONGITUDE;
|
||||||
|
public static String LOCATION;
|
||||||
|
|
||||||
|
public static String TOKEN = "token";
|
||||||
|
|
||||||
|
public static String USERID = "uid";
|
||||||
|
|
||||||
|
public static String PREF_NAME = "pref_name";
|
||||||
|
|
||||||
|
public static int permission_camera_code = 786;
|
||||||
|
public static int permission_write_data = 788;
|
||||||
|
public static int permission_Read_data = 789;
|
||||||
|
public static int permission_Recording_audio = 790;
|
||||||
|
|
||||||
|
public static SimpleDateFormat df =
|
||||||
|
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
|
||||||
|
public static String versionname = "1.0";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package id.ontime.driver.constants;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/20/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Functions {
|
||||||
|
|
||||||
|
public static void hideSoftKeyboard(Activity activity) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
|
View view = activity.getCurrentFocus();
|
||||||
|
if (view == null) {
|
||||||
|
view = new View(activity);
|
||||||
|
}
|
||||||
|
Objects.requireNonNull(imm).hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package id.ontime.driver.constants;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ontime on 12/4/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class VersionChecker extends AsyncTask<String, String, String> {
|
||||||
|
|
||||||
|
private String newVersion;
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private Activity context;
|
||||||
|
|
||||||
|
public VersionChecker(Activity context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(String... params) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + context.getPackageName() + "&hl=en")
|
||||||
|
.timeout(30000)
|
||||||
|
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
|
||||||
|
.referrer("http://www.google.com")
|
||||||
|
.get()
|
||||||
|
.select(".IQ1z0d .htlgb")
|
||||||
|
.get(7)
|
||||||
|
.ownText();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return newVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String s) {
|
||||||
|
super.onPostExecute(s);
|
||||||
|
PackageInfo pInfo = null;
|
||||||
|
try {
|
||||||
|
pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (newVersion != null) {
|
||||||
|
int latestVersion = Integer.parseInt(newVersion.replace(".", ""));
|
||||||
|
int versionCode = Integer.parseInt(Objects.requireNonNull(pInfo).versionName.replace(".", ""));
|
||||||
|
|
||||||
|
if (versionCode < latestVersion) {
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(context, R.style.DialogStyle);
|
||||||
|
alert.setTitle(R.string.app_name)
|
||||||
|
.setIcon(R.mipmap.ic_launcher)
|
||||||
|
.setMessage("Please update" + " " + context.getString(R.string.app_name) + " " + "app. you have an old version.")
|
||||||
|
.setNegativeButton("Update", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setCancelable(false);
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Address;
|
||||||
|
import android.location.Geocoder;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.android.gms.tasks.OnSuccessListener;
|
||||||
|
|
||||||
|
import id.ontime.driver.activity.MainActivity;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.IntroActivity;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
|
|
||||||
|
public class EnableLlocationFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_enablelocation, container, false);
|
||||||
|
context = getContext();
|
||||||
|
|
||||||
|
|
||||||
|
sharedPreferences = Objects.requireNonNull(context).getSharedPreferences(Constants.PREF_NAME, MODE_PRIVATE);
|
||||||
|
|
||||||
|
Button enableLocation = getView.findViewById(R.id.enable_location_btn);
|
||||||
|
enableLocation.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getLocationPermission();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
|
||||||
|
// Skip custom fragment animations now that the third-party library has been removed.
|
||||||
|
if (enter) {
|
||||||
|
GPSStatus();
|
||||||
|
}
|
||||||
|
return super.onCreateAnimation(transit, enter, nextAnim);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void getLocationPermission() {
|
||||||
|
|
||||||
|
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||||
|
123);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
|
||||||
|
if (requestCode == 123) {
|
||||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
GetCurrentlocation();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, "Please Grant permission", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void GPSStatus() {
|
||||||
|
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
boolean GpsStatus = Objects.requireNonNull(locationManager).isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||||
|
if (!GpsStatus) {
|
||||||
|
Toast.makeText(context, "On Location in High Accuracy", Toast.LENGTH_SHORT).show();
|
||||||
|
startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), 2);
|
||||||
|
} else {
|
||||||
|
GetCurrentlocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == 2) {
|
||||||
|
GPSStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetCurrentlocation() {
|
||||||
|
FusedLocationProviderClient mFusedLocationClient = LocationServices.getFusedLocationProviderClient(context);
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
|
getLocationPermission();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mFusedLocationClient.getLastLocation()
|
||||||
|
.addOnSuccessListener(requireActivity(), new OnSuccessListener<Location>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Location location) {
|
||||||
|
if (location != null) {
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(String.valueOf(Constants.LATITUDE), "" + location.getLatitude());
|
||||||
|
editor.putString(String.valueOf(Constants.LONGITUDE), "" + location.getLongitude());
|
||||||
|
editor.apply();
|
||||||
|
Constants.LATITUDE = location.getLatitude();
|
||||||
|
Constants.LONGITUDE = location.getLongitude();
|
||||||
|
try {
|
||||||
|
Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault());
|
||||||
|
final List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
|
||||||
|
if (!addresses.isEmpty()) {
|
||||||
|
addresses.size();
|
||||||
|
String address = addresses.get(0).getAddressLine(0);
|
||||||
|
Constants.LOCATION = String.valueOf(address);
|
||||||
|
} else {
|
||||||
|
Constants.LOCATION = "not Availeble";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
GoToNext_Activty();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (sharedPreferences.getString(String.valueOf(Constants.LATITUDE), "").equals("") || sharedPreferences.getString(String.valueOf(Constants.LONGITUDE), "").equals("")) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(String.valueOf(Constants.LATITUDE), "33.738045");
|
||||||
|
editor.putString(String.valueOf(Constants.LONGITUDE), "73.084488");
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GoToNext_Activty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void GoToNext_Activty() {
|
||||||
|
final User user = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
if (user != null) {
|
||||||
|
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
requireActivity().finish();
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(getActivity(), IntroActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
requireActivity().finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import com.squareup.picasso.Callback;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
public class FullImageFragment extends Fragment {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
private String chat_id;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private File fullpath;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_fullimage, container, false);
|
||||||
|
context = getContext();
|
||||||
|
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
Objects.requireNonNull(getActivity()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
String imageUrl = Objects.requireNonNull(getArguments()).getString("image_url");
|
||||||
|
chat_id = getArguments().getString("chat_id");
|
||||||
|
Button savebtn2 = getView.findViewById(R.id.savebtn2);
|
||||||
|
|
||||||
|
ImageView closeGallery = getView.findViewById(R.id.close_gallery);
|
||||||
|
closeGallery.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Objects.requireNonNull(getActivity()).onBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fullpath = new File(Environment.getExternalStorageDirectory() + "/ourride/" + chat_id + ".jpg");
|
||||||
|
|
||||||
|
Button savebtn = getView.findViewById(R.id.savebtn);
|
||||||
|
if (fullpath.exists()) {
|
||||||
|
savebtn.setVisibility(View.GONE);
|
||||||
|
savebtn2.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
savebtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(context, "Save not available in this build.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
progressBar = getView.findViewById(R.id.progress);
|
||||||
|
ImageView singleImage = getView.findViewById(R.id.single_image);
|
||||||
|
|
||||||
|
if (fullpath.exists()) {
|
||||||
|
Uri uri = Uri.parse(fullpath.getAbsolutePath());
|
||||||
|
singleImage.setImageURI(uri);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
PicassoTrustAll.getInstance(context).load(imageUrl).placeholder(R.drawable.image_placeholder)
|
||||||
|
.into(singleImage, new Callback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
View sharebtn = getView.findViewById(R.id.sharebtn);
|
||||||
|
sharebtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SharePicture();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SharePicture() {
|
||||||
|
// Simple share stub: share the image URL as text.
|
||||||
|
String imageUrl = Objects.requireNonNull(getArguments()).getString("image_url");
|
||||||
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, imageUrl);
|
||||||
|
startActivity(Intent.createChooser(intent, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Savepicture(final boolean isfromshare) {
|
||||||
|
// Download/save is not supported anymore; keep method to satisfy old call sites.
|
||||||
|
Toast.makeText(context, "Save not available in this build.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.item.HistoryItem;
|
||||||
|
import id.ontime.driver.json.AllTransResponseJson;
|
||||||
|
import id.ontime.driver.json.DetailRequestJson;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public class HistoryFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private ShimmerFrameLayout shimmer;
|
||||||
|
private RecyclerView recycle;
|
||||||
|
private HistoryItem historyItem;
|
||||||
|
private RelativeLayout rlnodata;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_recycle, container, false);
|
||||||
|
context = getContext();
|
||||||
|
shimmer = getView.findViewById(R.id.shimmerwallet);
|
||||||
|
recycle = getView.findViewById(R.id.inboxlist);
|
||||||
|
rlnodata = getView.findViewById(R.id.rlnodata);
|
||||||
|
|
||||||
|
recycle.setHasFixedSize(true);
|
||||||
|
recycle.setLayoutManager(new GridLayoutManager(context, 1));
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmershow() {
|
||||||
|
recycle.setVisibility(View.GONE);
|
||||||
|
shimmer.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.startShimmerAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmertutup() {
|
||||||
|
|
||||||
|
recycle.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.setVisibility(View.GONE);
|
||||||
|
shimmer.stopShimmerAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getdatatrans() {
|
||||||
|
shimmershow();
|
||||||
|
User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService driverService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
DetailRequestJson param = new DetailRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
driverService.history(param).enqueue(new Callback<AllTransResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<AllTransResponseJson> call, @NonNull Response<AllTransResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
shimmertutup();
|
||||||
|
historyItem = new HistoryItem(context, Objects.requireNonNull(response.body()).getData(), R.layout.item_order);
|
||||||
|
recycle.setAdapter(historyItem);
|
||||||
|
if (response.body().getData().isEmpty()) {
|
||||||
|
recycle.setVisibility(View.GONE);
|
||||||
|
rlnodata.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
recycle.setVisibility(View.VISIBLE);
|
||||||
|
rlnodata.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<AllTransResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
getdatatrans();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
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.LatLng;
|
||||||
|
import com.google.android.gms.maps.model.MapStyleOptions;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.TopupSaldoActivity;
|
||||||
|
import id.ontime.driver.activity.WalletActivity;
|
||||||
|
import id.ontime.driver.activity.WithdrawActivity;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.json.GetOnRequestJson;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.item.BanklistItem;
|
||||||
|
import id.ontime.driver.json.ResponseJson;
|
||||||
|
import id.ontime.driver.models.BankModels;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class HomeFragment extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||||
|
private static final String TAG = "Home";
|
||||||
|
private Context context;
|
||||||
|
private GoogleMap gMap;
|
||||||
|
private static final int REQUEST_PERMISSION_LOCATION = 991;
|
||||||
|
private GoogleApiClient googleApiClient;
|
||||||
|
private TextView saldo;
|
||||||
|
private TextView nama;
|
||||||
|
private ImageView foto;
|
||||||
|
private RelativeLayout rlprogress;
|
||||||
|
private Button onoff, uangbelanja, autobid;
|
||||||
|
private SettingPreference sp;
|
||||||
|
private ArrayList<BankModels> mList;
|
||||||
|
private String statusdriver, saldodriver;
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
|
context = getContext();
|
||||||
|
nama = getView.findViewById(R.id.username);
|
||||||
|
foto = getView.findViewById(R.id.userphoto);
|
||||||
|
RelativeLayout topup = getView.findViewById(R.id.topup);
|
||||||
|
RelativeLayout withdraw = getView.findViewById(R.id.withdraw);
|
||||||
|
RelativeLayout detail = getView.findViewById(R.id.detail);
|
||||||
|
saldo = getView.findViewById(R.id.saldo);
|
||||||
|
autobid = getView.findViewById(R.id.autobid);
|
||||||
|
uangbelanja = getView.findViewById(R.id.maks);
|
||||||
|
onoff = getView.findViewById(R.id.onoff);
|
||||||
|
mList = new ArrayList<>();
|
||||||
|
sp = new SettingPreference(context);
|
||||||
|
rlprogress = getView.findViewById(R.id.rlprogress);
|
||||||
|
topup.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, TopupSaldoActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
sp.updateNotif("OFF");
|
||||||
|
withdraw.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, WithdrawActivity.class);
|
||||||
|
i.putExtra("type","withdraw");
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
detail.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, WalletActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
uangbelanja.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialog();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
|
||||||
|
.findFragmentById(R.id.mapView);
|
||||||
|
Objects.requireNonNull(mapFragment).getMapAsync(this);
|
||||||
|
if (googleApiClient == null) {
|
||||||
|
googleApiClient = new GoogleApiClient.Builder(context)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp.getSetting()[0].equals("OFF")) {
|
||||||
|
autobid.setSelected(false);
|
||||||
|
} else {
|
||||||
|
autobid.setSelected(true);
|
||||||
|
}
|
||||||
|
//rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
Bundle bundle = getArguments();
|
||||||
|
if (bundle != null) {
|
||||||
|
statusdriver = bundle.getString("status");
|
||||||
|
saldodriver = bundle.getString("saldo");
|
||||||
|
}
|
||||||
|
if (statusdriver.equals("1")) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
sp.updateKerja("ON");
|
||||||
|
onoff.setSelected(true);
|
||||||
|
onoff.setText("ON");
|
||||||
|
} else if (statusdriver.equals("4")) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
onoff.setSelected(false);
|
||||||
|
onoff.setText("OFF");
|
||||||
|
sp.updateKerja("OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
onoff.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getturnon();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (sp.getSetting()[1].isEmpty()) {
|
||||||
|
Utility.currencyTXT(uangbelanja, "10000", context);
|
||||||
|
} else if (sp.getSetting()[1].equals("Unlimited")) {
|
||||||
|
uangbelanja.setText(sp.getSetting()[1]);
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(uangbelanja, sp.getSetting()[1], context);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BankModels> items = getPeopleData(context);
|
||||||
|
mList.addAll(items);
|
||||||
|
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<BankModels> getPeopleData(Context ctx) {
|
||||||
|
List<BankModels> items = new ArrayList<>();
|
||||||
|
@SuppressLint("Recycle") TypedArray drw_arr = ctx.getResources().obtainTypedArray(R.array.list_maximum);
|
||||||
|
String[] name_arr = ctx.getResources().getStringArray(R.array.list_maximum);
|
||||||
|
|
||||||
|
for (int i = 0; i < drw_arr.length(); i++) {
|
||||||
|
BankModels obj = new BankModels();
|
||||||
|
obj.setText(name_arr[i]);
|
||||||
|
items.add(obj);
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMapReady(GoogleMap googleMap) {
|
||||||
|
gMap = googleMap;
|
||||||
|
gMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||||
|
gMap.getUiSettings().setMapToolbarEnabled(true);
|
||||||
|
try {
|
||||||
|
boolean success = googleMap.setMapStyle(
|
||||||
|
MapStyleOptions.loadRawResourceStyle(
|
||||||
|
context, R.raw.style_json));
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
Log.e(TAG, "Style parsing failed.");
|
||||||
|
}
|
||||||
|
} catch (Resources.NotFoundException e) {
|
||||||
|
Log.e(TAG, "Can't find style. Error: ", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateLastLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastLocation() {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_LOCATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location lastKnownLocation = LocationServices.FusedLocationApi.getLastLocation(
|
||||||
|
googleApiClient);
|
||||||
|
gMap.setMyLocationEnabled(true);
|
||||||
|
|
||||||
|
if (lastKnownLocation != null) {
|
||||||
|
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
|
new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()), 15f)
|
||||||
|
);
|
||||||
|
|
||||||
|
gMap.animateCamera(CameraUpdateFactory.zoomTo(15f));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnected(@Nullable Bundle bundle) {
|
||||||
|
updateLastLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionSuspended(int i) {
|
||||||
|
updateLastLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
||||||
|
updateLastLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
googleApiClient.connect();
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
googleApiClient.disconnect();
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
nama.setText(loginUser.getFullnama());
|
||||||
|
|
||||||
|
|
||||||
|
autobid.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (sp.getSetting()[0].equals("OFF")) {
|
||||||
|
sp.updateAutoBid("ON");
|
||||||
|
autobid.setSelected(true);
|
||||||
|
} else {
|
||||||
|
sp.updateAutoBid("OFF");
|
||||||
|
autobid.setSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Utility.currencyTXT(saldo, saldodriver, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getturnon() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
GetOnRequestJson param = new GetOnRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
if (statusdriver.equals("1")) {
|
||||||
|
param.setOn(false);
|
||||||
|
} else {
|
||||||
|
param.setOn(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
userService.turnon(param).enqueue(new Callback<ResponseJson>() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<ResponseJson> call, @NonNull Response<ResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
statusdriver = Objects.requireNonNull(response.body()).getData();
|
||||||
|
if (response.body().getData().equals("1")) {
|
||||||
|
sp.updateKerja("ON");
|
||||||
|
onoff.setSelected(true);
|
||||||
|
onoff.setText("ON");
|
||||||
|
} else if (response.body().getData().equals("4")) {
|
||||||
|
sp.updateKerja("OFF");
|
||||||
|
onoff.setSelected(false);
|
||||||
|
onoff.setText("OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<ResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dialog() {
|
||||||
|
final Dialog dialog = new Dialog(context);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
|
||||||
|
dialog.setContentView(R.layout.dialog_bank);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
|
||||||
|
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||||
|
lp.copyFrom(Objects.requireNonNull(dialog.getWindow()).getAttributes());
|
||||||
|
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
|
|
||||||
|
|
||||||
|
final ImageView close = dialog.findViewById(R.id.close);
|
||||||
|
final RecyclerView list = dialog.findViewById(R.id.recycleview);
|
||||||
|
|
||||||
|
|
||||||
|
list.setHasFixedSize(true);
|
||||||
|
list.setLayoutManager(new GridLayoutManager(context, 1));
|
||||||
|
|
||||||
|
BanklistItem bankItem = new BanklistItem(context, mList, R.layout.item_petunjuk, new BanklistItem.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(BankModels item) {
|
||||||
|
if (item.getText().equals("Unlimited")) {
|
||||||
|
uangbelanja.setText(item.getText());
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(uangbelanja, item.getText(), context);
|
||||||
|
}
|
||||||
|
sp.updateMaksimalBelanja(item.getText());
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
list.setAdapter(bankItem);
|
||||||
|
|
||||||
|
|
||||||
|
close.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
dialog.getWindow().setAttributes(lp);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||||
|
import com.google.firebase.database.DataSnapshot;
|
||||||
|
import com.google.firebase.database.DatabaseError;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.database.Query;
|
||||||
|
import com.google.firebase.database.ValueEventListener;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.ChatActivity;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.constants.Functions;
|
||||||
|
import id.ontime.driver.item.MessageItem;
|
||||||
|
import id.ontime.driver.models.MessageModels;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
public class MessageFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
|
private View getView;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
private RecyclerView inboxList;
|
||||||
|
|
||||||
|
private ArrayList<MessageModels> inboxArraylist;
|
||||||
|
private ShimmerFrameLayout shimmer;
|
||||||
|
private DatabaseReference rootRef;
|
||||||
|
|
||||||
|
private MessageItem inboxItem;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
getView = inflater.inflate(R.layout.fragment_recycle, container, false);
|
||||||
|
context = getContext();
|
||||||
|
|
||||||
|
try {
|
||||||
|
rootRef = FirebaseDatabase.getInstance().getReference();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
rootRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
inboxList = getView.findViewById(R.id.inboxlist);
|
||||||
|
shimmer = getView.findViewById(R.id.shimmerwallet);
|
||||||
|
inboxArraylist =new ArrayList<>();
|
||||||
|
inboxList = getView.findViewById(R.id.inboxlist);
|
||||||
|
LinearLayoutManager layout = new LinearLayoutManager(context);
|
||||||
|
inboxList.setLayoutManager(layout);
|
||||||
|
inboxList.setHasFixedSize(false);
|
||||||
|
inboxItem = new MessageItem(context, inboxArraylist, new MessageItem.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(MessageModels item) {
|
||||||
|
User loginuser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
if (checkReadStoragepermission()) {
|
||||||
|
Intent intent = new Intent(getActivity(), ChatActivity.class);
|
||||||
|
intent.putExtra("senderid", loginuser.getId());
|
||||||
|
intent.putExtra("receiverid", item.getId());
|
||||||
|
intent.putExtra("name", item.getName());
|
||||||
|
intent.putExtra("tokendriver", loginuser.getToken());
|
||||||
|
intent.putExtra("tokenku", item.getTokenuser());
|
||||||
|
intent.putExtra("pic", item.getPicture());
|
||||||
|
requireActivity().startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
inboxList.setAdapter(inboxItem);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
getView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Functions.hideSoftKeyboard(requireActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
shimmershow();
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ValueEventListener valueEventListener;
|
||||||
|
|
||||||
|
private Query inboxQuery;
|
||||||
|
private void shimmershow() {
|
||||||
|
inboxList.setVisibility(View.GONE);
|
||||||
|
shimmer.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.startShimmerAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmertutup() {
|
||||||
|
|
||||||
|
inboxList.setVisibility(View.VISIBLE);
|
||||||
|
shimmer.setVisibility(View.GONE);
|
||||||
|
shimmer.stopShimmerAnimation();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
if (rootRef == null) {
|
||||||
|
shimmertutup();
|
||||||
|
if (getView != null) {
|
||||||
|
View empty = getView.findViewById(R.id.rlnodata);
|
||||||
|
if (empty != null) {
|
||||||
|
empty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User loginuser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
inboxQuery = rootRef.child("Inbox").child(loginuser.getId()).orderByChild("date");
|
||||||
|
valueEventListener = new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
|
||||||
|
shimmertutup();
|
||||||
|
inboxArraylist.clear();
|
||||||
|
|
||||||
|
for (DataSnapshot ds:dataSnapshot.getChildren()) {
|
||||||
|
MessageModels model = new MessageModels();
|
||||||
|
model.setId(ds.getKey());
|
||||||
|
model.setName(Objects.requireNonNull(ds.child("name").getValue()).toString());
|
||||||
|
model.setMessage(Objects.requireNonNull(ds.child("msg").getValue()).toString());
|
||||||
|
model.setTimestamp(Objects.requireNonNull(ds.child("date").getValue()).toString());
|
||||||
|
model.setStatus(Objects.requireNonNull(ds.child("status").getValue()).toString());
|
||||||
|
model.setPicture(Objects.requireNonNull(ds.child("pic").getValue()).toString());
|
||||||
|
model.setTokendriver(Objects.requireNonNull(ds.child("tokendriver").getValue()).toString());
|
||||||
|
model.setTokenuser(Objects.requireNonNull(ds.child("tokenuser").getValue()).toString());
|
||||||
|
inboxArraylist.add(model);
|
||||||
|
}
|
||||||
|
Collections.reverse(inboxArraylist);
|
||||||
|
inboxItem.notifyDataSetChanged();
|
||||||
|
|
||||||
|
if(inboxArraylist.isEmpty()){
|
||||||
|
getView.findViewById(R.id.rlnodata).setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
getView.findViewById(R.id.rlnodata).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError databaseError) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inboxQuery.addValueEventListener(valueEventListener);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
if(inboxQuery !=null)
|
||||||
|
inboxQuery.removeEventListener(valueEventListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkReadStoragepermission(){
|
||||||
|
if (ContextCompat.checkSelfPermission(Objects.requireNonNull(getActivity()).getApplicationContext(),
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
== PackageManager.PERMISSION_GRANTED){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
Constants.permission_Read_data );
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,853 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||||
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
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.MapStyleOptions;
|
||||||
|
import com.google.android.gms.maps.model.Marker;
|
||||||
|
import com.google.android.gms.maps.model.MarkerOptions;
|
||||||
|
import com.google.android.gms.maps.model.Polyline;
|
||||||
|
import com.google.android.gms.maps.model.PolylineOptions;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.ChatActivity;
|
||||||
|
import id.ontime.driver.activity.MainActivity;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.gmap.directions.Directions;
|
||||||
|
import id.ontime.driver.gmap.directions.Route;
|
||||||
|
import id.ontime.driver.item.ItemPesananItem;
|
||||||
|
import id.ontime.driver.json.AcceptRequestJson;
|
||||||
|
import id.ontime.driver.json.AcceptResponseJson;
|
||||||
|
import id.ontime.driver.json.ResponseJson;
|
||||||
|
import id.ontime.driver.json.VerifyRequestJson;
|
||||||
|
import id.ontime.driver.utils.api.FCMHelper;
|
||||||
|
import id.ontime.driver.utils.api.MapDirectionAPI;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.json.DetailRequestJson;
|
||||||
|
import id.ontime.driver.json.DetailTransResponseJson;
|
||||||
|
import id.ontime.driver.json.fcm.FCMMessage;
|
||||||
|
import id.ontime.driver.models.OrderFCM;
|
||||||
|
import id.ontime.driver.models.PelangganModel;
|
||||||
|
import id.ontime.driver.models.TransaksiModel;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.Log;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
|
||||||
|
public class OrderFragment extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private GoogleMap gMap;
|
||||||
|
private static final int REQUEST_PERMISSION_LOCATION = 991;
|
||||||
|
private static final int REQUEST_PERMISSION_CALL = 992;
|
||||||
|
private GoogleApiClient googleApiClient;
|
||||||
|
private LatLng pickUpLatLng;
|
||||||
|
private LatLng destinationLatLng;
|
||||||
|
private Polyline directionLine;
|
||||||
|
private Marker pickUpMarker;
|
||||||
|
private Marker destinationMarker;
|
||||||
|
private String idtrans, idpelanggan, response, fitur, onsubmit;
|
||||||
|
|
||||||
|
LinearLayout bottomsheet;
|
||||||
|
TextView layanan;
|
||||||
|
TextView layanandesk;
|
||||||
|
TextView verify;
|
||||||
|
TextView namamerchant;
|
||||||
|
LinearLayout llchat;
|
||||||
|
CircleImageView foto;
|
||||||
|
TextView pickUpText;
|
||||||
|
TextView destinationText;
|
||||||
|
TextView fiturtext;
|
||||||
|
TextView distanceText;
|
||||||
|
TextView priceText;
|
||||||
|
RelativeLayout rlprogress;
|
||||||
|
TextView textprogress;
|
||||||
|
TextView cost;
|
||||||
|
TextView deliveryfee;
|
||||||
|
ImageView phone;
|
||||||
|
|
||||||
|
ImageView chat;
|
||||||
|
ImageView phonemerchant;
|
||||||
|
ImageView chatmerchant;
|
||||||
|
LinearLayout lldestination;
|
||||||
|
LinearLayout llorderdetail;
|
||||||
|
LinearLayout lldistance;
|
||||||
|
LinearLayout lldetailsend;
|
||||||
|
TextView produk;
|
||||||
|
TextView sendername;
|
||||||
|
TextView receivername;
|
||||||
|
Button senderphone;
|
||||||
|
Button receiverphone;
|
||||||
|
ShimmerFrameLayout shimmerlayanan;
|
||||||
|
ShimmerFrameLayout shimmerpickup;
|
||||||
|
ShimmerFrameLayout shimmerdestination;
|
||||||
|
ShimmerFrameLayout shimmerfitur;
|
||||||
|
ShimmerFrameLayout shimmerdistance;
|
||||||
|
ShimmerFrameLayout shimmerprice;
|
||||||
|
Button submit;
|
||||||
|
LinearLayout llmerchantdetail;
|
||||||
|
LinearLayout llmerchantinfo;
|
||||||
|
LinearLayout llbutton;
|
||||||
|
RecyclerView rvmerchantnear;
|
||||||
|
private ItemPesananItem itemPesananItem;
|
||||||
|
private TextView totaltext;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@Nullable LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = Objects.requireNonNull(inflater).inflate(R.layout.activity_detail_order, container, false);
|
||||||
|
context = getContext();
|
||||||
|
bottomsheet = getView.findViewById(R.id.bottom_sheet);
|
||||||
|
layanan = getView.findViewById(R.id.layanan);
|
||||||
|
layanandesk = getView.findViewById(R.id.layanandes);
|
||||||
|
verify = getView.findViewById(R.id.verifycation);
|
||||||
|
namamerchant = getView.findViewById(R.id.namamerchant);
|
||||||
|
llchat = getView.findViewById(R.id.llchat);
|
||||||
|
foto = getView.findViewById(R.id.background);
|
||||||
|
pickUpText = getView.findViewById(R.id.pickUpText);
|
||||||
|
destinationText = getView.findViewById(R.id.destinationText);
|
||||||
|
fiturtext = getView.findViewById(R.id.fitur);
|
||||||
|
distanceText = getView.findViewById(R.id.distance);
|
||||||
|
priceText = getView.findViewById(R.id.price);
|
||||||
|
rlprogress = getView.findViewById(R.id.rlprogress);
|
||||||
|
textprogress = getView.findViewById(R.id.textprogress);
|
||||||
|
cost = getView.findViewById(R.id.cost);
|
||||||
|
deliveryfee = getView.findViewById(R.id.deliveryfee);
|
||||||
|
phone = getView.findViewById(R.id.phonenumber);
|
||||||
|
chat = getView.findViewById(R.id.chat);
|
||||||
|
phonemerchant = getView.findViewById(R.id.phonemerchant);
|
||||||
|
chatmerchant = getView.findViewById(R.id.chatmerchant);
|
||||||
|
lldestination = getView.findViewById(R.id.lldestination);
|
||||||
|
llorderdetail = getView.findViewById(R.id.orderdetail);
|
||||||
|
lldistance = getView.findViewById(R.id.lldistance);
|
||||||
|
lldetailsend = getView.findViewById(R.id.senddetail);
|
||||||
|
produk = getView.findViewById(R.id.produk);
|
||||||
|
sendername = getView.findViewById(R.id.sendername);
|
||||||
|
receivername = getView.findViewById(R.id.receivername);
|
||||||
|
senderphone = getView.findViewById(R.id.senderphone);
|
||||||
|
receiverphone = getView.findViewById(R.id.receiverphone);
|
||||||
|
shimmerlayanan = getView.findViewById(R.id.shimmerlayanan);
|
||||||
|
shimmerpickup = getView.findViewById(R.id.shimmerpickup);
|
||||||
|
shimmerdestination = getView.findViewById(R.id.shimmerdestination);
|
||||||
|
shimmerfitur = getView.findViewById(R.id.shimmerfitur);
|
||||||
|
shimmerdistance = getView.findViewById(R.id.shimmerdistance);
|
||||||
|
shimmerprice = getView.findViewById(R.id.shimmerprice);
|
||||||
|
submit = getView.findViewById(R.id.order);
|
||||||
|
llmerchantdetail = getView.findViewById(R.id.merchantdetail);
|
||||||
|
llmerchantinfo = getView.findViewById(R.id.merchantinfo);
|
||||||
|
llbutton = getView.findViewById(R.id.llbutton);
|
||||||
|
rvmerchantnear = getView.findViewById(R.id.merchantnear);
|
||||||
|
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomsheet);
|
||||||
|
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||||
|
totaltext = getView.findViewById(R.id.totaltext);
|
||||||
|
fitur = "0";
|
||||||
|
type = "0";
|
||||||
|
Bundle bundle = getArguments();
|
||||||
|
if (bundle != null) {
|
||||||
|
idpelanggan = bundle.getString("id_pelanggan");
|
||||||
|
idtrans = bundle.getString("id_transaksi");
|
||||||
|
response = bundle.getString("response");
|
||||||
|
}
|
||||||
|
|
||||||
|
shimmerload();
|
||||||
|
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
|
||||||
|
.findFragmentById(R.id.mapView);
|
||||||
|
Objects.requireNonNull(mapFragment).getMapAsync(this);
|
||||||
|
if (googleApiClient == null) {
|
||||||
|
googleApiClient = new GoogleApiClient.Builder(context)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
switch (response) {
|
||||||
|
case "2":
|
||||||
|
onsubmit = "2";
|
||||||
|
llchat.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
onsubmit = "3";
|
||||||
|
llchat.setVisibility(View.VISIBLE);
|
||||||
|
submit.setVisibility(View.VISIBLE);
|
||||||
|
verify.setVisibility(View.GONE);
|
||||||
|
submit.setText("finish");
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
llchat.setVisibility(View.GONE);
|
||||||
|
submit.setVisibility(View.GONE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_finish));
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
llchat.setVisibility(View.GONE);
|
||||||
|
layanandesk.setText(getString(R.string.notification_cancel));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rvmerchantnear.setHasFixedSize(true);
|
||||||
|
rvmerchantnear.setNestedScrollingEnabled(false);
|
||||||
|
rvmerchantnear.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
||||||
|
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
textprogress.setText(getString(R.string.waiting_pleaseWait));
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getData(final String idtrans, final String idpelanggan) {
|
||||||
|
final User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||||
|
DetailRequestJson param = new DetailRequestJson();
|
||||||
|
param.setId(idtrans);
|
||||||
|
param.setIdPelanggan(idpelanggan);
|
||||||
|
service.detailtrans(param).enqueue(new Callback<DetailTransResponseJson>() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<DetailTransResponseJson> call, @NonNull Response<DetailTransResponseJson> responsedata) {
|
||||||
|
if (responsedata.isSuccessful()) {
|
||||||
|
shimmertutup();
|
||||||
|
Log.e("", String.valueOf(Objects.requireNonNull(responsedata.body()).getData().get(0)));
|
||||||
|
final TransaksiModel transaksi = responsedata.body().getData().get(0);
|
||||||
|
final PelangganModel pelanggan = responsedata.body().getPelanggan().get(0);
|
||||||
|
type = transaksi.getHome();
|
||||||
|
|
||||||
|
if (transaksi.isPakaiWallet()) {
|
||||||
|
totaltext.setText("Total (Saldo)");
|
||||||
|
} else {
|
||||||
|
totaltext.setText("Total (Tunai)");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onsubmit.equals("2")) {
|
||||||
|
if (transaksi.getHome().equals("4")) {
|
||||||
|
layanandesk.setText("Ambil Pesanan");
|
||||||
|
submit.setText("Mulai Pengiriman");
|
||||||
|
verify.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
layanandesk.setText(getString(R.string.notification_accept));
|
||||||
|
}
|
||||||
|
submit.setVisibility(View.VISIBLE);
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (transaksi.getHome().equals("4")) {
|
||||||
|
|
||||||
|
if (verify.getText().toString().isEmpty()) {
|
||||||
|
Toast.makeText(context, "Masukan Kode Merchant!", Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
SimpleDateFormat timeFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
|
||||||
|
String finalDate = timeFormat.format(transaksi.getWaktuOrder());
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
verify(verify.getText().toString(), pelanggan, transaksi.getToken_merchant(), transaksi.idtransmerchant, finalDate);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
start(pelanggan, transaksi.getToken_merchant(), transaksi.idtransmerchant, String.valueOf(transaksi.getWaktuOrder()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (onsubmit.equals("3")) {
|
||||||
|
if (transaksi.getHome().equals("4")) {
|
||||||
|
layanandesk.setText("Mulai Pengiriman");
|
||||||
|
} else {
|
||||||
|
layanandesk.setText(getString(R.string.notification_start));
|
||||||
|
}
|
||||||
|
|
||||||
|
verify.setVisibility(View.GONE);
|
||||||
|
submit.setText("Finish");
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish(pelanggan, transaksi.token_merchant);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fitur = transaksi.getOrderFitur();
|
||||||
|
if (transaksi.getHome().equals("3")) {
|
||||||
|
lldestination.setVisibility(View.GONE);
|
||||||
|
lldistance.setVisibility(View.GONE);
|
||||||
|
fiturtext.setText(transaksi.getEstimasi());
|
||||||
|
} else if (transaksi.getHome().equals("4")) {
|
||||||
|
llorderdetail.setVisibility(View.VISIBLE);
|
||||||
|
llmerchantdetail.setVisibility(View.VISIBLE);
|
||||||
|
llmerchantinfo.setVisibility(View.VISIBLE);
|
||||||
|
Utility.currencyTXT(deliveryfee, String.valueOf(transaksi.getHarga()), context);
|
||||||
|
Utility.currencyTXT(cost, String.valueOf(transaksi.getTotal_biaya()), context);
|
||||||
|
namamerchant.setText(transaksi.getNama_merchant());
|
||||||
|
itemPesananItem = new ItemPesananItem(responsedata.body().getItem(), R.layout.item_pesanan);
|
||||||
|
rvmerchantnear.setAdapter(itemPesananItem);
|
||||||
|
|
||||||
|
phonemerchant.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Telpon Customer");
|
||||||
|
alertDialogBuilder.setMessage("Anda ingin menelepon Merchant (+" + transaksi.getTeleponmerchant() + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("ya",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:+" + transaksi.getTeleponmerchant()));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("Tidak", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chatmerchant.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(context, ChatActivity.class);
|
||||||
|
intent.putExtra("senderid", loginUser.getId());
|
||||||
|
intent.putExtra("receiverid", transaksi.getId_merchant());
|
||||||
|
intent.putExtra("tokendriver", loginUser.getToken());
|
||||||
|
intent.putExtra("tokenku", transaksi.getToken_merchant());
|
||||||
|
intent.putExtra("name", transaksi.getNama_merchant());
|
||||||
|
intent.putExtra("pic", Constants.IMAGESMERCHANT + transaksi.getFoto_merchant());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (transaksi.getHome().equalsIgnoreCase("2")) {
|
||||||
|
requestRoute();
|
||||||
|
lldetailsend.setVisibility(View.VISIBLE);
|
||||||
|
produk.setText(transaksi.getNamaBarang());
|
||||||
|
sendername.setText(transaksi.namaPengirim);
|
||||||
|
receivername.setText(transaksi.namaPenerima);
|
||||||
|
|
||||||
|
senderphone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Telpon Driver");
|
||||||
|
alertDialogBuilder.setMessage("You want to call " + transaksi.getNamaPengirim() + "(" + transaksi.teleponPengirim + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:" + transaksi.teleponPengirim));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
receiverphone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Call Driver");
|
||||||
|
alertDialogBuilder.setMessage("You want to call " + transaksi.getNamaPenerima() + "(" + transaksi.teleponPenerima + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:" + transaksi.teleponPenerima));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
pickUpLatLng = new LatLng(transaksi.getStartLatitude(), transaksi.getStartLongitude());
|
||||||
|
destinationLatLng = new LatLng(transaksi.getEndLatitude(), transaksi.getEndLongitude());
|
||||||
|
if (pickUpMarker != null) pickUpMarker.remove();
|
||||||
|
pickUpMarker = gMap.addMarker(new MarkerOptions()
|
||||||
|
.position(pickUpLatLng)
|
||||||
|
.title("Ambil")
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pickup)));
|
||||||
|
|
||||||
|
|
||||||
|
if (destinationMarker != null) destinationMarker.remove();
|
||||||
|
destinationMarker = gMap.addMarker(new MarkerOptions()
|
||||||
|
.position(destinationLatLng)
|
||||||
|
.title("Tujuan")
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.drawable.destination)));
|
||||||
|
updateLastLocation();
|
||||||
|
parsedata(transaksi, pelanggan);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull retrofit2.Call<DetailTransResponseJson> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmerload() {
|
||||||
|
shimmerlayanan.startShimmerAnimation();
|
||||||
|
shimmerpickup.startShimmerAnimation();
|
||||||
|
shimmerdestination.startShimmerAnimation();
|
||||||
|
shimmerfitur.startShimmerAnimation();
|
||||||
|
shimmerdistance.startShimmerAnimation();
|
||||||
|
shimmerprice.startShimmerAnimation();
|
||||||
|
|
||||||
|
layanan.setVisibility(View.GONE);
|
||||||
|
layanandesk.setVisibility(View.GONE);
|
||||||
|
pickUpText.setVisibility(View.GONE);
|
||||||
|
destinationText.setVisibility(View.GONE);
|
||||||
|
fiturtext.setVisibility(View.GONE);
|
||||||
|
priceText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shimmertutup() {
|
||||||
|
shimmerlayanan.stopShimmerAnimation();
|
||||||
|
shimmerpickup.stopShimmerAnimation();
|
||||||
|
shimmerdestination.stopShimmerAnimation();
|
||||||
|
shimmerfitur.stopShimmerAnimation();
|
||||||
|
shimmerdistance.stopShimmerAnimation();
|
||||||
|
shimmerprice.stopShimmerAnimation();
|
||||||
|
|
||||||
|
shimmerlayanan.setVisibility(View.GONE);
|
||||||
|
shimmerpickup.setVisibility(View.GONE);
|
||||||
|
shimmerdestination.setVisibility(View.GONE);
|
||||||
|
shimmerfitur.setVisibility(View.GONE);
|
||||||
|
shimmerdistance.setVisibility(View.GONE);
|
||||||
|
shimmerprice.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
layanan.setVisibility(View.VISIBLE);
|
||||||
|
layanandesk.setVisibility(View.VISIBLE);
|
||||||
|
pickUpText.setVisibility(View.VISIBLE);
|
||||||
|
destinationText.setVisibility(View.VISIBLE);
|
||||||
|
distanceText.setVisibility(View.VISIBLE);
|
||||||
|
fiturtext.setVisibility(View.VISIBLE);
|
||||||
|
priceText.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parsedata(TransaksiModel request, final PelangganModel pelanggan) {
|
||||||
|
requestRoute();
|
||||||
|
final User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
pickUpLatLng = new LatLng(request.getStartLatitude(), request.getStartLongitude());
|
||||||
|
destinationLatLng = new LatLng(request.getEndLatitude(), request.getEndLongitude());
|
||||||
|
|
||||||
|
PicassoTrustAll.getInstance(context)
|
||||||
|
.load(Constants.IMAGESUSER + pelanggan.getFoto())
|
||||||
|
.placeholder(R.drawable.image_placeholder)
|
||||||
|
.into(foto);
|
||||||
|
|
||||||
|
|
||||||
|
layanan.setText(pelanggan.getFullnama());
|
||||||
|
pickUpText.setText(request.getAlamatAsal());
|
||||||
|
destinationText.setText(request.getAlamatTujuan());
|
||||||
|
if (type.equals("4")) {
|
||||||
|
double totalbiaya = Double.parseDouble(request.getTotal_biaya());
|
||||||
|
Utility.currencyTXT(priceText, String.valueOf(request.getHarga() + totalbiaya), context);
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(priceText, String.valueOf(request.getHarga()), context);
|
||||||
|
}
|
||||||
|
|
||||||
|
phone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context, R.style.DialogStyle);
|
||||||
|
alertDialogBuilder.setTitle("Call Customer");
|
||||||
|
alertDialogBuilder.setMessage("You want to call Costumer (+" + pelanggan.getNoTelepon() + ")?");
|
||||||
|
alertDialogBuilder.setPositiveButton("yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PERMISSION_CALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:+" + pelanggan.getNoTelepon()));
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chat.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(context, ChatActivity.class);
|
||||||
|
intent.putExtra("senderid", loginUser.getId());
|
||||||
|
intent.putExtra("receiverid", pelanggan.getId());
|
||||||
|
intent.putExtra("tokendriver", loginUser.getToken());
|
||||||
|
intent.putExtra("tokenku", pelanggan.getToken());
|
||||||
|
intent.putExtra("name", pelanggan.getFullnama());
|
||||||
|
intent.putExtra("pic", Constants.IMAGESUSER + pelanggan.getFoto());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastLocation() {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_LOCATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocationServices.FusedLocationApi.getLastLocation(
|
||||||
|
googleApiClient);
|
||||||
|
gMap.setMyLocationEnabled(true);
|
||||||
|
|
||||||
|
if (pickUpLatLng != null) {
|
||||||
|
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
|
pickUpLatLng, 15f)
|
||||||
|
);
|
||||||
|
|
||||||
|
gMap.animateCamera(CameraUpdateFactory.zoomTo(15f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private okhttp3.Callback updateRouteCallback = new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, okhttp3.Response response) throws IOException {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
final String json = Objects.requireNonNull(response.body()).string();
|
||||||
|
if (MapDirectionAPI.getDirectionErrorMessage(json) != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final long distance = MapDirectionAPI.getDistance(context, json);
|
||||||
|
final String time = MapDirectionAPI.getTimeDistance(context, json);
|
||||||
|
if (distance >= 0) {
|
||||||
|
if (getActivity() == null)
|
||||||
|
return;
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateLineDestination(json);
|
||||||
|
float km = ((float) (distance)) / 1000f;
|
||||||
|
String format = String.format(Locale.US, "%.1f", km);
|
||||||
|
distanceText.setText(format);
|
||||||
|
fiturtext.setText(time);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void requestRoute() {
|
||||||
|
if (pickUpLatLng != null && destinationLatLng != null) {
|
||||||
|
MapDirectionAPI.getDirection(context, pickUpLatLng, destinationLatLng)
|
||||||
|
.enqueue(updateRouteCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLineDestination(String json) {
|
||||||
|
Directions directions = new Directions(context);
|
||||||
|
try {
|
||||||
|
List<Route> routes = directions.parse(json);
|
||||||
|
|
||||||
|
if (directionLine != null) directionLine.remove();
|
||||||
|
if (routes.size() > 0) {
|
||||||
|
directionLine = gMap.addPolyline((new PolylineOptions())
|
||||||
|
.addAll(routes.get(0).getOverviewPolyLine())
|
||||||
|
.color(ContextCompat.getColor(context, R.color.colorgradient))
|
||||||
|
.width(8));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnected(@Nullable Bundle bundle) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionSuspended(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMapReady(GoogleMap googleMap) {
|
||||||
|
gMap = googleMap;
|
||||||
|
gMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||||
|
try {
|
||||||
|
boolean success = googleMap.setMapStyle(
|
||||||
|
MapStyleOptions.loadRawResourceStyle(
|
||||||
|
context, R.raw.style_json));
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
android.util.Log.e("", "Style parsing failed.");
|
||||||
|
}
|
||||||
|
} catch (Resources.NotFoundException e) {
|
||||||
|
android.util.Log.e("", "Can't find style. Error: ", e);
|
||||||
|
}
|
||||||
|
getData(idtrans, idpelanggan);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void start(final PelangganModel pelanggan, final String tokenmerchant, final String idtransmerchant, final String waktuorder) {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
final User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
AcceptRequestJson param = new AcceptRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setIdtrans(idtrans);
|
||||||
|
userService.startrequest(param).enqueue(new Callback<AcceptResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<AcceptResponseJson> call, @NonNull final Response<AcceptResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("berhasil")) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
onsubmit = "3";
|
||||||
|
getData(idtrans, idpelanggan);
|
||||||
|
OrderFCM orderfcm = new OrderFCM();
|
||||||
|
orderfcm.id_driver = loginUser.getId();
|
||||||
|
orderfcm.id_transaksi = idtrans;
|
||||||
|
orderfcm.response = "3";
|
||||||
|
if (type.equals("4")) {
|
||||||
|
orderfcm.id_pelanggan = idpelanggan;
|
||||||
|
orderfcm.invoice = "INV-" + idtrans + idtransmerchant;
|
||||||
|
orderfcm.ordertime = waktuorder;
|
||||||
|
orderfcm.desc = "driver delivers the order";
|
||||||
|
sendMessageToDriver(tokenmerchant, orderfcm);
|
||||||
|
} else {
|
||||||
|
orderfcm.desc = getString(R.string.notification_start);
|
||||||
|
}
|
||||||
|
sendMessageToDriver(pelanggan.getToken(), orderfcm);
|
||||||
|
} else {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(context, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
Toast.makeText(context, "Order sudah tidak aktif!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<AcceptResponseJson> call, @NonNull Throwable t) {
|
||||||
|
Toast.makeText(context, "Error Connection!", Toast.LENGTH_SHORT).show();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verify(String verificode, final PelangganModel pelanggan, final String tokenmerchant, final String idtransmerchant, final String waktuorder) {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
final User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
VerifyRequestJson param = new VerifyRequestJson();
|
||||||
|
param.setId(loginUser.getNoTelepon());
|
||||||
|
param.setIdtrans(idtrans);
|
||||||
|
param.setVerifycode(verificode);
|
||||||
|
userService.verifycode(param).enqueue(new Callback<ResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<ResponseJson> call, @NonNull final Response<ResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
|
||||||
|
start(pelanggan, tokenmerchant, idtransmerchant, waktuorder);
|
||||||
|
} else {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Toast.makeText(context, "verifikasi kode merchant tidak sesuai!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<ResponseJson> call, @NonNull Throwable t) {
|
||||||
|
Toast.makeText(context, "Error Connection!", Toast.LENGTH_SHORT).show();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finish(final PelangganModel pelanggan, final String tokenmerchant) {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
final User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
DriverService userService = ServiceGenerator.createService(
|
||||||
|
DriverService.class, loginUser.getNoTelepon(), loginUser.getPassword());
|
||||||
|
AcceptRequestJson param = new AcceptRequestJson();
|
||||||
|
param.setId(loginUser.getId());
|
||||||
|
param.setIdtrans(idtrans);
|
||||||
|
userService.finishrequest(param).enqueue(new Callback<AcceptResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<AcceptResponseJson> call, @NonNull final Response<AcceptResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("berhasil")) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(context, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
OrderFCM orderfcm = new OrderFCM();
|
||||||
|
orderfcm.id_driver = loginUser.getId();
|
||||||
|
orderfcm.id_transaksi = idtrans;
|
||||||
|
orderfcm.response = "4";
|
||||||
|
orderfcm.desc = getString(R.string.notification_finish);
|
||||||
|
if (type.equals("4")) {
|
||||||
|
sendMessageToDriver(tokenmerchant, orderfcm);
|
||||||
|
sendMessageToDriver(pelanggan.getToken(), orderfcm);
|
||||||
|
} else {
|
||||||
|
sendMessageToDriver(pelanggan.getToken(), orderfcm);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
Intent i = new Intent(context, MainActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
Toast.makeText(context, "Order is no longer available!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<AcceptResponseJson> call, @NonNull Throwable t) {
|
||||||
|
Toast.makeText(context, "Error Connection!", Toast.LENGTH_SHORT).show();
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessageToDriver(final String regIDTujuan, final OrderFCM response) {
|
||||||
|
|
||||||
|
final FCMMessage message = new FCMMessage();
|
||||||
|
message.setTo(regIDTujuan);
|
||||||
|
message.setData(response);
|
||||||
|
|
||||||
|
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||||
|
android.util.Log.e("REQUEST TO DRIVER", message.getData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import nl.changer.audiowife.AudioWife;
|
||||||
|
|
||||||
|
|
||||||
|
public class PlayAudioFragment extends Fragment {
|
||||||
|
|
||||||
|
private AudioWife audioWife;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_playaudio, container, false);
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
|
||||||
|
ImageView close_btn = getView.findViewById(R.id.close_btn);
|
||||||
|
ImageButton playBtn = getView.findViewById(R.id.playbtn);
|
||||||
|
ImageButton pauseBtn = getView.findViewById(R.id.pause_btn);
|
||||||
|
SeekBar seekBar = getView.findViewById(R.id.seekbar);
|
||||||
|
TextView durationTime = getView.findViewById(R.id.duration_time);
|
||||||
|
TextView totalTime = getView.findViewById(R.id.totaltime);
|
||||||
|
|
||||||
|
String filepath = Objects.requireNonNull(getArguments()).getString("path");
|
||||||
|
Uri uri = Uri.parse(filepath);
|
||||||
|
|
||||||
|
audioWife = AudioWife.getInstance();
|
||||||
|
audioWife.init(context, uri)
|
||||||
|
.setPlayView(playBtn)
|
||||||
|
.setPauseView(pauseBtn)
|
||||||
|
.setSeekBar(seekBar)
|
||||||
|
.setRuntimeView(durationTime)
|
||||||
|
.setTotalTimeView(totalTime);
|
||||||
|
|
||||||
|
audioWife.play();
|
||||||
|
|
||||||
|
close_btn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Objects.requireNonNull(getActivity()).onBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
audioWife.pause();
|
||||||
|
audioWife.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,348 @@
|
|||||||
|
package id.ontime.driver.fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.ChangepassActivity;
|
||||||
|
import id.ontime.driver.activity.EditKendaraanActivity;
|
||||||
|
import id.ontime.driver.activity.EditProfileActivity;
|
||||||
|
import id.ontime.driver.activity.IntroActivity;
|
||||||
|
import id.ontime.driver.activity.PrivacyActivity;
|
||||||
|
import id.ontime.driver.constants.BaseApp;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.json.GetHomeRequestJson;
|
||||||
|
import id.ontime.driver.json.GetHomeResponseJson;
|
||||||
|
import id.ontime.driver.utils.api.ServiceGenerator;
|
||||||
|
import id.ontime.driver.utils.api.service.DriverService;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
import id.ontime.driver.utils.SettingPreference;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import io.realm.Realm;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
import static android.content.Context.NOTIFICATION_SERVICE;
|
||||||
|
|
||||||
|
|
||||||
|
public class ProfileFragment extends Fragment {
|
||||||
|
private Context context;
|
||||||
|
private ImageView foto;
|
||||||
|
private TextView nama, iduser;
|
||||||
|
private TextView email;
|
||||||
|
private RelativeLayout rlprogress;
|
||||||
|
private SettingPreference sp;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View getView = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||||
|
context = getContext();
|
||||||
|
foto = getView.findViewById(R.id.userphoto);
|
||||||
|
nama = getView.findViewById(R.id.username);
|
||||||
|
iduser = getView.findViewById(R.id.iduser);
|
||||||
|
email = getView.findViewById(R.id.email);
|
||||||
|
LinearLayout aboutus = getView.findViewById(R.id.llaboutus);
|
||||||
|
LinearLayout privacy = getView.findViewById(R.id.llprivacypolicy);
|
||||||
|
LinearLayout shareapp = getView.findViewById(R.id.llshareapp);
|
||||||
|
LinearLayout rateapp = getView.findViewById(R.id.llrateapp);
|
||||||
|
LinearLayout editprofile = getView.findViewById(R.id.lleditprofile);
|
||||||
|
LinearLayout logout = getView.findViewById(R.id.lllogout);
|
||||||
|
LinearLayout llpassword = getView.findViewById(R.id.llpassword);
|
||||||
|
LinearLayout llkendaraan = getView.findViewById(R.id.llkendaraan);
|
||||||
|
rlprogress = getView.findViewById(R.id.rlprogress);
|
||||||
|
TextView rate = getView.findViewById(R.id.rate);
|
||||||
|
sp = new SettingPreference(context);
|
||||||
|
|
||||||
|
User driver = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
String format = String.format(Locale.US, "%.1f", Float.valueOf(driver.getRating()));
|
||||||
|
rate.setText(format);
|
||||||
|
|
||||||
|
llpassword.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, ChangepassActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
llkendaraan.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, EditKendaraanActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
privacy.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, PrivacyActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
aboutus.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
aboutus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
shareapp.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
|
||||||
|
String shareMessage = "Download NGOJOL Driver - Daftar Mitra Driver Sekarang! ";
|
||||||
|
shareMessage = shareMessage + "https://play.google.com/store/apps/details?id=" + requireActivity().getPackageName() + "\n\n";
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
|
||||||
|
startActivity(Intent.createChooser(shareIntent, "choose one"));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rateapp.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Uri uri = Uri.parse("market://details?id=" + Objects.requireNonNull(getActivity()).getPackageName());
|
||||||
|
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
|
||||||
|
Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
|
||||||
|
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
startActivity(goToMarket);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("http://play.google.com/store/apps/details?id=" + getActivity().getPackageName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
editprofile.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(context, EditProfileActivity.class);
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
logout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
clickDone();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return getView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clickDone() {
|
||||||
|
new AlertDialog.Builder(requireActivity(), R.style.DialogStyle)
|
||||||
|
.setIcon(R.mipmap.ic_launcher)
|
||||||
|
.setTitle(getString(R.string.app_name))
|
||||||
|
.setMessage(getString(R.string.exit))
|
||||||
|
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
logout();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void aboutus() {
|
||||||
|
final Dialog dialog = new Dialog(context);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
|
||||||
|
dialog.setContentView(R.layout.dialog_aboutus);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
|
||||||
|
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||||
|
lp.copyFrom(Objects.requireNonNull(dialog.getWindow()).getAttributes());
|
||||||
|
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
|
|
||||||
|
final ImageView close = dialog.findViewById(R.id.bt_close);
|
||||||
|
final LinearLayout email = dialog.findViewById(R.id.email);
|
||||||
|
final LinearLayout phone = dialog.findViewById(R.id.phone);
|
||||||
|
final LinearLayout website = dialog.findViewById(R.id.website);
|
||||||
|
final WebView about = dialog.findViewById(R.id.aboutus);
|
||||||
|
|
||||||
|
String mimeType = "text/html";
|
||||||
|
String encoding = "utf-8";
|
||||||
|
String htmlText = sp.getSetting()[5];
|
||||||
|
String text = "<html dir=" + "><head>"
|
||||||
|
+ "<style type=\"text/css\">@font-face {font-family: MyFont;src: url(\"file:///android_asset/fonts/Montserrat_Regular.ttf\")}body{font-family: MyFont;color: #000000;text-align:justify;line-height:1.2}"
|
||||||
|
+ "</style></head>"
|
||||||
|
+ "<body>"
|
||||||
|
+ htmlText
|
||||||
|
+ "</body></html>";
|
||||||
|
|
||||||
|
about.loadDataWithBaseURL(null, text, mimeType, encoding, null);
|
||||||
|
|
||||||
|
phone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final int REQUEST_PHONE_CALL = 1;
|
||||||
|
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
callIntent.setData(Uri.parse("tel:" + (sp.getSetting()[7])));
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PHONE_CALL);
|
||||||
|
} else {
|
||||||
|
startActivity(callIntent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
email.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
String[] TO = {(sp.getSetting()[6])};
|
||||||
|
Intent emailIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
emailIntent.setType("text/plain");
|
||||||
|
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "halo");
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_TEXT, "email" + "\n");
|
||||||
|
try {
|
||||||
|
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
|
||||||
|
} catch (android.content.ActivityNotFoundException ex) {
|
||||||
|
Toast.makeText(getActivity(),
|
||||||
|
"There is no email client installed.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
website.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String url = sp.getSetting()[8];
|
||||||
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse(url));
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
close.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
dialog.getWindow().setAttributes(lp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
User loginUser = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
nama.setText(loginUser.getFullnama());
|
||||||
|
iduser.setText(loginUser.getId());
|
||||||
|
email.setText(loginUser.getEmail());
|
||||||
|
|
||||||
|
PicassoTrustAll.getInstance(context)
|
||||||
|
.load(Constants.IMAGESDRIVER + loginUser.getFotodriver())
|
||||||
|
.placeholder(R.drawable.image_placeholder)
|
||||||
|
.resize(250, 250)
|
||||||
|
.into(foto);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logout() {
|
||||||
|
rlprogress.setVisibility(View.VISIBLE);
|
||||||
|
User driver = BaseApp.getInstance(context).getLoginUser();
|
||||||
|
GetHomeRequestJson request = new GetHomeRequestJson();
|
||||||
|
request.setId(driver.getId());
|
||||||
|
|
||||||
|
DriverService service = ServiceGenerator.createService(DriverService.class, driver.getEmail(), driver.getPassword());
|
||||||
|
service.logout(request).enqueue(new Callback<GetHomeResponseJson>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<GetHomeResponseJson> call, @NonNull Response<GetHomeResponseJson> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("success")) {
|
||||||
|
removeNotif();
|
||||||
|
Realm realm = BaseApp.getInstance(context).getRealmInstance();
|
||||||
|
realm.beginTransaction();
|
||||||
|
realm.delete(User.class);
|
||||||
|
realm.commitTransaction();
|
||||||
|
BaseApp.getInstance(context).setLoginUser(null);
|
||||||
|
startActivity(new Intent(getContext(), IntroActivity.class)
|
||||||
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||||
|
Objects.requireNonNull(getActivity()).finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<GetHomeResponseJson> call, @NonNull Throwable t) {
|
||||||
|
rlprogress.setVisibility(View.GONE);
|
||||||
|
t.printStackTrace();
|
||||||
|
Toast.makeText(context, "error connection!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void removeNotif() {
|
||||||
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
|
||||||
|
Objects.requireNonNull(notificationManager).cancel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package id.ontime.driver.gmap;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Direction implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -4198690398884769235L;
|
||||||
|
|
||||||
|
public String durationText;
|
||||||
|
public String html_instructions;
|
||||||
|
public String distanceText;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,332 @@
|
|||||||
|
package id.ontime.driver.gmap;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
import id.ontime.driver.activity.MainActivity;
|
||||||
|
import id.ontime.driver.utils.Log;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
|
public class GMapDirection {
|
||||||
|
public final static String MODE_DRIVING = "driving";
|
||||||
|
public final static String MODE_WALKING = "walking";
|
||||||
|
public GMapDirection() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUrl(LatLng start, LatLng end, String mode, boolean isAlternative) {
|
||||||
|
|
||||||
|
String url = "https://maps.googleapis.com/maps/api/directions/json?"
|
||||||
|
+ "origin=" + start.latitude + "," + start.longitude
|
||||||
|
+ "&destination=" + end.latitude + "," + end.longitude
|
||||||
|
+ "&sensor=false&units=metric&mode="+mode
|
||||||
|
+ "&key="+ MainActivity.apikey;
|
||||||
|
|
||||||
|
if (isAlternative)
|
||||||
|
url += "&alternatives=true";
|
||||||
|
|
||||||
|
Log.e("getUrl", url);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrlVia(String mode, boolean isAlternative, LatLng start, LatLng... end) {
|
||||||
|
String via = "&waypoints=";
|
||||||
|
if(end.length > 1){
|
||||||
|
for(LatLng end_latLng:end){
|
||||||
|
via += "via:"+end_latLng.latitude+"%2C"+end_latLng.longitude+"%7C";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
via = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String url = "https://maps.googleapis.com/maps/api/directions/json?"
|
||||||
|
+ "origin=" + start.latitude + "," + start.longitude
|
||||||
|
+ "&destination=" + end[end.length-1].latitude + "," + end[end.length-1].longitude
|
||||||
|
+ via
|
||||||
|
+ "&sensor=false&units=metric&mode="+mode
|
||||||
|
+ "&key="+ MainActivity.apikey;
|
||||||
|
|
||||||
|
if (isAlternative)
|
||||||
|
url += "&alternatives=true";
|
||||||
|
|
||||||
|
Log.e("getUrl", url);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Document getDocument(LatLng start, LatLng end, String mode) {
|
||||||
|
|
||||||
|
String url = "https://maps.googleapis.com/maps/api/directions/json?"
|
||||||
|
+ "origin=" + start.latitude + "," + start.longitude
|
||||||
|
+ "&destination=" + end.latitude + "," + end.longitude
|
||||||
|
+ "&sensor=false&units=metric&mode=driving"
|
||||||
|
+ "&key="+ MainActivity.apikey;
|
||||||
|
|
||||||
|
// String url = "http://maps.googleapis.com/maps/api/directions/xml?"
|
||||||
|
// + "origin=" + start.latitude + "," + start.longitude
|
||||||
|
// + "&destination=" + end.latitude + "," + end.longitude
|
||||||
|
// + "&sensor=false&units=metric&mode=driving"+"alternatives=true";
|
||||||
|
|
||||||
|
url = url.replace(" ", "+");
|
||||||
|
|
||||||
|
Log.e("URL", url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL ur = new URL(url);
|
||||||
|
URLConnection connection = ur.openConnection();
|
||||||
|
|
||||||
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
Document doc = builder.parse(connection.getInputStream());
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Document getDocument(String origin, String destination, String mode) {
|
||||||
|
String url = "http://maps.googleapis.com/maps/api/directions/json?"
|
||||||
|
+ "origin=" + origin + "&destination=" + destination
|
||||||
|
+ "&sensor=false&units=metric&mode=driving"
|
||||||
|
+ "&key="+ MainActivity.apikey;
|
||||||
|
|
||||||
|
url = url.replace(" ", "+");
|
||||||
|
Log.e("Query URL", url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL ur = new URL(url);
|
||||||
|
URLConnection connection = ur.openConnection();
|
||||||
|
|
||||||
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
Document doc = builder.parse(connection.getInputStream());
|
||||||
|
return doc;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDurationText(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("duration");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "text"));
|
||||||
|
Log.i("DurationText", node2.getTextContent());
|
||||||
|
return node2.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDurationValue(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("duration");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "value"));
|
||||||
|
Log.i("DurationValue", node2.getTextContent());
|
||||||
|
return Integer.parseInt(node2.getTextContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDistanceText(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("distance");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "text"));
|
||||||
|
Log.i("DistanceText", node2.getTextContent());
|
||||||
|
return node2.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistanceValue(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("distance");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "value"));
|
||||||
|
Log.i("DistanceValue", node2.getTextContent());
|
||||||
|
return Integer.parseInt(node2.getTextContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Float> getDistanceValueInMeters(Document doc) {
|
||||||
|
List<Float> list = new ArrayList<Float>();
|
||||||
|
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("distance");
|
||||||
|
|
||||||
|
for (int x = 0; x < nl1.getLength(); x++) {
|
||||||
|
Node node1 = nl1.item(x);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "value"));
|
||||||
|
|
||||||
|
Log.i("DistanceValue", node2.getTextContent());
|
||||||
|
|
||||||
|
float val = Integer.parseInt(node2.getTextContent());
|
||||||
|
|
||||||
|
list.add(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartAddress(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("start_address");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
Log.i("StartAddress", node1.getTextContent());
|
||||||
|
return node1.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndAddress(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("end_address");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
Log.i("StartAddress", node1.getTextContent());
|
||||||
|
return node1.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCopyRights(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("copyrights");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
Log.i("CopyRights", node1.getTextContent());
|
||||||
|
return node1.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LatLng getStartLocation(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("start_location");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "lat"));
|
||||||
|
Node node21 = nl2.item(getNodeIndex(nl2, "lng"));
|
||||||
|
|
||||||
|
Log.i("DistanceValue", node2.getTextContent());
|
||||||
|
return new LatLng(Float.parseFloat(node2.getTextContent()), Float.parseFloat(node21.getTextContent()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getEndLocation(Document doc) {
|
||||||
|
NodeList nl1 = doc.getElementsByTagName("end_location");
|
||||||
|
Node node1 = nl1.item(0);
|
||||||
|
NodeList nl2 = node1.getChildNodes();
|
||||||
|
Node node2 = nl2.item(getNodeIndex(nl2, "lat"));
|
||||||
|
Node node21 = nl2.item(getNodeIndex(nl2, "lng"));
|
||||||
|
|
||||||
|
Log.i("DistanceValue", node2.getTextContent());
|
||||||
|
return new LatLng(Float.parseFloat(node2.getTextContent()), Float.parseFloat(node21.getTextContent()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<LatLng> getDirection(Document doc) {
|
||||||
|
NodeList nl1, nl2, nl3;
|
||||||
|
ArrayList<LatLng> listGeopoints = new ArrayList<LatLng>();
|
||||||
|
nl1 = doc.getElementsByTagName("step");
|
||||||
|
if (nl1.getLength() > 0) {
|
||||||
|
for (int i = 0; i < nl1.getLength(); i++) {
|
||||||
|
Node node1 = nl1.item(i);
|
||||||
|
nl2 = node1.getChildNodes();
|
||||||
|
|
||||||
|
Node locationNode = nl2.item(getNodeIndex(nl2, "start_location"));
|
||||||
|
nl3 = locationNode.getChildNodes();
|
||||||
|
Node latNode = nl3.item(getNodeIndex(nl3, "lat"));
|
||||||
|
double lat = Double.parseDouble(latNode.getTextContent());
|
||||||
|
Node lngNode = nl3.item(getNodeIndex(nl3, "lng"));
|
||||||
|
double lng = Double.parseDouble(lngNode.getTextContent());
|
||||||
|
listGeopoints.add(new LatLng(lat, lng));
|
||||||
|
|
||||||
|
locationNode = nl2.item(getNodeIndex(nl2, "polyline"));
|
||||||
|
nl3 = locationNode.getChildNodes();
|
||||||
|
latNode = nl3.item(getNodeIndex(nl3, "points"));
|
||||||
|
ArrayList<LatLng> arr = decodePoly(latNode.getTextContent());
|
||||||
|
for (int j = 0; j < arr.size(); j++) {
|
||||||
|
listGeopoints.add(new LatLng(arr.get(j).latitude, arr.get(j).longitude));
|
||||||
|
}
|
||||||
|
|
||||||
|
locationNode = nl2.item(getNodeIndex(nl2, "end_location"));
|
||||||
|
nl3 = locationNode.getChildNodes();
|
||||||
|
latNode = nl3.item(getNodeIndex(nl3, "lat"));
|
||||||
|
lat = Double.parseDouble(latNode.getTextContent());
|
||||||
|
lngNode = nl3.item(getNodeIndex(nl3, "lng"));
|
||||||
|
lng = Double.parseDouble(lngNode.getTextContent());
|
||||||
|
listGeopoints.add(new LatLng(lat, lng));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return listGeopoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Direction> getDirections(Document doc) {
|
||||||
|
NodeList nl1, nl2, nl3;
|
||||||
|
ArrayList<Direction> listDirections = new ArrayList<Direction>();
|
||||||
|
nl1 = doc.getElementsByTagName("step");
|
||||||
|
if (nl1.getLength() > 0) {
|
||||||
|
for (int i = 0; i < nl1.getLength(); i++) {
|
||||||
|
|
||||||
|
Direction d = new Direction();
|
||||||
|
|
||||||
|
Node node1 = nl1.item(i);
|
||||||
|
nl2 = node1.getChildNodes();
|
||||||
|
|
||||||
|
Node locationNode = nl2.item(getNodeIndex(nl2, "duration"));
|
||||||
|
nl3 = locationNode.getChildNodes();
|
||||||
|
Node latNode = nl3.item(getNodeIndex(nl3, "text"));
|
||||||
|
d.durationText = latNode.getTextContent();
|
||||||
|
|
||||||
|
|
||||||
|
locationNode = nl2.item(getNodeIndex(nl2, "html_instructions"));
|
||||||
|
d.html_instructions = locationNode.getTextContent();
|
||||||
|
|
||||||
|
locationNode = nl2.item(getNodeIndex(nl2, "distance"));
|
||||||
|
nl3 = locationNode.getChildNodes();
|
||||||
|
latNode = nl3.item(getNodeIndex(nl3, "text"));
|
||||||
|
d.distanceText = latNode.getTextContent();
|
||||||
|
|
||||||
|
listDirections.add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return listDirections;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getNodeIndex(NodeList nl, String nodename) {
|
||||||
|
for (int i = 0; i < nl.getLength(); i++) {
|
||||||
|
if (nl.item(i).getNodeName().equals(nodename))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<LatLng> decodePoly(String encoded) {
|
||||||
|
ArrayList<LatLng> poly = new ArrayList<LatLng>();
|
||||||
|
int index = 0, len = encoded.length();
|
||||||
|
int lat = 0, lng = 0;
|
||||||
|
while (index < len) {
|
||||||
|
int b, shift = 0, result = 0;
|
||||||
|
do {
|
||||||
|
b = encoded.charAt(index++) - 63;
|
||||||
|
result |= (b & 0x1f) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (b >= 0x20);
|
||||||
|
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||||
|
lat += dlat;
|
||||||
|
shift = 0;
|
||||||
|
result = 0;
|
||||||
|
do {
|
||||||
|
b = encoded.charAt(index++) - 63;
|
||||||
|
result |= (b & 0x1f) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (b >= 0x20);
|
||||||
|
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||||
|
lng += dlng;
|
||||||
|
|
||||||
|
LatLng position = new LatLng((double) lat / 1E5, (double) lng / 1E5);
|
||||||
|
poly.add(position);
|
||||||
|
}
|
||||||
|
return poly;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
public class Bound {
|
||||||
|
private LatLng northEast;
|
||||||
|
private LatLng southWest;
|
||||||
|
|
||||||
|
public LatLng getNorthEast() {
|
||||||
|
return northEast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNorthEast(LatLng northEast) {
|
||||||
|
this.northEast = northEast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getSouthWest() {
|
||||||
|
return southWest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSouthWest(LatLng southWest) {
|
||||||
|
this.southWest = southWest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Directions {
|
||||||
|
|
||||||
|
Context context;
|
||||||
|
private String ROUTES = "routes";
|
||||||
|
private String SUMMARY = "summary";
|
||||||
|
private String LEGS = "legs";
|
||||||
|
private String DISTANCE = "distance";
|
||||||
|
private String TEXT = "text";
|
||||||
|
|
||||||
|
private String STEPS = "steps";
|
||||||
|
private String DURATION = "duration";
|
||||||
|
private String END_LOCATION = "end_location";
|
||||||
|
private String LATITUDE = "lat";
|
||||||
|
private String HTML_INSTRUCTION = "html_instructions";
|
||||||
|
private String OVERVIEW_POLYLINE = "overview_polyline";
|
||||||
|
private String POLYLINE = "polyline";
|
||||||
|
private String POINTS = "points";
|
||||||
|
|
||||||
|
private String START_LOCATION = "start_location";
|
||||||
|
private String LONGITUDE = "lng";
|
||||||
|
|
||||||
|
private String VALUE = "value";
|
||||||
|
|
||||||
|
public Directions(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String convertStreamToString(final InputStream input) throws Exception {
|
||||||
|
try {
|
||||||
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(input));
|
||||||
|
final StringBuffer sBuf = new StringBuffer();
|
||||||
|
String line = null;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
sBuf.append(line);
|
||||||
|
}
|
||||||
|
return sBuf.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
input.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Route> parse(String routesJSONString) throws Exception {
|
||||||
|
try {
|
||||||
|
List<Route> routeList = new ArrayList<Route>();
|
||||||
|
|
||||||
|
final JSONObject jSONObject = new JSONObject(routesJSONString);
|
||||||
|
JSONArray routeJSONArray = jSONObject.getJSONArray(ROUTES);
|
||||||
|
Route route;
|
||||||
|
JSONObject routesJSONObject;
|
||||||
|
for (int m = 0; m < routeJSONArray.length(); m++) {
|
||||||
|
route = new Route(context);
|
||||||
|
routesJSONObject = routeJSONArray.getJSONObject(m);
|
||||||
|
JSONArray legsJSONArray;
|
||||||
|
route.setSummary(routesJSONObject.getString(SUMMARY));
|
||||||
|
route.setOverviewPolyLine(decodePolyLines(routesJSONObject.getJSONObject(OVERVIEW_POLYLINE).getString(POINTS)));
|
||||||
|
legsJSONArray = routesJSONObject.getJSONArray(LEGS);
|
||||||
|
JSONObject legJSONObject;
|
||||||
|
Leg leg;
|
||||||
|
JSONArray stepsJSONArray;
|
||||||
|
for (int b = 0; b < legsJSONArray.length(); b++) {
|
||||||
|
leg = new Leg();
|
||||||
|
legJSONObject = legsJSONArray.getJSONObject(b);
|
||||||
|
leg.setDistance(new Distance(legJSONObject.optJSONObject(DISTANCE).optString(TEXT), legJSONObject.optJSONObject(DISTANCE).optLong(VALUE)));
|
||||||
|
leg.setDuration(new Duration(legJSONObject.optJSONObject(DURATION).optString(TEXT), legJSONObject.optJSONObject(DURATION).optLong(VALUE)));
|
||||||
|
stepsJSONArray = legJSONObject.getJSONArray(STEPS);
|
||||||
|
JSONObject stepJSONObject, stepDurationJSONObject, legPolyLineJSONObject, stepStartLocationJSONObject, stepEndLocationJSONObject;
|
||||||
|
Step step;
|
||||||
|
String encodedString;
|
||||||
|
LatLng stepStartLocationLatLng, stepEndLocationLatLng;
|
||||||
|
for (int i = 0; i < stepsJSONArray.length(); i++) {
|
||||||
|
stepJSONObject = stepsJSONArray.getJSONObject(i);
|
||||||
|
step = new Step();
|
||||||
|
JSONObject stepDistanceJSONObject = stepJSONObject.getJSONObject(DISTANCE);
|
||||||
|
step.setDistance(new Distance(stepDistanceJSONObject.getString(TEXT), stepDistanceJSONObject.getLong(VALUE)));
|
||||||
|
stepDurationJSONObject = stepJSONObject.getJSONObject(DURATION);
|
||||||
|
step.setDuration(new Duration(stepDurationJSONObject.getString(TEXT), stepDurationJSONObject.getLong(VALUE)));
|
||||||
|
stepEndLocationJSONObject = stepJSONObject.getJSONObject(END_LOCATION);
|
||||||
|
stepEndLocationLatLng = new LatLng(stepEndLocationJSONObject.getDouble(LATITUDE), stepEndLocationJSONObject.getDouble(LONGITUDE));
|
||||||
|
step.setEndLocation(stepEndLocationLatLng);
|
||||||
|
step.setHtmlInstructions(stepJSONObject.getString(HTML_INSTRUCTION));
|
||||||
|
legPolyLineJSONObject = stepJSONObject.getJSONObject(POLYLINE);
|
||||||
|
encodedString = legPolyLineJSONObject.getString(POINTS);
|
||||||
|
step.setPoints(decodePolyLines(encodedString));
|
||||||
|
|
||||||
|
stepStartLocationJSONObject = stepJSONObject.getJSONObject(START_LOCATION);
|
||||||
|
stepStartLocationLatLng = new LatLng(stepStartLocationJSONObject.getDouble(LATITUDE), stepStartLocationJSONObject.getDouble(LONGITUDE));
|
||||||
|
step.setStartLocation(stepStartLocationLatLng);
|
||||||
|
leg.addStep(step);
|
||||||
|
}
|
||||||
|
route.addLeg(leg);
|
||||||
|
}
|
||||||
|
routeList.add(route);
|
||||||
|
}
|
||||||
|
return routeList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<LatLng> decodePolyLines(String encoded) {
|
||||||
|
ArrayList<LatLng> poly = new ArrayList<LatLng>();
|
||||||
|
int index = 0, len = encoded.length();
|
||||||
|
int lat = 0, lng = 0;
|
||||||
|
while (index < len) {
|
||||||
|
int b, shift = 0, result = 0;
|
||||||
|
do {
|
||||||
|
b = encoded.charAt(index++) - 63;
|
||||||
|
result |= (b & 0x1f) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (b >= 0x20);
|
||||||
|
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||||
|
lat += dlat;
|
||||||
|
shift = 0;
|
||||||
|
result = 0;
|
||||||
|
do {
|
||||||
|
b = encoded.charAt(index++) - 63;
|
||||||
|
result |= (b & 0x1f) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (b >= 0x20);
|
||||||
|
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||||
|
lng += dlng;
|
||||||
|
|
||||||
|
LatLng position = new LatLng((double) lat / 1E5, (double) lng / 1E5);
|
||||||
|
poly.add(position);
|
||||||
|
}
|
||||||
|
return poly;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
public class Distance {
|
||||||
|
private String text;
|
||||||
|
private long value;
|
||||||
|
|
||||||
|
public Distance(String text, long value) {
|
||||||
|
this.text = text;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(long value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
public class Duration {
|
||||||
|
private String text;
|
||||||
|
private long value;
|
||||||
|
public Duration(String text, long value) {
|
||||||
|
this.text = text;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(long value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Leg {
|
||||||
|
private Distance distance;
|
||||||
|
private Duration duration;
|
||||||
|
private String endAddress;
|
||||||
|
private LatLng endLocation;
|
||||||
|
private String startAddress;
|
||||||
|
private LatLng startLocation;
|
||||||
|
private List<Step> steps;
|
||||||
|
|
||||||
|
public Leg() {
|
||||||
|
steps = new ArrayList<Step>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Distance getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistance(Distance distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Duration getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(Duration duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndAddress() {
|
||||||
|
return endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndAddress(String endAddress) {
|
||||||
|
this.endAddress = endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getEndLocation() {
|
||||||
|
return endLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndLocation(LatLng endLocation) {
|
||||||
|
this.endLocation = endLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartAddress() {
|
||||||
|
return startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartAddress(String startAddress) {
|
||||||
|
this.startAddress = startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getStartLocation() {
|
||||||
|
return startLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartLocation(LatLng startLocation) {
|
||||||
|
this.startLocation = startLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Step> getSteps() {
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSteps(List<Step> steps) {
|
||||||
|
this.steps = steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addStep(Step step) {
|
||||||
|
this.steps.add(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Route implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Bound bounds;
|
||||||
|
private String copyrights;
|
||||||
|
private List<Leg> legs;
|
||||||
|
private List<LatLng> overviewPolyLine;
|
||||||
|
private String summary;
|
||||||
|
|
||||||
|
public Route(Context context) {
|
||||||
|
legs = new ArrayList<Leg>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialversionuid() {
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bound getBounds() {
|
||||||
|
return bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBounds(Bound bounds) {
|
||||||
|
this.bounds = bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCopyrights() {
|
||||||
|
return copyrights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCopyrights(String copyrights) {
|
||||||
|
this.copyrights = copyrights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Leg> getLegs() {
|
||||||
|
return legs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLegs(List<Leg> legs) {
|
||||||
|
this.legs = legs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLeg(Leg leg) {
|
||||||
|
this.legs.add(leg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LatLng> getOverviewPolyLine() {
|
||||||
|
return overviewPolyLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverviewPolyLine(List<LatLng> overviewPolyLine) {
|
||||||
|
this.overviewPolyLine = overviewPolyLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSummary() {
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSummary(String summary) {
|
||||||
|
this.summary = summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package id.ontime.driver.gmap.directions;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Step {
|
||||||
|
private Distance distance;
|
||||||
|
private Duration duration;
|
||||||
|
private LatLng endLocation;
|
||||||
|
private LatLng startLocation;
|
||||||
|
private String htmlInstructions;
|
||||||
|
private String travelMode;
|
||||||
|
private List<LatLng> points;
|
||||||
|
|
||||||
|
public List<LatLng> getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(List<LatLng> points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Distance getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistance(Distance distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Duration getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(Duration duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getEndLocation() {
|
||||||
|
return endLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndLocation(LatLng endLocation) {
|
||||||
|
this.endLocation = endLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LatLng getStartLocation() {
|
||||||
|
return startLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartLocation(LatLng startLocation) {
|
||||||
|
this.startLocation = startLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHtmlInstructions() {
|
||||||
|
return htmlInstructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHtmlInstructions(String htmlInstructions) {
|
||||||
|
this.htmlInstructions = htmlInstructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTravelMode() {
|
||||||
|
return travelMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTravelMode(String travelMode) {
|
||||||
|
this.travelMode = travelMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.BankModel;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||||
|
|
||||||
|
|
||||||
|
public class BankItem extends RecyclerView.Adapter<BankItem.ItemRowHolder> {
|
||||||
|
|
||||||
|
private List<BankModel> dataList;
|
||||||
|
private Context mContext;
|
||||||
|
private int rowLayout;
|
||||||
|
|
||||||
|
public BankItem(Context context, List<BankModel> dataList, int rowLayout) {
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.mContext = context;
|
||||||
|
this.rowLayout = rowLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ItemRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false);
|
||||||
|
return new ItemRowHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final ItemRowHolder holder, final int position) {
|
||||||
|
final BankModel singleItem = dataList.get(position);
|
||||||
|
PicassoTrustAll.getInstance(mContext)
|
||||||
|
.load(Constants.IMAGESBANK + singleItem.getImage_bank())
|
||||||
|
.resize(250, 250)
|
||||||
|
.into(holder.images);
|
||||||
|
|
||||||
|
holder.namabank.setText(singleItem.getNama_bank());
|
||||||
|
holder.namapemilik.setText(singleItem.getNama_pemilik());
|
||||||
|
holder.rekening.setText(singleItem.getRekening_bank());
|
||||||
|
|
||||||
|
|
||||||
|
if (position % 2 == 1) {
|
||||||
|
holder.background.setBackgroundColor(mContext.getResources().getColor(R.color.backgroundgray));
|
||||||
|
// holder.imageView.setBackgroundColor(Color.parseColor("#FFFFFF"));
|
||||||
|
} else {
|
||||||
|
holder.background.setBackgroundColor(mContext.getResources().getColor(R.color.white));
|
||||||
|
// holder.imageView.setBackgroundColor(Color.parseColor("#FFFAF8FD"));
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.rekening.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(mContext, "Disalin!", Toast.LENGTH_SHORT).show();
|
||||||
|
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) mContext.getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
Objects.requireNonNull(clipboard).setText(singleItem.getRekening_bank());
|
||||||
|
} else {
|
||||||
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) mContext.getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
android.content.ClipData clip = android.content.ClipData.newPlainText("Disalin!", singleItem.getRekening_bank());
|
||||||
|
Objects.requireNonNull(clipboard).setPrimaryClip(clip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return (null != dataList ? dataList.size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ItemRowHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView namabank, namapemilik, rekening;
|
||||||
|
ImageView images;
|
||||||
|
RelativeLayout background;
|
||||||
|
|
||||||
|
ItemRowHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
background = itemView.findViewById(R.id.rootLayout);
|
||||||
|
namabank = itemView.findViewById(R.id.namabank);
|
||||||
|
namapemilik = itemView.findViewById(R.id.namapemilik);
|
||||||
|
rekening = itemView.findViewById(R.id.norekening);
|
||||||
|
images = itemView.findViewById(R.id.images);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.models.BankModels;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
public class BanklistItem extends RecyclerView.Adapter<BanklistItem.ItemRowHolder> {
|
||||||
|
|
||||||
|
private ArrayList<BankModels> dataList;
|
||||||
|
private Context mContext;
|
||||||
|
private int rowLayout;
|
||||||
|
private OnItemClickListener listener;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(BankModels item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BanklistItem(Context context, ArrayList<BankModels> dataList, int rowLayout, OnItemClickListener listener) {
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.mContext = context;
|
||||||
|
this.rowLayout = rowLayout;
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ItemRowHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false);
|
||||||
|
return new ItemRowHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final ItemRowHolder holder, final int position) {
|
||||||
|
final BankModels singleItem = dataList.get(position);
|
||||||
|
if (singleItem.getText().equals("Unlimited")) {
|
||||||
|
holder.text.setText(singleItem.getText());
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(holder.text, singleItem.getText(), mContext);
|
||||||
|
}
|
||||||
|
holder.text.setTypeface(Typeface.createFromAsset(mContext.getAssets(),
|
||||||
|
"fonts/NeoSansPro_Medium.ttf"));
|
||||||
|
|
||||||
|
holder.bind(singleItem, listener);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return (null != dataList ? dataList.size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemRowHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView text;
|
||||||
|
LinearLayout background;
|
||||||
|
|
||||||
|
ItemRowHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
background = itemView.findViewById(R.id.rootLayout);
|
||||||
|
text = itemView.findViewById(R.id.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final BankModels item, final OnItemClickListener listener) {
|
||||||
|
|
||||||
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onItemClick(item);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.OrderDetailActivity;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.AllTransaksiModel;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by otacodes on 3/24/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HistoryItem extends RecyclerView.Adapter<HistoryItem.ItemRowHolder> {
|
||||||
|
|
||||||
|
private List<AllTransaksiModel> dataList;
|
||||||
|
private Context mContext;
|
||||||
|
private int rowLayout;
|
||||||
|
|
||||||
|
|
||||||
|
public HistoryItem(Context context, List<AllTransaksiModel> dataList, int rowLayout) {
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.mContext = context;
|
||||||
|
this.rowLayout = rowLayout;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ItemRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false);
|
||||||
|
return new ItemRowHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final ItemRowHolder holder, final int position) {
|
||||||
|
final AllTransaksiModel singleItem = dataList.get(position);
|
||||||
|
holder.text.setText("Order " + singleItem.getFitur());
|
||||||
|
if (singleItem.getHome().equals("4")) {
|
||||||
|
double totalbiaya = Double.parseDouble(singleItem.getTotalbiaya());
|
||||||
|
Utility.currencyTXT(holder.nominal, String.valueOf(singleItem.getHarga()+ totalbiaya), mContext);
|
||||||
|
} else {
|
||||||
|
Utility.currencyTXT(holder.nominal, String.valueOf(singleItem.getHarga()), mContext);
|
||||||
|
}
|
||||||
|
holder.keterangan.setText(singleItem.getStatustransaksi());
|
||||||
|
|
||||||
|
|
||||||
|
SimpleDateFormat timeFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
|
||||||
|
String finalDate = timeFormat.format(singleItem.getWaktuOrder());
|
||||||
|
holder.tanggal.setText(finalDate);
|
||||||
|
|
||||||
|
PicassoTrustAll.getInstance(mContext)
|
||||||
|
.load(Constants.IMAGESFITUR + singleItem.getIcon())
|
||||||
|
.into(holder.images);
|
||||||
|
|
||||||
|
if (singleItem.status == 4 && singleItem.getRate().isEmpty()) {
|
||||||
|
holder.keterangan.setTextColor(mContext.getResources().getColor(R.color.black));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.colorgradient));
|
||||||
|
holder.background.setBackground(mContext.getResources().getDrawable(R.drawable.btn_rect));
|
||||||
|
|
||||||
|
} else if (singleItem.status == 5) {
|
||||||
|
holder.keterangan.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.background.setBackground(mContext.getResources().getDrawable(R.drawable.btn_rect_red));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
holder.keterangan.setTextColor(mContext.getResources().getColor(R.color.black));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.colorgradient));
|
||||||
|
holder.background.setBackground(mContext.getResources().getDrawable(R.drawable.btn_rect));
|
||||||
|
|
||||||
|
}
|
||||||
|
holder.itemlayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(mContext, OrderDetailActivity.class);
|
||||||
|
i.putExtra("id_pelanggan", singleItem.getIdPelanggan());
|
||||||
|
i.putExtra("id_transaksi", singleItem.getIdTransaksi());
|
||||||
|
i.putExtra("response", String.valueOf(singleItem.status));
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
mContext.startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return (null != dataList ? dataList.size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ItemRowHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView text, tanggal, nominal, keterangan;
|
||||||
|
ImageView background, images;
|
||||||
|
RelativeLayout itemlayout;
|
||||||
|
|
||||||
|
ItemRowHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
background = itemView.findViewById(R.id.background);
|
||||||
|
images = itemView.findViewById(R.id.image);
|
||||||
|
text = itemView.findViewById(R.id.text);
|
||||||
|
tanggal = itemView.findViewById(R.id.texttanggal);
|
||||||
|
nominal = itemView.findViewById(R.id.price);
|
||||||
|
keterangan = itemView.findViewById(R.id.textket);
|
||||||
|
itemlayout = itemView.findViewById(R.id.mainlayout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,512 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.MediaMetadataRetriever;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.activity.ChatActivity;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.ChatModels;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class ItemChat extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
private List<ChatModels> mDataSet;
|
||||||
|
private String myID;
|
||||||
|
private static final int mychat = 1;
|
||||||
|
private static final int friendchat = 2;
|
||||||
|
private static final int mychatimage = 3;
|
||||||
|
private static final int otherchatimage = 4;
|
||||||
|
private static final int alert_message = 7;
|
||||||
|
|
||||||
|
private static final int my_audio_message = 8;
|
||||||
|
private static final int other_audio_message = 9;
|
||||||
|
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private Integer today_day;
|
||||||
|
|
||||||
|
private OnItemClickListener listener;
|
||||||
|
private OnLongClickListener long_listener;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(ChatModels item, View view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnLongClickListener {
|
||||||
|
void onLongclick(ChatModels item, View view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemChat(List<ChatModels> dataSet, String id, Context context, OnItemClickListener listener, OnLongClickListener long_listener) {
|
||||||
|
mDataSet = dataSet;
|
||||||
|
this.myID = id;
|
||||||
|
this.context = context;
|
||||||
|
this.listener = listener;
|
||||||
|
this.long_listener = long_listener;
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
today_day = cal.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewtype) {
|
||||||
|
View v;
|
||||||
|
switch (viewtype) {
|
||||||
|
case mychat:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_my, viewGroup, false);
|
||||||
|
return new Chatviewholder(v);
|
||||||
|
case friendchat:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_other, viewGroup, false);
|
||||||
|
return new Chatviewholder(v);
|
||||||
|
case mychatimage:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_image_my, viewGroup, false);
|
||||||
|
return new Chatimageviewholder(v);
|
||||||
|
case otherchatimage:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_image_other, viewGroup, false);
|
||||||
|
return new Chatimageviewholder(v);
|
||||||
|
|
||||||
|
case my_audio_message:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chataudio, viewGroup, false);
|
||||||
|
return new Chataudioviewholder(v);
|
||||||
|
|
||||||
|
case other_audio_message:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_audio_other, viewGroup, false);
|
||||||
|
return new Chataudioviewholder(v);
|
||||||
|
case alert_message:
|
||||||
|
v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_chat_alert, viewGroup, false);
|
||||||
|
return new Alertviewholder(v);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDataSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
ChatModels chat = mDataSet.get(position);
|
||||||
|
|
||||||
|
switch (chat.getType()) {
|
||||||
|
case "text":
|
||||||
|
Chatviewholder chatviewholder = (Chatviewholder) holder;
|
||||||
|
// check if the message is from sender or receiver
|
||||||
|
if (chat.getSender_id().equals(myID)) {
|
||||||
|
if (chat.getStatus().equals("1"))
|
||||||
|
chatviewholder.message_seen.setText("Seen at " + chat.getTime());
|
||||||
|
else
|
||||||
|
chatviewholder.message_seen.setText("Sent");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
chatviewholder.message_seen.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position != 0) {
|
||||||
|
ChatModels chat2 = mDataSet.get(position - 1);
|
||||||
|
if (chat2.getTimestamp().substring(14, 16).equals(chat.getTimestamp().substring(14, 16))) {
|
||||||
|
chatviewholder.datetxt.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
chatviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
}
|
||||||
|
chatviewholder.message.setText(chat.getText());
|
||||||
|
} else {
|
||||||
|
chatviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
chatviewholder.message.setText(chat.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
chatviewholder.bind(chat, long_listener);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "image": {
|
||||||
|
final Chatimageviewholder chatimageholder = (Chatimageviewholder) holder;
|
||||||
|
if (chat.getSender_id().equals(myID)) {
|
||||||
|
if (chat.getStatus().equals("1"))
|
||||||
|
chatimageholder.messageSeen.setText("Seen at " + chat.getTime());
|
||||||
|
else
|
||||||
|
chatimageholder.messageSeen.setText("Sent");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
chatimageholder.messageSeen.setText("");
|
||||||
|
}
|
||||||
|
if (chat.getPic_url().equals("none")) {
|
||||||
|
if (ChatActivity.uploadingImageId.equals(chat.getChat_id())) {
|
||||||
|
chatimageholder.progressBar.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.messageSeen.setText("");
|
||||||
|
} else {
|
||||||
|
chatimageholder.progressBar.setVisibility(View.GONE);
|
||||||
|
chatimageholder.notSendMessageIcon.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.messageSeen.setText("Not delivered. ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chatimageholder.notSendMessageIcon.setVisibility(View.GONE);
|
||||||
|
chatimageholder.progressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position != 0) {
|
||||||
|
ChatModels chat2 = mDataSet.get(position - 1);
|
||||||
|
if (chat2.getTimestamp().substring(14, 16).equals(chat.getTimestamp().substring(14, 16))) {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
}
|
||||||
|
PicassoTrustAll.getInstance(context).load(chat.getPic_url()).placeholder(R.drawable.image_placeholder).resize(400, 400).centerCrop().into(chatimageholder.chatimage);
|
||||||
|
} else {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
PicassoTrustAll.getInstance(context).load(chat.getPic_url()).placeholder(R.drawable.image_placeholder).resize(400, 400).centerCrop().into(chatimageholder.chatimage);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chatimageholder.bind(mDataSet.get(position), listener, long_listener);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "audio":
|
||||||
|
final Chataudioviewholder chataudioviewholder = (Chataudioviewholder) holder;
|
||||||
|
// check if the message is from sender or receiver
|
||||||
|
if (chat.getSender_id().equals(myID)) {
|
||||||
|
if (chat.getStatus().equals("1"))
|
||||||
|
chataudioviewholder.messageSeen.setText("Seen at " + chat.getTime());
|
||||||
|
else
|
||||||
|
chataudioviewholder.messageSeen.setText("Sent");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.messageSeen.setText("");
|
||||||
|
}
|
||||||
|
if (chat.getPic_url().equals("none")) {
|
||||||
|
if (ChatActivity.uploadingAudioId.equals(chat.getChat_id())) {
|
||||||
|
chataudioviewholder.progressBar.setVisibility(View.VISIBLE);
|
||||||
|
chataudioviewholder.messageSeen.setText("");
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.progressBar.setVisibility(View.GONE);
|
||||||
|
chataudioviewholder.notSendMessageIcon.setVisibility(View.VISIBLE);
|
||||||
|
chataudioviewholder.messageSeen.setText("Not delivered. ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.notSendMessageIcon.setVisibility(View.GONE);
|
||||||
|
chataudioviewholder.progressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the group of message by date set the gap of 1 min
|
||||||
|
// means message send with in 1 min will show as a group
|
||||||
|
if (position != 0) {
|
||||||
|
ChatModels chat2 = mDataSet.get(position - 1);
|
||||||
|
if (chat2.getTimestamp().substring(14, 16).equals(chat.getTimestamp().substring(14, 16))) {
|
||||||
|
chataudioviewholder.datetxt.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chataudioviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chataudioviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chataudioviewholder.seekBar.setEnabled(false);
|
||||||
|
|
||||||
|
File fullpath = new File(Environment.getExternalStorageDirectory() + "/ontime/" + chat.getChat_id() + ".mp3");
|
||||||
|
if (fullpath.exists()) {
|
||||||
|
chataudioviewholder.totalTime.setText(getfileduration(Uri.parse(fullpath.getAbsolutePath())));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
chataudioviewholder.totalTime.setText(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
chataudioviewholder.bind(mDataSet.get(position), listener, long_listener);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "gif": {
|
||||||
|
final Chatimageviewholder chatimageholder = (Chatimageviewholder) holder;
|
||||||
|
if (chat.getSender_id().equals(myID)) {
|
||||||
|
if (chat.getStatus().equals("1"))
|
||||||
|
chatimageholder.messageSeen.setText("Seen at " + chat.getTime());
|
||||||
|
else
|
||||||
|
chatimageholder.messageSeen.setText("Sent");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
chatimageholder.messageSeen.setText("");
|
||||||
|
}
|
||||||
|
// make the group of message by date set the gap of 1 min
|
||||||
|
// means message send with in 1 min will show as a group
|
||||||
|
if (position != 0) {
|
||||||
|
ChatModels chat2 = mDataSet.get(position - 1);
|
||||||
|
if (chat2.getTimestamp().substring(14, 16).equals(chat.getTimestamp().substring(14, 16))) {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chatimageholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
chatimageholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chatimageholder.bind(mDataSet.get(position), listener, long_listener);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "delete":
|
||||||
|
Alertviewholder alertviewholder = (Alertviewholder) holder;
|
||||||
|
alertviewholder.message.setTextColor(context.getResources().getColor(R.color.gray));
|
||||||
|
alertviewholder.message.setBackground(context.getResources().getDrawable(R.drawable.round_edittext_background));
|
||||||
|
|
||||||
|
alertviewholder.message.setText("This message is deleted by " + chat.getSender_name());
|
||||||
|
|
||||||
|
if (position != 0) {
|
||||||
|
ChatModels chat2 = mDataSet.get(position - 1);
|
||||||
|
if (chat2.getTimestamp().substring(11, 13).equals(chat.getTimestamp().substring(11, 13))) {
|
||||||
|
alertviewholder.datetxt.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
alertviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
alertviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
alertviewholder.datetxt.setVisibility(View.VISIBLE);
|
||||||
|
alertviewholder.datetxt.setText(ChangeDate(chat.getTimestamp()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
switch (mDataSet.get(position).getType()) {
|
||||||
|
case "text":
|
||||||
|
if (mDataSet.get(position).getSender_id().equals(myID)) {
|
||||||
|
return mychat;
|
||||||
|
}
|
||||||
|
return friendchat;
|
||||||
|
case "image":
|
||||||
|
if (mDataSet.get(position).getSender_id().equals(myID)) {
|
||||||
|
return mychatimage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return otherchatimage;
|
||||||
|
|
||||||
|
case "audio":
|
||||||
|
if (mDataSet.get(position).getSender_id().equals(myID)) {
|
||||||
|
return my_audio_message;
|
||||||
|
}
|
||||||
|
return other_audio_message;
|
||||||
|
default:
|
||||||
|
return alert_message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Chatviewholder extends RecyclerView.ViewHolder {
|
||||||
|
TextView message, datetxt, message_seen;
|
||||||
|
View view;
|
||||||
|
|
||||||
|
Chatviewholder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
view = itemView;
|
||||||
|
this.message = view.findViewById(R.id.msgtxt);
|
||||||
|
this.datetxt = view.findViewById(R.id.datetxt);
|
||||||
|
message_seen = view.findViewById(R.id.messageseen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final ChatModels item, final OnLongClickListener long_listener) {
|
||||||
|
message.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
long_listener.onLongclick(item, v);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// second is for the chat image
|
||||||
|
static class Chatimageviewholder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView chatimage;
|
||||||
|
TextView datetxt, messageSeen;
|
||||||
|
ProgressBar progressBar;
|
||||||
|
ImageView notSendMessageIcon;
|
||||||
|
View getView;
|
||||||
|
|
||||||
|
Chatimageviewholder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
getView = itemView;
|
||||||
|
this.chatimage = getView.findViewById(R.id.chatimage);
|
||||||
|
this.datetxt = getView.findViewById(R.id.datetxt);
|
||||||
|
messageSeen = getView.findViewById(R.id.messageseen);
|
||||||
|
notSendMessageIcon = getView.findViewById(R.id.notsend);
|
||||||
|
progressBar = getView.findViewById(R.id.progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final ChatModels item, final OnItemClickListener listener, final OnLongClickListener long_listener) {
|
||||||
|
|
||||||
|
chatimage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onItemClick(item, v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chatimage.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
long_listener.onLongclick(item, v);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Chataudioviewholder extends RecyclerView.ViewHolder {
|
||||||
|
TextView datetxt, messageSeen;
|
||||||
|
ProgressBar progressBar;
|
||||||
|
ImageView notSendMessageIcon;
|
||||||
|
ImageView playBtn;
|
||||||
|
SeekBar seekBar;
|
||||||
|
TextView totalTime;
|
||||||
|
LinearLayout audioBubble;
|
||||||
|
View getView;
|
||||||
|
|
||||||
|
Chataudioviewholder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
getView = itemView;
|
||||||
|
audioBubble = getView.findViewById(R.id.audiobubble);
|
||||||
|
datetxt = getView.findViewById(R.id.datetxt);
|
||||||
|
messageSeen = getView.findViewById(R.id.messageseen);
|
||||||
|
notSendMessageIcon = getView.findViewById(R.id.notsend);
|
||||||
|
progressBar = getView.findViewById(R.id.progress);
|
||||||
|
this.playBtn = getView.findViewById(R.id.playbtn);
|
||||||
|
this.seekBar = getView.findViewById(R.id.seekbar);
|
||||||
|
this.totalTime = getView.findViewById(R.id.totaltime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final ChatModels item, final OnItemClickListener listener, final OnLongClickListener long_listener) {
|
||||||
|
|
||||||
|
|
||||||
|
audioBubble.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onItemClick(item, v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
audioBubble.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
long_listener.onLongclick(item, v);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Alertviewholder extends RecyclerView.ViewHolder {
|
||||||
|
TextView message, datetxt;
|
||||||
|
View getView;
|
||||||
|
|
||||||
|
Alertviewholder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
getView = itemView;
|
||||||
|
this.message = getView.findViewById(R.id.message);
|
||||||
|
this.datetxt = getView.findViewById(R.id.datetxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String ChangeDate(String date) {
|
||||||
|
long currenttime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long databasedate = 0;
|
||||||
|
Date d = null;
|
||||||
|
try {
|
||||||
|
d = Constants.df.parse(date);
|
||||||
|
databasedate = Objects.requireNonNull(d).getTime();
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
long difference = currenttime - databasedate;
|
||||||
|
if (difference < 86400000) {
|
||||||
|
int chatday = Integer.parseInt(date.substring(0, 2));
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
|
||||||
|
if (today_day == chatday)
|
||||||
|
return "Today " + sdf.format(Objects.requireNonNull(d));
|
||||||
|
else if ((today_day - chatday) == 1)
|
||||||
|
return "Yesterday " + sdf.format(Objects.requireNonNull(d));
|
||||||
|
} else if (difference < 172800000) {
|
||||||
|
int chatday = Integer.parseInt(date.substring(0, 2));
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
|
||||||
|
if ((today_day - chatday) == 1)
|
||||||
|
return "Yesterday " + sdf.format(Objects.requireNonNull(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy hh:mm a");
|
||||||
|
|
||||||
|
if (d != null)
|
||||||
|
return sdf.format(d);
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("DefaultLocale")
|
||||||
|
private String getfileduration(Uri uri) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
|
||||||
|
mmr.setDataSource(context, uri);
|
||||||
|
String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||||
|
final int file_duration = Integer.parseInt(durationStr);
|
||||||
|
|
||||||
|
long second = (file_duration / 1000) % 60;
|
||||||
|
long minute = (file_duration / (1000 * 60)) % 60;
|
||||||
|
|
||||||
|
return String.format("%02d:%02d", minute, second);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.models.ItemPesananModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ontime team on 3/24/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ItemPesananItem extends RecyclerView.Adapter<ItemPesananItem.ItemRowHolder> {
|
||||||
|
|
||||||
|
private List<ItemPesananModel> dataList;
|
||||||
|
private int rowLayout;
|
||||||
|
|
||||||
|
public ItemPesananItem(List<ItemPesananModel> dataList, int rowLayout) {
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.rowLayout = rowLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ItemRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false);
|
||||||
|
return new ItemRowHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final ItemRowHolder holder, final int position) {
|
||||||
|
final ItemPesananModel singleItem = dataList.get(position);
|
||||||
|
holder.name.setText(singleItem.getNama_item());
|
||||||
|
holder.qty.setText(singleItem.getJumlah_item());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return (null != dataList ? dataList.size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ItemRowHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView name,qty;
|
||||||
|
|
||||||
|
ItemRowHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
qty = itemView.findViewById(R.id.qty);
|
||||||
|
name = itemView.findViewById(R.id.namaitem);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Filter;
|
||||||
|
import android.widget.Filterable;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.constants.Constants;
|
||||||
|
import id.ontime.driver.models.MessageModels;
|
||||||
|
import id.ontime.driver.utils.PicassoTrustAll;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class MessageItem extends RecyclerView.Adapter<MessageItem.CustomViewHolder> implements Filterable {
|
||||||
|
public Context context;
|
||||||
|
private ArrayList<MessageModels> messageModels;
|
||||||
|
private ArrayList<MessageModels> messageModelsFilter;
|
||||||
|
private OnItemClickListener listener;
|
||||||
|
|
||||||
|
private Integer today_day;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(MessageModels item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageItem(Context context, ArrayList<MessageModels> user_dataList, OnItemClickListener listener) {
|
||||||
|
this.context = context;
|
||||||
|
this.messageModels = user_dataList;
|
||||||
|
this.messageModelsFilter = user_dataList;
|
||||||
|
this.listener = listener;
|
||||||
|
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
today_day = cal.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public CustomViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewtype) {
|
||||||
|
@SuppressLint("InflateParams") View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_message, null);
|
||||||
|
view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
|
||||||
|
return new CustomViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return messageModelsFilter.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class CustomViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView username, lastMessage, dateCreated;
|
||||||
|
ImageView userImage;
|
||||||
|
|
||||||
|
CustomViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
userImage = itemView.findViewById(R.id.userimages);
|
||||||
|
username = itemView.findViewById(R.id.fullname);
|
||||||
|
lastMessage = itemView.findViewById(R.id.message);
|
||||||
|
dateCreated = itemView.findViewById(R.id.datetxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final MessageModels item, final OnItemClickListener listener) {
|
||||||
|
|
||||||
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onItemClick(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final CustomViewHolder holder, final int i) {
|
||||||
|
|
||||||
|
final MessageModels item = messageModelsFilter.get(i);
|
||||||
|
holder.username.setText(item.getName());
|
||||||
|
holder.lastMessage.setText(item.getMessage());
|
||||||
|
holder.dateCreated.setText(ChangeDate(item.getTimestamp()));
|
||||||
|
|
||||||
|
if (item.getPicture().equals("") && item.getPicture() != null) {
|
||||||
|
PicassoTrustAll.getInstance(context).
|
||||||
|
load(R.drawable.image_placeholder)
|
||||||
|
.resize(100, 100)
|
||||||
|
.placeholder(R.drawable.image_placeholder).into(holder.userImage);
|
||||||
|
} else {
|
||||||
|
PicassoTrustAll.getInstance(context).
|
||||||
|
load(item.getPicture())
|
||||||
|
.resize(100, 100)
|
||||||
|
.placeholder(R.drawable.image_placeholder).into(holder.userImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
String status = "" + item.getStatus();
|
||||||
|
if (status.equals("0")) {
|
||||||
|
holder.lastMessage.setTypeface(null, Typeface.BOLD);
|
||||||
|
holder.lastMessage.setTextColor(context.getResources().getColor(R.color.black));
|
||||||
|
} else {
|
||||||
|
holder.lastMessage.setTypeface(null, Typeface.NORMAL);
|
||||||
|
holder.lastMessage.setTextColor(context.getResources().getColor(R.color.dark_gray));
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.bind(item, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String ChangeDate(String date) {
|
||||||
|
long currenttime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long databasedate = 0;
|
||||||
|
Date d = null;
|
||||||
|
try {
|
||||||
|
d = Constants.df.parse(date);
|
||||||
|
databasedate = Objects.requireNonNull(d).getTime();
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
long difference = currenttime - databasedate;
|
||||||
|
if (difference < 86400000) {
|
||||||
|
int chatday = Integer.parseInt(date.substring(0, 2));
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
|
||||||
|
if (today_day == chatday)
|
||||||
|
return sdf.format(Objects.requireNonNull(d));
|
||||||
|
else if ((today_day - chatday) == 1)
|
||||||
|
return "Yesterday";
|
||||||
|
} else if (difference < 172800000) {
|
||||||
|
int chatday = Integer.parseInt(date.substring(0, 2));
|
||||||
|
if ((today_day - chatday) == 1)
|
||||||
|
return "Yesterday";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy");
|
||||||
|
|
||||||
|
if (d != null)
|
||||||
|
return sdf.format(d);
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Filter getFilter() {
|
||||||
|
return new Filter() {
|
||||||
|
@Override
|
||||||
|
protected FilterResults performFiltering(CharSequence charSequence) {
|
||||||
|
String charString = charSequence.toString();
|
||||||
|
if (charString.isEmpty()) {
|
||||||
|
messageModelsFilter = messageModels;
|
||||||
|
} else {
|
||||||
|
ArrayList<MessageModels> filteredList = new ArrayList<>();
|
||||||
|
for (MessageModels row : messageModels) {
|
||||||
|
if (row.getName().toLowerCase().contains(charString.toLowerCase())) {
|
||||||
|
filteredList.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
messageModelsFilter = filteredList;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilterResults filterResults = new FilterResults();
|
||||||
|
filterResults.values = messageModelsFilter;
|
||||||
|
return filterResults;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
|
||||||
|
messageModelsFilter = (ArrayList<MessageModels>) filterResults.values;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package id.ontime.driver.item;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import id.ontime.driver.R;
|
||||||
|
import id.ontime.driver.models.WalletModel;
|
||||||
|
import id.ontime.driver.utils.Utility;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by otacodes on 3/24/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class WalletItem extends RecyclerView.Adapter<WalletItem.ItemRowHolder> {
|
||||||
|
|
||||||
|
private List<WalletModel> dataList;
|
||||||
|
private Context mContext;
|
||||||
|
private int rowLayout;
|
||||||
|
|
||||||
|
|
||||||
|
public WalletItem(Context context, List<WalletModel> dataList, int rowLayout) {
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.mContext = context;
|
||||||
|
this.rowLayout = rowLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ItemRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false);
|
||||||
|
return new ItemRowHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final ItemRowHolder holder, final int position) {
|
||||||
|
final WalletModel singleItem = dataList.get(position);
|
||||||
|
|
||||||
|
|
||||||
|
if (singleItem.getType().equals("withdraw")) {
|
||||||
|
holder.text.setText(singleItem.getType());
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
|
||||||
|
switch (singleItem.getStatus()) {
|
||||||
|
case "1":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.keterangan.setText("Penarikan Dana");
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.keterangan.setText("Pending");
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.keterangan.setText("Dibatalkan");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (singleItem.getType().equals("Order-")) {
|
||||||
|
holder.text.setText("Order " + singleItem.getBank());
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
|
||||||
|
switch (singleItem.getStatus()) {
|
||||||
|
case "1":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.red));
|
||||||
|
holder.keterangan.setText("Biaya Transaksi");
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.keterangan.setText("Pending");
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.keterangan.setText("Dibatalkan");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (singleItem.getType().equals("topup") && singleItem.getStatus().equals("1")) {
|
||||||
|
holder.text.setText(singleItem.getType()+" "+singleItem.getBank());
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.keterangan.setText("TopUp Berhasil");
|
||||||
|
|
||||||
|
} else if (singleItem.getType().equals("topup") && singleItem.getStatus().equals("2")) {
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
holder.text.setText(singleItem.getType()+" "+singleItem.getBank());
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.gray));
|
||||||
|
holder.keterangan.setText("Dibatalkan");
|
||||||
|
|
||||||
|
} else if (singleItem.getType().equals("topup") && singleItem.getStatus().equals("0")) {
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
holder.text.setText(singleItem.getType()+" "+singleItem.getBank());
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.keterangan.setText("Pending");
|
||||||
|
|
||||||
|
} else if (singleItem.getType().equals("Order+")) {
|
||||||
|
holder.text.setText("Order " + singleItem.getBank());
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.green));
|
||||||
|
holder.keterangan.setText("Saldo Masuk");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
holder.background.setColorFilter(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.text.setText(singleItem.getType()+" "+singleItem.getBank());
|
||||||
|
holder.text.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
holder.nominal.setTextColor(mContext.getResources().getColor(R.color.yellow));
|
||||||
|
Utility.currencyTXT(holder.nominal, singleItem.getJumlah(), mContext);
|
||||||
|
|
||||||
|
holder.keterangan.setText("Pending");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
Date myDate = null;
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm", Locale.US);
|
||||||
|
try {
|
||||||
|
myDate = dateFormat.parse(singleItem.getWaktu());
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
SimpleDateFormat timeFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
|
||||||
|
String finalDate = timeFormat.format(Objects.requireNonNull(myDate));
|
||||||
|
holder.tanggal.setText(finalDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return (null != dataList ? dataList.size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ItemRowHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView text, tanggal, nominal, keterangan;
|
||||||
|
ImageView background;
|
||||||
|
|
||||||
|
ItemRowHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
background = itemView.findViewById(R.id.background);
|
||||||
|
text = itemView.findViewById(R.id.text);
|
||||||
|
tanggal = itemView.findViewById(R.id.texttanggal);
|
||||||
|
nominal = itemView.findViewById(R.id.textharga);
|
||||||
|
keterangan = itemView.findViewById(R.id.textket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AcceptRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("id_transaksi")
|
||||||
|
@Expose
|
||||||
|
private String idtrans;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdtrans() {
|
||||||
|
return idtrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdtrans(String idtrans) {
|
||||||
|
this.idtrans = idtrans;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AcceptResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.AllTransaksiModel;
|
||||||
|
import id.ontime.driver.models.PelangganModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/19/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AllTransResponseJson {
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("data")
|
||||||
|
private List<AllTransaksiModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("driver")
|
||||||
|
private List<PelangganModel> driver = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AllTransaksiModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<AllTransaksiModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PelangganModel> getDriver() {
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriver(List<PelangganModel> driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.BankModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/19/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BankResponseJson {
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("data")
|
||||||
|
private List<BankModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BankModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<BankModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ChangePassRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String notelepon;
|
||||||
|
|
||||||
|
@SerializedName("email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@SerializedName("password")
|
||||||
|
@Expose
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@SerializedName("new_password")
|
||||||
|
@Expose
|
||||||
|
private String new_password;
|
||||||
|
|
||||||
|
public String getNotelepon() {
|
||||||
|
return notelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotelepon(String notelepon) {
|
||||||
|
this.notelepon = notelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewPassword() {
|
||||||
|
return new_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPassword(String new_password) {
|
||||||
|
this.new_password = new_password;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 24/02/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DetailRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("id_pelanggan")
|
||||||
|
@Expose
|
||||||
|
private String idPelanggan;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdPelanggan() {
|
||||||
|
return idPelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdPelanggan(String idPelanggan) {
|
||||||
|
this.idPelanggan = idPelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.ItemPesananModel;
|
||||||
|
import id.ontime.driver.models.PelangganModel;
|
||||||
|
import id.ontime.driver.models.TransaksiModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/19/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DetailTransResponseJson {
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("data")
|
||||||
|
private List<TransaksiModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("pelanggan")
|
||||||
|
private List<PelangganModel> pelanggan = new ArrayList<>();
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
@SerializedName("item")
|
||||||
|
private List<ItemPesananModel> item = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TransaksiModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<TransaksiModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PelangganModel> getPelanggan() {
|
||||||
|
return pelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPelanggan(List<PelangganModel> pelanggan) {
|
||||||
|
this.pelanggan = pelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemPesananModel> getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItem(List<ItemPesananModel> item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EditKendaraanRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String noTelepon;
|
||||||
|
|
||||||
|
@SerializedName("merek")
|
||||||
|
@Expose
|
||||||
|
private String merek;
|
||||||
|
|
||||||
|
@SerializedName("tipe")
|
||||||
|
@Expose
|
||||||
|
private String tipe;
|
||||||
|
|
||||||
|
@SerializedName("no_kendaraan")
|
||||||
|
@Expose
|
||||||
|
private String no_kendaraan;
|
||||||
|
|
||||||
|
@SerializedName("warna")
|
||||||
|
@Expose
|
||||||
|
private String warna;
|
||||||
|
|
||||||
|
@SerializedName("id_kendaraan")
|
||||||
|
@Expose
|
||||||
|
private String id_kendaraan;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoTelepon() {
|
||||||
|
return noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoTelepon(String noTelepon) {
|
||||||
|
this.noTelepon = noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerek() {
|
||||||
|
return merek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerek(String merek) {
|
||||||
|
this.merek = merek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipe() {
|
||||||
|
return tipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipe(String tipe) {
|
||||||
|
this.tipe = tipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNo_kendaraan() {
|
||||||
|
return no_kendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNo_kendaraan(String no_kendaraan) {
|
||||||
|
this.no_kendaraan = no_kendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWarna() {
|
||||||
|
return warna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWarna(String warna) {
|
||||||
|
this.warna = warna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId_kendaraan() {
|
||||||
|
return id_kendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId_kendaraan(String id_kendaraan) {
|
||||||
|
this.id_kendaraan = id_kendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EditprofileRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("fullnama")
|
||||||
|
@Expose
|
||||||
|
private String fullNama;
|
||||||
|
|
||||||
|
@SerializedName("email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@SerializedName("email_lama")
|
||||||
|
@Expose
|
||||||
|
private String emaillama;
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String noTelepon;
|
||||||
|
|
||||||
|
@SerializedName("phone")
|
||||||
|
@Expose
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@SerializedName("no_telepon_lama")
|
||||||
|
@Expose
|
||||||
|
private String phonelama;
|
||||||
|
|
||||||
|
@SerializedName("tgl_lahir")
|
||||||
|
@Expose
|
||||||
|
private String tglLahir = "-";
|
||||||
|
|
||||||
|
|
||||||
|
@SerializedName("fotodriver")
|
||||||
|
@Expose
|
||||||
|
private String fotopelanggan;
|
||||||
|
|
||||||
|
@SerializedName("fotodriver_lama")
|
||||||
|
@Expose
|
||||||
|
private String fotopelangganlama;
|
||||||
|
|
||||||
|
@SerializedName("countrycode")
|
||||||
|
@Expose
|
||||||
|
private String countrycode;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullNama() {
|
||||||
|
return fullNama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullNama(String fullNama) {
|
||||||
|
this.fullNama = fullNama;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmaillama() {
|
||||||
|
return emaillama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmaillama(String emaillama) {
|
||||||
|
this.emaillama = emaillama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoTelepon() {
|
||||||
|
return noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoTelepon(String noTelepon) {
|
||||||
|
this.noTelepon = noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTglLahir() {
|
||||||
|
return tglLahir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTglLahir(String tglLahir) {
|
||||||
|
this.tglLahir = tglLahir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getFotopelanggan() {
|
||||||
|
return fotopelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFotopelanggan(String fotopelanggan) {
|
||||||
|
this.fotopelanggan = fotopelanggan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhonelama() {
|
||||||
|
return phonelama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhonelama(String phonelama) {
|
||||||
|
this.phonelama = phonelama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFotopelangganlama() {
|
||||||
|
return fotopelangganlama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFotopelangganlama(String fotopelangganlama) {
|
||||||
|
this.fotopelangganlama = fotopelangganlama;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountrycode() {
|
||||||
|
return countrycode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountrycode(String countrycode) {
|
||||||
|
this.countrycode = countrycode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GetHomeRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.TransaksiModel;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GetHomeResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("saldo")
|
||||||
|
@Expose
|
||||||
|
private String saldo;
|
||||||
|
|
||||||
|
@SerializedName("currency")
|
||||||
|
@Expose
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
@SerializedName("app_aboutus")
|
||||||
|
@Expose
|
||||||
|
private String aboutus;
|
||||||
|
|
||||||
|
@SerializedName("app_email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@SerializedName("app_contact")
|
||||||
|
@Expose
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@SerializedName("app_website")
|
||||||
|
@Expose
|
||||||
|
private String website;
|
||||||
|
|
||||||
|
@SerializedName("driver_status")
|
||||||
|
@Expose
|
||||||
|
private String driverstatus;
|
||||||
|
|
||||||
|
@SerializedName("data_transaksi")
|
||||||
|
@Expose
|
||||||
|
private List<TransaksiModel> transaksi = new ArrayList<>();
|
||||||
|
|
||||||
|
@SerializedName("data_driver")
|
||||||
|
@Expose
|
||||||
|
private List<User> datadriver = new ArrayList<>();
|
||||||
|
|
||||||
|
@SerializedName("currency_text")
|
||||||
|
@Expose
|
||||||
|
private String currency_text;
|
||||||
|
|
||||||
|
@SerializedName("mobilepulsa_username")
|
||||||
|
@Expose
|
||||||
|
private String mobilepulsausername;
|
||||||
|
|
||||||
|
@SerializedName("mobilepulsa_api_key")
|
||||||
|
@Expose
|
||||||
|
private String mobilepulsaapikey;
|
||||||
|
|
||||||
|
@SerializedName("mp_status")
|
||||||
|
@Expose
|
||||||
|
private String mpstatus;
|
||||||
|
|
||||||
|
@SerializedName("mp_active")
|
||||||
|
@Expose
|
||||||
|
private String mpactive;
|
||||||
|
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSaldo() {
|
||||||
|
return saldo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaldo(String saldo) {
|
||||||
|
this.saldo = saldo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrency(String currency) {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAboutus() {
|
||||||
|
return aboutus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAboutus(String aboutus) {
|
||||||
|
this.aboutus = aboutus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebsite() {
|
||||||
|
return website;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebsite(String website) {
|
||||||
|
this.website = website;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriverstatus() {
|
||||||
|
return driverstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverstatus(String driverstatus) {
|
||||||
|
this.driverstatus = driverstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TransaksiModel> getTransaksi() {
|
||||||
|
return transaksi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransaksi(List<TransaksiModel> transaksi) {
|
||||||
|
this.transaksi = transaksi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatadriver(List<User> datadriver) {
|
||||||
|
this.datadriver = datadriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getDatadriver() {
|
||||||
|
return datadriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrencytext() {
|
||||||
|
return currency_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencytext(String currencytext) {
|
||||||
|
this.currency_text = currencytext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobilepulsausername() {
|
||||||
|
return mobilepulsausername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobilepulsausername(String mobilepulsausername) {
|
||||||
|
this.mobilepulsausername = mobilepulsausername;
|
||||||
|
}
|
||||||
|
public String getMobilepulsaapikey() {
|
||||||
|
return mobilepulsaapikey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobilepulsaapikey(String mobilepulsaapikey) {
|
||||||
|
this.mobilepulsaapikey = mobilepulsaapikey;
|
||||||
|
}
|
||||||
|
public String getMpstatus() {
|
||||||
|
return mpstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMpstatus(String mpstatus) {
|
||||||
|
this.mpstatus = mpstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMpactive() {
|
||||||
|
return mpactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMpactive(String mpactive) {
|
||||||
|
this.mpactive = mpactive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GetOnRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("is_turn")
|
||||||
|
@Expose
|
||||||
|
private boolean turn;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOn() {
|
||||||
|
return turn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOn(boolean turn) {
|
||||||
|
this.turn = turn;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.JobModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class JobResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private List<JobModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JobModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<JobModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LoginRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String notelepon;
|
||||||
|
|
||||||
|
@SerializedName("email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@SerializedName("token")
|
||||||
|
@Expose
|
||||||
|
private String regId;
|
||||||
|
|
||||||
|
public String getNotelepon() {
|
||||||
|
return notelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotelepon(String notelepon) {
|
||||||
|
this.notelepon = notelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegId() {
|
||||||
|
return regId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegId(String regId) {
|
||||||
|
this.regId = regId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LoginResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private List<User> data = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<User> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class MobileTopUpDetailResponseModel implements Serializable {
|
||||||
|
@SerializedName("pulsa_code")
|
||||||
|
String phoneCreditCode;
|
||||||
|
@SerializedName("pulsa_op")
|
||||||
|
String phoneCreditOperator;
|
||||||
|
@SerializedName("pulsa_nominal")
|
||||||
|
String phoneCreditDescription;
|
||||||
|
@SerializedName("pulsa_price")
|
||||||
|
int phoneCreditPrice;
|
||||||
|
@SerializedName("pulsa_type")
|
||||||
|
String phoneCreditType;
|
||||||
|
@SerializedName("status")
|
||||||
|
String phoneCreditStatus;
|
||||||
|
|
||||||
|
public String getPhoneCreditCode() {
|
||||||
|
return phoneCreditCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditCode(String phoneCreditCode) {
|
||||||
|
this.phoneCreditCode = phoneCreditCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneCreditOperator() {
|
||||||
|
return phoneCreditOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditOperator(String phoneCreditOperator) {
|
||||||
|
this.phoneCreditOperator = phoneCreditOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneCreditDescription() {
|
||||||
|
return phoneCreditDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditDescription(String phoneCreditDescription) {
|
||||||
|
this.phoneCreditDescription = phoneCreditDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPhoneCreditPrice() {
|
||||||
|
return phoneCreditPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditPrice(int phoneCreditPrice) {
|
||||||
|
this.phoneCreditPrice = phoneCreditPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneCreditType() {
|
||||||
|
return phoneCreditType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditType(String phoneCreditType) {
|
||||||
|
this.phoneCreditType = phoneCreditType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneCreditStatus() {
|
||||||
|
return phoneCreditStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditStatus(String phoneCreditStatus) {
|
||||||
|
this.phoneCreditStatus = phoneCreditStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class MobileTopUpRequestModel implements Serializable {
|
||||||
|
|
||||||
|
@SerializedName("commands")
|
||||||
|
String command;
|
||||||
|
@SerializedName("username")
|
||||||
|
String username;
|
||||||
|
@SerializedName("sign")
|
||||||
|
String sign;
|
||||||
|
@SerializedName("status")
|
||||||
|
String status;
|
||||||
|
@SerializedName("ref_id")
|
||||||
|
String orderId;
|
||||||
|
@SerializedName("hp")
|
||||||
|
String destinationPhoneNumber;
|
||||||
|
@SerializedName("pulsa_code")
|
||||||
|
String phoneCreditCode;
|
||||||
|
|
||||||
|
public String getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommand(String command) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSign() {
|
||||||
|
return sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSign(String sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderId() {
|
||||||
|
return orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderId(String orderId) {
|
||||||
|
this.orderId = orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDestinationPhoneNumber() {
|
||||||
|
return destinationPhoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDestinationPhoneNumber(String destinationPhoneNumber) {
|
||||||
|
this.destinationPhoneNumber = destinationPhoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneCreditCode() {
|
||||||
|
return phoneCreditCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneCreditCode(String phoneCreditCode) {
|
||||||
|
this.phoneCreditCode = phoneCreditCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MobileTopUpResponseModel implements Serializable {
|
||||||
|
@SerializedName("data")
|
||||||
|
List<MobileTopUpDetailResponseModel> detailResponse;
|
||||||
|
|
||||||
|
public List<MobileTopUpDetailResponseModel> getDetailResponse() {
|
||||||
|
return detailResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDetailResponse(List<MobileTopUpDetailResponseModel> detailResponse) {
|
||||||
|
this.detailResponse = detailResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PrivacyRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("privacy")
|
||||||
|
@Expose
|
||||||
|
private String privacy;
|
||||||
|
|
||||||
|
public String getPrivacy() {
|
||||||
|
return privacy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrivacy(String privacy) {
|
||||||
|
this.privacy = privacy;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.SettingsModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PrivacyResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private List<SettingsModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SettingsModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<SettingsModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.RegionModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class RegionResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private List<RegionModel> data = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RegionModel> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<RegionModel> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RegisterRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("nama_driver")
|
||||||
|
@Expose
|
||||||
|
private String namadriver;
|
||||||
|
|
||||||
|
@SerializedName("no_ktp")
|
||||||
|
@Expose
|
||||||
|
private String noktp;
|
||||||
|
|
||||||
|
@SerializedName("tgl_lahir")
|
||||||
|
@Expose
|
||||||
|
private String tglLahir = "-";
|
||||||
|
|
||||||
|
@SerializedName("exp_stnk")
|
||||||
|
@Expose
|
||||||
|
private String expStnk = "-";
|
||||||
|
|
||||||
|
@SerializedName("no_telepon")
|
||||||
|
@Expose
|
||||||
|
private String noTelepon;
|
||||||
|
|
||||||
|
@SerializedName("phone")
|
||||||
|
@Expose
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@SerializedName("email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@SerializedName("foto")
|
||||||
|
@Expose
|
||||||
|
private String foto;
|
||||||
|
|
||||||
|
@SerializedName("job")
|
||||||
|
@Expose
|
||||||
|
private String job;
|
||||||
|
|
||||||
|
@SerializedName("partner_region")
|
||||||
|
@Expose
|
||||||
|
private String partner_region;
|
||||||
|
|
||||||
|
@SerializedName("gender")
|
||||||
|
@Expose
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@SerializedName("alamat_driver")
|
||||||
|
@Expose
|
||||||
|
private String alamat;
|
||||||
|
|
||||||
|
@SerializedName("token")
|
||||||
|
@Expose
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@SerializedName("merek")
|
||||||
|
@Expose
|
||||||
|
private String merek;
|
||||||
|
|
||||||
|
@SerializedName("tipe")
|
||||||
|
@Expose
|
||||||
|
private String tipe;
|
||||||
|
|
||||||
|
@SerializedName("nomor_kendaraan")
|
||||||
|
@Expose
|
||||||
|
private String nomorkendaraan;
|
||||||
|
|
||||||
|
@SerializedName("warna")
|
||||||
|
@Expose
|
||||||
|
private String warna;
|
||||||
|
|
||||||
|
@SerializedName("foto_ktp")
|
||||||
|
@Expose
|
||||||
|
private String fotoktp;
|
||||||
|
|
||||||
|
@SerializedName("foto_sim")
|
||||||
|
@Expose
|
||||||
|
private String fotosim;
|
||||||
|
|
||||||
|
@SerializedName("foto_stnk")
|
||||||
|
@Expose
|
||||||
|
private String fotostnk;
|
||||||
|
|
||||||
|
@SerializedName("id_sim")
|
||||||
|
@Expose
|
||||||
|
private String idsim;
|
||||||
|
|
||||||
|
@SerializedName("checked")
|
||||||
|
@Expose
|
||||||
|
private String checked;
|
||||||
|
|
||||||
|
@SerializedName("countrycode")
|
||||||
|
@Expose
|
||||||
|
private String countrycode;
|
||||||
|
|
||||||
|
|
||||||
|
public String getNamadriver() {
|
||||||
|
return namadriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNamadriver(String namadriver) {
|
||||||
|
this.namadriver = namadriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoktp() {
|
||||||
|
return noktp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoktp(String noktp) {
|
||||||
|
this.noktp = noktp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTglLahir() {
|
||||||
|
return tglLahir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTglLahir(String tglLahir) {
|
||||||
|
this.tglLahir = tglLahir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpStnk() {
|
||||||
|
return expStnk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpStnk(String expStnk) {
|
||||||
|
this.expStnk = expStnk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoTelepon() {
|
||||||
|
return noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoTelepon(String noTelepon) {
|
||||||
|
this.noTelepon = noTelepon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFoto() {
|
||||||
|
return foto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFoto(String foto) {
|
||||||
|
this.foto = foto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJob() {
|
||||||
|
return job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJob(String job) {
|
||||||
|
this.job = job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartner_region() { return partner_region; }
|
||||||
|
|
||||||
|
public void setPartner_region(String partner_region) { this.partner_region = partner_region; }
|
||||||
|
|
||||||
|
public String getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlamat() {
|
||||||
|
return alamat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlamat(String alamat) {
|
||||||
|
this.alamat = alamat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerek() {
|
||||||
|
return merek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerek(String merek) {
|
||||||
|
this.merek = merek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipe() {
|
||||||
|
return tipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipe(String tipe) {
|
||||||
|
this.tipe = tipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNomorkendaraan() {
|
||||||
|
return nomorkendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNomorkendaraan(String nomorkendaraan) {
|
||||||
|
this.nomorkendaraan = nomorkendaraan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWarna() {
|
||||||
|
return warna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWarna(String warna) {
|
||||||
|
this.warna = warna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFotoktp() {
|
||||||
|
return fotoktp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFotoktp(String fotoktp) {
|
||||||
|
this.fotoktp = fotoktp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFotosim() {
|
||||||
|
return fotosim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFotosim(String fotosim) {
|
||||||
|
this.fotosim = fotosim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFotostnk() {
|
||||||
|
return fotosim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFotostnk(String fotostnk) {
|
||||||
|
this.fotostnk = fotostnk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdsim() {
|
||||||
|
return idsim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdsim(String idsim) {
|
||||||
|
this.idsim = idsim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecked(String checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountrycode() {
|
||||||
|
return countrycode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountrycode(String countrycode) {
|
||||||
|
this.countrycode = countrycode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RegisterResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TopupRequestJson {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
@Expose
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@SerializedName("email")
|
||||||
|
@Expose
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@SerializedName("card_num")
|
||||||
|
@Expose
|
||||||
|
private String cardnum;
|
||||||
|
|
||||||
|
@SerializedName("cvc")
|
||||||
|
@Expose
|
||||||
|
private String cvc;
|
||||||
|
|
||||||
|
@SerializedName("expired")
|
||||||
|
@Expose
|
||||||
|
private String expired;
|
||||||
|
|
||||||
|
@SerializedName("product")
|
||||||
|
@Expose
|
||||||
|
private String product;
|
||||||
|
|
||||||
|
@SerializedName("number")
|
||||||
|
@Expose
|
||||||
|
private String number;
|
||||||
|
|
||||||
|
@SerializedName("price")
|
||||||
|
@Expose
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardnum() {
|
||||||
|
return cardnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardnum(String cardnum) {
|
||||||
|
this.cardnum = cardnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCvc() {
|
||||||
|
return cvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvc(String cvc) {
|
||||||
|
this.cvc = cvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpired() {
|
||||||
|
return expired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpired(String expired) {
|
||||||
|
this.expired = expired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduct(String product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(String price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package id.ontime.driver.json;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import id.ontime.driver.models.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ourdevelops Team on 10/13/2019.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TopupResponseJson {
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
@Expose
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@SerializedName("status")
|
||||||
|
@Expose
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@SerializedName("data")
|
||||||
|
@Expose
|
||||||
|
private List<User> data = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<User> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user