Merge pull request #79 from vernu/android-ui-ux
improve android app ui/uxpull/81/head
-
4android/app/build.gradle
-
3android/app/src/main/AndroidManifest.xml
-
BINandroid/app/src/main/ic_launcher-playstore.png
-
3android/app/src/main/java/com/vernu/sms/AppConstants.java
-
69android/app/src/main/java/com/vernu/sms/TextBeeUtils.java
-
218android/app/src/main/java/com/vernu/sms/activities/MainActivity.java
-
111android/app/src/main/java/com/vernu/sms/helpers/VersionTracker.java
-
57android/app/src/main/java/com/vernu/sms/services/StickyNotificationService.java
-
6android/app/src/main/res/color/radio_button_text_color.xml
-
6android/app/src/main/res/color/radio_button_tint.xml
-
10android/app/src/main/res/drawable/ic_baseline_edit_24.xml
-
10android/app/src/main/res/drawable/ic_baseline_info_24.xml
-
622android/app/src/main/res/layout/activity_main.xml
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher.webp
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher.webp
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
-
17android/app/src/main/res/values-night/colors.xml
-
33android/app/src/main/res/values-night/themes.xml
-
7android/app/src/main/res/values/colors.xml
-
2android/app/src/main/res/values/strings.xml
-
10android/app/src/main/res/values/styles.xml
-
18android/app/src/main/res/values/themes.xml
-
1android/build.gradle
|
Before Width: 512 | Height: 512 | Size: 237 KiB After Width: 512 | Height: 512 | Size: 131 KiB |
@ -0,0 +1,111 @@ |
|||||
|
package com.vernu.sms.helpers; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.util.Log; |
||||
|
|
||||
|
import com.vernu.sms.ApiManager; |
||||
|
import com.vernu.sms.AppConstants; |
||||
|
import com.vernu.sms.BuildConfig; |
||||
|
import com.vernu.sms.dtos.RegisterDeviceInputDTO; |
||||
|
import com.vernu.sms.dtos.RegisterDeviceResponseDTO; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
public class VersionTracker { |
||||
|
private static final String TAG = "VersionTracker"; |
||||
|
|
||||
|
/** |
||||
|
* Checks if the app version has changed since the last time it was run |
||||
|
* @param context Application context |
||||
|
* @return true if version has changed, false otherwise |
||||
|
*/ |
||||
|
public static boolean hasVersionChanged(Context context) { |
||||
|
int lastVersionCode = SharedPreferenceHelper.getSharedPreferenceInt( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_LAST_VERSION_CODE_KEY, |
||||
|
-1 |
||||
|
); |
||||
|
|
||||
|
String lastVersionName = SharedPreferenceHelper.getSharedPreferenceString( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_LAST_VERSION_NAME_KEY, |
||||
|
"" |
||||
|
); |
||||
|
|
||||
|
int currentVersionCode = BuildConfig.VERSION_CODE; |
||||
|
String currentVersionName = BuildConfig.VERSION_NAME; |
||||
|
|
||||
|
// First app launch or version changed |
||||
|
return lastVersionCode == -1 || |
||||
|
lastVersionCode != currentVersionCode || |
||||
|
!lastVersionName.equals(currentVersionName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Updates the stored version information with current version |
||||
|
* @param context Application context |
||||
|
*/ |
||||
|
public static void updateStoredVersion(Context context) { |
||||
|
SharedPreferenceHelper.setSharedPreferenceInt( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_LAST_VERSION_CODE_KEY, |
||||
|
BuildConfig.VERSION_CODE |
||||
|
); |
||||
|
|
||||
|
SharedPreferenceHelper.setSharedPreferenceString( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_LAST_VERSION_NAME_KEY, |
||||
|
BuildConfig.VERSION_NAME |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Reports current app version to the server |
||||
|
* @param context Application context |
||||
|
*/ |
||||
|
public static void reportVersionToServer(Context context) { |
||||
|
String deviceId = SharedPreferenceHelper.getSharedPreferenceString( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_DEVICE_ID_KEY, |
||||
|
"" |
||||
|
); |
||||
|
|
||||
|
String apiKey = SharedPreferenceHelper.getSharedPreferenceString( |
||||
|
context, |
||||
|
AppConstants.SHARED_PREFS_API_KEY_KEY, |
||||
|
"" |
||||
|
); |
||||
|
|
||||
|
// If device is not registered or no API key, can't report version |
||||
|
if (deviceId.isEmpty() || apiKey.isEmpty()) { |
||||
|
Log.d(TAG, "Can't report version: device not registered or no API key"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
RegisterDeviceInputDTO updateInput = new RegisterDeviceInputDTO(); |
||||
|
updateInput.setAppVersionCode(BuildConfig.VERSION_CODE); |
||||
|
updateInput.setAppVersionName(BuildConfig.VERSION_NAME); |
||||
|
|
||||
|
Call<RegisterDeviceResponseDTO> apiCall = ApiManager.getApiService() |
||||
|
.updateDevice(deviceId, apiKey, updateInput); |
||||
|
|
||||
|
apiCall.enqueue(new Callback<RegisterDeviceResponseDTO>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<RegisterDeviceResponseDTO> call, Response<RegisterDeviceResponseDTO> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
Log.d(TAG, "Version update reported successfully"); |
||||
|
updateStoredVersion(context); |
||||
|
} else { |
||||
|
Log.e(TAG, "Failed to report version update: " + response.code()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<RegisterDeviceResponseDTO> call, Throwable t) { |
||||
|
Log.e(TAG, "Error reporting version update: " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
<item android:state_checked="true" android:color="?attr/colorPrimary" /> |
||||
|
<item android:state_enabled="false" android:color="@color/text_secondary" /> |
||||
|
<item android:color="@color/text_primary" /> |
||||
|
</selector> |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
<item android:state_checked="true" android:color="?attr/colorPrimary" /> |
||||
|
<item android:state_enabled="false" android:color="@color/text_secondary" /> |
||||
|
<item android:color="@color/text_secondary" /> |
||||
|
</selector> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:width="24dp" |
||||
|
android:height="24dp" |
||||
|
android:viewportWidth="24" |
||||
|
android:viewportHeight="24" |
||||
|
android:tint="?attr/colorControlNormal"> |
||||
|
<path |
||||
|
android:fillColor="@android:color/white" |
||||
|
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/> |
||||
|
</vector> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:width="24dp" |
||||
|
android:height="24dp" |
||||
|
android:viewportWidth="24" |
||||
|
android:viewportHeight="24" |
||||
|
android:tint="?attr/colorControlNormal"> |
||||
|
<path |
||||
|
android:fillColor="@android:color/white" |
||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/> |
||||
|
</vector> |
||||
|
Before Width: 72 | Height: 72 | Size: 4.0 KiB |
|
Before Width: 162 | Height: 162 | Size: 10 KiB |
|
Before Width: 72 | Height: 72 | Size: 6.2 KiB |
|
Before Width: 48 | Height: 48 | Size: 2.2 KiB |
|
Before Width: 108 | Height: 108 | Size: 5.0 KiB |
|
Before Width: 48 | Height: 48 | Size: 3.5 KiB |
|
Before Width: 96 | Height: 96 | Size: 6.3 KiB |
|
Before Width: 216 | Height: 216 | Size: 18 KiB |
|
Before Width: 96 | Height: 96 | Size: 9.7 KiB |
|
Before Width: 144 | Height: 144 | Size: 12 KiB |
|
Before Width: 324 | Height: 324 | Size: 40 KiB |
|
Before Width: 144 | Height: 144 | Size: 18 KiB |
|
Before Width: 192 | Height: 192 | Size: 21 KiB |
|
Before Width: 432 | Height: 432 | Size: 74 KiB |
|
Before Width: 192 | Height: 192 | Size: 30 KiB |
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<resources> |
||||
|
<color name="purple_200">#FFBB86FC</color> |
||||
|
<color name="purple_500">#FF6200EE</color> |
||||
|
<color name="purple_700">#FF3700B3</color> |
||||
|
<color name="teal_200">#FF03DAC5</color> |
||||
|
<color name="teal_700">#FF018786</color> |
||||
|
<color name="black">#FF000000</color> |
||||
|
<color name="white">#FFFFFFFF</color> |
||||
|
|
||||
|
<!-- Dark mode specific colors --> |
||||
|
<color name="background_primary">#121212</color> |
||||
|
<color name="background_secondary">#1E1E1E</color> |
||||
|
<color name="text_primary">#FFFFFF</color> |
||||
|
<color name="text_secondary">#B3FFFFFF</color> <!-- 70% white --> |
||||
|
<color name="divider">#454545</color> |
||||
|
</resources> |
||||
@ -1,3 +1,3 @@ |
|||||
<resources> |
<resources> |
||||
<string name="app_name">TextBee</string> |
|
||||
|
<string name="app_name">textbee.dev</string> |
||||
</resources> |
</resources> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<resources> |
||||
|
<style name="RadioButtonStyle" parent="Widget.AppCompat.CompoundButton.RadioButton"> |
||||
|
<item name="android:textColor">@color/radio_button_text_color</item> |
||||
|
<item name="android:paddingStart">8dp</item> |
||||
|
<item name="android:paddingTop">12dp</item> |
||||
|
<item name="android:paddingBottom">12dp</item> |
||||
|
<item name="android:buttonTint">?attr/colorPrimary</item> |
||||
|
</style> |
||||
|
</resources> |
||||