diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/BUILD_DEBUG_APK.md b/BUILD_DEBUG_APK.md new file mode 100644 index 0000000..652d753 --- /dev/null +++ b/BUILD_DEBUG_APK.md @@ -0,0 +1,47 @@ +# Build debug APKs (User, Driver, Merchant) + +## One command (recommended) + +From the repo root (where this file is): + +```bash +./build-debug-apks.sh +``` + +**Requires:** JDK 17+ and Android SDK (API 33) installed. If you use Android Studio, it provides both. + +--- + +## Output locations + +After a successful run you get: + +| App | Debug APK path | +|---------|----------------| +| **User** | `OnTime_User_live/app/build/outputs/apk/debug/app-debug.apk` | +| **Driver** | `OnTime_Driver_live/app/build/outputs/apk/debug/app-debug.apk` | +| **Merchant**| `OnTime_Merchant_live/app/build/outputs/apk/debug/app-debug.apk` | + +--- + +## Build each app separately + +```bash +# User +cd OnTime_User_live && ./gradlew assembleDebug && cd .. + +# Driver +cd OnTime_Driver_live && ./gradlew assembleDebug && cd .. + +# Merchant +cd OnTime_Merchant_live && ./gradlew assembleDebug && cd .. +``` + +--- + +## Signing + +- **User** and **Merchant** use `app/ontimekeystore.jks` (same keystore). User has it; the script copies it to Merchant if missing. +- **Driver** uses the default Android debug keystore (no custom jks). + +If User or Merchant build fails with “keystore not found”, ensure `OnTime_User_live/app/ontimekeystore.jks` exists, then run the script again. diff --git a/FCM_V1_PROCESS.md b/FCM_V1_PROCESS.md new file mode 100644 index 0000000..0d5c7f4 --- /dev/null +++ b/FCM_V1_PROCESS.md @@ -0,0 +1,47 @@ +# Firebase FCM v1 Process (Login, Send, Receive) + +Reference: **test** app (`test/app`). All three live apps and the backend use the same Firebase project **ngojol-trial** and FCM HTTP v1 for login, sending, and receiving messages. + +## 1. Firebase project and config + +- **Project:** `ngojol-trial` (project_number: 158861273889) +- **Backend:** Uses `ngojol-trial-firebase-adminsdk-lc81n-00c9e935db.json` and `fcm_v1_helper.php` to send via FCM HTTP v1 API. +- **Android apps:** Each app uses `google-services.json` that includes the **id.ontime.*** package entries for this project: + - **User:** `id.ontime.customer` + - **Driver:** `id.ontime.driver` + - **Merchant:** `id.ontime.merchant` + Use the same multi-app `google-services.json` as in **test/app/google-services.json** (or ensure your Firebase Console has these three Android apps under ngojol-trial). + +## 2. Login and FCM token (FCM v1) + +- **Token retrieval:** All apps use `FirebaseMessaging.getInstance().getToken()` (async) instead of deprecated `FirebaseInstanceId.getInstance().getToken()`. +- **BaseApp (User, Driver, Merchant):** On startup, get token with `getToken().addOnCompleteListener(...)`, then subscribe to topics (`pelanggan` / `driver`+`ouride` / `mitra`+`ouride`) and store the token in Realm. +- **LoginActivity:** On sign-in, get token with `getToken().addOnCompleteListener(...)` and send it to the backend as `reg_id` in the login request so the server can target this device for FCM. +- **RegisterActivity (User):** Registration request sends the FCM token via `getToken().addOnCompleteListener(...)` then `request.setToken(...)` and `service.register(request)`. +- **onNewToken:** In each app’s `MessagingService`, `onNewToken()` saves the new token in Realm and posts it on EventBus so the UI can use the latest token; the next login will send the updated token to the backend. + +## 3. Sending messages (backend → devices) + +- Backend uses **FCM HTTP v1** only: + - `application/helpers/fcm_v1_helper.php`: `fcm_v1_get_access_token()`, `fcm_v1_send($target, $data, $is_topic, $options)`. + - `application/models/Notification_model.php`: `send_generic_to_token()` and `send_generic_to_topic()` call `fcm_v1_send`. +- Config in `application/config/config.php`: `FCM_PROJECT_ID` = `ngojol-trial`, `FCM_CREDENTIALS_PATH` = path to the service account JSON. +- All notification flows (order, chat, top-up, etc.) go through this v1 path. + +## 4. Receiving messages (devices) + +- Each app has a `MessagingService` extending `FirebaseMessagingService`: + - **User:** `id.ontime.customer.utils.api.service.MessagingService` + - **Driver:** `id.ontime.driver.utils.api.service.MessagingService` + - **Merchant:** `id.ontime.merchant.utils.api.service.MessagingService` +- `onMessageReceived(RemoteMessage)` handles data payloads (e.g. `type` 1=order, 2=chat, 3/4=other), shows notifications and updates UI (including broadcasts for order status). +- No legacy FCM or `FirebaseInstanceId` usage; token handling is FCM v1 only. + +## 5. Checklist + +- [x] BaseApp: FCM token via `FirebaseMessaging.getToken()` async + topic subscribe. +- [x] LoginActivity: Send `reg_id` to backend using token from `getToken().addOnCompleteListener(...)`. +- [x] RegisterActivity (User): Send token with register request via async `getToken()`. +- [x] MessagingService: `onNewToken()` implemented; token stored in Realm and posted on EventBus. +- [x] Backend: Sends all FCM via `fcm_v1_helper` (FCM HTTP v1). +- [x] All apps and backend use the same Firebase project (**ngojol-trial**) and matching `google-services.json` / service account. diff --git a/JDK_REQUIREMENTS.md b/JDK_REQUIREMENTS.md new file mode 100644 index 0000000..e7cc2ea --- /dev/null +++ b/JDK_REQUIREMENTS.md @@ -0,0 +1,112 @@ +# JDK version for OnTime (User, Driver, Merchant) + +## Required: **JDK 17** or **JDK 21** + +The project uses: +- **Gradle 8.9** (gradle-wrapper) +- **Android Gradle Plugin 8.5.0** (User app; Driver/Merchant use similar) +- **App source/target:** Java 11 (Driver, Merchant); User follows Gradle default + +Android Gradle Plugin 8.x needs **JDK 17** or newer. Use **JDK 17** or **JDK 21**. + +--- + +## Install JDK + +### macOS (Homebrew) + +```bash +# JDK 17 (LTS) +brew install openjdk@17 + +# Or JDK 21 +brew install openjdk@21 +``` + +Then link and set `JAVA_HOME` (add to `~/.zshrc` or `~/.bash_profile`): + +```bash +# For JDK 17 +export JAVA_HOME="$(/usr/libexec/java_home -v 17 2>/dev/null || echo /opt/homebrew/opt/openjdk@17)" +export PATH="$JAVA_HOME/bin:$PATH" +``` + +### macOS (manual) + +1. Download **JDK 17** or **21** from [Adoptium](https://adoptium.net/) or [Oracle](https://www.oracle.com/java/technologies/downloads/). +2. Install the `.pkg`. +3. Set `JAVA_HOME`, e.g. for Adoptium 17 on Apple Silicon: + ```bash + export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home + ``` + +### Windows + +1. Download **JDK 17** or **21** from [Adoptium](https://adoptium.net/). +2. Run the installer and note the install path (e.g. `C:\Program Files\Eclipse Adoptium\jdk-17`). +3. Set environment variables: + - `JAVA_HOME` = that path + - Add `%JAVA_HOME%\bin` to `Path`. + +### Linux (apt) + +```bash +# JDK 17 +sudo apt update +sudo apt install openjdk-17-jdk + +# Or JDK 21 +sudo apt install openjdk-21-jdk +``` + +Set `JAVA_HOME` if needed (e.g. in `~/.bashrc`): + +```bash +export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 +export PATH="$JAVA_HOME/bin:$PATH" +``` + +--- + +## Check version + +```bash +java -version +javac -version +``` + +You should see version **17** or **21**. + +--- + +## Android SDK (required for building) + +Gradle needs the Android SDK path. Either: + +1. **Set `ANDROID_HOME`** (recommended): + ```bash + export ANDROID_HOME=$HOME/Library/Android/sdk # macOS default + export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools + ``` + +2. **Or use `local.properties`** in each app folder (already created if you opened the project): + - `OnTime_User_live/local.properties` + - `OnTime_Driver_live/local.properties` + - `OnTime_Merchant_live/local.properties` + Each should contain: + ```properties + sdk.dir=/Users/YOUR_USERNAME/Library/Android/sdk + ``` + Replace `YOUR_USERNAME` with your macOS username, or use the path where Android Studio installed the SDK (e.g. Windows: `C:\\Users\\You\\AppData\\Local\\Android\\Sdk`). + +If the SDK is in a different location, edit `sdk.dir` in each `local.properties` or set `ANDROID_HOME` to that path. + +--- + +Then build the apps: + +```bash +./build-debug-apks.sh +``` + +Or open **OnTime_User_live**, **OnTime_Driver_live**, or **OnTime_Merchant_live** in Android Studio (it will use the JDK configured in **File → Settings → Build → Build Tools → Gradle**). diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/ORDERING_WORKFLOW.md b/ORDERING_WORKFLOW.md new file mode 100644 index 0000000..388217c --- /dev/null +++ b/ORDERING_WORKFLOW.md @@ -0,0 +1,78 @@ +# OnTime Ordering Workflow & Firebase Alignment + +## Order flow (User → Driver → Tujuan) + +1. **User: Set jemput (pickup)** – In RideCarActivity, user sets pickup via map/Places (`pickUpText`, `pickUpLatLang`). +2. **User: Set tujuan (destination)** – User sets destination (`destinationText`, `destinationLatLang`). Route and price are calculated. +3. **User: Set payment** – Cash or wallet (`checkedpaywallet`, `cashpayment` / `walletpayment`). +4. **Search driver** – `GetNearRideCarRequestJson` / `GetNearRideCarResponseJson` loads nearby drivers; `driverAvailable` is used for FCM. +5. **User: Order** – `sendRequestTransaksi()` calls backend, then `fcmBroadcast()` sends FCM to each driver token via **backend** `notification/send_generic`. +6. **Driver: Bid or auto bid** – Driver receives FCM in `MessagingService` (type=1), opens `NewOrderActivity`. Manual: tap "order"; Auto: `getaccept(true)` after 2s if setting is ON. +7. **Driver: Accept** – `getaccept()` calls backend `accept`, then sends FCM to **user token** (`regid`) with `OrderFCM` (response="2", type=1, id_driver, id_transaksi). +8. **User: Driver accepted** – User app `MessagingService` gets type=1, response="2", posts `DriverResponse` via EventBus; `RideCarActivity.onMessageEvent` starts `ProgressActivity` (response "2"). +9. **Progress (until tujuan)** – User stays in `ProgressActivity`; driver in `OrderFragment` can tap "finish" (start) then "finish" (arrive). Each action: driver calls backend (`startrequest` / `finishrequest`), then FCM to user with response "3" (start) or "4" (finish/tujuan). +10. **User: Start / Finish** – `MessagingService` parses type=1 and response "3"/"4", posts `DriverResponse`; `ProgressActivity` receives via EventBus or broadcast, `orderHandler()` updates status (e.g. "driver start", "finish/tiba di tujuan"). + +## Test backend API + +**To test backend, use endpoint: `apitest.semestaterpadu.my.id`** + +All apps and the backend panel use the same test API base URL: + +| Component | Config location | Base URL | API base | +|-------------|-----------------|----------|----------| +| User app | `OnTime_User_live` → `Constants.java` | `https://apitest.semestaterpadu.my.id/` | `.../api/` | +| Driver app | `OnTime_Driver_live` → `Constants.java` | `https://apitest.semestaterpadu.my.id/` | `.../api/` | +| Backend | `backendpanel/application/config/config.php` → `$config['base_url']` | `https://apitest.semestaterpadu.my.id/` | same | + +Example test endpoints: +- Base: `https://apitest.semestaterpadu.my.id/` +- API (login, transaksi, etc.): `https://apitest.semestaterpadu.my.id/api/` +- FCM send: `POST https://apitest.semestaterpadu.my.id/api/notification/send_generic` + +--- + +## Firebase: same project for User, Backend, Driver + +- **Backend** – Single FCM project: uses `fcm_v1_helper` (HTTP v1) with service account (e.g. `FCM_CREDENTIALS_PATH` / `FCM_PROJECT_ID`). All sends go through **backend** `api/notification/send_generic` (POST). +- **User app** – Receives FCM via `FirebaseMessagingService`; **sends** by calling same backend `Constants.CONNECTION + "notification/send_generic"` with `target` = driver token and `data` = `DriverRequest` (order offer). +- **Driver app** – Receives FCM via `FirebaseMessagingService`; **sends** by calling same backend `Constants.CONNECTION + "notification/send_generic"` with `target` = user token and `data` = `OrderFCM` (accept/start/finish). + +Both apps use the same `BASE_URL` (e.g. `https://apitest.semestaterpadu.my.id/`) and same endpoint, so they share the same Firebase project and backend. + +## FCM type and payload alignment + +| Type | Meaning | Sender | Receiver | Key payload | +|------|-----------|----------|----------|-------------| +| 1 | Order | User→Driver: `DriverRequest` (offer); Driver→User: `OrderFCM` (accept/start/finish/cancel) | Both | id_transaksi, id_driver, response ("2"/"3"/"4"/"5"), plus offer fields for driver | +| 2 | Chat | User/Driver | User/Driver | chat fields | +| 3 | Other | Backend | User/Driver | title, message | +| 4 | Other2 | Backend | User/Driver | title, message | + +Backend `send_generic_to_token` / `send_generic_to_topic` flatten `data` and stringify values so FCM receives a flat string map. + +## Driver & merchant matching: purely GPS (no region) + +- **Driver nearby** (`list_ride` / `list_car`): Uses only **real GPS** – driver position from `config_driver` (updated by driver app’s `update_location`) and user/customer position from the request. **No region/wilayah** is used. Radius is `fitur.jarak_minimum` (km), with a minimum of 10 km. +- **Merchant nearby**: Uses only **real GPS** – `merchant.latitude_merchant`, `merchant.longitude_merchant` and user’s lat/long. **No region** filter. Distance cap is `fitur.jarak_minimum`. + +Driver’s `wilayah` (partner_region) is only used in the admin panel for display; it is **not** used when finding nearby drivers or merchants for the user. + +--- + +## "Tidak ada pengemudi di sekitar Anda" – checklist + +If the user always sees "Maaf, tidak ada pengemudi di sekitar Anda" even when a driver is close: + +1. **Driver must be "online"** – In the driver app the driver must be in "online" / status 1 mode. The backend only returns drivers where `config_driver.status = '1'`. +2. **Driver location** – The driver app sends location via `driver/update_location`. Ensure the driver has opened the app and location permission is granted so `config_driver` has recent latitude/longitude. +3. **Backend radius** – The backend uses `fitur.jarak_minimum` (km). A minimum radius of **10 km** is now applied so that small values in the admin panel (e.g. 1–2 km) still show drivers within 10 km. Admin can set **Services → jarak_minimum** to a larger value (e.g. 15 or 20 km) if needed. +4. **User app** – If the first fetch was slow or location was not ready, the user can tap **Order** anyway: the app will **refetch** nearby drivers once (using pickup or last location) and then either place the order or show the message. + +## Fixes applied + +- **Backend:** Implemented `send_generic_to_token` and `send_generic_to_topic` in `Notification_model` using `fcm_v1_send`; controller loads `fcm_v1_helper` so generic FCM from both apps works. +- **User MessagingService:** Null-safe handling for `getData()` and `type`; broadcast bundle now includes `code`, `response`, `id_transaksi`, `id_driver` so ProgressActivity can update when driver sends start/finish. +- **ProgressActivity:** BroadcastReceiver only applies updates when `id_transaksi` matches; updates local `response` and calls `orderHandler(code)` so status and flow (e.g. sampai tujuan) stay correct. +- **Driver MessagingService:** Null-safe handling for `getData()`, `type`, and `harga` to avoid NPE/crash on malformed FCM. +- **"No driver near you":** Backend `get_driver_ride` now uses a minimum radius of 10 km (`GREATEST(COALESCE(f.jarak_minimum, 10), 10)`) so drivers within 10 km are found even if the fitur’s `jarak_minimum` is set very small. User app: when the user taps Order and the driver list is empty, the app refetches nearby drivers once (using pickup or last location) and then proceeds or shows the message. diff --git a/OnTime_Driver_live/.gitignore b/OnTime_Driver_live/.gitignore old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/.gitignore b/OnTime_Driver_live/app/.gitignore old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/build.gradle b/OnTime_Driver_live/app/build.gradle old mode 100644 new mode 100755 index e7c29ac..6aefb73 --- a/OnTime_Driver_live/app/build.gradle +++ b/OnTime_Driver_live/app/build.gradle @@ -8,12 +8,12 @@ android { // Use default debug keystore on this machine } } - compileSdk 33 + compileSdk 34 defaultConfig { applicationId "id.ontime.driver" - minSdkVersion 21 - targetSdkVersion 33 + minSdkVersion 23 + targetSdkVersion 34 versionCode 10 versionName '1.1.0' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -55,11 +55,11 @@ dependencies { 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 platform('com.google.firebase:firebase-bom:33.1.0') + implementation 'com.google.firebase:firebase-database' + implementation 'com.google.firebase:firebase-storage' + implementation 'com.google.firebase:firebase-messaging' + implementation 'com.google.firebase:firebase-auth' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'com.google.android.material:material:1.5.0' diff --git a/OnTime_Driver_live/app/butterknife-proguard-rules.pro b/OnTime_Driver_live/app/butterknife-proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/guava-proguard-rules.pro b/OnTime_Driver_live/app/guava-proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/okhttp3-proguard-rules.pro b/OnTime_Driver_live/app/okhttp3-proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/proguard-rules.pro b/OnTime_Driver_live/app/proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/release/output-metadata.json b/OnTime_Driver_live/app/release/output-metadata.json old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/retrofit-proguard-rules.pro b/OnTime_Driver_live/app/retrofit-proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/saripaar-proguard-rules.pro b/OnTime_Driver_live/app/saripaar-proguard-rules.pro old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/sharuser.txt b/OnTime_Driver_live/app/sharuser.txt new file mode 100644 index 0000000..a0d02f6 --- /dev/null +++ b/OnTime_Driver_live/app/sharuser.txt @@ -0,0 +1,26 @@ +Alias name: ontimekeystore +Creation date: Oct 26, 2022 +Entry type: PrivateKeyEntry +Certificate chain length: 1 +Certificate[1]: +Owner: CN=Ontime Apps +Issuer: CN=Ontime Apps +Serial number: 39fdbb23 +Valid from: Wed Oct 26 11:27:28 WIB 2022 until: Thu Oct 13 11:27:28 WIB 2072 +Certificate fingerprints: + SHA1: DC:13:DA:DC:9F:5F:A8:AD:3A:6C:F7:1C:5C:94:55:BB:AD:2E:F6:10 + SHA256: 73:17:40:D3:E1:63:4A:2E:AB:C1:BA:0A:65:BD:A4:77:A2:FB:CC:F5:46:C1:87:3D:AE:6D:87:4B:94:5C:2B:66 +Signature algorithm name: SHA256withRSA +Subject Public Key Algorithm: 2048-bit RSA key +Version: 3 + +Extensions: + +#1: ObjectId: 2.5.29.14 Criticality=false +SubjectKeyIdentifier [ +KeyIdentifier [ +0000: 04 8E EC F7 50 72 86 16 C2 AF 1C 2B A9 B4 63 47 ....Pr.....+..cG +0010: 71 55 24 44 qU$D +] +] + diff --git a/OnTime_Driver_live/app/src/main/AndroidManifest.xml b/OnTime_Driver_live/app/src/main/AndroidManifest.xml old mode 100644 new mode 100755 index f80dd50..ded77ed --- a/OnTime_Driver_live/app/src/main/AndroidManifest.xml +++ b/OnTime_Driver_live/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Bold.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Bold.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Medium.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Medium.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Regular.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_Regular.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_SemiBold.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/Montserrat_SemiBold.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/NeoSansPro_Medium.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/NeoSansPro_Medium.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/NeoSans_Pro_Regular.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/NeoSans_Pro_Regular.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Bold.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Bold.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Light.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Light.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Regular.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/OpenSans-Regular.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/assets/fonts/ride_rewrite_bungee.ttf b/OnTime_Driver_live/app/src/main/assets/fonts/ride_rewrite_bungee.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/ic_launcher-playstore.png b/OnTime_Driver_live/app/src/main/ic_launcher-playstore.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/AutoCompleteTextViewSFProDisplayRegular.java b/OnTime_Driver_live/app/src/main/java/customfonts/AutoCompleteTextViewSFProDisplayRegular.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/Button_SF_Pro_Display_Medium.java b/OnTime_Driver_live/app/src/main/java/customfonts/Button_SF_Pro_Display_Medium.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/EditTextSFProDisplayMedium.java b/OnTime_Driver_live/app/src/main/java/customfonts/EditTextSFProDisplayMedium.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/EditTextSFProDisplayRegular.java b/OnTime_Driver_live/app/src/main/java/customfonts/EditTextSFProDisplayRegular.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/RadioButton_SF_Pro_Display_Medium.java b/OnTime_Driver_live/app/src/main/java/customfonts/RadioButton_SF_Pro_Display_Medium.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/TextViewSFProDisplayMedium.java b/OnTime_Driver_live/app/src/main/java/customfonts/TextViewSFProDisplayMedium.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/customfonts/TextViewSFProDisplayRegular.java b/OnTime_Driver_live/app/src/main/java/customfonts/TextViewSFProDisplayRegular.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChangepassActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChangepassActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChatActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChatActivity.java old mode 100644 new mode 100755 index 9711ff7..9f5261f --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChatActivity.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ChatActivity.java @@ -1359,7 +1359,9 @@ public class ChatActivity extends AppCompatActivity { } private void sendMessageToDriver(final String regIDTujuan, final Chat chat) { - + if (regIDTujuan == null || regIDTujuan.trim().isEmpty()) { + return; + } final FCMMessage message = new FCMMessage(); message.setTo(regIDTujuan); message.setData(chat); diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ConfirmWAActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/ConfirmWAActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/EditKendaraanActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/EditKendaraanActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/EditProfileActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/EditProfileActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/IntroActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/IntroActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LoginActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LoginActivity.java old mode 100644 new mode 100755 index a44e9c0..0ca9419 --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LoginActivity.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LoginActivity.java @@ -31,8 +31,8 @@ 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.messaging.FirebaseMessaging; -import com.google.firebase.iid.FirebaseInstanceId; import id.ontime.driver.constants.BaseApp; import id.ontime.driver.R; import id.ontime.driver.constants.Constants; @@ -478,7 +478,7 @@ public class LoginActivity extends AppCompatActivity { private void onSignInClick() { progressshow(); - LoginRequestJson request = new LoginRequestJson(); + final LoginRequestJson request = new LoginRequestJson(); String emailText = email != null ? email.getText().toString().trim() : ""; String phoneDigits = phoneText.getText().toString().trim(); @@ -490,13 +490,47 @@ public class LoginActivity extends AppCompatActivity { 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); + + // Enforce FCM token: login ONLY proceeds when we have a non-empty Firebase token. + // 1) Try to use token that was already stored in Realm (BaseApp / MessagingService.onNewToken). + io.realm.Realm realm = BaseApp.getInstance(this).getRealmInstance(); + FirebaseToken storedToken = realm.where(FirebaseToken.class).findFirst(); + if (storedToken != null && storedToken.getTokenId() != null && !storedToken.getTokenId().isEmpty()) { + request.setRegId(storedToken.getTokenId()); + doLoginRequest(request, emailText); + return; } + // 2) If not yet stored, request a fresh token from FirebaseMessaging. + try { + FirebaseMessaging.getInstance().getToken() + .addOnCompleteListener(task -> { + if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) { + String fcmToken = task.getResult(); + request.setRegId(fcmToken); + + // Persist so future logins can use the cached value. + realm.executeTransaction(r -> { + FirebaseToken t = new FirebaseToken(fcmToken); + r.delete(FirebaseToken.class); + r.copyToRealm(t); + }); + + doLoginRequest(request, emailText); + } else { + // Token is required: stop login and show message. + progresshide(); + notif("Firebase token not ready, please check your network and try again."); + } + }); + } catch (IllegalStateException e) { + // Firebase not initialized: block login instead of proceeding without token. + progresshide(); + notif("Firebase is not initialized, cannot login. Please restart the app."); + } + } + + private void doLoginRequest(LoginRequestJson request, String emailText) { String basicUser = !TextUtils.isEmpty(emailText) ? emailText : request.getNotelepon(); DriverService service = ServiceGenerator.createService(DriverService.class, basicUser, request.getPassword()); service.login(request).enqueue(new Callback() { diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LupapassActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/LupapassActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/MainActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/MainActivity.java old mode 100644 new mode 100755 index 0c0afa1..e6238c9 --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/MainActivity.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/MainActivity.java @@ -372,6 +372,7 @@ public class MainActivity extends AppCompatActivity { public void onLocationChanged(Location location) { if (location != null) { User loginUser = BaseApp.getInstance(this).getLoginUser(); + if (loginUser == null) return; DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword()); UpdateLocationRequestJson param = new UpdateLocationRequestJson(); @@ -379,6 +380,12 @@ public class MainActivity extends AppCompatActivity { param.setLatitude(String.valueOf(location.getLatitude())); param.setLongitude(String.valueOf(location.getLongitude())); param.setBearing(String.valueOf(location.getBearing())); + // Include FCM token so backend always has latest reg_id for push notifications + io.realm.Realm realm = BaseApp.getInstance(this).getRealmInstance(); + id.ontime.driver.models.FirebaseToken ft = realm.where(id.ontime.driver.models.FirebaseToken.class).findFirst(); + if (ft != null && ft.getTokenId() != null && !ft.getTokenId().isEmpty()) { + param.setRegId(ft.getTokenId()); + } service.updatelocation(param).enqueue(new Callback() { @Override diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/NewOrderActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/NewOrderActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/OrderDetailActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/OrderDetailActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/PrivacyActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/PrivacyActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/RegisterActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/RegisterActivity.java old mode 100644 new mode 100755 index d38eb24..9c8500e --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/RegisterActivity.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/RegisterActivity.java @@ -54,7 +54,7 @@ import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.PhoneAuthCredential; import com.google.firebase.auth.PhoneAuthProvider; -import com.google.firebase.iid.FirebaseInstanceId; +import com.google.firebase.messaging.FirebaseMessaging; import id.ontime.driver.R; import id.ontime.driver.constants.Constants; import id.ontime.driver.json.JobResponseJson; @@ -164,7 +164,12 @@ public class RegisterActivity extends AppCompatActivity { rlnotif2 = findViewById(R.id.rlnotif2); textnotif2 = findViewById(R.id.textnotif2); confirmButton = findViewById(R.id.buttonconfirm); - token = FirebaseInstanceId.getInstance().getToken(); + // FCM v1: async token via FirebaseMessaging.getToken() + FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> { + if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) { + token = task.getResult(); + } + }); numOne = findViewById(R.id.numone); numTwo = findViewById(R.id.numtwo); numThree = findViewById(R.id.numthree); diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/SplashActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/SplashActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/TopupSaldoActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/TopupSaldoActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/WalletActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/WalletActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/WithdrawActivity.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/activity/WithdrawActivity.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/BaseApp.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/BaseApp.java old mode 100644 new mode 100755 index 7875f85..22a71d4 --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/BaseApp.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/BaseApp.java @@ -16,8 +16,8 @@ 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 android.util.Log; import id.ontime.driver.json.UpdateLocationRequestJson; import id.ontime.driver.utils.MyLocationService; import id.ontime.driver.utils.api.ServiceGenerator; @@ -71,22 +71,29 @@ public class BaseApp extends Application { // 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. + // FCM v1: async token fetch and topic subscribe (reference: test app). 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(); - } + FirebaseMessaging.getInstance().getToken() + .addOnCompleteListener(task -> { + if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) { + String fcmToken = task.getResult(); + Log.d("FCM_TOKEN", "BaseApp init token=" + fcmToken); + FirebaseToken token = new FirebaseToken(fcmToken); + FirebaseMessaging.getInstance().subscribeToTopic("ouride"); + FirebaseMessaging.getInstance().subscribeToTopic("driver"); + try { + realmInstance.beginTransaction(); + realmInstance.delete(FirebaseToken.class); + realmInstance.copyToRealm(token); + realmInstance.commitTransaction(); + } catch (Exception e) { + if (realmInstance.isInTransaction()) realmInstance.cancelTransaction(); + e.printStackTrace(); + } + } + }); } } catch (IllegalStateException e) { e.printStackTrace(); @@ -160,6 +167,7 @@ public class BaseApp extends Application { public void onLocationChanged(Location location) { if (location != null) { User loginUser = getLoginUser(); + if (loginUser == null) return; DriverService service = ServiceGenerator.createService(DriverService.class, loginUser.getEmail(), loginUser.getPassword()); UpdateLocationRequestJson param = new UpdateLocationRequestJson(); @@ -167,6 +175,11 @@ public class BaseApp extends Application { param.setLatitude(String.valueOf(location.getLatitude())); param.setLongitude(String.valueOf(location.getLongitude())); param.setBearing(String.valueOf(location.getBearing())); + // Include FCM token so backend always has latest reg_id for push notifications + FirebaseToken ft = realmInstance.where(FirebaseToken.class).findFirst(); + if (ft != null && ft.getTokenId() != null && !ft.getTokenId().isEmpty()) { + param.setRegId(ft.getTokenId()); + } service.updatelocation(param).enqueue(new Callback() { @Override diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Constants.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Constants.java old mode 100644 new mode 100755 index 355dd64..db26b2a --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Constants.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Constants.java @@ -6,6 +6,7 @@ import java.util.Locale; public class Constants { + /** Test backend API base URL (api/, notification/send_generic, etc.). */ 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/"; diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Functions.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/Functions.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/VersionChecker.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/constants/VersionChecker.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/EnableLlocationFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/EnableLlocationFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/FullImageFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/FullImageFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/HistoryFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/HistoryFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/HomeFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/HomeFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/MessageFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/MessageFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/OrderFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/OrderFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/PlayAudioFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/PlayAudioFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/ProfileFragment.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/fragment/ProfileFragment.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/Direction.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/Direction.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/GMapDirection.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/GMapDirection.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Bound.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Bound.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Directions.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Directions.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Distance.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Distance.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Duration.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Duration.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Leg.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Leg.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Route.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Route.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Step.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/gmap/directions/Step.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/BankItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/BankItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/BanklistItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/BanklistItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/HistoryItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/HistoryItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/ItemChat.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/ItemChat.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/ItemPesananItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/ItemPesananItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/MessageItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/MessageItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/WalletItem.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/item/WalletItem.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AcceptRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AcceptRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AcceptResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AcceptResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AllTransResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/AllTransResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/BankResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/BankResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/ChangePassRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/ChangePassRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/DetailRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/DetailRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/DetailTransResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/DetailTransResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/EditKendaraanRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/EditKendaraanRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/EditprofileRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/EditprofileRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetHomeRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetHomeRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetHomeResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetHomeResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetOnRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/GetOnRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/JobResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/JobResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/LoginRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/LoginRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/LoginResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/LoginResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpDetailResponseModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpDetailResponseModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpRequestModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpRequestModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpResponseModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/MobileTopUpResponseModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/PrivacyRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/PrivacyRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/PrivacyResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/PrivacyResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegionResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegionResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegisterRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegisterRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegisterResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/RegisterResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/ResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/ResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/TopupRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/TopupRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/TopupResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/TopupResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/UpdateLocationRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/UpdateLocationRequestJson.java old mode 100644 new mode 100755 index ca53b67..c71f300 --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/UpdateLocationRequestJson.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/UpdateLocationRequestJson.java @@ -25,6 +25,10 @@ public class UpdateLocationRequestJson { @Expose private String bearing; + @SerializedName("reg_id") + @Expose + private String regId; + public String getId() { return id; } @@ -56,4 +60,12 @@ public class UpdateLocationRequestJson { public void setBearing(String bearing) { this.bearing = bearing; } + + public String getRegId() { + return regId; + } + + public void setRegId(String regId) { + this.regId = regId; + } } diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/VerifyRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/VerifyRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WalletRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WalletRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WalletResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WalletResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WithdrawRequestJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WithdrawRequestJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WithdrawResponseJson.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/WithdrawResponseJson.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/fcm/FCMMessage.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/fcm/FCMMessage.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/fcm/FCMType.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/json/fcm/FCMType.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/AllTransaksiModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/AllTransaksiModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/BankModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/BankModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/BankModels.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/BankModels.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/Chat.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/Chat.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/ChatModels.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/ChatModels.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/FirebaseToken.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/FirebaseToken.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/ItemPesananModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/ItemPesananModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/JobModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/JobModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/MessageModels.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/MessageModels.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/Notif.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/Notif.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/OrderFCM.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/OrderFCM.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/PelangganModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/PelangganModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/RegionModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/RegionModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/SettingsModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/SettingsModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/TransaksiModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/TransaksiModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/TransaksiSendModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/TransaksiSendModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/User.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/User.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/WalletModel.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/models/WalletModel.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/AppIntroPagerAdapter.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/AppIntroPagerAdapter.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/BooleanSerializerDeserializer.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/BooleanSerializerDeserializer.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/Log.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/Log.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/MyLocationService.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/MyLocationService.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/NetworkUtils.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/NetworkUtils.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/PicassoTrustAll.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/PicassoTrustAll.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/ProjectUtils.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/ProjectUtils.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SendAudio.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SendAudio.java old mode 100644 new mode 100755 index 34740a6..6371b26 --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SendAudio.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SendAudio.java @@ -342,7 +342,9 @@ public class SendAudio { } private void sendMessageToDriver(final String regIDTujuan, final Chat chat) { - + if (regIDTujuan == null || regIDTujuan.trim().isEmpty()) { + return; + } final FCMMessage message = new FCMMessage(); message.setTo(regIDTujuan); message.setData(chat); diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SettingPreference.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SettingPreference.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SharedPrefrence.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/SharedPrefrence.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/Utility.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/Utility.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/FCMHelper.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/FCMHelper.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/MapDirectionAPI.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/MapDirectionAPI.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/ServiceGenerator.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/ServiceGenerator.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/DriverService.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/DriverService.java old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/MessagingService.java b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/MessagingService.java old mode 100644 new mode 100755 index 2b16f83..dc7339b --- a/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/MessagingService.java +++ b/OnTime_Driver_live/app/src/main/java/id/ontime/driver/utils/api/service/MessagingService.java @@ -26,6 +26,7 @@ import id.ontime.driver.constants.BaseApp; import id.ontime.driver.models.User; import id.ontime.driver.utils.SettingPreference; +import java.util.Map; import java.util.Objects; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK; @@ -35,7 +36,6 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; * Created by BBT Dev Team on 09/15/2020. */ -@SuppressLint("MissingFirebaseInstanceTokenRefresh") public class MessagingService extends FirebaseMessagingService { Intent intent; public static final String BROADCAST_ACTION = "id.ontime.driver"; @@ -47,7 +47,24 @@ public class MessagingService extends FirebaseMessagingService { super.onCreate(); intent = new Intent(BROADCAST_ACTION); intentOrder = new Intent(BROADCAST_ORDER); + } + /** FCM v1: when token is refreshed, persist in Realm (reference: test app). */ + @Override + public void onNewToken(@NonNull String token) { + super.onNewToken(token); + try { + android.util.Log.d("FCM_TOKEN", "MessagingService.onNewToken: " + token); + id.ontime.driver.models.FirebaseToken t = new id.ontime.driver.models.FirebaseToken(token); + io.realm.Realm realm = BaseApp.getInstance(this).getRealmInstance(); + realm.executeTransaction(r -> { + r.delete(id.ontime.driver.models.FirebaseToken.class); + r.copyToRealm(t); + }); + org.greenrobot.eventbus.EventBus.getDefault().postSticky(t); + } catch (Exception e) { + e.printStackTrace(); + } } @@ -55,19 +72,24 @@ public class MessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); - if (!remoteMessage.getData().isEmpty()) { - messageHandler(remoteMessage); + if (remoteMessage.getData() == null || remoteMessage.getData().isEmpty()) { + return; } + messageHandler(remoteMessage); } @RequiresApi(api = Build.VERSION_CODES.M) private void messageHandler(RemoteMessage remoteMessage){ + Map data = remoteMessage.getData(); + if (data == null) return; + String type = data.get("type"); + if (type == null) return; User user = BaseApp.getInstance(this).getLoginUser(); SettingPreference sp = new SettingPreference(this); - if (Objects.requireNonNull(remoteMessage.getData().get("type")).equals("1")) { + if (type.equals("1")) { if (user != null) { - String resp = remoteMessage.getData().get("response"); - if (resp == null ) { + String resp = data.get("response"); + if (resp == null) { if (sp.getSetting()[1].equals("Unlimited")) { if (sp.getSetting()[2].equals("ON") && sp.getSetting()[3].equals("OFF")) { @@ -78,7 +100,8 @@ public class MessagingService extends FirebaseMessagingService { } } else { double uangbelanja = Double.parseDouble(sp.getSetting()[1]); - double harga = Double.parseDouble(Objects.requireNonNull(remoteMessage.getData().get("harga"))); + String hargaStr = data.get("harga"); + double harga = (hargaStr != null && !hargaStr.isEmpty()) ? Double.parseDouble(hargaStr) : 0; if (uangbelanja > harga && sp.getSetting()[2].equals("ON") && sp.getSetting()[3].equals("OFF")) { notification(remoteMessage); } @@ -88,13 +111,13 @@ public class MessagingService extends FirebaseMessagingService { intentCancel(); } } - } else if (Objects.requireNonNull(remoteMessage.getData().get("type")).equals("3")) { + } else if (type.equals("3")) { if (user != null) { otherHandler(remoteMessage); } - } else if (Objects.requireNonNull(remoteMessage.getData().get("type")).equals("4")) { - otherHandler2(remoteMessage); - } else if (Objects.requireNonNull(remoteMessage.getData().get("type")).equals("2")) { + } else if (type.equals("4")) { + otherHandler2(remoteMessage); + } else if (type.equals("2")) { if (user != null) { chat(remoteMessage); } diff --git a/OnTime_Driver_live/app/src/main/res/anim/from_left.xml b/OnTime_Driver_live/app/src/main/res/anim/from_left.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/from_right.xml b/OnTime_Driver_live/app/src/main/res/anim/from_right.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/indicator_animator.xml b/OnTime_Driver_live/app/src/main/res/anim/indicator_animator.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/slide_in_bottom.xml b/OnTime_Driver_live/app/src/main/res/anim/slide_in_bottom.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/slide_out_bottom.xml b/OnTime_Driver_live/app/src/main/res/anim/slide_out_bottom.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/to_left.xml b/OnTime_Driver_live/app/src/main/res/anim/to_left.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/anim/to_right.xml b/OnTime_Driver_live/app/src/main/res/anim/to_right.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/color/selector.xml b/OnTime_Driver_live/app/src/main/res/color/selector.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_back.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_back.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_camera.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_camera.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_cancel.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_cancel.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_card.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_card.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_chat.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_destination.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_destination.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_detailwallet.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_detailwallet.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_edit.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_edit.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_editlist.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_editlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_email.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_email.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_gallery.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_gallery.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_gender.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_gender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_home.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_home.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_home_s.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_home_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_job.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_job.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_kalender.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_kalender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_lock.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_lock.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_logoutlist.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_logoutlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_mic.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_mic.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pesan.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pesan.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pesan_s.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pesan_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_phone.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_phone.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pickup.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_pickup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_price.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_price.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_privacy_policy.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_privacy_policy.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_privacylist.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_privacylist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_profil.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_profil.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_profil_s.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_profil_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_ratelist.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_ratelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_send.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_send.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_sharelist.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_sharelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_topup.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_topup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_transaksi.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_transaksi.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_transaksi_s.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_transaksi_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_user.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_user.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_vehicle.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_vehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_web.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_web.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/ic_withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-hdpi/logo.png b/OnTime_Driver_live/app/src/main/res/drawable-hdpi/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_back.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_back.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_camera.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_camera.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_cancel.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_cancel.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_card.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_card.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_chat.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_destination.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_destination.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_detailwallet.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_detailwallet.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_edit.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_edit.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_editlist.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_editlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_email.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_email.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_gallery.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_gallery.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_gender.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_gender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_home.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_home.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_home_s.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_home_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_job.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_job.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_kalender.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_kalender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_lock.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_lock.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_logoutlist.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_logoutlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_mic.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_mic.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pesan.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pesan.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pesan_s.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pesan_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_phone.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_phone.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pickup.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_pickup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_price.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_price.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_privacy_policy.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_privacy_policy.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_privacylist.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_privacylist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_profil.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_profil.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_profil_s.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_profil_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_ratelist.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_ratelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_send.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_send.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_sharelist.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_sharelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_topup.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_topup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_transaksi.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_transaksi.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_transaksi_s.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_transaksi_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_user.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_user.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_vehicle.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_vehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_web.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_web.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/ic_withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-mdpi/logo.png b/OnTime_Driver_live/app/src/main/res/drawable-mdpi/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_back.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_back.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_camera.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_camera.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_cancel.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_cancel.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_card.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_card.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_chat.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_destination.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_destination.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_detailwallet.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_detailwallet.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_edit.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_edit.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_editlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_editlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_email.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_email.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_gallery.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_gallery.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_gender.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_gender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_home.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_home.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_home_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_home_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_job.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_job.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_kalender.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_kalender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_lock.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_lock.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_logoutlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_logoutlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_mic.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_mic.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pesan.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pesan.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pesan_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pesan_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_phone.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_phone.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pickup.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_pickup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_price.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_price.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_privacy_policy.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_privacy_policy.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_privacylist.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_privacylist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_profil.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_profil.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_profil_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_profil_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_ratelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_ratelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_send.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_send.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_sharelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_sharelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_topup.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_topup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_transaksi.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_transaksi.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_transaksi_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_transaksi_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_user.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_user.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_vehicle.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_vehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_web.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_web.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/ic_withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/logo.png b/OnTime_Driver_live/app/src/main/res/drawable-xhdpi/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/atm.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/atm.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_back.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_back.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_camera.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_camera.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_cancel.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_cancel.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_card.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_card.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_chat.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_destination.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_destination.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_detailwallet.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_detailwallet.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_edit.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_edit.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_editlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_editlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_email.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_email.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_gallery.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_gallery.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_gender.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_gender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_home.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_home.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_home_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_home_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_job.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_job.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_kalender.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_kalender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_lock.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_lock.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_logoutlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_logoutlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_mic.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_mic.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pesan.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pesan.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pesan_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pesan_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_phone.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_phone.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pickup.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_pickup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_price.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_price.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_privacy_policy.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_privacy_policy.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_privacylist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_privacylist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_profil.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_profil.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_profil_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_profil_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_ratelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_ratelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_send.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_send.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_sharelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_sharelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_topup.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_topup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_transaksi.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_transaksi.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_transaksi_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_transaksi_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_user.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_user.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_vehicle.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_vehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_web.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_web.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/ic_withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/logo.png b/OnTime_Driver_live/app/src/main/res/drawable-xxhdpi/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_back.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_back.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_camera.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_camera.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_cancel.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_cancel.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_card.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_card.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_chat.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_detailwallet.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_detailwallet.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_edit.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_edit.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_editlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_editlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_email.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_email.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_gallery.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_gallery.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_gender.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_gender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_home.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_home.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_home_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_home_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_job.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_job.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_kalender.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_kalender.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_lock.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_lock.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_logoutlist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_logoutlist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_mic.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_mic.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_pesan.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_pesan.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_pesan_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_pesan_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_phone.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_phone.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_price.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_price.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_privacy_policy.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_privacy_policy.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_privacylist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_privacylist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_profil.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_profil.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_profil_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_profil_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_ratelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_ratelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_send.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_send.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_sharelist.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_sharelist.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_topup.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_topup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_transaksi.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_transaksi.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_transaksi_s.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_transaksi_s.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_user.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_user.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_vehicle.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_vehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_web.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_web.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/ic_withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/logo.png b/OnTime_Driver_live/app/src/main/res/drawable-xxxhdpi/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/aboutshape.png b/OnTime_Driver_live/app/src/main/res/drawable/aboutshape.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/american_express.png b/OnTime_Driver_live/app/src/main/res/drawable/american_express.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/background_chat.png b/OnTime_Driver_live/app/src/main/res/drawable/background_chat.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/background_chat_other.xml b/OnTime_Driver_live/app/src/main/res/drawable/background_chat_other.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/background_my_chat.xml b/OnTime_Driver_live/app/src/main/res/drawable/background_my_chat.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/backgroundabout.jpg b/OnTime_Driver_live/app/src/main/res/drawable/backgroundabout.jpg old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/backgroundabout2.png b/OnTime_Driver_live/app/src/main/res/drawable/backgroundabout2.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/backrouddrawable.xml b/OnTime_Driver_live/app/src/main/res/drawable/backrouddrawable.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/banktransfer.png b/OnTime_Driver_live/app/src/main/res/drawable/banktransfer.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/bg_border.xml b/OnTime_Driver_live/app/src/main/res/drawable/bg_border.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/btn_rect.xml b/OnTime_Driver_live/app/src/main/res/drawable/btn_rect.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/btn_rect_red.xml b/OnTime_Driver_live/app/src/main/res/drawable/btn_rect_red.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/btn_stroke.xml b/OnTime_Driver_live/app/src/main/res/drawable/btn_stroke.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/burst.png b/OnTime_Driver_live/app/src/main/res/drawable/burst.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/button_round_1.xml b/OnTime_Driver_live/app/src/main/res/drawable/button_round_1.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/button_round_2.xml b/OnTime_Driver_live/app/src/main/res/drawable/button_round_2.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/changepass.png b/OnTime_Driver_live/app/src/main/res/drawable/changepass.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/chip.png b/OnTime_Driver_live/app/src/main/res/drawable/chip.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/destination.png b/OnTime_Driver_live/app/src/main/res/drawable/destination.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/diners_club.png b/OnTime_Driver_live/app/src/main/res/drawable/diners_club.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/discover.png b/OnTime_Driver_live/app/src/main/res/drawable/discover.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/editvehicle.png b/OnTime_Driver_live/app/src/main/res/drawable/editvehicle.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/fitur.png b/OnTime_Driver_live/app/src/main/res/drawable/fitur.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_bank.xml b/OnTime_Driver_live/app/src/main/res/drawable/ic_bank.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_content_copy_24.xml b/OnTime_Driver_live/app/src/main/res/drawable/ic_content_copy_24.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_koin.xml b/OnTime_Driver_live/app/src/main/res/drawable/ic_koin.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_not_send_message.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_not_send_message.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_pause.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_pause.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_play.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_play.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_playsound.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_playsound.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_star_filled.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_star_filled.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_star_half.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_star_half.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/ic_starempty.png b/OnTime_Driver_live/app/src/main/res/drawable/ic_starempty.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/image_placeholder.png b/OnTime_Driver_live/app/src/main/res/drawable/image_placeholder.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/login.png b/OnTime_Driver_live/app/src/main/res/drawable/login.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/login_bg.png b/OnTime_Driver_live/app/src/main/res/drawable/login_bg.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/logo.png b/OnTime_Driver_live/app/src/main/res/drawable/logo.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/logoflash.png b/OnTime_Driver_live/app/src/main/res/drawable/logoflash.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/lupapass.png b/OnTime_Driver_live/app/src/main/res/drawable/lupapass.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/map.png b/OnTime_Driver_live/app/src/main/res/drawable/map.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/midtrans.png b/OnTime_Driver_live/app/src/main/res/drawable/midtrans.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/neworder.png b/OnTime_Driver_live/app/src/main/res/drawable/neworder.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/nonselecteditem_dot.xml b/OnTime_Driver_live/app/src/main/res/drawable/nonselecteditem_dot.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/pickup.png b/OnTime_Driver_live/app/src/main/res/drawable/pickup.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/round_edittext_background.xml b/OnTime_Driver_live/app/src/main/res/drawable/round_edittext_background.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/rounded_corners_button.xml b/OnTime_Driver_live/app/src/main/res/drawable/rounded_corners_button.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/rounded_corners_button_red.xml b/OnTime_Driver_live/app/src/main/res/drawable/rounded_corners_button_red.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/rounded_delip.xml b/OnTime_Driver_live/app/src/main/res/drawable/rounded_delip.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/selecteditem_dot.xml b/OnTime_Driver_live/app/src/main/res/drawable/selecteditem_dot.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/selector.xml b/OnTime_Driver_live/app/src/main/res/drawable/selector.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/slide_one.png b/OnTime_Driver_live/app/src/main/res/drawable/slide_one.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/slide_three.png b/OnTime_Driver_live/app/src/main/res/drawable/slide_three.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/slide_two.png b/OnTime_Driver_live/app/src/main/res/drawable/slide_two.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/underdevelopment.png b/OnTime_Driver_live/app/src/main/res/drawable/underdevelopment.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/verify.png b/OnTime_Driver_live/app/src/main/res/drawable/verify.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/withdraw.png b/OnTime_Driver_live/app/src/main/res/drawable/withdraw.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/drawable/word_map.png b/OnTime_Driver_live/app/src/main/res/drawable/word_map.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/montserrat_bold.ttf b/OnTime_Driver_live/app/src/main/res/font/montserrat_bold.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/montserrat_medium.ttf b/OnTime_Driver_live/app/src/main/res/font/montserrat_medium.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/montserrat_regular.ttf b/OnTime_Driver_live/app/src/main/res/font/montserrat_regular.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/montserrat_semibold.ttf b/OnTime_Driver_live/app/src/main/res/font/montserrat_semibold.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/neosans_pro_regular.ttf b/OnTime_Driver_live/app/src/main/res/font/neosans_pro_regular.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/neosanspro_medium.ttf b/OnTime_Driver_live/app/src/main/res/font/neosanspro_medium.ttf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/font/questv_bold.otf b/OnTime_Driver_live/app/src/main/res/font/questv_bold.otf old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_changepassword.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_changepassword.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_chat.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_chat.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_confirm_wa.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_confirm_wa.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_detail_order.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_detail_order.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_editkendaraan.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_editkendaraan.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_editprofile.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_editprofile.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_intro.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_intro.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_login.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_login.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_lupapassword.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_lupapassword.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_main.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_main.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_new_order.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_new_order.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_privacy.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_privacy.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_register.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_register.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_splash.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_splash.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_topup.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_topup.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_wallet.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_wallet.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/activity_withdraw.xml b/OnTime_Driver_live/app/src/main/res/layout/activity_withdraw.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/dialog_aboutus.xml b/OnTime_Driver_live/app/src/main/res/layout/dialog_aboutus.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/dialog_bank.xml b/OnTime_Driver_live/app/src/main/res/layout/dialog_bank.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_enablelocation.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_enablelocation.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_fullimage.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_fullimage.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_home.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_home.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_playaudio.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_playaudio.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_profile.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_profile.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/fragment_recycle.xml b/OnTime_Driver_live/app/src/main/res/layout/fragment_recycle.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_bank.xml b/OnTime_Driver_live/app/src/main/res/layout/item_bank.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_alert.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_alert.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_audio_other.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_audio_other.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_image_my.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_image_my.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_image_other.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_image_other.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_my.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_my.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chat_other.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chat_other.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_chataudio.xml b/OnTime_Driver_live/app/src/main/res/layout/item_chataudio.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_message.xml b/OnTime_Driver_live/app/src/main/res/layout/item_message.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_order.xml b/OnTime_Driver_live/app/src/main/res/layout/item_order.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_pesanan.xml b/OnTime_Driver_live/app/src/main/res/layout/item_pesanan.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_petunjuk.xml b/OnTime_Driver_live/app/src/main/res/layout/item_petunjuk.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_slider_layout.xml b/OnTime_Driver_live/app/src/main/res/layout/item_slider_layout.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/item_wallet.xml b/OnTime_Driver_live/app/src/main/res/layout/item_wallet.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/sheet_doc_upload.xml b/OnTime_Driver_live/app/src/main/res/layout/sheet_doc_upload.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/sheet_list.xml b/OnTime_Driver_live/app/src/main/res/layout/sheet_list.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/sheet_upload.xml b/OnTime_Driver_live/app/src/main/res/layout/sheet_upload.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/shimerpromo.xml b/OnTime_Driver_live/app/src/main/res/layout/shimerpromo.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/shimerwallet.xml b/OnTime_Driver_live/app/src/main/res/layout/shimerwallet.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/spinner.xml b/OnTime_Driver_live/app/src/main/res/layout/spinner.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/layout/verifycode.xml b/OnTime_Driver_live/app/src/main/res/layout/verifycode.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/menu/navigation.xml b/OnTime_Driver_live/app/src/main/res/menu/navigation.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/mipmap-hdpi/ic_launcher.png b/OnTime_Driver_live/app/src/main/res/mipmap-hdpi/ic_launcher.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/mipmap-mdpi/ic_launcher.png b/OnTime_Driver_live/app/src/main/res/mipmap-mdpi/ic_launcher.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/OnTime_Driver_live/app/src/main/res/mipmap-xhdpi/ic_launcher.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/OnTime_Driver_live/app/src/main/res/mipmap-xxhdpi/ic_launcher.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/OnTime_Driver_live/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/raw/notification.mp3 b/OnTime_Driver_live/app/src/main/res/raw/notification.mp3 old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/raw/style_json.json b/OnTime_Driver_live/app/src/main/res/raw/style_json.json old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/raw/voice.mp3 b/OnTime_Driver_live/app/src/main/res/raw/voice.mp3 old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/values/colors.xml b/OnTime_Driver_live/app/src/main/res/values/colors.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/values/dimens.xml b/OnTime_Driver_live/app/src/main/res/values/dimens.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/values/ic_launcher_background.xml b/OnTime_Driver_live/app/src/main/res/values/ic_launcher_background.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/values/strings.xml b/OnTime_Driver_live/app/src/main/res/values/strings.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/values/styles.xml b/OnTime_Driver_live/app/src/main/res/values/styles.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/xml/file_paths.xml b/OnTime_Driver_live/app/src/main/res/xml/file_paths.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/app/src/main/res/xml/network_security_config.xml b/OnTime_Driver_live/app/src/main/res/xml/network_security_config.xml old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/build.gradle b/OnTime_Driver_live/build.gradle old mode 100644 new mode 100755 index 7b1e3d2..512079c --- a/OnTime_Driver_live/build.gradle +++ b/OnTime_Driver_live/build.gradle @@ -4,7 +4,6 @@ buildscript { repositories { google() mavenCentral() - jcenter() } dependencies { // Android Gradle Plugin compatible with Gradle 8.x and JDK 21 @@ -22,7 +21,6 @@ allprojects { repositories { google() mavenCentral() - jcenter() maven { url 'https://jitpack.io' } } } diff --git a/OnTime_Driver_live/gradle.properties b/OnTime_Driver_live/gradle.properties old mode 100644 new mode 100755 index 3c1d633..d420742 --- a/OnTime_Driver_live/gradle.properties +++ b/OnTime_Driver_live/gradle.properties @@ -11,6 +11,7 @@ # The setting is particularly useful for tweaking memory settings. android.enableJetifier=true android.useAndroidX=true +android.suppressUnsupportedCompileSdk=35 org.gradle.jvmargs=-Xmx1024m \ --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ diff --git a/OnTime_Driver_live/gradle/wrapper/gradle-wrapper.properties b/OnTime_Driver_live/gradle/wrapper/gradle-wrapper.properties old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/gradlew.bat b/OnTime_Driver_live/gradlew.bat old mode 100644 new mode 100755 diff --git a/OnTime_Driver_live/lib/FragmentAnimations/LICENSE b/OnTime_Driver_live/lib/FragmentAnimations/LICENSE new file mode 100755 index 0000000..e06d208 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/README.md b/OnTime_Driver_live/lib/FragmentAnimations/README.md new file mode 100755 index 0000000..3af3459 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/README.md @@ -0,0 +1,112 @@ +# FragmentAnimations + +[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) + +[![API](https://img.shields.io/badge/API-4%2B-yellow.svg?style=flat)](https://android-arsenal.com/api?level=4) +[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FragmentAnimations-green.svg?style=true)](https://android-arsenal.com/details/1/3526) + +Animation examples for `support.v4.Fragment` transition. + +These animations do not depends on any external libraries. + +[Try it on your device via DeployGate](https://dply.me/h7azvd) + +## Usage Example + +In your `Fragment`, just code like this. + +```java +@Override +public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { + return CubeAnimation.create(CubeAnimation.UP, enter, DURATION); +} +``` + +See more example in [ExampleFragment.java](https://github.com/kakajika/FragmentAnimations/blob/master/app/src/main/java/com/labo/kaji/fragmentanimations/example/ExampleFragment.java) + +## Contents + +### Cube Animation + +[CubeAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/CubeAnimation.java) + +![Cube](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/cube.gif) + +### Flip Animation + +[FlipAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/FlipAnimation.java) + +![Flip](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/flip.gif) + +### Push/Pull Animation + +[PushPullAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/PushPullAnimation.java) + +![Push/Pull](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/pushpull.gif) + +### Sides Animation + +[SidesAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/SidesAnimation.java) + +### Move Animation + +[MoveAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/MoveAnimation.java) + +![Move](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/move.gif) + +## Combination + +You can use above Animations with another one. + +```java +@Override +public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { + if (enter) { + return MoveAnimation.create(MoveAnimation.UP, enter, DURATION); + } else { + return CubeAnimation.create(CubeAnimation.UP, enter, DURATION); + } +} +``` + +### Cube/Move Animation + +![Cube/Move](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/cubemove.gif) + +### Move/Cube Animation + +![Move/Cube](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/movecube.gif) + +### Push/Move Animation + +![Push/Move](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/pushmove.gif) + +### Move/Pull Animation + +![Move/Pull](https://raw.githubusercontent.com/wiki/kakajika/FragmentAnimations/images/movepull.gif) + +## Install + +This library is available in jcenter. + +```groovy +dependencies { + compile 'com.labo.kaji:fragmentanimations:0.1.1' +} +``` + +## License + + Copyright 2015 kakajika + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/.gitignore b/OnTime_Driver_live/lib/FragmentAnimations/app/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/build.gradle b/OnTime_Driver_live/lib/FragmentAnimations/app/build.gradle new file mode 100755 index 0000000..cbcb969 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.application' +apply plugin: 'deploygate' + +android { + compileSdkVersion 24 + buildToolsVersion "24.0.1" + + defaultConfig { + applicationId "com.labo.kaji.fragmentanimations" + minSdkVersion 7 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile project(':fragmentanimations') + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:24.1.1' + compile 'com.android.support:design:24.1.1' + compile 'com.android.support:support-v4:24.1.1' + compile 'com.jakewharton:butterknife:7.0.1' + compile 'com.deploygate:sdk:3.1' +} diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/proguard-rules.pro b/OnTime_Driver_live/lib/FragmentAnimations/app/proguard-rules.pro new file mode 100755 index 0000000..664a4d6 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/kakajika/Library/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 *; +#} diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/androidTest/java/com/labo/kaji/fragmentanimations/ApplicationTest.java b/OnTime_Driver_live/lib/FragmentAnimations/app/src/androidTest/java/com/labo/kaji/fragmentanimations/ApplicationTest.java new file mode 100755 index 0000000..bf9686e --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/androidTest/java/com/labo/kaji/fragmentanimations/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.labo.kaji.fragmentanimations; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/AndroidManifest.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/AndroidManifest.xml new file mode 100755 index 0000000..9f74823 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/App.java b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/App.java new file mode 100755 index 0000000..9b0b992 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/App.java @@ -0,0 +1,18 @@ +package com.labo.kaji.fragmentanimations.example; + +import android.app.Application; + +import com.deploygate.sdk.DeployGate; + +/** + * @author kakajika + * @since 2016/04/20 + */ +public class App extends Application { + + @Override + public void onCreate() { + super.onCreate(); + DeployGate.install(this); + } +} diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/ExampleFragment.java b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/ExampleFragment.java new file mode 100755 index 0000000..e49b473 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/java/com/labo/kaji/fragmentanimations/example/ExampleFragment.java @@ -0,0 +1,389 @@ +package com.labo.kaji.fragmentanimations.example; + +import android.annotation.SuppressLint; +import android.graphics.Color; +import android.os.Bundle; +import android.support.annotation.IntDef; +import android.support.annotation.Nullable; +import android.support.design.widget.Snackbar; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.widget.TextView; + +import com.labo.kaji.fragmentanimations.CubeAnimation; +import com.labo.kaji.fragmentanimations.FlipAnimation; +import com.labo.kaji.fragmentanimations.MoveAnimation; +import com.labo.kaji.fragmentanimations.PushPullAnimation; +import com.labo.kaji.fragmentanimations.SidesAnimation; + +import butterknife.Bind; +import butterknife.ButterKnife; +import butterknife.OnClick; + +/** + * @author kakajika + * @since 2015/11/27 + */ +public class ExampleFragment extends Fragment { + + @IntDef({NONE, MOVE, CUBE, FLIP, PUSHPULL, SIDES, CUBEMOVE, MOVECUBE, PUSHMOVE, MOVEPULL, FLIPMOVE, MOVEFLIP, FLIPCUBE, CUBEFLIP}) + public @interface AnimationStyle {} + public static final int NONE = 0; + public static final int MOVE = 1; + public static final int CUBE = 2; + public static final int FLIP = 3; + public static final int PUSHPULL = 4; + public static final int SIDES = 5; + public static final int CUBEMOVE = 6; + public static final int MOVECUBE = 7; + public static final int PUSHMOVE = 8; + public static final int MOVEPULL = 9; + public static final int FLIPMOVE = 10; + public static final int MOVEFLIP = 11; + public static final int FLIPCUBE = 12; + public static final int CUBEFLIP = 13; + + @IntDef({NODIR, UP, DOWN, LEFT, RIGHT}) + public @interface AnimationDirection {} + public static final int NODIR = 0; + public static final int UP = 1; + public static final int DOWN = 2; + public static final int LEFT = 3; + public static final int RIGHT = 4; + + private static final long DURATION = 500; + + @AnimationStyle + private static int sAnimationStyle = CUBE; + + @Bind(R.id.textAnimationStyle) + TextView mTextAnimationStyle; + + public static ExampleFragment newInstance(@AnimationDirection int direction) { + ExampleFragment f = new ExampleFragment(); + f.setArguments(new Bundle()); + f.getArguments().putInt("direction", direction); + return f; + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.content_anim, container, false); + int color = Color.rgb((int) Math.floor(Math.random() * 128) + 64, + (int) Math.floor(Math.random() * 128) + 64, + (int) Math.floor(Math.random() * 128) + 64); + view.setBackgroundColor(color); + ButterKnife.bind(this, view); + setAnimationStyleText(); + return view; + } + + @Override + public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { + switch (sAnimationStyle) { + case MOVE: + switch (getArguments().getInt("direction")) { + case UP: + return MoveAnimation.create(MoveAnimation.UP, enter, DURATION); + case DOWN: + return MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION); + case LEFT: + return MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION); + case RIGHT: + return MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION); + } + break; + case CUBE: + switch (getArguments().getInt("direction")) { + case UP: + return CubeAnimation.create(CubeAnimation.UP, enter, DURATION); + case DOWN: + return CubeAnimation.create(CubeAnimation.DOWN, enter, DURATION); + case LEFT: + return CubeAnimation.create(CubeAnimation.LEFT, enter, DURATION); + case RIGHT: + return CubeAnimation.create(CubeAnimation.RIGHT, enter, DURATION); + } + break; + case FLIP: + switch (getArguments().getInt("direction")) { + case UP: + return FlipAnimation.create(FlipAnimation.UP, enter, DURATION); + case DOWN: + return FlipAnimation.create(FlipAnimation.DOWN, enter, DURATION); + case LEFT: + return FlipAnimation.create(FlipAnimation.LEFT, enter, DURATION); + case RIGHT: + return FlipAnimation.create(FlipAnimation.RIGHT, enter, DURATION); + } + break; + case PUSHPULL: + switch (getArguments().getInt("direction")) { + case UP: + return PushPullAnimation.create(PushPullAnimation.UP, enter, DURATION); + case DOWN: + return PushPullAnimation.create(PushPullAnimation.DOWN, enter, DURATION); + case LEFT: + return PushPullAnimation.create(PushPullAnimation.LEFT, enter, DURATION); + case RIGHT: + return PushPullAnimation.create(PushPullAnimation.RIGHT, enter, DURATION); + } + break; + case SIDES: + switch (getArguments().getInt("direction")) { + case UP: + return SidesAnimation.create(SidesAnimation.UP, enter, DURATION); + case DOWN: + return SidesAnimation.create(SidesAnimation.DOWN, enter, DURATION); + case LEFT: + return SidesAnimation.create(SidesAnimation.LEFT, enter, DURATION); + case RIGHT: + return SidesAnimation.create(SidesAnimation.RIGHT, enter, DURATION); + } + break; + case CUBEMOVE: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? MoveAnimation.create(MoveAnimation.UP, enter, DURATION).fading(0.3f, 1.0f) : + CubeAnimation.create(CubeAnimation.UP, enter, DURATION).fading(1.0f, 0.3f); + case DOWN: + return enter ? MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION).fading(0.3f, 1.0f) : + CubeAnimation.create(CubeAnimation.DOWN, enter, DURATION).fading(1.0f, 0.3f); + case LEFT: + return enter ? MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION).fading(0.3f, 1.0f) : + CubeAnimation.create(CubeAnimation.LEFT, enter, DURATION).fading(1.0f, 0.3f); + case RIGHT: + return enter ? MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION).fading(0.3f, 1.0f) : + CubeAnimation.create(CubeAnimation.RIGHT, enter, DURATION).fading(1.0f, 0.3f); + } + break; + case MOVECUBE: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? CubeAnimation.create(CubeAnimation.UP, enter, DURATION).fading(0.3f, 1.0f) : + MoveAnimation.create(MoveAnimation.UP, enter, DURATION).fading(1.0f, 0.3f); + case DOWN: + return enter ? CubeAnimation.create(CubeAnimation.DOWN, enter, DURATION).fading(0.3f, 1.0f) : + MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION).fading(1.0f, 0.3f); + case LEFT: + return enter ? CubeAnimation.create(CubeAnimation.LEFT, enter, DURATION).fading(0.3f, 1.0f) : + MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION).fading(1.0f, 0.3f); + case RIGHT: + return enter ? CubeAnimation.create(CubeAnimation.RIGHT, enter, DURATION).fading(0.3f, 1.0f) : + MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION).fading(1.0f, 0.3f); + } + break; + case PUSHMOVE: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? MoveAnimation.create(MoveAnimation.UP, enter, DURATION) : + PushPullAnimation.create(PushPullAnimation.UP, enter, DURATION); + case DOWN: + return enter ? MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION) : + PushPullAnimation.create(PushPullAnimation.DOWN, enter, DURATION); + case LEFT: + return enter ? MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION) : + PushPullAnimation.create(PushPullAnimation.LEFT, enter, DURATION); + case RIGHT: + return enter ? MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION) : + PushPullAnimation.create(PushPullAnimation.RIGHT, enter, DURATION); + } + break; + case MOVEPULL: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? PushPullAnimation.create(PushPullAnimation.UP, enter, DURATION) : + MoveAnimation.create(MoveAnimation.UP, enter, DURATION).fading(1.0f, 0.3f); + case DOWN: + return enter ? PushPullAnimation.create(PushPullAnimation.DOWN, enter, DURATION) : + MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION).fading(1.0f, 0.3f); + case LEFT: + return enter ? PushPullAnimation.create(PushPullAnimation.LEFT, enter, DURATION) : + MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION).fading(1.0f, 0.3f); + case RIGHT: + return enter ? PushPullAnimation.create(PushPullAnimation.RIGHT, enter, DURATION) : + MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION).fading(1.0f, 0.3f); + } + break; + case FLIPMOVE: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? MoveAnimation.create(MoveAnimation.UP, enter, DURATION) : + FlipAnimation.create(FlipAnimation.UP, enter, DURATION); + case DOWN: + return enter ? MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION) : + FlipAnimation.create(FlipAnimation.DOWN, enter, DURATION); + case LEFT: + return enter ? MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION) : + FlipAnimation.create(FlipAnimation.LEFT, enter, DURATION); + case RIGHT: + return enter ? MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION) : + FlipAnimation.create(FlipAnimation.RIGHT, enter, DURATION); + } + break; + case MOVEFLIP: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? FlipAnimation.create(FlipAnimation.UP, enter, DURATION) : + MoveAnimation.create(MoveAnimation.UP, enter, DURATION).fading(1.0f, 0.3f); + case DOWN: + return enter ? FlipAnimation.create(FlipAnimation.DOWN, enter, DURATION) : + MoveAnimation.create(MoveAnimation.DOWN, enter, DURATION).fading(1.0f, 0.3f); + case LEFT: + return enter ? FlipAnimation.create(FlipAnimation.LEFT, enter, DURATION) : + MoveAnimation.create(MoveAnimation.LEFT, enter, DURATION).fading(1.0f, 0.3f); + case RIGHT: + return enter ? FlipAnimation.create(FlipAnimation.RIGHT, enter, DURATION) : + MoveAnimation.create(MoveAnimation.RIGHT, enter, DURATION).fading(1.0f, 0.3f); + } + break; + case FLIPCUBE: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? CubeAnimation.create(CubeAnimation.UP, enter, DURATION) : + FlipAnimation.create(FlipAnimation.UP, enter, DURATION); + case DOWN: + return enter ? CubeAnimation.create(CubeAnimation.DOWN, enter, DURATION) : + FlipAnimation.create(FlipAnimation.DOWN, enter, DURATION); + case LEFT: + return enter ? CubeAnimation.create(CubeAnimation.LEFT, enter, DURATION) : + FlipAnimation.create(FlipAnimation.LEFT, enter, DURATION); + case RIGHT: + return enter ? CubeAnimation.create(CubeAnimation.RIGHT, enter, DURATION) : + FlipAnimation.create(FlipAnimation.RIGHT, enter, DURATION); + } + break; + case CUBEFLIP: + switch (getArguments().getInt("direction")) { + case UP: + return enter ? FlipAnimation.create(FlipAnimation.UP, enter, DURATION) : + CubeAnimation.create(CubeAnimation.UP, enter, DURATION).fading(1.0f, 0.3f); + case DOWN: + return enter ? FlipAnimation.create(FlipAnimation.DOWN, enter, DURATION) : + CubeAnimation.create(CubeAnimation.DOWN, enter, DURATION).fading(1.0f, 0.3f); + case LEFT: + return enter ? FlipAnimation.create(FlipAnimation.LEFT, enter, DURATION) : + CubeAnimation.create(CubeAnimation.LEFT, enter, DURATION).fading(1.0f, 0.3f); + case RIGHT: + return enter ? FlipAnimation.create(FlipAnimation.RIGHT, enter, DURATION) : + CubeAnimation.create(CubeAnimation.RIGHT, enter, DURATION).fading(1.0f, 0.3f); + } + break; + case NONE: + break; + } + return null; + } + + @SuppressWarnings("unused") + @OnClick(R.id.buttonUp) + void onButtonUp() { + getArguments().putInt("direction", UP); + FragmentTransaction ft = getFragmentManager().beginTransaction(); + ft.replace(R.id.layout_main, ExampleFragment.newInstance(UP)); + ft.commit(); + } + + @SuppressWarnings("unused") + @OnClick(R.id.buttonDown) + void onButtonDown() { + getArguments().putInt("direction", DOWN); + FragmentTransaction ft = getFragmentManager().beginTransaction(); + ft.replace(R.id.layout_main, ExampleFragment.newInstance(DOWN)); + ft.commit(); + } + + @SuppressWarnings("unused") + @OnClick(R.id.buttonLeft) + void onButtonLeft() { + getArguments().putInt("direction", LEFT); + FragmentTransaction ft = getFragmentManager().beginTransaction(); + ft.replace(R.id.layout_main, ExampleFragment.newInstance(LEFT)); + ft.commit(); + } + + @SuppressWarnings("unused") + @OnClick(R.id.buttonRight) + void onButtonRight() { + getArguments().putInt("direction", RIGHT); + FragmentTransaction ft = getFragmentManager().beginTransaction(); + ft.replace(R.id.layout_main, ExampleFragment.newInstance(RIGHT)); + ft.commit(); + } + + @SuppressWarnings("unused") + @OnClick(R.id.textAnimationStyle) + public void switchAnimationStyle(View view) { + @AnimationStyle int[] styles; + styles = new int[]{MOVE, CUBE, FLIP, PUSHPULL, SIDES, CUBEMOVE, MOVECUBE, PUSHMOVE, MOVEPULL, FLIPMOVE, MOVEFLIP, FLIPCUBE, CUBEFLIP}; + for (int i = 0; i + + + + + + + + + + + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_anim.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_anim.xml new file mode 100755 index 0000000..53e29ec --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_anim.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_main.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_main.xml new file mode 100755 index 0000000..e8f12a1 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/layout/content_main.xml @@ -0,0 +1,24 @@ + + + + + + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/menu/menu_main.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/menu/menu_main.xml new file mode 100755 index 0000000..3df93f1 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-hdpi/ic_launcher.png b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100755 index 0000000..cde69bc Binary files /dev/null and b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-mdpi/ic_launcher.png b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100755 index 0000000..c133a0c Binary files /dev/null and b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100755 index 0000000..bfa42f0 Binary files /dev/null and b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100755 index 0000000..324e72c Binary files /dev/null and b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100755 index 0000000..aee44e1 Binary files /dev/null and b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-v21/styles.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-v21/styles.xml new file mode 100755 index 0000000..251fb9f --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,9 @@ +> + + + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-w820dp/dimens.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-w820dp/dimens.xml new file mode 100755 index 0000000..63fc816 --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/colors.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/colors.xml new file mode 100755 index 0000000..3ab3e9c --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/dimens.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/dimens.xml new file mode 100755 index 0000000..812cb7b --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/dimens.xml @@ -0,0 +1,6 @@ + + + 16dp + 16dp + 16dp + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/strings.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/strings.xml new file mode 100755 index 0000000..d1647aa --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + FragmentAnimations + Settings + diff --git a/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/styles.xml b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/styles.xml new file mode 100755 index 0000000..177cefc --- /dev/null +++ b/OnTime_Driver_live/lib/FragmentAnimations/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/OnTime_Driver_live/lib/PRDownloader/app/src/test/java/com/sample/ExampleUnitTest.java b/OnTime_Driver_live/lib/PRDownloader/app/src/test/java/com/sample/ExampleUnitTest.java new file mode 100755 index 0000000..424a1ed --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/app/src/test/java/com/sample/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.sample; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/OnTime_Driver_live/lib/PRDownloader/assets/prdownloader.png b/OnTime_Driver_live/lib/PRDownloader/assets/prdownloader.png new file mode 100755 index 0000000..758a0e3 Binary files /dev/null and b/OnTime_Driver_live/lib/PRDownloader/assets/prdownloader.png differ diff --git a/OnTime_Driver_live/lib/PRDownloader/assets/sample_download.png b/OnTime_Driver_live/lib/PRDownloader/assets/sample_download.png new file mode 100755 index 0000000..23e23e2 Binary files /dev/null and b/OnTime_Driver_live/lib/PRDownloader/assets/sample_download.png differ diff --git a/OnTime_Driver_live/lib/PRDownloader/build.gradle b/OnTime_Driver_live/lib/PRDownloader/build.gradle new file mode 100755 index 0000000..0ad3aaf --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/build.gradle @@ -0,0 +1,28 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + jcenter() + maven { url 'https://jitpack.io' } + } + dependencies { + classpath 'com.android.tools.build:gradle:8.7.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + maven { url 'https://jitpack.io' } + } +} + +tasks.register('clean', Delete) { + delete rootProject.layout.buildDirectory +} diff --git a/OnTime_Driver_live/lib/PRDownloader/gradle.properties b/OnTime_Driver_live/lib/PRDownloader/gradle.properties new file mode 100755 index 0000000..e78e65c --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +android.useAndroidX=true diff --git a/OnTime_Driver_live/lib/PRDownloader/gradle/wrapper/gradle-wrapper.properties b/OnTime_Driver_live/lib/PRDownloader/gradle/wrapper/gradle-wrapper.properties new file mode 100755 index 0000000..09523c0 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/OnTime_Driver_live/lib/PRDownloader/gradlew b/OnTime_Driver_live/lib/PRDownloader/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/OnTime_Driver_live/lib/PRDownloader/gradlew.bat b/OnTime_Driver_live/lib/PRDownloader/gradlew.bat new file mode 100755 index 0000000..9b42019 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/OnTime_Driver_live/lib/PRDownloader/jitpack.yml b/OnTime_Driver_live/lib/PRDownloader/jitpack.yml new file mode 100755 index 0000000..1e41e00 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk17 \ No newline at end of file diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/.gitignore b/OnTime_Driver_live/lib/PRDownloader/prdownloader/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/.gitignore @@ -0,0 +1 @@ +/build diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/build.gradle b/OnTime_Driver_live/lib/PRDownloader/prdownloader/build.gradle new file mode 100755 index 0000000..fb30ca8 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.library' + +android { + namespace 'com.downloader' + compileSdk 33 + + defaultConfig { + minSdkVersion 21 + targetSdkVersion 33 + versionCode 1 + versionName "1.0.1" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/proguard-rules.pro b/OnTime_Driver_live/lib/PRDownloader/prdownloader/proguard-rules.pro new file mode 100755 index 0000000..f1b4245 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/androidTest/java/com/downloader/ExampleInstrumentedTest.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/androidTest/java/com/downloader/ExampleInstrumentedTest.java new file mode 100755 index 0000000..8afb62c --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/androidTest/java/com/downloader/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.downloader; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.downloader.test", appContext.getPackageName()); + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Constants.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Constants.java new file mode 100755 index 0000000..df5a59b --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Constants.java @@ -0,0 +1,26 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public final class Constants { + + private Constants() { + // no instance + } + + public static final int UPDATE = 0x01; + public static final String RANGE = "Range"; + public static final String ETAG = "ETag"; + public static final String USER_AGENT = "User-Agent"; + public static final String DEFAULT_USER_AGENT = "PRDownloader"; + + public static final int DEFAULT_READ_TIMEOUT_IN_MILLS = 20_000; + public static final int DEFAULT_CONNECT_TIMEOUT_IN_MILLS = 20_000; + + public static final int HTTP_RANGE_NOT_SATISFIABLE = 416; + public static final int HTTP_TEMPORARY_REDIRECT = 307; + public static final int HTTP_PERMANENT_REDIRECT = 308; + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Error.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Error.java new file mode 100755 index 0000000..15e20a6 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Error.java @@ -0,0 +1,66 @@ +package com.downloader; + +import java.util.List; +import java.util.Map; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class Error { + + private boolean isServerError; + private boolean isConnectionError; + private String serverErrorMessage; + private Map> headerFields; + private Throwable connectionException; + private int responseCode; + + public boolean isServerError() { + return isServerError; + } + + public void setServerError(boolean serverError) { + isServerError = serverError; + } + + public boolean isConnectionError() { + return isConnectionError; + } + + public void setConnectionError(boolean connectionError) { + isConnectionError = connectionError; + } + + public void setServerErrorMessage(String serverErrorMessage) { + this.serverErrorMessage = serverErrorMessage; + } + + public String getServerErrorMessage() { + return serverErrorMessage; + } + + public void setHeaderFields(Map> headerFields) { + this.headerFields = headerFields; + } + + public Map> getHeaderFields() { + return headerFields; + } + + public void setConnectionException(Throwable connectionException) { + this.connectionException = connectionException; + } + + public Throwable getConnectionException() { + return connectionException; + } + + public void setResponseCode(int responseCode) { + this.responseCode = responseCode; + } + + public int getResponseCode() { + return responseCode; + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnCancelListener.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnCancelListener.java new file mode 100755 index 0000000..e9dd8c4 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnCancelListener.java @@ -0,0 +1,11 @@ +package com.downloader; + +/** + * Created by amitshekhar on 15/11/17. + */ + +public interface OnCancelListener { + + void onCancel(); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnDownloadListener.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnDownloadListener.java new file mode 100755 index 0000000..c9e61de --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnDownloadListener.java @@ -0,0 +1,13 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface OnDownloadListener { + + void onDownloadComplete(); + + void onError(Error error); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnPauseListener.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnPauseListener.java new file mode 100755 index 0000000..72654fa --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnPauseListener.java @@ -0,0 +1,11 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface OnPauseListener { + + void onPause(); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnProgressListener.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnProgressListener.java new file mode 100755 index 0000000..751ceaf --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnProgressListener.java @@ -0,0 +1,11 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface OnProgressListener { + + void onProgress(Progress progress); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnStartOrResumeListener.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnStartOrResumeListener.java new file mode 100755 index 0000000..6e07a84 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/OnStartOrResumeListener.java @@ -0,0 +1,11 @@ +package com.downloader; + +/** + * Created by amitshekhar on 15/11/17. + */ + +public interface OnStartOrResumeListener { + + void onStartOrResume(); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloader.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloader.java new file mode 100755 index 0000000..8c972ad --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloader.java @@ -0,0 +1,129 @@ +package com.downloader; + +/** + * Created by amitshekhar on 12/11/17. + */ + +import android.content.Context; + +import com.downloader.core.Core; +import com.downloader.internal.ComponentHolder; +import com.downloader.internal.DownloadRequestQueue; +import com.downloader.request.DownloadRequestBuilder; +import com.downloader.utils.Utils; + +/** + * PRDownloader entry point. + * You must initialize this class before use. The simplest way is to just do + * {#code PRDownloader.initialize(context)}. + */ +public class PRDownloader { + + /** + * private constructor to prevent instantiation of this class + */ + private PRDownloader() { + } + + /** + * Initializes PRDownloader with the default config. + * + * @param context The context + */ + public static void initialize(Context context) { + initialize(context, PRDownloaderConfig.newBuilder().build()); + } + + /** + * Initializes PRDownloader with the custom config. + * + * @param context The context + * @param config The PRDownloaderConfig + */ + public static void initialize(Context context, PRDownloaderConfig config) { + ComponentHolder.getInstance().init(context, config); + DownloadRequestQueue.initialize(); + } + + /** + * Method to make download request + * + * @param url The url on which request is to be made + * @param dirPath The directory path on which file is to be saved + * @param fileName The file name with which file is to be saved + * @return the DownloadRequestBuilder + */ + public static DownloadRequestBuilder download(String url, String dirPath, String fileName) { + return new DownloadRequestBuilder(url, dirPath, fileName); + } + + /** + * Method to pause request with the given downloadId + * + * @param downloadId The downloadId with which request is to be paused + */ + public static void pause(int downloadId) { + DownloadRequestQueue.getInstance().pause(downloadId); + } + + /** + * Method to resume request with the given downloadId + * + * @param downloadId The downloadId with which request is to be resumed + */ + public static void resume(int downloadId) { + DownloadRequestQueue.getInstance().resume(downloadId); + } + + /** + * Method to cancel request with the given downloadId + * + * @param downloadId The downloadId with which request is to be cancelled + */ + public static void cancel(int downloadId) { + DownloadRequestQueue.getInstance().cancel(downloadId); + } + + /** + * Method to cancel requests with the given tag + * + * @param tag The tag with which requests are to be cancelled + */ + public static void cancel(Object tag) { + DownloadRequestQueue.getInstance().cancel(tag); + } + + /** + * Method to cancel all requests + */ + public static void cancelAll() { + DownloadRequestQueue.getInstance().cancelAll(); + } + + /** + * Method to check the request with the given downloadId is running or not + * + * @param downloadId The downloadId with which request status is to be checked + * @return the running status + */ + public static Status getStatus(int downloadId) { + return DownloadRequestQueue.getInstance().getStatus(downloadId); + } + + /** + * Method to clean up temporary resumed files which is older than the given day + * + * @param days the days + */ + public static void cleanUp(int days) { + Utils.deleteUnwantedModelsAndTempFiles(days); + } + + /** + * Shuts PRDownloader down + */ + public static void shutDown() { + Core.shutDown(); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloaderConfig.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloaderConfig.java new file mode 100755 index 0000000..4a49c83 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/PRDownloaderConfig.java @@ -0,0 +1,107 @@ +package com.downloader; + +import com.downloader.httpclient.DefaultHttpClient; +import com.downloader.httpclient.HttpClient; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class PRDownloaderConfig { + + private int readTimeout; + private int connectTimeout; + private String userAgent; + private HttpClient httpClient; + private boolean databaseEnabled; + + private PRDownloaderConfig(Builder builder) { + this.readTimeout = builder.readTimeout; + this.connectTimeout = builder.connectTimeout; + this.userAgent = builder.userAgent; + this.httpClient = builder.httpClient; + this.databaseEnabled = builder.databaseEnabled; + } + + public int getReadTimeout() { + return readTimeout; + } + + public void setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + } + + public int getConnectTimeout() { + return connectTimeout; + } + + public void setConnectTimeout(int connectTimeout) { + this.connectTimeout = connectTimeout; + } + + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public HttpClient getHttpClient() { + return httpClient; + } + + public void setHttpClient(HttpClient httpClient) { + this.httpClient = httpClient; + } + + public boolean isDatabaseEnabled() { + return databaseEnabled; + } + + public void setDatabaseEnabled(boolean databaseEnabled) { + this.databaseEnabled = databaseEnabled; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public static class Builder { + + int readTimeout = Constants.DEFAULT_READ_TIMEOUT_IN_MILLS; + int connectTimeout = Constants.DEFAULT_CONNECT_TIMEOUT_IN_MILLS; + String userAgent = Constants.DEFAULT_USER_AGENT; + HttpClient httpClient = new DefaultHttpClient(); + boolean databaseEnabled = false; + + public Builder setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + public Builder setConnectTimeout(int connectTimeout) { + this.connectTimeout = connectTimeout; + return this; + } + + public Builder setUserAgent(String userAgent) { + this.userAgent = userAgent; + return this; + } + + public Builder setHttpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder setDatabaseEnabled(boolean databaseEnabled) { + this.databaseEnabled = databaseEnabled; + return this; + } + + public PRDownloaderConfig build() { + return new PRDownloaderConfig(this); + } + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Priority.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Priority.java new file mode 100755 index 0000000..f9f46e2 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Priority.java @@ -0,0 +1,32 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +/** + * Priority levels recognized by the request server. + */ +public enum Priority { + + /** + * Lowest priority level. Used for prefetches of data. + */ + LOW, + + /** + * Medium priority level. Used for warming of data that might soon get visible. + */ + MEDIUM, + + /** + * Highest priority level. Used for data that are currently visible on screen. + */ + HIGH, + + /** + * Highest priority level. Used for data that are required instantly(mainly for emergency). + */ + IMMEDIATE + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Progress.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Progress.java new file mode 100755 index 0000000..b06db5a --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Progress.java @@ -0,0 +1,26 @@ +package com.downloader; + +import java.io.Serializable; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class Progress implements Serializable { + + public long currentBytes; + public long totalBytes; + + public Progress(long currentBytes, long totalBytes) { + this.currentBytes = currentBytes; + this.totalBytes = totalBytes; + } + + @Override + public String toString() { + return "Progress{" + + "currentBytes=" + currentBytes + + ", totalBytes=" + totalBytes + + '}'; + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Response.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Response.java new file mode 100755 index 0000000..fd0f076 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Response.java @@ -0,0 +1,46 @@ +package com.downloader; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class Response { + + private Error error; + private boolean isSuccessful; + private boolean isPaused; + private boolean isCancelled; + + public Error getError() { + return error; + } + + public void setError(Error error) { + this.error = error; + } + + public boolean isSuccessful() { + return isSuccessful; + } + + public void setSuccessful(boolean successful) { + isSuccessful = successful; + } + + public boolean isPaused() { + return isPaused; + } + + public void setPaused(boolean paused) { + isPaused = paused; + } + + public boolean isCancelled() { + return isCancelled; + } + + public void setCancelled(boolean cancelled) { + isCancelled = cancelled; + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Status.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Status.java new file mode 100755 index 0000000..cc6575c --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/Status.java @@ -0,0 +1,23 @@ +package com.downloader; + +/** + * Created by amitshekhar on 15/11/17. + */ + +public enum Status { + + QUEUED, + + RUNNING, + + PAUSED, + + COMPLETED, + + CANCELLED, + + FAILED, + + UNKNOWN + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/Core.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/Core.java new file mode 100755 index 0000000..1d6e049 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/Core.java @@ -0,0 +1,36 @@ +package com.downloader.core; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class Core { + + private static Core instance = null; + private final ExecutorSupplier executorSupplier; + + private Core() { + this.executorSupplier = new DefaultExecutorSupplier(); + } + + public static Core getInstance() { + if (instance == null) { + synchronized (Core.class) { + if (instance == null) { + instance = new Core(); + } + } + } + return instance; + } + + public ExecutorSupplier getExecutorSupplier() { + return executorSupplier; + } + + public static void shutDown() { + if (instance != null) { + instance = null; + } + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DefaultExecutorSupplier.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DefaultExecutorSupplier.java new file mode 100755 index 0000000..4a8a26e --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DefaultExecutorSupplier.java @@ -0,0 +1,41 @@ +package com.downloader.core; + +import android.os.Process; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DefaultExecutorSupplier implements ExecutorSupplier { + + private static final int DEFAULT_MAX_NUM_THREADS = 2 * Runtime.getRuntime().availableProcessors() + 1; + private final DownloadExecutor networkExecutor; + private final Executor backgroundExecutor; + private final Executor mainThreadExecutor; + + DefaultExecutorSupplier() { + ThreadFactory backgroundPriorityThreadFactory = new PriorityThreadFactory(Process.THREAD_PRIORITY_BACKGROUND); + networkExecutor = new DownloadExecutor(DEFAULT_MAX_NUM_THREADS, backgroundPriorityThreadFactory); + backgroundExecutor = Executors.newSingleThreadExecutor(); + mainThreadExecutor = new MainThreadExecutor(); + } + + @Override + public DownloadExecutor forDownloadTasks() { + return networkExecutor; + } + + @Override + public Executor forBackgroundTasks() { + return backgroundExecutor; + } + + @Override + public Executor forMainThreadTasks() { + return mainThreadExecutor; + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadExecutor.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadExecutor.java new file mode 100755 index 0000000..fa659b8 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadExecutor.java @@ -0,0 +1,27 @@ +package com.downloader.core; + +import com.downloader.internal.DownloadRunnable; + +import java.util.concurrent.Future; +import java.util.concurrent.PriorityBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadExecutor extends ThreadPoolExecutor { + + DownloadExecutor(int maxNumThreads, ThreadFactory threadFactory) { + super(maxNumThreads, maxNumThreads, 0, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), threadFactory); + } + + @Override + public Future submit(Runnable task) { + DownloadFutureTask futureTask = new DownloadFutureTask((DownloadRunnable) task); + execute(futureTask); + return futureTask; + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadFutureTask.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadFutureTask.java new file mode 100755 index 0000000..d2f4b06 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/DownloadFutureTask.java @@ -0,0 +1,27 @@ +package com.downloader.core; + +import com.downloader.Priority; +import com.downloader.internal.DownloadRunnable; + +import java.util.concurrent.FutureTask; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadFutureTask extends FutureTask implements Comparable { + + private final DownloadRunnable runnable; + + DownloadFutureTask(DownloadRunnable downloadRunnable) { + super(downloadRunnable, null); + this.runnable = downloadRunnable; + } + + @Override + public int compareTo(DownloadFutureTask other) { + Priority p1 = runnable.priority; + Priority p2 = other.runnable.priority; + return (p1 == p2 ? runnable.sequence - other.runnable.sequence : p2.ordinal() - p1.ordinal()); + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/ExecutorSupplier.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/ExecutorSupplier.java new file mode 100755 index 0000000..34f75ac --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/ExecutorSupplier.java @@ -0,0 +1,17 @@ +package com.downloader.core; + +import java.util.concurrent.Executor; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface ExecutorSupplier { + + DownloadExecutor forDownloadTasks(); + + Executor forBackgroundTasks(); + + Executor forMainThreadTasks(); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/MainThreadExecutor.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/MainThreadExecutor.java new file mode 100755 index 0000000..af6df63 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/MainThreadExecutor.java @@ -0,0 +1,20 @@ +package com.downloader.core; + +import android.os.Handler; +import android.os.Looper; + +import java.util.concurrent.Executor; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class MainThreadExecutor implements Executor { + + private final Handler handler = new Handler(Looper.getMainLooper()); + + @Override + public void execute(Runnable runnable) { + handler.post(runnable); + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/PriorityThreadFactory.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/PriorityThreadFactory.java new file mode 100755 index 0000000..a305ebc --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/core/PriorityThreadFactory.java @@ -0,0 +1,34 @@ +package com.downloader.core; + +import android.os.Process; + +import java.util.concurrent.ThreadFactory; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class PriorityThreadFactory implements ThreadFactory { + + private final int mThreadPriority; + + PriorityThreadFactory(int threadPriority) { + mThreadPriority = threadPriority; + } + + @Override + public Thread newThread(final Runnable runnable) { + Runnable wrapperRunnable = new Runnable() { + @Override + public void run() { + try { + Process.setThreadPriority(mThreadPriority); + } catch (Throwable ignored) { + + } + runnable.run(); + } + }; + return new Thread(wrapperRunnable); + } +} \ No newline at end of file diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/AppDbHelper.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/AppDbHelper.java new file mode 100755 index 0000000..9955e70 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/AppDbHelper.java @@ -0,0 +1,154 @@ +package com.downloader.database; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by anandgaurav on 14-11-2017. + */ + +public class AppDbHelper implements DbHelper { + + public static final String TABLE_NAME = "prdownloader"; + private final SQLiteDatabase db; + + public AppDbHelper(Context context) { + DatabaseOpenHelper databaseOpenHelper = new DatabaseOpenHelper(context); + db = databaseOpenHelper.getWritableDatabase(); + } + + @Override + public DownloadModel find(int id) { + Cursor cursor = null; + DownloadModel model = null; + try { + cursor = db.rawQuery("SELECT * FROM " + TABLE_NAME + " WHERE " + + DownloadModel.ID + " = " + id, null); + if (cursor != null && cursor.moveToFirst()) { + model = new DownloadModel(); + model.setId(id); + model.setUrl(cursor.getString(cursor.getColumnIndex(DownloadModel.URL))); + model.setETag(cursor.getString(cursor.getColumnIndex(DownloadModel.ETAG))); + model.setDirPath(cursor.getString(cursor.getColumnIndex(DownloadModel.DIR_PATH))); + model.setFileName(cursor.getString(cursor.getColumnIndex(DownloadModel.FILE_NAME))); + model.setTotalBytes(cursor.getLong(cursor.getColumnIndex(DownloadModel.TOTAL_BYTES))); + model.setDownloadedBytes(cursor.getLong(cursor.getColumnIndex(DownloadModel.DOWNLOADED_BYTES))); + model.setLastModifiedAt(cursor.getLong(cursor.getColumnIndex(DownloadModel.LAST_MODIFIED_AT))); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (cursor != null) { + cursor.close(); + } + } + return model; + } + + @Override + public void insert(DownloadModel model) { + try { + ContentValues values = new ContentValues(); + values.put(DownloadModel.ID, model.getId()); + values.put(DownloadModel.URL, model.getUrl()); + values.put(DownloadModel.ETAG, model.getETag()); + values.put(DownloadModel.DIR_PATH, model.getDirPath()); + values.put(DownloadModel.FILE_NAME, model.getFileName()); + values.put(DownloadModel.TOTAL_BYTES, model.getTotalBytes()); + values.put(DownloadModel.DOWNLOADED_BYTES, model.getDownloadedBytes()); + values.put(DownloadModel.LAST_MODIFIED_AT, model.getLastModifiedAt()); + db.insert(TABLE_NAME, null, values); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void update(DownloadModel model) { + try { + ContentValues values = new ContentValues(); + values.put(DownloadModel.URL, model.getUrl()); + values.put(DownloadModel.ETAG, model.getETag()); + values.put(DownloadModel.DIR_PATH, model.getDirPath()); + values.put(DownloadModel.FILE_NAME, model.getFileName()); + values.put(DownloadModel.TOTAL_BYTES, model.getTotalBytes()); + values.put(DownloadModel.DOWNLOADED_BYTES, model.getDownloadedBytes()); + values.put(DownloadModel.LAST_MODIFIED_AT, model.getLastModifiedAt()); + db.update(TABLE_NAME, values, DownloadModel.ID + " = ? ", + new String[]{String.valueOf(model.getId())}); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void updateProgress(int id, long downloadedBytes, long lastModifiedAt) { + try { + ContentValues values = new ContentValues(); + values.put(DownloadModel.DOWNLOADED_BYTES, downloadedBytes); + values.put(DownloadModel.LAST_MODIFIED_AT, lastModifiedAt); + db.update(TABLE_NAME, values, DownloadModel.ID + " = ? ", + new String[]{String.valueOf(id)}); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void remove(int id) { + try { + db.execSQL("DELETE FROM " + TABLE_NAME + " WHERE " + + DownloadModel.ID + " = " + id); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public List getUnwantedModels(int days) { + List models = new ArrayList<>(); + Cursor cursor = null; + try { + final long daysInMillis = days * 24 * 60 * 60 * 1000L; + final long beforeTimeInMillis = System.currentTimeMillis() - daysInMillis; + cursor = db.rawQuery("SELECT * FROM " + TABLE_NAME + " WHERE " + + DownloadModel.LAST_MODIFIED_AT + " <= " + beforeTimeInMillis, null); + if (cursor != null && cursor.moveToFirst()) { + do { + DownloadModel model = new DownloadModel(); + model.setId(cursor.getInt(cursor.getColumnIndex(DownloadModel.ID))); + model.setUrl(cursor.getString(cursor.getColumnIndex(DownloadModel.URL))); + model.setETag(cursor.getString(cursor.getColumnIndex(DownloadModel.ETAG))); + model.setDirPath(cursor.getString(cursor.getColumnIndex(DownloadModel.DIR_PATH))); + model.setFileName(cursor.getString(cursor.getColumnIndex(DownloadModel.FILE_NAME))); + model.setTotalBytes(cursor.getLong(cursor.getColumnIndex(DownloadModel.TOTAL_BYTES))); + model.setDownloadedBytes(cursor.getLong(cursor.getColumnIndex(DownloadModel.DOWNLOADED_BYTES))); + model.setLastModifiedAt(cursor.getLong(cursor.getColumnIndex(DownloadModel.LAST_MODIFIED_AT))); + + models.add(model); + } while (cursor.moveToNext()); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (cursor != null) { + cursor.close(); + } + } + return models; + } + + @Override + public void clear() { + try { + db.delete(TABLE_NAME, null, null); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DatabaseOpenHelper.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DatabaseOpenHelper.java new file mode 100755 index 0000000..5d44943 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DatabaseOpenHelper.java @@ -0,0 +1,40 @@ +package com.downloader.database; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + + +/** + * Created by anandgaurav on 14-11-2017. + */ + +public class DatabaseOpenHelper extends SQLiteOpenHelper { + + private static final String DATABASE_NAME = "prdownloader.db"; + private static final int DATABASE_VERSION = 1; + + DatabaseOpenHelper(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL("CREATE TABLE IF NOT EXISTS " + + AppDbHelper.TABLE_NAME + "( " + + DownloadModel.ID + " INTEGER PRIMARY KEY, " + + DownloadModel.URL + " VARCHAR, " + + DownloadModel.ETAG + " VARCHAR, " + + DownloadModel.DIR_PATH + " VARCHAR, " + + DownloadModel.FILE_NAME + " VARCHAR, " + + DownloadModel.TOTAL_BYTES + " INTEGER, " + + DownloadModel.DOWNLOADED_BYTES + " INTEGER, " + + DownloadModel.LAST_MODIFIED_AT + " INTEGER " + + ")"); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int i, int i1) { + + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DbHelper.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DbHelper.java new file mode 100755 index 0000000..2b69d26 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DbHelper.java @@ -0,0 +1,25 @@ +package com.downloader.database; + +import java.util.List; + +/** + * Created by anandgaurav on 14-11-2017. + */ + +public interface DbHelper { + + DownloadModel find(int id); + + void insert(DownloadModel model); + + void update(DownloadModel model); + + void updateProgress(int id, long downloadedBytes, long lastModifiedAt); + + void remove(int id); + + List getUnwantedModels(int days); + + void clear(); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DownloadModel.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DownloadModel.java new file mode 100755 index 0000000..ccffab0 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/DownloadModel.java @@ -0,0 +1,91 @@ +package com.downloader.database; + +/** + * Created by anandgaurav on 14-11-2017. + */ + +public class DownloadModel { + + static final String ID = "id"; + static final String URL = "url"; + static final String ETAG = "etag"; + static final String DIR_PATH = "dir_path"; + static final String FILE_NAME = "file_name"; + static final String TOTAL_BYTES = "total_bytes"; + static final String DOWNLOADED_BYTES = "downloaded_bytes"; + static final String LAST_MODIFIED_AT = "last_modified_at"; + + private int id; + private String url; + private String eTag; + private String dirPath; + private String fileName; + private long totalBytes; + private long downloadedBytes; + private long lastModifiedAt; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getETag() { + return eTag; + } + + public void setETag(String eTag) { + this.eTag = eTag; + } + + public String getDirPath() { + return dirPath; + } + + public void setDirPath(String dirPath) { + this.dirPath = dirPath; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getTotalBytes() { + return totalBytes; + } + + public void setTotalBytes(long totalBytes) { + this.totalBytes = totalBytes; + } + + public long getDownloadedBytes() { + return downloadedBytes; + } + + public void setDownloadedBytes(long downloadedBytes) { + this.downloadedBytes = downloadedBytes; + } + + public long getLastModifiedAt() { + return lastModifiedAt; + } + + public void setLastModifiedAt(long lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/NoOpsDbHelper.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/NoOpsDbHelper.java new file mode 100755 index 0000000..23150a8 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/database/NoOpsDbHelper.java @@ -0,0 +1,49 @@ +package com.downloader.database; + +import java.util.List; + +/** + * Created by anandgaurav on 14-11-2017. + */ + +public class NoOpsDbHelper implements DbHelper { + + public NoOpsDbHelper() { + + } + + @Override + public DownloadModel find(int id) { + return null; + } + + @Override + public void insert(DownloadModel model) { + + } + + @Override + public void update(DownloadModel model) { + + } + + @Override + public void updateProgress(int id, long downloadedBytes, long lastModifiedAt) { + + } + + @Override + public void remove(int id) { + + } + + @Override + public List getUnwantedModels(int days) { + return null; + } + + @Override + public void clear() { + + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/handler/ProgressHandler.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/handler/ProgressHandler.java new file mode 100755 index 0000000..dceab0f --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/handler/ProgressHandler.java @@ -0,0 +1,38 @@ +package com.downloader.handler; + +import android.os.Handler; +import android.os.Looper; +import android.os.Message; + +import com.downloader.Constants; +import com.downloader.Progress; +import com.downloader.OnProgressListener; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class ProgressHandler extends Handler { + + private final OnProgressListener listener; + + public ProgressHandler(OnProgressListener listener) { + super(Looper.getMainLooper()); + this.listener = listener; + } + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case Constants.UPDATE: + if (listener != null) { + final Progress progress = (Progress) msg.obj; + listener.onProgress(progress); + } + break; + default: + super.handleMessage(msg); + break; + } + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/DefaultHttpClient.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/DefaultHttpClient.java new file mode 100755 index 0000000..22bbd9a --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/DefaultHttpClient.java @@ -0,0 +1,111 @@ +package com.downloader.httpclient; + +import com.downloader.Constants; +import com.downloader.request.DownloadRequest; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DefaultHttpClient implements HttpClient { + + private URLConnection connection; + + public DefaultHttpClient() { + + } + + @SuppressWarnings("CloneDoesntCallSuperClone") + @Override + public HttpClient clone() { + return new DefaultHttpClient(); + } + + @Override + public void connect(DownloadRequest request) throws IOException { + connection = new URL(request.getUrl()).openConnection(); + connection.setReadTimeout(request.getReadTimeout()); + connection.setConnectTimeout(request.getConnectTimeout()); + final String range = String.format(Locale.ENGLISH, + "bytes=%d-", request.getDownloadedBytes()); + connection.addRequestProperty(Constants.RANGE, range); + connection.addRequestProperty(Constants.USER_AGENT, request.getUserAgent()); + addHeaders(request); + connection.connect(); + } + + @Override + public int getResponseCode() throws IOException { + int responseCode = 0; + if (connection instanceof HttpURLConnection) { + responseCode = ((HttpURLConnection) connection).getResponseCode(); + } + return responseCode; + } + + @Override + public InputStream getInputStream() throws IOException { + return connection.getInputStream(); + } + + @Override + public long getContentLength() { + String length = connection.getHeaderField("Content-Length"); + try { + return Long.parseLong(length); + } catch (NumberFormatException e) { + return -1; + } + } + + @Override + public String getResponseHeader(String name) { + return connection.getHeaderField(name); + } + + @Override + public void close() { + // no operation + } + + @Override + public Map> getHeaderFields() { + return connection.getHeaderFields(); + } + + @Override + public InputStream getErrorStream() { + if (connection instanceof HttpURLConnection) { + return ((HttpURLConnection) connection).getErrorStream(); + } + return null; + } + + private void addHeaders(DownloadRequest request) { + final HashMap> headers = request.getHeaders(); + if (headers != null) { + Set>> entries = headers.entrySet(); + for (Map.Entry> entry : entries) { + String name = entry.getKey(); + List list = entry.getValue(); + if (list != null) { + for (String value : list) { + connection.addRequestProperty(name, value); + } + } + } + } + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/HttpClient.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/HttpClient.java new file mode 100755 index 0000000..ca9d790 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/httpclient/HttpClient.java @@ -0,0 +1,34 @@ +package com.downloader.httpclient; + +import com.downloader.request.DownloadRequest; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface HttpClient extends Cloneable { + + HttpClient clone(); + + void connect(DownloadRequest request) throws IOException; + + int getResponseCode() throws IOException; + + InputStream getInputStream() throws IOException; + + long getContentLength(); + + String getResponseHeader(String name); + + void close(); + + Map> getHeaderFields(); + + InputStream getErrorStream() throws IOException; + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/ComponentHolder.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/ComponentHolder.java new file mode 100755 index 0000000..88ede5c --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/ComponentHolder.java @@ -0,0 +1,97 @@ +package com.downloader.internal; + +import android.content.Context; + +import com.downloader.Constants; +import com.downloader.PRDownloader; +import com.downloader.PRDownloaderConfig; +import com.downloader.database.AppDbHelper; +import com.downloader.database.DbHelper; +import com.downloader.database.NoOpsDbHelper; +import com.downloader.httpclient.DefaultHttpClient; +import com.downloader.httpclient.HttpClient; + +/** + * Created by amitshekhar on 14/11/17. + */ + +public class ComponentHolder { + + private final static ComponentHolder INSTANCE = new ComponentHolder(); + private int readTimeout; + private int connectTimeout; + private String userAgent; + private HttpClient httpClient; + private DbHelper dbHelper; + + public static ComponentHolder getInstance() { + return INSTANCE; + } + + public void init(Context context, PRDownloaderConfig config) { + this.readTimeout = config.getReadTimeout(); + this.connectTimeout = config.getConnectTimeout(); + this.userAgent = config.getUserAgent(); + this.httpClient = config.getHttpClient(); + this.dbHelper = config.isDatabaseEnabled() ? new AppDbHelper(context) : new NoOpsDbHelper(); + if (config.isDatabaseEnabled()) { + PRDownloader.cleanUp(30); + } + } + + public int getReadTimeout() { + if (readTimeout == 0) { + synchronized (ComponentHolder.class) { + if (readTimeout == 0) { + readTimeout = Constants.DEFAULT_READ_TIMEOUT_IN_MILLS; + } + } + } + return readTimeout; + } + + public int getConnectTimeout() { + if (connectTimeout == 0) { + synchronized (ComponentHolder.class) { + if (connectTimeout == 0) { + connectTimeout = Constants.DEFAULT_CONNECT_TIMEOUT_IN_MILLS; + } + } + } + return connectTimeout; + } + + public String getUserAgent() { + if (userAgent == null) { + synchronized (ComponentHolder.class) { + if (userAgent == null) { + userAgent = Constants.DEFAULT_USER_AGENT; + } + } + } + return userAgent; + } + + public DbHelper getDbHelper() { + if (dbHelper == null) { + synchronized (ComponentHolder.class) { + if (dbHelper == null) { + dbHelper = new NoOpsDbHelper(); + } + } + } + return dbHelper; + } + + public HttpClient getHttpClient() { + if (httpClient == null) { + synchronized (ComponentHolder.class) { + if (httpClient == null) { + httpClient = new DefaultHttpClient(); + } + } + } + return httpClient.clone(); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRequestQueue.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRequestQueue.java new file mode 100755 index 0000000..513f71a --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRequestQueue.java @@ -0,0 +1,118 @@ +package com.downloader.internal; + +import com.downloader.Status; +import com.downloader.core.Core; +import com.downloader.request.DownloadRequest; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadRequestQueue { + + private static DownloadRequestQueue instance; + private final Map currentRequestMap; + private final AtomicInteger sequenceGenerator; + + private DownloadRequestQueue() { + currentRequestMap = new ConcurrentHashMap<>(); + sequenceGenerator = new AtomicInteger(); + } + + public static void initialize() { + getInstance(); + } + + public static DownloadRequestQueue getInstance() { + if (instance == null) { + synchronized (DownloadRequestQueue.class) { + if (instance == null) { + instance = new DownloadRequestQueue(); + } + } + } + return instance; + } + + private int getSequenceNumber() { + return sequenceGenerator.incrementAndGet(); + } + + public void pause(int downloadId) { + DownloadRequest request = currentRequestMap.get(downloadId); + if (request != null) { + request.setStatus(Status.PAUSED); + } + } + + public void resume(int downloadId) { + DownloadRequest request = currentRequestMap.get(downloadId); + if (request != null) { + request.setStatus(Status.QUEUED); + request.setFuture(Core.getInstance() + .getExecutorSupplier() + .forDownloadTasks() + .submit(new DownloadRunnable(request))); + } + } + + private void cancelAndRemoveFromMap(DownloadRequest request) { + if (request != null) { + request.cancel(); + currentRequestMap.remove(request.getDownloadId()); + } + } + + public void cancel(int downloadId) { + DownloadRequest request = currentRequestMap.get(downloadId); + cancelAndRemoveFromMap(request); + } + + public void cancel(Object tag) { + for (Map.Entry currentRequestMapEntry : currentRequestMap.entrySet()) { + DownloadRequest request = currentRequestMapEntry.getValue(); + if (request.getTag() instanceof String && tag instanceof String) { + final String tempRequestTag = (String) request.getTag(); + final String tempTag = (String) tag; + if (tempRequestTag.equals(tempTag)) { + cancelAndRemoveFromMap(request); + } + } else if (request.getTag().equals(tag)) { + cancelAndRemoveFromMap(request); + } + } + } + + public void cancelAll() { + for (Map.Entry currentRequestMapEntry : currentRequestMap.entrySet()) { + DownloadRequest request = currentRequestMapEntry.getValue(); + cancelAndRemoveFromMap(request); + } + } + + public Status getStatus(int downloadId) { + DownloadRequest request = currentRequestMap.get(downloadId); + if (request != null) { + return request.getStatus(); + } + return Status.UNKNOWN; + } + + public void addRequest(DownloadRequest request) { + currentRequestMap.put(request.getDownloadId(), request); + request.setStatus(Status.QUEUED); + request.setSequenceNumber(getSequenceNumber()); + request.setFuture(Core.getInstance() + .getExecutorSupplier() + .forDownloadTasks() + .submit(new DownloadRunnable(request))); + } + + public void finish(DownloadRequest request) { + currentRequestMap.remove(request.getDownloadId()); + } +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRunnable.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRunnable.java new file mode 100755 index 0000000..26d11d7 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadRunnable.java @@ -0,0 +1,41 @@ +package com.downloader.internal; + +import com.downloader.Error; +import com.downloader.Priority; +import com.downloader.Response; +import com.downloader.Status; +import com.downloader.request.DownloadRequest; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadRunnable implements Runnable { + + public final Priority priority; + public final int sequence; + public final DownloadRequest request; + + DownloadRunnable(DownloadRequest request) { + this.request = request; + this.priority = request.getPriority(); + this.sequence = request.getSequenceNumber(); + } + + @Override + public void run() { + request.setStatus(Status.RUNNING); + DownloadTask downloadTask = DownloadTask.create(request); + Response response = downloadTask.run(); + if (response.isSuccessful()) { + request.deliverSuccess(); + } else if (response.isPaused()) { + request.deliverPauseEvent(); + } else if (response.getError() != null) { + request.deliverError(response.getError()); + } else if (!response.isCancelled()) { + request.deliverError(new Error()); + } + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadTask.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadTask.java new file mode 100755 index 0000000..3702ba8 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/DownloadTask.java @@ -0,0 +1,390 @@ +package com.downloader.internal; + +import com.downloader.Constants; +import com.downloader.Error; +import com.downloader.Progress; +import com.downloader.Response; +import com.downloader.Status; +import com.downloader.database.DownloadModel; +import com.downloader.handler.ProgressHandler; +import com.downloader.httpclient.HttpClient; +import com.downloader.internal.stream.FileDownloadOutputStream; +import com.downloader.internal.stream.FileDownloadRandomAccessFile; +import com.downloader.request.DownloadRequest; +import com.downloader.utils.Utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadTask { + + private static final int BUFFER_SIZE = 1024 * 4; + private static final long TIME_GAP_FOR_SYNC = 2000; + private static final long MIN_BYTES_FOR_SYNC = 65536; + private final DownloadRequest request; + private ProgressHandler progressHandler; + private long lastSyncTime; + private long lastSyncBytes; + private InputStream inputStream; + private FileDownloadOutputStream outputStream; + private HttpClient httpClient; + private long totalBytes; + private int responseCode; + private String eTag; + private boolean isResumeSupported; + private String tempPath; + + private DownloadTask(DownloadRequest request) { + this.request = request; + } + + static DownloadTask create(DownloadRequest request) { + return new DownloadTask(request); + } + + Response run() { + + Response response = new Response(); + + if (request.getStatus() == Status.CANCELLED) { + response.setCancelled(true); + return response; + } else if (request.getStatus() == Status.PAUSED) { + response.setPaused(true); + return response; + } + + try { + + if (request.getOnProgressListener() != null) { + progressHandler = new ProgressHandler(request.getOnProgressListener()); + } + + tempPath = Utils.getTempPath(request.getDirPath(), request.getFileName()); + + File file = new File(tempPath); + + DownloadModel model = getDownloadModelIfAlreadyPresentInDatabase(); + + if (model != null) { + if (file.exists()) { + request.setTotalBytes(model.getTotalBytes()); + request.setDownloadedBytes(model.getDownloadedBytes()); + } else { + removeNoMoreNeededModelFromDatabase(); + request.setDownloadedBytes(0); + request.setTotalBytes(0); + model = null; + } + } + + httpClient = ComponentHolder.getInstance().getHttpClient(); + + httpClient.connect(request); + + if (request.getStatus() == Status.CANCELLED) { + response.setCancelled(true); + return response; + } else if (request.getStatus() == Status.PAUSED) { + response.setPaused(true); + return response; + } + + httpClient = Utils.getRedirectedConnectionIfAny(httpClient, request); + + responseCode = httpClient.getResponseCode(); + + eTag = httpClient.getResponseHeader(Constants.ETAG); + + if (checkIfFreshStartRequiredAndStart(model)) { + model = null; + } + + if (!isSuccessful()) { + Error error = new Error(); + error.setServerError(true); + error.setServerErrorMessage(convertStreamToString(httpClient.getErrorStream())); + error.setHeaderFields(httpClient.getHeaderFields()); + error.setResponseCode(responseCode); + response.setError(error); + return response; + } + + setResumeSupportedOrNot(); + + totalBytes = request.getTotalBytes(); + + if (!isResumeSupported) { + deleteTempFile(); + } + + if (totalBytes == 0) { + totalBytes = httpClient.getContentLength(); + request.setTotalBytes(totalBytes); + } + + if (isResumeSupported && model == null) { + createAndInsertNewModel(); + } + + if (request.getStatus() == Status.CANCELLED) { + response.setCancelled(true); + return response; + } else if (request.getStatus() == Status.PAUSED) { + response.setPaused(true); + return response; + } + + request.deliverStartEvent(); + + inputStream = httpClient.getInputStream(); + + byte[] buff = new byte[BUFFER_SIZE]; + + if (!file.exists()) { + if (file.getParentFile() != null && !file.getParentFile().exists()) { + if (file.getParentFile().mkdirs()) { + //noinspection ResultOfMethodCallIgnored + file.createNewFile(); + } + } else { + //noinspection ResultOfMethodCallIgnored + file.createNewFile(); + } + } + + this.outputStream = FileDownloadRandomAccessFile.create(file); + + if (isResumeSupported && request.getDownloadedBytes() != 0) { + outputStream.seek(request.getDownloadedBytes()); + } + + if (request.getStatus() == Status.CANCELLED) { + response.setCancelled(true); + return response; + } else if (request.getStatus() == Status.PAUSED) { + response.setPaused(true); + return response; + } + + do { + + final int byteCount = inputStream.read(buff, 0, BUFFER_SIZE); + + if (byteCount == -1) { + break; + } + + outputStream.write(buff, 0, byteCount); + + request.setDownloadedBytes(request.getDownloadedBytes() + byteCount); + + sendProgress(); + + syncIfRequired(outputStream); + + if (request.getStatus() == Status.CANCELLED) { + response.setCancelled(true); + return response; + } else if (request.getStatus() == Status.PAUSED) { + sync(outputStream); + response.setPaused(true); + return response; + } + + } while (true); + + final String path = Utils.getPath(request.getDirPath(), request.getFileName()); + + Utils.renameFileName(tempPath, path); + + response.setSuccessful(true); + + if (isResumeSupported) { + removeNoMoreNeededModelFromDatabase(); + } + + } catch (IOException | IllegalAccessException e) { + if (!isResumeSupported) { + deleteTempFile(); + } + Error error = new Error(); + error.setConnectionError(true); + error.setConnectionException(e); + response.setError(error); + } finally { + closeAllSafely(outputStream); + } + + return response; + } + + private void deleteTempFile() { + File file = new File(tempPath); + if (file.exists()) { + //noinspection ResultOfMethodCallIgnored + file.delete(); + } + } + + private boolean isSuccessful() { + return responseCode >= HttpURLConnection.HTTP_OK + && responseCode < HttpURLConnection.HTTP_MULT_CHOICE; + } + + private void setResumeSupportedOrNot() { + isResumeSupported = (responseCode == HttpURLConnection.HTTP_PARTIAL); + } + + private boolean checkIfFreshStartRequiredAndStart(DownloadModel model) throws IOException, + IllegalAccessException { + if (responseCode == Constants.HTTP_RANGE_NOT_SATISFIABLE || isETagChanged(model)) { + if (model != null) { + removeNoMoreNeededModelFromDatabase(); + } + deleteTempFile(); + request.setDownloadedBytes(0); + request.setTotalBytes(0); + httpClient = ComponentHolder.getInstance().getHttpClient(); + httpClient.connect(request); + httpClient = Utils.getRedirectedConnectionIfAny(httpClient, request); + responseCode = httpClient.getResponseCode(); + return true; + } + return false; + } + + private boolean isETagChanged(DownloadModel model) { + return !(eTag == null || model == null || model.getETag() == null) + && !model.getETag().equals(eTag); + } + + private DownloadModel getDownloadModelIfAlreadyPresentInDatabase() { + return ComponentHolder.getInstance().getDbHelper().find(request.getDownloadId()); + } + + private void createAndInsertNewModel() { + DownloadModel model = new DownloadModel(); + model.setId(request.getDownloadId()); + model.setUrl(request.getUrl()); + model.setETag(eTag); + model.setDirPath(request.getDirPath()); + model.setFileName(request.getFileName()); + model.setDownloadedBytes(request.getDownloadedBytes()); + model.setTotalBytes(totalBytes); + model.setLastModifiedAt(System.currentTimeMillis()); + ComponentHolder.getInstance().getDbHelper().insert(model); + } + + private void removeNoMoreNeededModelFromDatabase() { + ComponentHolder.getInstance().getDbHelper().remove(request.getDownloadId()); + } + + private void sendProgress() { + if (request.getStatus() != Status.CANCELLED) { + if (progressHandler != null) { + progressHandler + .obtainMessage(Constants.UPDATE, + new Progress(request.getDownloadedBytes(), + totalBytes)).sendToTarget(); + } + } + } + + private void syncIfRequired(FileDownloadOutputStream outputStream) { + final long currentBytes = request.getDownloadedBytes(); + final long currentTime = System.currentTimeMillis(); + final long bytesDelta = currentBytes - lastSyncBytes; + final long timeDelta = currentTime - lastSyncTime; + if (bytesDelta > MIN_BYTES_FOR_SYNC && timeDelta > TIME_GAP_FOR_SYNC) { + sync(outputStream); + lastSyncBytes = currentBytes; + lastSyncTime = currentTime; + } + } + + private void sync(FileDownloadOutputStream outputStream) { + boolean success; + try { + outputStream.flushAndSync(); + success = true; + } catch (IOException e) { + success = false; + e.printStackTrace(); + } + if (success && isResumeSupported) { + ComponentHolder.getInstance().getDbHelper() + .updateProgress(request.getDownloadId(), + request.getDownloadedBytes(), + System.currentTimeMillis()); + } + + } + + private void closeAllSafely(FileDownloadOutputStream outputStream) { + if (httpClient != null) { + try { + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + if (outputStream != null) { + try { + sync(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } + } + } finally { + if (outputStream != null) + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private String convertStreamToString(InputStream stream) { + StringBuilder stringBuilder = new StringBuilder(); + if (stream != null) { + String line; + BufferedReader bufferedReader = null; + try { + bufferedReader = new BufferedReader(new InputStreamReader(stream)); + while ((line = bufferedReader.readLine()) != null) { + stringBuilder.append(line); + } + } catch (IOException ignored) { + + } finally { + try { + if (bufferedReader != null) { + bufferedReader.close(); + } + } catch (NullPointerException | IOException ignored) { + + } + } + } + return stringBuilder.toString(); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/SynchronousCall.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/SynchronousCall.java new file mode 100755 index 0000000..008e4ec --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/SynchronousCall.java @@ -0,0 +1,19 @@ +package com.downloader.internal; + +import com.downloader.Response; +import com.downloader.request.DownloadRequest; + +public class SynchronousCall { + + public final DownloadRequest request; + + public SynchronousCall(DownloadRequest request) { + this.request = request; + } + + public Response execute() { + DownloadTask downloadTask = DownloadTask.create(request); + return downloadTask.run(); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadOutputStream.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadOutputStream.java new file mode 100755 index 0000000..1d080dd --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadOutputStream.java @@ -0,0 +1,38 @@ +package com.downloader.internal.stream; + + +import java.io.IOException; + +public interface FileDownloadOutputStream { + + /** + * Writes len bytes from the specified byte array + * starting at offset off to this file. + */ + void write(byte b[], int off, int len) throws IOException; + + /** + * Flush all buffer to system and force all system buffers to synchronize with the underlying + * device. + */ + void flushAndSync() throws IOException; + + /** + * Closes this output stream and releases any system resources associated with this stream. The + * general contract of close is that it closes the output stream. A closed stream + * cannot perform output operations and cannot be reopened. + */ + void close() throws IOException; + + /** + * Sets the file-pointer offset, measured from the beginning of this file, at which the next + * read or write occurs. The offset may be set beyond the end of the file. + */ + void seek(long offset) throws IOException, IllegalAccessException; + + /** + * Sets the length of this file. + */ + void setLength(final long newLength) throws IOException, IllegalAccessException; + +} \ No newline at end of file diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadRandomAccessFile.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadRandomAccessFile.java new file mode 100755 index 0000000..b0ebf7a --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/internal/stream/FileDownloadRandomAccessFile.java @@ -0,0 +1,53 @@ +package com.downloader.internal.stream; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.RandomAccessFile; + +public class FileDownloadRandomAccessFile implements FileDownloadOutputStream { + + private final BufferedOutputStream out; + private final FileDescriptor fd; + private final RandomAccessFile randomAccess; + + private FileDownloadRandomAccessFile(File file) throws IOException { + randomAccess = new RandomAccessFile(file, "rw"); + fd = randomAccess.getFD(); + out = new BufferedOutputStream(new FileOutputStream(randomAccess.getFD())); + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + out.write(b, off, len); + } + + @Override + public void flushAndSync() throws IOException { + out.flush(); + fd.sync(); + } + + @Override + public void close() throws IOException { + out.close(); + randomAccess.close(); + } + + @Override + public void seek(long offset) throws IOException { + randomAccess.seek(offset); + } + + @Override + public void setLength(long totalBytes) throws IOException { + randomAccess.setLength(totalBytes); + } + + public static FileDownloadOutputStream create(File file) throws IOException { + return new FileDownloadRandomAccessFile(file); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequest.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequest.java new file mode 100755 index 0000000..04abfcf --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequest.java @@ -0,0 +1,319 @@ +package com.downloader.request; + +import com.downloader.Error; +import com.downloader.OnCancelListener; +import com.downloader.OnDownloadListener; +import com.downloader.OnPauseListener; +import com.downloader.OnProgressListener; +import com.downloader.OnStartOrResumeListener; +import com.downloader.Priority; +import com.downloader.Response; +import com.downloader.Status; +import com.downloader.core.Core; +import com.downloader.internal.ComponentHolder; +import com.downloader.internal.DownloadRequestQueue; +import com.downloader.internal.SynchronousCall; +import com.downloader.utils.Utils; + +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.Future; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadRequest { + + private Priority priority; + private Object tag; + private String url; + private String dirPath; + private String fileName; + private int sequenceNumber; + private Future future; + private long downloadedBytes; + private long totalBytes; + private int readTimeout; + private int connectTimeout; + private String userAgent; + private OnProgressListener onProgressListener; + private OnDownloadListener onDownloadListener; + private OnStartOrResumeListener onStartOrResumeListener; + private OnPauseListener onPauseListener; + private OnCancelListener onCancelListener; + private int downloadId; + private HashMap> headerMap; + private Status status; + + DownloadRequest(DownloadRequestBuilder builder) { + this.url = builder.url; + this.dirPath = builder.dirPath; + this.fileName = builder.fileName; + this.headerMap = builder.headerMap; + this.priority = builder.priority; + this.tag = builder.tag; + this.readTimeout = + builder.readTimeout != 0 ? + builder.readTimeout : + getReadTimeoutFromConfig(); + this.connectTimeout = + builder.connectTimeout != 0 ? + builder.connectTimeout : + getConnectTimeoutFromConfig(); + this.userAgent = builder.userAgent; + } + + public Priority getPriority() { + return priority; + } + + public void setPriority(Priority priority) { + this.priority = priority; + } + + public Object getTag() { + return tag; + } + + public void setTag(Object tag) { + this.tag = tag; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDirPath() { + return dirPath; + } + + public void setDirPath(String dirPath) { + this.dirPath = dirPath; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public int getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(int sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + public HashMap> getHeaders() { + return headerMap; + } + + public Future getFuture() { + return future; + } + + public void setFuture(Future future) { + this.future = future; + } + + public long getDownloadedBytes() { + return downloadedBytes; + } + + public void setDownloadedBytes(long downloadedBytes) { + this.downloadedBytes = downloadedBytes; + } + + public long getTotalBytes() { + return totalBytes; + } + + public void setTotalBytes(long totalBytes) { + this.totalBytes = totalBytes; + } + + public int getReadTimeout() { + return readTimeout; + } + + public void setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + } + + public int getConnectTimeout() { + return connectTimeout; + } + + public void setConnectTimeout(int connectTimeout) { + this.connectTimeout = connectTimeout; + } + + public String getUserAgent() { + if (userAgent == null) { + userAgent = ComponentHolder.getInstance().getUserAgent(); + } + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public int getDownloadId() { + return downloadId; + } + + public void setDownloadId(int downloadId) { + this.downloadId = downloadId; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public OnProgressListener getOnProgressListener() { + return onProgressListener; + } + + public DownloadRequest setOnStartOrResumeListener(OnStartOrResumeListener onStartOrResumeListener) { + this.onStartOrResumeListener = onStartOrResumeListener; + return this; + } + + public DownloadRequest setOnProgressListener(OnProgressListener onProgressListener) { + this.onProgressListener = onProgressListener; + return this; + } + + public DownloadRequest setOnPauseListener(OnPauseListener onPauseListener) { + this.onPauseListener = onPauseListener; + return this; + } + + public DownloadRequest setOnCancelListener(OnCancelListener onCancelListener) { + this.onCancelListener = onCancelListener; + return this; + } + + public int start(OnDownloadListener onDownloadListener) { + this.onDownloadListener = onDownloadListener; + downloadId = Utils.getUniqueId(url, dirPath, fileName); + DownloadRequestQueue.getInstance().addRequest(this); + return downloadId; + } + + public Response executeSync() { + downloadId = Utils.getUniqueId(url, dirPath, fileName); + return new SynchronousCall(this).execute(); + } + + public void deliverError(final Error error) { + if (status != Status.CANCELLED) { + setStatus(Status.FAILED); + Core.getInstance().getExecutorSupplier().forMainThreadTasks() + .execute(new Runnable() { + public void run() { + if (onDownloadListener != null) { + onDownloadListener.onError(error); + } + finish(); + } + }); + } + } + + public void deliverSuccess() { + if (status != Status.CANCELLED) { + setStatus(Status.COMPLETED); + Core.getInstance().getExecutorSupplier().forMainThreadTasks() + .execute(new Runnable() { + public void run() { + if (onDownloadListener != null) { + onDownloadListener.onDownloadComplete(); + } + finish(); + } + }); + } + } + + public void deliverStartEvent() { + if (status != Status.CANCELLED) { + Core.getInstance().getExecutorSupplier().forMainThreadTasks() + .execute(new Runnable() { + public void run() { + if (onStartOrResumeListener != null) { + onStartOrResumeListener.onStartOrResume(); + } + } + }); + } + } + + public void deliverPauseEvent() { + if (status != Status.CANCELLED) { + Core.getInstance().getExecutorSupplier().forMainThreadTasks() + .execute(new Runnable() { + public void run() { + if (onPauseListener != null) { + onPauseListener.onPause(); + } + } + }); + } + } + + private void deliverCancelEvent() { + Core.getInstance().getExecutorSupplier().forMainThreadTasks() + .execute(new Runnable() { + public void run() { + if (onCancelListener != null) { + onCancelListener.onCancel(); + } + } + }); + } + + public void cancel() { + status = Status.CANCELLED; + if (future != null) { + future.cancel(true); + } + deliverCancelEvent(); + Utils.deleteTempFileAndDatabaseEntryInBackground(Utils.getTempPath(dirPath, fileName), downloadId); + } + + private void finish() { + destroy(); + DownloadRequestQueue.getInstance().finish(this); + } + + private void destroy() { + this.onProgressListener = null; + this.onDownloadListener = null; + this.onStartOrResumeListener = null; + this.onPauseListener = null; + this.onCancelListener = null; + } + + private int getReadTimeoutFromConfig() { + return ComponentHolder.getInstance().getReadTimeout(); + } + + private int getConnectTimeoutFromConfig() { + return ComponentHolder.getInstance().getConnectTimeout(); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequestBuilder.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequestBuilder.java new file mode 100755 index 0000000..67d5dff --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/DownloadRequestBuilder.java @@ -0,0 +1,81 @@ +package com.downloader.request; + +import com.downloader.Priority; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public class DownloadRequestBuilder implements RequestBuilder { + + String url; + String dirPath; + String fileName; + Priority priority = Priority.MEDIUM; + Object tag; + int readTimeout; + int connectTimeout; + String userAgent; + HashMap> headerMap; + + public DownloadRequestBuilder(String url, String dirPath, String fileName) { + this.url = url; + this.dirPath = dirPath; + this.fileName = fileName; + } + + @Override + public DownloadRequestBuilder setHeader(String name, String value) { + if (headerMap == null) { + headerMap = new HashMap<>(); + } + List list = headerMap.get(name); + if (list == null) { + list = new ArrayList<>(); + headerMap.put(name, list); + } + if (!list.contains(value)) { + list.add(value); + } + return this; + } + + @Override + public DownloadRequestBuilder setPriority(Priority priority) { + this.priority = priority; + return this; + } + + @Override + public DownloadRequestBuilder setTag(Object tag) { + this.tag = tag; + return this; + } + + @Override + public DownloadRequestBuilder setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + @Override + public DownloadRequestBuilder setConnectTimeout(int connectTimeout) { + this.connectTimeout = connectTimeout; + return this; + } + + @Override + public DownloadRequestBuilder setUserAgent(String userAgent) { + this.userAgent = userAgent; + return this; + } + + public DownloadRequest build() { + return new DownloadRequest(this); + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/RequestBuilder.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/RequestBuilder.java new file mode 100755 index 0000000..f1919d5 --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/request/RequestBuilder.java @@ -0,0 +1,23 @@ +package com.downloader.request; + +import com.downloader.Priority; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public interface RequestBuilder { + + RequestBuilder setHeader(String name, String value); + + RequestBuilder setPriority(Priority priority); + + RequestBuilder setTag(Object tag); + + RequestBuilder setReadTimeout(int readTimeout); + + RequestBuilder setConnectTimeout(int connectTimeout); + + RequestBuilder setUserAgent(String userAgent); + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/utils/Utils.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/utils/Utils.java new file mode 100755 index 0000000..6c0633f --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/java/com/downloader/utils/Utils.java @@ -0,0 +1,157 @@ +package com.downloader.utils; + +import com.downloader.Constants; +import com.downloader.core.Core; +import com.downloader.database.DownloadModel; +import com.downloader.httpclient.HttpClient; +import com.downloader.internal.ComponentHolder; +import com.downloader.request.DownloadRequest; + +import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.List; + +/** + * Created by amitshekhar on 13/11/17. + */ + +public final class Utils { + + private final static int MAX_REDIRECTION = 10; + + private Utils() { + // no instance + } + + public static String getPath(String dirPath, String fileName) { + return dirPath + File.separator + fileName; + } + + public static String getTempPath(String dirPath, String fileName) { + return getPath(dirPath, fileName) + ".temp"; + } + + public static void renameFileName(String oldPath, String newPath) throws IOException { + final File oldFile = new File(oldPath); + try { + final File newFile = new File(newPath); + if (newFile.exists()) { + if (!newFile.delete()) { + throw new IOException("Deletion Failed"); + } + } + if (!oldFile.renameTo(newFile)) { + throw new IOException("Rename Failed"); + } + } finally { + if (oldFile.exists()) { + //noinspection ResultOfMethodCallIgnored + oldFile.delete(); + } + } + } + + public static void deleteTempFileAndDatabaseEntryInBackground(final String path, final int downloadId) { + Core.getInstance().getExecutorSupplier().forBackgroundTasks() + .execute(new Runnable() { + @Override + public void run() { + ComponentHolder.getInstance().getDbHelper().remove(downloadId); + File file = new File(path); + if (file.exists()) { + //noinspection ResultOfMethodCallIgnored + file.delete(); + } + } + }); + } + + public static void deleteUnwantedModelsAndTempFiles(final int days) { + Core.getInstance().getExecutorSupplier().forBackgroundTasks() + .execute(new Runnable() { + @Override + public void run() { + List models = ComponentHolder.getInstance() + .getDbHelper() + .getUnwantedModels(days); + if (models != null) { + for (DownloadModel model : models) { + final String tempPath = getTempPath(model.getDirPath(), model.getFileName()); + ComponentHolder.getInstance().getDbHelper().remove(model.getId()); + File file = new File(tempPath); + if (file.exists()) { + //noinspection ResultOfMethodCallIgnored + file.delete(); + } + } + } + } + }); + } + + public static int getUniqueId(String url, String dirPath, String fileName) { + + String string = url + File.separator + dirPath + File.separator + fileName; + + byte[] hash; + + try { + hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("NoSuchAlgorithmException", e); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("UnsupportedEncodingException", e); + } + + StringBuilder hex = new StringBuilder(hash.length * 2); + + for (byte b : hash) { + if ((b & 0xFF) < 0x10) hex.append("0"); + hex.append(Integer.toHexString(b & 0xFF)); + } + + return hex.toString().hashCode(); + + } + + public static HttpClient getRedirectedConnectionIfAny(HttpClient httpClient, + DownloadRequest request) + throws IOException, IllegalAccessException { + int redirectTimes = 0; + int code = httpClient.getResponseCode(); + String location = httpClient.getResponseHeader("Location"); + + while (isRedirection(code)) { + if (location == null) { + throw new IllegalAccessException("Location is null"); + } + httpClient.close(); + + request.setUrl(location); + httpClient = ComponentHolder.getInstance().getHttpClient(); + httpClient.connect(request); + code = httpClient.getResponseCode(); + location = httpClient.getResponseHeader("Location"); + redirectTimes++; + if (redirectTimes >= MAX_REDIRECTION) { + throw new IllegalAccessException("Max redirection done"); + } + } + + return httpClient; + } + + private static boolean isRedirection(int code) { + return code == HttpURLConnection.HTTP_MOVED_PERM + || code == HttpURLConnection.HTTP_MOVED_TEMP + || code == HttpURLConnection.HTTP_SEE_OTHER + || code == HttpURLConnection.HTTP_MULT_CHOICE + || code == Constants.HTTP_TEMPORARY_REDIRECT + || code == Constants.HTTP_PERMANENT_REDIRECT; + } + +} diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/res/values/strings.xml b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/res/values/strings.xml new file mode 100755 index 0000000..e672d7b --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + downloader + diff --git a/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/test/java/com/downloader/ExampleUnitTest.java b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/test/java/com/downloader/ExampleUnitTest.java new file mode 100755 index 0000000..49f38ab --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/prdownloader/src/test/java/com/downloader/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.downloader; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/OnTime_Driver_live/lib/PRDownloader/settings.gradle b/OnTime_Driver_live/lib/PRDownloader/settings.gradle new file mode 100755 index 0000000..85308ca --- /dev/null +++ b/OnTime_Driver_live/lib/PRDownloader/settings.gradle @@ -0,0 +1 @@ +include ':app', ':prdownloader' diff --git a/OnTime_Driver_live/lib/README.md b/OnTime_Driver_live/lib/README.md new file mode 100755 index 0000000..f158674 --- /dev/null +++ b/OnTime_Driver_live/lib/README.md @@ -0,0 +1,15 @@ +# Local libraries (not shared) + +These modules are **included only in this app**. They are not shared with other OnTime apps (User, Merchant). Each app has its own copy under its own `lib/` folder. + +## Modules + +| Module | Path | Description | +|--------|------|-------------| +| rating-view | `RatingView/rating-view` | Rating bar widget | +| textdrawable | `TextDrawable/library` | Text-based drawables | +| prdownloader | `PRDownloader/prdownloader` | File downloader | +| liboverscroll | `overscroll-decor/liboverscroll` | Overscroll effects | +| fragmentanimations | `FragmentAnimations/fragmentanimations` | Fragment transition animations | + +All libs use **compileSdk 33**, **targetSdk 33**, **minSdk 21**, and AndroidX. diff --git a/OnTime_Driver_live/lib/RatingView/.gitignore b/OnTime_Driver_live/lib/RatingView/.gitignore new file mode 100755 index 0000000..c6cbe56 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/OnTime_Driver_live/lib/RatingView/LICENSE b/OnTime_Driver_live/lib/RatingView/LICENSE new file mode 100755 index 0000000..2bb9ad2 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/LICENSE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/OnTime_Driver_live/lib/RatingView/README.md b/OnTime_Driver_live/lib/RatingView/README.md new file mode 100755 index 0000000..166e28d --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/README.md @@ -0,0 +1,29 @@ +# RatingView +[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RatingView-green.svg?style=true)](https://android-arsenal.com/details/1/3770) + +Simple android widget that can replace standard inconvenient RatingBar in your app. + +![Screenshot](https://googledrive.com/host/0Bwz1_b9mA7XYbC1EQ28xaHVwcGc/ratingview2.jpg) +##Description +The default Android `RatingBar` widget hardly can satisfy developers' needs. It's a pain to customize it at all. This simple view can take a huge advantage of setting and scaling drawables for rating view easily. +##Usage +You can download this library with the following line in your `app` module `build.gradle`: +```gradle +compile 'com.github.ornolfr:rating-view:0.1.2@aar' +``` +##Example +Declare `RatingView` in your XML with `app` attributes: +```xml + +``` +And use it through `RatingView` instance in your code. Goog luck! diff --git a/OnTime_Driver_live/lib/RatingView/app/.gitignore b/OnTime_Driver_live/lib/RatingView/app/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/OnTime_Driver_live/lib/RatingView/app/build.gradle b/OnTime_Driver_live/lib/RatingView/app/build.gradle new file mode 100755 index 0000000..2b321d4 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 24 + buildToolsVersion "24.0.2" + + defaultConfig { + applicationId "com.github.ornolfr.ratingview" + minSdkVersion 15 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:24.2.0' + compile project(':rating-view') +} diff --git a/OnTime_Driver_live/lib/RatingView/app/proguard-rules.pro b/OnTime_Driver_live/lib/RatingView/app/proguard-rules.pro new file mode 100755 index 0000000..4ed9620 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Roman\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 *; +#} diff --git a/OnTime_Driver_live/lib/RatingView/app/src/main/AndroidManifest.xml b/OnTime_Driver_live/lib/RatingView/app/src/main/AndroidManifest.xml new file mode 100755 index 0000000..41609b2 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OnTime_Driver_live/lib/RatingView/app/src/main/java/com/github/ornolfr/ratingview_sample/MainActivity.java b/OnTime_Driver_live/lib/RatingView/app/src/main/java/com/github/ornolfr/ratingview_sample/MainActivity.java new file mode 100755 index 0000000..fd3a122 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/src/main/java/com/github/ornolfr/ratingview_sample/MainActivity.java @@ -0,0 +1,55 @@ +package com.github.ornolfr.ratingview_sample; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; +import android.widget.Toast; + +import com.github.ornolfr.ratingview.RatingView; + +import java.util.Random; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + + private RatingView ratingView; + + private Button buttonRating, buttonIndicator; + + private Random random = new Random(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + ratingView = (RatingView) findViewById(R.id.ratingView); + + buttonIndicator = (Button) findViewById(R.id.buttonIndicator); + buttonRating = (Button) findViewById(R.id.buttonRating); + + buttonIndicator.setOnClickListener(this); + buttonRating.setOnClickListener(this); + + ratingView.setOnRatingChangedListener(new RatingView.OnRatingChangedListener() { + @Override + public void onRatingChange(float oldRating, float newRating) { + Toast.makeText(MainActivity.this, "Old rating = " + oldRating + "; New rating = " + newRating, Toast.LENGTH_SHORT).show(); + } + }); + + } + + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.buttonIndicator: + ratingView.setIsIndicator(!ratingView.isIndicator()); + break; + case R.id.buttonRating: + ratingView.setRating(random.nextFloat() * ratingView.getMaxCount()); + break; + } + } +} diff --git a/OnTime_Driver_live/lib/RatingView/app/src/main/res/layout/activity_main.xml b/OnTime_Driver_live/lib/RatingView/app/src/main/res/layout/activity_main.xml new file mode 100755 index 0000000..837ed43 --- /dev/null +++ b/OnTime_Driver_live/lib/RatingView/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,46 @@ + + + + + +