From 566ec4bf7c286e3aacf91e26ba6784eee9805c0b Mon Sep 17 00:00:00 2001 From: angrezichatterbox Date: Wed, 21 Aug 2024 20:25:48 +0530 Subject: [PATCH 1/4] feat:Upgraded gradle to 8.5.2 --- app/build.gradle | 12 ++++++----- app/src/main/{kotlin => java}/be/scri/App.kt | 0 .../be/scri/activities/AboutActivity.kt | 0 .../be/scri/activities/BaseSimpleActivity.kt | 0 .../be/scri/activities/BaseSplashActivity.kt | 0 .../be/scri/activities/LanguageSettings.kt | 20 +++++++++++++++++++ .../be/scri/activities/MainActivity.kt | 0 .../be/scri/activities/SettingsActivity.kt | 0 .../be/scri/activities/SimpleActivity.kt | 0 .../be/scri/activities/SplashActivity.kt | 0 .../activities/WikimediaScribeActivity.kt | 0 .../be/scri/databases/ClipsDatabase.kt | 0 .../be/scri/dialogs/AppSideloadedDialog.kt | 0 .../dialogs/ConfirmationAdvancedDialog.kt | 0 .../be/scri/dialogs/ConfirmationDialog.kt | 0 .../dialogs/CustomIntervalPickerDialog.kt | 0 .../be/scri/dialogs/RadioGroupDialog.kt | 0 .../be/scri/dialogs/WritePermissionDialog.kt | 0 .../be/scri/extensions/Activity-sdk30.kt | 0 .../be/scri/extensions/Activity-themes.kt | 0 .../be/scri/extensions/Activity.kt | 0 .../be/scri/extensions/AlertDialog.kt | 0 .../be/scri/extensions/Any.kt | 0 .../be/scri/extensions/App.kt | 0 .../be/scri/extensions/ArrayList.kt | 0 .../be/scri/extensions/BufferedWriter.kt | 0 .../be/scri/extensions/CommonsContext.kt | 0 .../scri/extensions/Context-storage-sdk30.kt | 0 .../be/scri/extensions/Context-storage.kt | 0 .../be/scri/extensions/Context-styling.kt | 0 .../be/scri/extensions/Context.kt | 0 .../be/scri/extensions/Cursor.kt | 0 .../be/scri/extensions/DocumentFile.kt | 0 .../be/scri/extensions/Drawable.kt | 0 .../be/scri/extensions/EditText.kt | 0 .../be/scri/extensions/Editable.kt | 0 .../be/scri/extensions/ExifInterface.kt | 0 .../be/scri/extensions/File.kt | 0 .../be/scri/extensions/ImageView.kt | 0 .../be/scri/extensions/InputStream.kt | 0 .../be/scri/extensions/Int.kt | 0 .../be/scri/extensions/List.kt | 0 .../be/scri/extensions/Long.kt | 0 .../be/scri/extensions/Point.kt | 0 .../be/scri/extensions/RemoteViews.kt | 0 .../be/scri/extensions/Resources.kt | 0 .../be/scri/extensions/SeekBar.kt | 0 .../be/scri/extensions/String.kt | 0 .../be/scri/extensions/TabLayout.kt | 0 .../be/scri/extensions/TextView.kt | 0 .../be/scri/extensions/View.kt | 0 .../be/scri/extensions/ViewPager.kt | 0 .../be/scri/helpers/AlphanumericComparator.kt | 0 .../be/scri/helpers/BaseConfig.kt | 0 .../be/scri/helpers/ClipsHelper.kt | 0 .../be/scri/helpers/CommonsConstants.kt | 0 .../be/scri/helpers/Config.kt | 0 .../be/scri/helpers/Constants.kt | 0 .../be/scri/helpers/CustomAdapter.kt | 0 .../helpers/ExternalStorageProviderHack.kt | 0 .../be/scri/helpers/MyContentProvider.kt | 0 .../be/scri/helpers/MyContextWrapper.kt | 0 .../be/scri/helpers/MyKeyboard.kt | 0 .../be/scri/helpers/String.kt | 0 .../be/scri/interfaces/ClipsDao.kt | 0 .../be/scri/interfaces/HashListener.kt | 0 .../interfaces/LineColorPickerListener.kt | 0 .../scri/interfaces/MyActionModeCallback.kt | 0 .../scri/interfaces/RefreshClipsListener.kt | 0 .../be/scri/interfaces/RenameTab.kt | 0 .../be/scri/interfaces/SecurityTab.kt | 0 .../be/scri/models/AlarmSound.kt | 0 .../be/scri/models/Android30RenameFormat.kt | 0 .../be/scri/models/BlockedNumber.kt | 0 .../{kotlin => java}/be/scri/models/Clip.kt | 0 .../be/scri/models/ClipsSectionLabel.kt | 0 .../be/scri/models/FileDirItem.kt | 0 .../be/scri/models/ImageItem.kt} | 0 .../be/scri/models/ListItem.kt | 0 .../be/scri/models/MyTheme.kt | 0 .../be/scri/models/RadioItem.kt | 0 .../be/scri/models/SharedTheme.kt | 0 .../main/java/be/scri/models/SwitchItem.kt | 3 +++ app/src/main/java/be/scri/models/TextItem.kt | 3 +++ .../be/scri/services/EnglishKeyboardIME.kt | 0 .../be/scri/services/FrenchKeyboardIME.kt | 0 .../be/scri/services/GermanKeyboardIME.kt | 0 .../be/scri/services/ItalianKeyboardIME.kt | 0 .../be/scri/services/PortugueseKeyboardIME.kt | 0 .../be/scri/services/RussianKeyboardIME.kt | 0 .../be/scri/services/SimpleKeyboardIME.kt | 0 .../be/scri/services/SpanishKeyboardIME.kt | 0 .../be/scri/services/SwedishKeyboardIME.kt | 0 .../be/scri/views/LineColorPicker.kt | 0 .../be/scri/views/MyAppCompatCheckbox.kt | 0 .../be/scri/views/MyCompatRadioButton.kt | 0 .../be/scri/views/MyEditText.kt | 0 .../be/scri/views/MyFloatingActionButton.kt | 0 .../be/scri/views/MyKeyboardView.kt | 0 .../be/scri/views/MyLinearLayoutManager.kt | 0 .../be/scri/views/MyScrollView.kt | 0 .../be/scri/views/MyTextView.kt | 0 .../BottomActionMenuCallback.kt | 0 .../bottomactionmenu/BottomActionMenuItem.kt | 0 .../BottomActionMenuItemPopup.kt | 0 .../bottomactionmenu/BottomActionMenuView.kt | 0 .../main/res/drawable/rounded_all_corners.xml | 4 ++++ .../res/layout/activity_language_settings.xml | 10 ++++++++++ app/src/main/res/layout/card_view_text.xml | 6 ++++++ ...ew_design.xml => card_view_with_image.xml} | 0 .../main/res/layout/card_view_with_switch.xml | 6 ++++++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 113 files changed, 61 insertions(+), 7 deletions(-) rename app/src/main/{kotlin => java}/be/scri/App.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/AboutActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/BaseSimpleActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/BaseSplashActivity.kt (100%) create mode 100644 app/src/main/java/be/scri/activities/LanguageSettings.kt rename app/src/main/{kotlin => java}/be/scri/activities/MainActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/SettingsActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/SimpleActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/SplashActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/activities/WikimediaScribeActivity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/databases/ClipsDatabase.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/AppSideloadedDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/ConfirmationAdvancedDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/ConfirmationDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/CustomIntervalPickerDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/RadioGroupDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/dialogs/WritePermissionDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Activity-sdk30.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Activity-themes.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Activity.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/AlertDialog.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Any.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/App.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/ArrayList.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/BufferedWriter.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/CommonsContext.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Context-storage-sdk30.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Context-storage.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Context-styling.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Context.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Cursor.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/DocumentFile.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Drawable.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/EditText.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Editable.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/ExifInterface.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/File.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/ImageView.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/InputStream.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Int.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/List.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Long.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Point.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/RemoteViews.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/Resources.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/SeekBar.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/String.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/TabLayout.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/TextView.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/View.kt (100%) rename app/src/main/{kotlin => java}/be/scri/extensions/ViewPager.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/AlphanumericComparator.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/BaseConfig.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/ClipsHelper.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/CommonsConstants.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/Config.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/Constants.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/CustomAdapter.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/ExternalStorageProviderHack.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/MyContentProvider.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/MyContextWrapper.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/MyKeyboard.kt (100%) rename app/src/main/{kotlin => java}/be/scri/helpers/String.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/ClipsDao.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/HashListener.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/LineColorPickerListener.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/MyActionModeCallback.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/RefreshClipsListener.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/RenameTab.kt (100%) rename app/src/main/{kotlin => java}/be/scri/interfaces/SecurityTab.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/AlarmSound.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/Android30RenameFormat.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/BlockedNumber.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/Clip.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/ClipsSectionLabel.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/FileDirItem.kt (100%) rename app/src/main/{kotlin/be/scri/models/ItemsViewModel.kt => java/be/scri/models/ImageItem.kt} (100%) rename app/src/main/{kotlin => java}/be/scri/models/ListItem.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/MyTheme.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/RadioItem.kt (100%) rename app/src/main/{kotlin => java}/be/scri/models/SharedTheme.kt (100%) create mode 100644 app/src/main/java/be/scri/models/SwitchItem.kt create mode 100644 app/src/main/java/be/scri/models/TextItem.kt rename app/src/main/{kotlin => java}/be/scri/services/EnglishKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/FrenchKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/GermanKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/ItalianKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/PortugueseKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/RussianKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/SimpleKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/SpanishKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/services/SwedishKeyboardIME.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/LineColorPicker.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyAppCompatCheckbox.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyCompatRadioButton.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyEditText.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyFloatingActionButton.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyKeyboardView.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyLinearLayoutManager.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyScrollView.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/MyTextView.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/bottomactionmenu/BottomActionMenuCallback.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/bottomactionmenu/BottomActionMenuItem.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/bottomactionmenu/BottomActionMenuItemPopup.kt (100%) rename app/src/main/{kotlin => java}/be/scri/views/bottomactionmenu/BottomActionMenuView.kt (100%) create mode 100644 app/src/main/res/drawable/rounded_all_corners.xml create mode 100644 app/src/main/res/layout/activity_language_settings.xml create mode 100644 app/src/main/res/layout/card_view_text.xml rename app/src/main/res/layout/{card_view_design.xml => card_view_with_image.xml} (100%) create mode 100644 app/src/main/res/layout/card_view_with_switch.xml diff --git a/app/build.gradle b/app/build.gradle index b80abd32..7b420aa3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,13 +11,13 @@ if (keystorePropertiesFile.exists()) { android { compileSdk 34 - - - + buildFeatures { + viewBinding = true + } defaultConfig { applicationId "be.scri" - minSdk 23 - targetSdk 31 + minSdk 26 + targetSdk 34 versionCode 7 versionName "1.0.0" multiDexEnabled true @@ -67,6 +67,8 @@ android { } dependencies { + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.activity:activity-ktx:1.9.1' kapt 'androidx.room:room-compiler:2.6.1' implementation 'androidx.room:room-runtime:2.6.1' annotationProcessor 'androidx.room:room-compiler:2.6.1' diff --git a/app/src/main/kotlin/be/scri/App.kt b/app/src/main/java/be/scri/App.kt similarity index 100% rename from app/src/main/kotlin/be/scri/App.kt rename to app/src/main/java/be/scri/App.kt diff --git a/app/src/main/kotlin/be/scri/activities/AboutActivity.kt b/app/src/main/java/be/scri/activities/AboutActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/AboutActivity.kt rename to app/src/main/java/be/scri/activities/AboutActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/BaseSimpleActivity.kt b/app/src/main/java/be/scri/activities/BaseSimpleActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/BaseSimpleActivity.kt rename to app/src/main/java/be/scri/activities/BaseSimpleActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/BaseSplashActivity.kt b/app/src/main/java/be/scri/activities/BaseSplashActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/BaseSplashActivity.kt rename to app/src/main/java/be/scri/activities/BaseSplashActivity.kt diff --git a/app/src/main/java/be/scri/activities/LanguageSettings.kt b/app/src/main/java/be/scri/activities/LanguageSettings.kt new file mode 100644 index 00000000..c6e27b74 --- /dev/null +++ b/app/src/main/java/be/scri/activities/LanguageSettings.kt @@ -0,0 +1,20 @@ +package be.scri + +import android.os.Bundle +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat + +class LanguageSettings : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContentView(R.layout.activity_language_settings) + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> + val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) + insets + } + } +} \ No newline at end of file diff --git a/app/src/main/kotlin/be/scri/activities/MainActivity.kt b/app/src/main/java/be/scri/activities/MainActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/MainActivity.kt rename to app/src/main/java/be/scri/activities/MainActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/SettingsActivity.kt b/app/src/main/java/be/scri/activities/SettingsActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/SettingsActivity.kt rename to app/src/main/java/be/scri/activities/SettingsActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/SimpleActivity.kt b/app/src/main/java/be/scri/activities/SimpleActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/SimpleActivity.kt rename to app/src/main/java/be/scri/activities/SimpleActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/SplashActivity.kt b/app/src/main/java/be/scri/activities/SplashActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/SplashActivity.kt rename to app/src/main/java/be/scri/activities/SplashActivity.kt diff --git a/app/src/main/kotlin/be/scri/activities/WikimediaScribeActivity.kt b/app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/activities/WikimediaScribeActivity.kt rename to app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt diff --git a/app/src/main/kotlin/be/scri/databases/ClipsDatabase.kt b/app/src/main/java/be/scri/databases/ClipsDatabase.kt similarity index 100% rename from app/src/main/kotlin/be/scri/databases/ClipsDatabase.kt rename to app/src/main/java/be/scri/databases/ClipsDatabase.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/AppSideloadedDialog.kt b/app/src/main/java/be/scri/dialogs/AppSideloadedDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/AppSideloadedDialog.kt rename to app/src/main/java/be/scri/dialogs/AppSideloadedDialog.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/ConfirmationAdvancedDialog.kt b/app/src/main/java/be/scri/dialogs/ConfirmationAdvancedDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/ConfirmationAdvancedDialog.kt rename to app/src/main/java/be/scri/dialogs/ConfirmationAdvancedDialog.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/ConfirmationDialog.kt b/app/src/main/java/be/scri/dialogs/ConfirmationDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/ConfirmationDialog.kt rename to app/src/main/java/be/scri/dialogs/ConfirmationDialog.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/CustomIntervalPickerDialog.kt b/app/src/main/java/be/scri/dialogs/CustomIntervalPickerDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/CustomIntervalPickerDialog.kt rename to app/src/main/java/be/scri/dialogs/CustomIntervalPickerDialog.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/RadioGroupDialog.kt b/app/src/main/java/be/scri/dialogs/RadioGroupDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/RadioGroupDialog.kt rename to app/src/main/java/be/scri/dialogs/RadioGroupDialog.kt diff --git a/app/src/main/kotlin/be/scri/dialogs/WritePermissionDialog.kt b/app/src/main/java/be/scri/dialogs/WritePermissionDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/dialogs/WritePermissionDialog.kt rename to app/src/main/java/be/scri/dialogs/WritePermissionDialog.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Activity-sdk30.kt b/app/src/main/java/be/scri/extensions/Activity-sdk30.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Activity-sdk30.kt rename to app/src/main/java/be/scri/extensions/Activity-sdk30.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Activity-themes.kt b/app/src/main/java/be/scri/extensions/Activity-themes.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Activity-themes.kt rename to app/src/main/java/be/scri/extensions/Activity-themes.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Activity.kt b/app/src/main/java/be/scri/extensions/Activity.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Activity.kt rename to app/src/main/java/be/scri/extensions/Activity.kt diff --git a/app/src/main/kotlin/be/scri/extensions/AlertDialog.kt b/app/src/main/java/be/scri/extensions/AlertDialog.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/AlertDialog.kt rename to app/src/main/java/be/scri/extensions/AlertDialog.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Any.kt b/app/src/main/java/be/scri/extensions/Any.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Any.kt rename to app/src/main/java/be/scri/extensions/Any.kt diff --git a/app/src/main/kotlin/be/scri/extensions/App.kt b/app/src/main/java/be/scri/extensions/App.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/App.kt rename to app/src/main/java/be/scri/extensions/App.kt diff --git a/app/src/main/kotlin/be/scri/extensions/ArrayList.kt b/app/src/main/java/be/scri/extensions/ArrayList.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/ArrayList.kt rename to app/src/main/java/be/scri/extensions/ArrayList.kt diff --git a/app/src/main/kotlin/be/scri/extensions/BufferedWriter.kt b/app/src/main/java/be/scri/extensions/BufferedWriter.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/BufferedWriter.kt rename to app/src/main/java/be/scri/extensions/BufferedWriter.kt diff --git a/app/src/main/kotlin/be/scri/extensions/CommonsContext.kt b/app/src/main/java/be/scri/extensions/CommonsContext.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/CommonsContext.kt rename to app/src/main/java/be/scri/extensions/CommonsContext.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Context-storage-sdk30.kt b/app/src/main/java/be/scri/extensions/Context-storage-sdk30.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Context-storage-sdk30.kt rename to app/src/main/java/be/scri/extensions/Context-storage-sdk30.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Context-storage.kt b/app/src/main/java/be/scri/extensions/Context-storage.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Context-storage.kt rename to app/src/main/java/be/scri/extensions/Context-storage.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Context-styling.kt b/app/src/main/java/be/scri/extensions/Context-styling.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Context-styling.kt rename to app/src/main/java/be/scri/extensions/Context-styling.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Context.kt b/app/src/main/java/be/scri/extensions/Context.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Context.kt rename to app/src/main/java/be/scri/extensions/Context.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Cursor.kt b/app/src/main/java/be/scri/extensions/Cursor.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Cursor.kt rename to app/src/main/java/be/scri/extensions/Cursor.kt diff --git a/app/src/main/kotlin/be/scri/extensions/DocumentFile.kt b/app/src/main/java/be/scri/extensions/DocumentFile.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/DocumentFile.kt rename to app/src/main/java/be/scri/extensions/DocumentFile.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Drawable.kt b/app/src/main/java/be/scri/extensions/Drawable.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Drawable.kt rename to app/src/main/java/be/scri/extensions/Drawable.kt diff --git a/app/src/main/kotlin/be/scri/extensions/EditText.kt b/app/src/main/java/be/scri/extensions/EditText.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/EditText.kt rename to app/src/main/java/be/scri/extensions/EditText.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Editable.kt b/app/src/main/java/be/scri/extensions/Editable.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Editable.kt rename to app/src/main/java/be/scri/extensions/Editable.kt diff --git a/app/src/main/kotlin/be/scri/extensions/ExifInterface.kt b/app/src/main/java/be/scri/extensions/ExifInterface.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/ExifInterface.kt rename to app/src/main/java/be/scri/extensions/ExifInterface.kt diff --git a/app/src/main/kotlin/be/scri/extensions/File.kt b/app/src/main/java/be/scri/extensions/File.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/File.kt rename to app/src/main/java/be/scri/extensions/File.kt diff --git a/app/src/main/kotlin/be/scri/extensions/ImageView.kt b/app/src/main/java/be/scri/extensions/ImageView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/ImageView.kt rename to app/src/main/java/be/scri/extensions/ImageView.kt diff --git a/app/src/main/kotlin/be/scri/extensions/InputStream.kt b/app/src/main/java/be/scri/extensions/InputStream.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/InputStream.kt rename to app/src/main/java/be/scri/extensions/InputStream.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Int.kt b/app/src/main/java/be/scri/extensions/Int.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Int.kt rename to app/src/main/java/be/scri/extensions/Int.kt diff --git a/app/src/main/kotlin/be/scri/extensions/List.kt b/app/src/main/java/be/scri/extensions/List.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/List.kt rename to app/src/main/java/be/scri/extensions/List.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Long.kt b/app/src/main/java/be/scri/extensions/Long.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Long.kt rename to app/src/main/java/be/scri/extensions/Long.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Point.kt b/app/src/main/java/be/scri/extensions/Point.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Point.kt rename to app/src/main/java/be/scri/extensions/Point.kt diff --git a/app/src/main/kotlin/be/scri/extensions/RemoteViews.kt b/app/src/main/java/be/scri/extensions/RemoteViews.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/RemoteViews.kt rename to app/src/main/java/be/scri/extensions/RemoteViews.kt diff --git a/app/src/main/kotlin/be/scri/extensions/Resources.kt b/app/src/main/java/be/scri/extensions/Resources.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/Resources.kt rename to app/src/main/java/be/scri/extensions/Resources.kt diff --git a/app/src/main/kotlin/be/scri/extensions/SeekBar.kt b/app/src/main/java/be/scri/extensions/SeekBar.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/SeekBar.kt rename to app/src/main/java/be/scri/extensions/SeekBar.kt diff --git a/app/src/main/kotlin/be/scri/extensions/String.kt b/app/src/main/java/be/scri/extensions/String.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/String.kt rename to app/src/main/java/be/scri/extensions/String.kt diff --git a/app/src/main/kotlin/be/scri/extensions/TabLayout.kt b/app/src/main/java/be/scri/extensions/TabLayout.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/TabLayout.kt rename to app/src/main/java/be/scri/extensions/TabLayout.kt diff --git a/app/src/main/kotlin/be/scri/extensions/TextView.kt b/app/src/main/java/be/scri/extensions/TextView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/TextView.kt rename to app/src/main/java/be/scri/extensions/TextView.kt diff --git a/app/src/main/kotlin/be/scri/extensions/View.kt b/app/src/main/java/be/scri/extensions/View.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/View.kt rename to app/src/main/java/be/scri/extensions/View.kt diff --git a/app/src/main/kotlin/be/scri/extensions/ViewPager.kt b/app/src/main/java/be/scri/extensions/ViewPager.kt similarity index 100% rename from app/src/main/kotlin/be/scri/extensions/ViewPager.kt rename to app/src/main/java/be/scri/extensions/ViewPager.kt diff --git a/app/src/main/kotlin/be/scri/helpers/AlphanumericComparator.kt b/app/src/main/java/be/scri/helpers/AlphanumericComparator.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/AlphanumericComparator.kt rename to app/src/main/java/be/scri/helpers/AlphanumericComparator.kt diff --git a/app/src/main/kotlin/be/scri/helpers/BaseConfig.kt b/app/src/main/java/be/scri/helpers/BaseConfig.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/BaseConfig.kt rename to app/src/main/java/be/scri/helpers/BaseConfig.kt diff --git a/app/src/main/kotlin/be/scri/helpers/ClipsHelper.kt b/app/src/main/java/be/scri/helpers/ClipsHelper.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/ClipsHelper.kt rename to app/src/main/java/be/scri/helpers/ClipsHelper.kt diff --git a/app/src/main/kotlin/be/scri/helpers/CommonsConstants.kt b/app/src/main/java/be/scri/helpers/CommonsConstants.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/CommonsConstants.kt rename to app/src/main/java/be/scri/helpers/CommonsConstants.kt diff --git a/app/src/main/kotlin/be/scri/helpers/Config.kt b/app/src/main/java/be/scri/helpers/Config.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/Config.kt rename to app/src/main/java/be/scri/helpers/Config.kt diff --git a/app/src/main/kotlin/be/scri/helpers/Constants.kt b/app/src/main/java/be/scri/helpers/Constants.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/Constants.kt rename to app/src/main/java/be/scri/helpers/Constants.kt diff --git a/app/src/main/kotlin/be/scri/helpers/CustomAdapter.kt b/app/src/main/java/be/scri/helpers/CustomAdapter.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/CustomAdapter.kt rename to app/src/main/java/be/scri/helpers/CustomAdapter.kt diff --git a/app/src/main/kotlin/be/scri/helpers/ExternalStorageProviderHack.kt b/app/src/main/java/be/scri/helpers/ExternalStorageProviderHack.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/ExternalStorageProviderHack.kt rename to app/src/main/java/be/scri/helpers/ExternalStorageProviderHack.kt diff --git a/app/src/main/kotlin/be/scri/helpers/MyContentProvider.kt b/app/src/main/java/be/scri/helpers/MyContentProvider.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/MyContentProvider.kt rename to app/src/main/java/be/scri/helpers/MyContentProvider.kt diff --git a/app/src/main/kotlin/be/scri/helpers/MyContextWrapper.kt b/app/src/main/java/be/scri/helpers/MyContextWrapper.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/MyContextWrapper.kt rename to app/src/main/java/be/scri/helpers/MyContextWrapper.kt diff --git a/app/src/main/kotlin/be/scri/helpers/MyKeyboard.kt b/app/src/main/java/be/scri/helpers/MyKeyboard.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/MyKeyboard.kt rename to app/src/main/java/be/scri/helpers/MyKeyboard.kt diff --git a/app/src/main/kotlin/be/scri/helpers/String.kt b/app/src/main/java/be/scri/helpers/String.kt similarity index 100% rename from app/src/main/kotlin/be/scri/helpers/String.kt rename to app/src/main/java/be/scri/helpers/String.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/ClipsDao.kt b/app/src/main/java/be/scri/interfaces/ClipsDao.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/ClipsDao.kt rename to app/src/main/java/be/scri/interfaces/ClipsDao.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/HashListener.kt b/app/src/main/java/be/scri/interfaces/HashListener.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/HashListener.kt rename to app/src/main/java/be/scri/interfaces/HashListener.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/LineColorPickerListener.kt b/app/src/main/java/be/scri/interfaces/LineColorPickerListener.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/LineColorPickerListener.kt rename to app/src/main/java/be/scri/interfaces/LineColorPickerListener.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/MyActionModeCallback.kt b/app/src/main/java/be/scri/interfaces/MyActionModeCallback.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/MyActionModeCallback.kt rename to app/src/main/java/be/scri/interfaces/MyActionModeCallback.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/RefreshClipsListener.kt b/app/src/main/java/be/scri/interfaces/RefreshClipsListener.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/RefreshClipsListener.kt rename to app/src/main/java/be/scri/interfaces/RefreshClipsListener.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/RenameTab.kt b/app/src/main/java/be/scri/interfaces/RenameTab.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/RenameTab.kt rename to app/src/main/java/be/scri/interfaces/RenameTab.kt diff --git a/app/src/main/kotlin/be/scri/interfaces/SecurityTab.kt b/app/src/main/java/be/scri/interfaces/SecurityTab.kt similarity index 100% rename from app/src/main/kotlin/be/scri/interfaces/SecurityTab.kt rename to app/src/main/java/be/scri/interfaces/SecurityTab.kt diff --git a/app/src/main/kotlin/be/scri/models/AlarmSound.kt b/app/src/main/java/be/scri/models/AlarmSound.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/AlarmSound.kt rename to app/src/main/java/be/scri/models/AlarmSound.kt diff --git a/app/src/main/kotlin/be/scri/models/Android30RenameFormat.kt b/app/src/main/java/be/scri/models/Android30RenameFormat.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/Android30RenameFormat.kt rename to app/src/main/java/be/scri/models/Android30RenameFormat.kt diff --git a/app/src/main/kotlin/be/scri/models/BlockedNumber.kt b/app/src/main/java/be/scri/models/BlockedNumber.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/BlockedNumber.kt rename to app/src/main/java/be/scri/models/BlockedNumber.kt diff --git a/app/src/main/kotlin/be/scri/models/Clip.kt b/app/src/main/java/be/scri/models/Clip.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/Clip.kt rename to app/src/main/java/be/scri/models/Clip.kt diff --git a/app/src/main/kotlin/be/scri/models/ClipsSectionLabel.kt b/app/src/main/java/be/scri/models/ClipsSectionLabel.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/ClipsSectionLabel.kt rename to app/src/main/java/be/scri/models/ClipsSectionLabel.kt diff --git a/app/src/main/kotlin/be/scri/models/FileDirItem.kt b/app/src/main/java/be/scri/models/FileDirItem.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/FileDirItem.kt rename to app/src/main/java/be/scri/models/FileDirItem.kt diff --git a/app/src/main/kotlin/be/scri/models/ItemsViewModel.kt b/app/src/main/java/be/scri/models/ImageItem.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/ItemsViewModel.kt rename to app/src/main/java/be/scri/models/ImageItem.kt diff --git a/app/src/main/kotlin/be/scri/models/ListItem.kt b/app/src/main/java/be/scri/models/ListItem.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/ListItem.kt rename to app/src/main/java/be/scri/models/ListItem.kt diff --git a/app/src/main/kotlin/be/scri/models/MyTheme.kt b/app/src/main/java/be/scri/models/MyTheme.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/MyTheme.kt rename to app/src/main/java/be/scri/models/MyTheme.kt diff --git a/app/src/main/kotlin/be/scri/models/RadioItem.kt b/app/src/main/java/be/scri/models/RadioItem.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/RadioItem.kt rename to app/src/main/java/be/scri/models/RadioItem.kt diff --git a/app/src/main/kotlin/be/scri/models/SharedTheme.kt b/app/src/main/java/be/scri/models/SharedTheme.kt similarity index 100% rename from app/src/main/kotlin/be/scri/models/SharedTheme.kt rename to app/src/main/java/be/scri/models/SharedTheme.kt diff --git a/app/src/main/java/be/scri/models/SwitchItem.kt b/app/src/main/java/be/scri/models/SwitchItem.kt new file mode 100644 index 00000000..6da9b3e9 --- /dev/null +++ b/app/src/main/java/be/scri/models/SwitchItem.kt @@ -0,0 +1,3 @@ +package be.scri.models + +data class SwitchItem() diff --git a/app/src/main/java/be/scri/models/TextItem.kt b/app/src/main/java/be/scri/models/TextItem.kt new file mode 100644 index 00000000..422391c6 --- /dev/null +++ b/app/src/main/java/be/scri/models/TextItem.kt @@ -0,0 +1,3 @@ +package be.scri.models + +data class TextItem() diff --git a/app/src/main/kotlin/be/scri/services/EnglishKeyboardIME.kt b/app/src/main/java/be/scri/services/EnglishKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/EnglishKeyboardIME.kt rename to app/src/main/java/be/scri/services/EnglishKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/FrenchKeyboardIME.kt b/app/src/main/java/be/scri/services/FrenchKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/FrenchKeyboardIME.kt rename to app/src/main/java/be/scri/services/FrenchKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/GermanKeyboardIME.kt b/app/src/main/java/be/scri/services/GermanKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/GermanKeyboardIME.kt rename to app/src/main/java/be/scri/services/GermanKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/ItalianKeyboardIME.kt b/app/src/main/java/be/scri/services/ItalianKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/ItalianKeyboardIME.kt rename to app/src/main/java/be/scri/services/ItalianKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/PortugueseKeyboardIME.kt b/app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/PortugueseKeyboardIME.kt rename to app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/RussianKeyboardIME.kt b/app/src/main/java/be/scri/services/RussianKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/RussianKeyboardIME.kt rename to app/src/main/java/be/scri/services/RussianKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/SimpleKeyboardIME.kt b/app/src/main/java/be/scri/services/SimpleKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/SimpleKeyboardIME.kt rename to app/src/main/java/be/scri/services/SimpleKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/SpanishKeyboardIME.kt b/app/src/main/java/be/scri/services/SpanishKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/SpanishKeyboardIME.kt rename to app/src/main/java/be/scri/services/SpanishKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/services/SwedishKeyboardIME.kt b/app/src/main/java/be/scri/services/SwedishKeyboardIME.kt similarity index 100% rename from app/src/main/kotlin/be/scri/services/SwedishKeyboardIME.kt rename to app/src/main/java/be/scri/services/SwedishKeyboardIME.kt diff --git a/app/src/main/kotlin/be/scri/views/LineColorPicker.kt b/app/src/main/java/be/scri/views/LineColorPicker.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/LineColorPicker.kt rename to app/src/main/java/be/scri/views/LineColorPicker.kt diff --git a/app/src/main/kotlin/be/scri/views/MyAppCompatCheckbox.kt b/app/src/main/java/be/scri/views/MyAppCompatCheckbox.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyAppCompatCheckbox.kt rename to app/src/main/java/be/scri/views/MyAppCompatCheckbox.kt diff --git a/app/src/main/kotlin/be/scri/views/MyCompatRadioButton.kt b/app/src/main/java/be/scri/views/MyCompatRadioButton.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyCompatRadioButton.kt rename to app/src/main/java/be/scri/views/MyCompatRadioButton.kt diff --git a/app/src/main/kotlin/be/scri/views/MyEditText.kt b/app/src/main/java/be/scri/views/MyEditText.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyEditText.kt rename to app/src/main/java/be/scri/views/MyEditText.kt diff --git a/app/src/main/kotlin/be/scri/views/MyFloatingActionButton.kt b/app/src/main/java/be/scri/views/MyFloatingActionButton.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyFloatingActionButton.kt rename to app/src/main/java/be/scri/views/MyFloatingActionButton.kt diff --git a/app/src/main/kotlin/be/scri/views/MyKeyboardView.kt b/app/src/main/java/be/scri/views/MyKeyboardView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyKeyboardView.kt rename to app/src/main/java/be/scri/views/MyKeyboardView.kt diff --git a/app/src/main/kotlin/be/scri/views/MyLinearLayoutManager.kt b/app/src/main/java/be/scri/views/MyLinearLayoutManager.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyLinearLayoutManager.kt rename to app/src/main/java/be/scri/views/MyLinearLayoutManager.kt diff --git a/app/src/main/kotlin/be/scri/views/MyScrollView.kt b/app/src/main/java/be/scri/views/MyScrollView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyScrollView.kt rename to app/src/main/java/be/scri/views/MyScrollView.kt diff --git a/app/src/main/kotlin/be/scri/views/MyTextView.kt b/app/src/main/java/be/scri/views/MyTextView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/MyTextView.kt rename to app/src/main/java/be/scri/views/MyTextView.kt diff --git a/app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuCallback.kt b/app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuCallback.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuCallback.kt rename to app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuCallback.kt diff --git a/app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuItem.kt b/app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuItem.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuItem.kt rename to app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuItem.kt diff --git a/app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuItemPopup.kt b/app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuItemPopup.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuItemPopup.kt rename to app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuItemPopup.kt diff --git a/app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuView.kt b/app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuView.kt similarity index 100% rename from app/src/main/kotlin/be/scri/views/bottomactionmenu/BottomActionMenuView.kt rename to app/src/main/java/be/scri/views/bottomactionmenu/BottomActionMenuView.kt diff --git a/app/src/main/res/drawable/rounded_all_corners.xml b/app/src/main/res/drawable/rounded_all_corners.xml new file mode 100644 index 00000000..81de3664 --- /dev/null +++ b/app/src/main/res/drawable/rounded_all_corners.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/activity_language_settings.xml b/app/src/main/res/layout/activity_language_settings.xml new file mode 100644 index 00000000..58f26217 --- /dev/null +++ b/app/src/main/res/layout/activity_language_settings.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/layout/card_view_text.xml b/app/src/main/res/layout/card_view_text.xml new file mode 100644 index 00000000..506660a8 --- /dev/null +++ b/app/src/main/res/layout/card_view_text.xml @@ -0,0 +1,6 @@ + + + + diff --git a/app/src/main/res/layout/card_view_design.xml b/app/src/main/res/layout/card_view_with_image.xml similarity index 100% rename from app/src/main/res/layout/card_view_design.xml rename to app/src/main/res/layout/card_view_with_image.xml diff --git a/app/src/main/res/layout/card_view_with_switch.xml b/app/src/main/res/layout/card_view_with_switch.xml new file mode 100644 index 00000000..506660a8 --- /dev/null +++ b/app/src/main/res/layout/card_view_with_switch.xml @@ -0,0 +1,6 @@ + + + + diff --git a/build.gradle b/build.gradle index 5a9f0f3a..1d0448ea 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.4.1' + classpath 'com.android.tools.build:gradle:8.5.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c6729007..5deb3fd8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Jan 04 09:48:27 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME From a7195e7bf78a94a8d3939fdc481b79aa22e8a36f Mon Sep 17 00:00:00 2001 From: angrezichatterbox Date: Wed, 21 Aug 2024 20:32:28 +0530 Subject: [PATCH 2/4] feat:Added the services with period on double tap in individual keyboard --- app/src/main/AndroidManifest.xml | 73 +++++---- .../java/be/scri/activities/AboutActivity.kt | 35 ++--- .../activities/WikimediaScribeActivity.kt | 1 + app/src/main/java/be/scri/helpers/Config.kt | 2 + .../java/be/scri/helpers/CustomAdapter.kt | 142 ++++++++++++++---- app/src/main/java/be/scri/models/ImageItem.kt | 2 +- .../be/scri/services/EnglishKeyboardIME.kt | 16 ++ .../be/scri/services/FrenchKeyboardIME.kt | 19 +++ .../be/scri/services/GermanKeyboardIME.kt | 18 +++ .../be/scri/services/ItalianKeyboardIME.kt | 17 +++ .../be/scri/services/PortugueseKeyboardIME.kt | 17 +++ .../be/scri/services/RussianKeyboardIME.kt | 20 +++ .../be/scri/services/SimpleKeyboardIME.kt | 1 + .../be/scri/services/SpanishKeyboardIME.kt | 14 ++ .../be/scri/services/SwedishKeyboardIME.kt | 14 ++ 15 files changed, 310 insertions(+), 81 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7a697597..625e4c18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,11 +2,9 @@ - - @@ -17,114 +15,133 @@ android:appCategory="productivity" android:icon="@mipmap/ic_launcher" android:label="@string/app_launcher_name" + android:localeConfig="@xml/locales_config" android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" - android:theme="@style/AppTheme" - android:localeConfig="@xml/locales_config"> - + android:theme="@style/AppTheme"> + + + + + + + + + - + - + + + + + + @@ -135,37 +152,27 @@ android:exported="true" android:label="@string/app.settings.title" android:parentActivityName=".activities.MainActivity"> - - + - - - - - - - - + + diff --git a/app/src/main/java/be/scri/activities/AboutActivity.kt b/app/src/main/java/be/scri/activities/AboutActivity.kt index 1f166cbc..7b610b00 100644 --- a/app/src/main/java/be/scri/activities/AboutActivity.kt +++ b/app/src/main/java/be/scri/activities/AboutActivity.kt @@ -1,5 +1,6 @@ package be.scri.activities + import android.content.Intent import android.os.Bundle import android.view.GestureDetector @@ -12,7 +13,7 @@ import kotlinx.android.synthetic.main.activity_about.* import be.scri.R import be.scri.extensions.* import be.scri.helpers.* -import be.scri.models.ItemsViewModel +import be.scri.models.ImageItem import kotlin.math.abs class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{ @@ -88,27 +89,27 @@ class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{ recyclerView3.suppressLayout(true) } - private fun getFirstRecyclerViewData(): List = listOf( - ItemsViewModel(image = R.drawable.github_logo, textResId = R.string.app_about_github, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android", activity = null, action = null), - ItemsViewModel(image = R.drawable.matrix_icon, textResId = R.string.app_about_matrix, image2 = R.drawable.external_link, url = "https://matrix.to/%23/%23scribe_community:matrix.org", activity = null, action = null), - ItemsViewModel(image = R.drawable.mastodon_svg_icon, textResId = R.string.app_about_mastodon, image2 = R.drawable.external_link, url = "https://wikis.world/@scribe", activity = null, action = null), - ItemsViewModel(image = R.drawable.share_icon, textResId = R.string.app_about_share, image2 = R.drawable.external_link, url = null, activity = null, action = ::shareScribe), - ItemsViewModel(image = R.drawable.scribe_icon, textResId = R.string.app_about_scribe, image2 = R.drawable.external_link, url = null, activity = null, action = null), - ItemsViewModel(image = R.drawable.wikimedia_logo_black, textResId = R.string.app_about_wikimedia, image2 = R.drawable.right_arrow, url = null, activity = WikimediaScribeActivity::class.java, action = null) + private fun getFirstRecyclerViewData(): List = listOf( + ImageItem(image = R.drawable.github_logo, textResId = R.string.app_about_github, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android", activity = null, action = null), + ImageItem(image = R.drawable.matrix_icon, textResId = R.string.app_about_matrix, image2 = R.drawable.external_link, url = "https://matrix.to/%23/%23scribe_community:matrix.org", activity = null, action = null), + ImageItem(image = R.drawable.mastodon_svg_icon, textResId = R.string.app_about_mastodon, image2 = R.drawable.external_link, url = "https://wikis.world/@scribe", activity = null, action = null), + ImageItem(image = R.drawable.share_icon, textResId = R.string.app_about_share, image2 = R.drawable.external_link, url = null, activity = null, action = ::shareScribe), + ImageItem(image = R.drawable.scribe_icon, textResId = R.string.app_about_scribe, image2 = R.drawable.external_link, url = null, activity = null, action = null), + ImageItem(image = R.drawable.wikimedia_logo_black, textResId = R.string.app_about_wikimedia, image2 = R.drawable.right_arrow, url = null, activity = WikimediaScribeActivity::class.java, action = null) ) - private fun getSecondRecyclerViewData(): List = listOf( - ItemsViewModel(image = R.drawable.star, textResId = R.string.app_about_rate, image2 = R.drawable.external_link, url = null, activity = null, action = null), - ItemsViewModel(image = R.drawable.bug_report_icon, textResId = R.string.app_about_bugReport, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android/issues", activity = null, action = null), - ItemsViewModel(image = R.drawable.mail_icon, textResId = R.string.app_about_email, image2 = R.drawable.external_link, url = null, activity = null, action = ::sendEmail), - ItemsViewModel(image = R.drawable.bookmark_icon, textResId = R.string.app_version, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), - ItemsViewModel(image = R.drawable.light_bulb_icon, textResId = R.string.app_about_appHints, image2 = R.drawable.counter_clockwise_icon, url = null, activity = null, action = null) + private fun getSecondRecyclerViewData(): List = listOf( + ImageItem(image = R.drawable.star, textResId = R.string.app_about_rate, image2 = R.drawable.external_link, url = null, activity = null, action = null), + ImageItem(image = R.drawable.bug_report_icon, textResId = R.string.app_about_bugReport, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android/issues", activity = null, action = null), + ImageItem(image = R.drawable.mail_icon, textResId = R.string.app_about_email, image2 = R.drawable.external_link, url = null, activity = null, action = ::sendEmail), + ImageItem(image = R.drawable.bookmark_icon, textResId = R.string.app_version, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), + ImageItem(image = R.drawable.light_bulb_icon, textResId = R.string.app_about_appHints, image2 = R.drawable.counter_clockwise_icon, url = null, activity = null, action = null) ) - private fun getThirdRecyclerViewData(): List { + private fun getThirdRecyclerViewData(): List { return listOf( - ItemsViewModel(image = R.drawable.shield_lock, R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), - ItemsViewModel(image = R.drawable.license_icon, R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = null, action = null) + ImageItem(image = R.drawable.shield_lock, R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), + ImageItem(image = R.drawable.license_icon, R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = null, action = null) ) } diff --git a/app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt b/app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt index dbac3b4e..141c78a6 100644 --- a/app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt +++ b/app/src/main/java/be/scri/activities/WikimediaScribeActivity.kt @@ -1,5 +1,6 @@ package be.scri.activities + import android.content.Intent import android.os.Bundle import androidx.activity.enableEdgeToEdge diff --git a/app/src/main/java/be/scri/helpers/Config.kt b/app/src/main/java/be/scri/helpers/Config.kt index 755fa46c..ef4c8642 100644 --- a/app/src/main/java/be/scri/helpers/Config.kt +++ b/app/src/main/java/be/scri/helpers/Config.kt @@ -8,6 +8,7 @@ class Config(context: Context) : BaseConfig(context) { fun newInstance(context: Context) = Config(context) } + var vibrateOnKeypress: Boolean get() = prefs.getBoolean(VIBRATE_ON_KEYPRESS, true) set(vibrateOnKeypress) = prefs.edit().putBoolean(VIBRATE_ON_KEYPRESS, vibrateOnKeypress).apply() @@ -32,6 +33,7 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(PERIOD_ON_DOUBLE_TAP, true) set(periodOnDoubleTap) = prefs.edit().putBoolean(PERIOD_ON_DOUBLE_TAP, periodOnDoubleTap).apply() + private fun getDefaultLanguage(): Int { val conf = context.resources.configuration return if (conf.locale.toString().toLowerCase(Locale.getDefault()).startsWith("ru_")) { diff --git a/app/src/main/java/be/scri/helpers/CustomAdapter.kt b/app/src/main/java/be/scri/helpers/CustomAdapter.kt index f5b40dda..e5826dbf 100644 --- a/app/src/main/java/be/scri/helpers/CustomAdapter.kt +++ b/app/src/main/java/be/scri/helpers/CustomAdapter.kt @@ -1,73 +1,155 @@ package be.scri.helpers import android.app.Activity -import android.content.Context import android.content.Intent import android.net.Uri +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView +import android.widget.Switch import android.widget.TextView import android.widget.Toast import androidx.core.content.ContextCompat.getString import androidx.recyclerview.widget.RecyclerView import be.scri.R -import be.scri.models.ItemsViewModel +import be.scri.activities.AboutActivity +import be.scri.models.ImageItem +import be.scri.models.SwitchItem +import be.scri.models.TextItem +import kotlinx.android.synthetic.main.card_view_with_switch.view.tvText +class CustomAdapter(private val mList: List, private val context: Activity) : RecyclerView.Adapter() { -class CustomAdapter(private val mList: List , private val context:Context) : RecyclerView.Adapter() { + companion object { + private const val VIEW_TYPE_IMAGE = 0 + private const val VIEW_TYPE_SWITCH = 1 + private const val VIEW_TYPE_TEXT = 2 - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.card_view_design, parent, false) - return ViewHolder(view) } - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - val itemViewModel = mList[position] - holder.imageView.setImageResource(itemViewModel.image) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + VIEW_TYPE_IMAGE -> { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.card_view_with_image, parent, false) + ImageViewHolder(view) + } + VIEW_TYPE_SWITCH -> { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.card_view_with_switch, parent, false) + SwitchViewHolder(view) + } + VIEW_TYPE_TEXT -> { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.card_view_text, parent, false) + TextViewHolder(view) + } + else -> throw IllegalArgumentException("Invalid view type") + } + } - holder.textView.text = getString(context,itemViewModel.textResId) - holder.imageView2.setImageResource(itemViewModel.image2) - if (position == 0) { - holder.itemView.setBackgroundResource(R.drawable.rounded_top); - } else if (position == mList.size - 1) { - holder.itemView.setBackgroundResource(R.drawable.rounded_bottom); + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is ImageViewHolder -> bindImageViewHolder(holder, position) + is SwitchViewHolder -> bindSwitchViewHolder(holder, position) + is TextViewHolder -> bindTextViewHolder(holder, position) + } - } else { - holder.itemView.setBackgroundResource(R.drawable.rounded_middle); + val backgroundResource = when { + mList.size == 1 -> R.drawable.rounded_all_corners + position == 0 -> R.drawable.rounded_top + position == mList.size - 1 -> R.drawable.rounded_bottom + else -> R.drawable.rounded_middle } + + holder.itemView.setBackgroundResource(backgroundResource) + } + + private fun bindImageViewHolder(holder: ImageViewHolder, position: Int) { + val item = mList[position] as ImageItem + holder.imageView.setImageResource(item.image) + holder.textView.text = getString(context, item.textResId) + holder.imageView2.setImageResource(item.image2) + holder.itemView.setOnClickListener { when { - itemViewModel.url != null -> { - val intent = Intent(Intent.ACTION_VIEW, Uri.parse(itemViewModel.url)) + item.url != null -> { + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(item.url)) context.startActivity(intent) } - itemViewModel.activity != null -> { - val intent = Intent(context, itemViewModel.activity) + item.activity != null -> { + val intent = Intent(context, item.activity) context.startActivity(intent) } - itemViewModel.action != null -> { - itemViewModel.action.invoke() + item.action != null -> { + item.action.invoke() } else -> { Toast.makeText(context, "No action defined", Toast.LENGTH_SHORT).show() - }}}} + } + } + } + } + private fun bindTextViewHolder(holder: TextViewHolder, position: Int) { + val item = mList[position] as TextItem + holder.textView.text = item.text + holder.imageView.setImageResource(item.image) + holder.itemView.setOnClickListener { + when(item.action){ + null -> Toast.makeText(context, "No action defined", Toast.LENGTH_SHORT).show() + else -> item.action.invoke() + } + } + } + + private fun bindSwitchViewHolder(holder: SwitchViewHolder, position: Int) { + val item = mList[position] as SwitchItem + holder.switchView.isChecked = item.isChecked + holder.switchView.setOnCheckedChangeListener(null) + holder.textView.text = item.title + holder.switchView.setOnCheckedChangeListener{_,isChecked -> + if(isChecked){ + item.isChecked = isChecked + item.action?.invoke() + } + else { + item.isChecked = isChecked + item.isChecked = false + item.action2?.invoke() + } + } + } + override fun getItemCount(): Int = mList.size - override fun getItemCount(): Int { - return mList.size + override fun getItemViewType(position: Int): Int { + return when (mList[position]) { + is ImageItem -> VIEW_TYPE_IMAGE + is SwitchItem -> VIEW_TYPE_SWITCH + is TextItem -> VIEW_TYPE_TEXT + else -> throw IllegalArgumentException("Invalid item type") + } } - class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + class ImageViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { val imageView: ImageView = itemView.findViewById(R.id.imgView1) val textView: TextView = itemView.findViewById(R.id.tvText) val imageView2: ImageView = itemView.findViewById(R.id.imgView2) - val activity: Activity = itemView.context as Activity + } + class SwitchViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val switchView: Switch = itemView.findViewById(R.id.checkbox) + val textView: TextView = itemView.findViewById(R.id.tvText) + } + + class TextViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val textView: TextView = itemView.findViewById(R.id.tvText) + val imageView: ImageView = itemView.findViewById(R.id.imgView2) } } + + diff --git a/app/src/main/java/be/scri/models/ImageItem.kt b/app/src/main/java/be/scri/models/ImageItem.kt index 5b6345ab..4275d6f3 100644 --- a/app/src/main/java/be/scri/models/ImageItem.kt +++ b/app/src/main/java/be/scri/models/ImageItem.kt @@ -4,4 +4,4 @@ import android.app.Activity import kotlin.reflect.KFunction0 -data class ItemsViewModel(val image: Int, val textResId: Int, val image2:Int, val url: String? = null, val activity: Class? = null, val action: KFunction0? = null) +data class ImageItem(val image: Int, val textResId: Int, val image2:Int, val url: String? = null, val activity: Class? = null, val action: KFunction0? = null):Item() diff --git a/app/src/main/java/be/scri/services/EnglishKeyboardIME.kt b/app/src/main/java/be/scri/services/EnglishKeyboardIME.kt index c36abc48..e88b2cd9 100644 --- a/app/src/main/java/be/scri/services/EnglishKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/EnglishKeyboardIME.kt @@ -1,7 +1,23 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class EnglishKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_english + + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("English")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } + } diff --git a/app/src/main/java/be/scri/services/FrenchKeyboardIME.kt b/app/src/main/java/be/scri/services/FrenchKeyboardIME.kt index 75f7b94e..dc9a250f 100644 --- a/app/src/main/java/be/scri/services/FrenchKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/FrenchKeyboardIME.kt @@ -1,8 +1,27 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class FrenchKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_french + + + private var lastSpaceTime: Long = 0 + private val doubleTapThreshold: Long = 300 + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("French")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } + } diff --git a/app/src/main/java/be/scri/services/GermanKeyboardIME.kt b/app/src/main/java/be/scri/services/GermanKeyboardIME.kt index 2dae7fcd..258b4985 100644 --- a/app/src/main/java/be/scri/services/GermanKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/GermanKeyboardIME.kt @@ -1,7 +1,25 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class GermanKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_german + private var lastSpaceTime: Long = 0 + private val doubleTapThreshold: Long = 300 + + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("German")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } + } diff --git a/app/src/main/java/be/scri/services/ItalianKeyboardIME.kt b/app/src/main/java/be/scri/services/ItalianKeyboardIME.kt index d9f4a44a..3f9387b3 100644 --- a/app/src/main/java/be/scri/services/ItalianKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/ItalianKeyboardIME.kt @@ -1,8 +1,25 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class ItalianKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_italian + private var lastSpaceTime: Long = 0 + private val doubleTapThreshold: Long = 300 + + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("Italian")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } } diff --git a/app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt b/app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt index 0474fdd0..97599a65 100644 --- a/app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/PortugueseKeyboardIME.kt @@ -1,8 +1,25 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class PortugueseKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_portuguese + private var lastSpaceTime: Long = 0 + private val doubleTapThreshold: Long = 300 + + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("Portuguese")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } } diff --git a/app/src/main/java/be/scri/services/RussianKeyboardIME.kt b/app/src/main/java/be/scri/services/RussianKeyboardIME.kt index 86cc5e05..2d0dcde3 100644 --- a/app/src/main/java/be/scri/services/RussianKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/RussianKeyboardIME.kt @@ -1,7 +1,27 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class RussianKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_russian + private var lastSpaceTime: Long = 0 + private val doubleTapThreshold: Long = 300 + + + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("Russian")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } + + } diff --git a/app/src/main/java/be/scri/services/SimpleKeyboardIME.kt b/app/src/main/java/be/scri/services/SimpleKeyboardIME.kt index b9abd21a..812fcb2a 100644 --- a/app/src/main/java/be/scri/services/SimpleKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/SimpleKeyboardIME.kt @@ -7,6 +7,7 @@ import android.text.InputType.TYPE_CLASS_NUMBER import android.text.InputType.TYPE_CLASS_PHONE import android.text.InputType.TYPE_MASK_CLASS import android.text.TextUtils +import android.util.Log import android.view.KeyEvent import android.view.View import android.view.inputmethod.EditorInfo diff --git a/app/src/main/java/be/scri/services/SpanishKeyboardIME.kt b/app/src/main/java/be/scri/services/SpanishKeyboardIME.kt index 45c7c71e..2edc2612 100644 --- a/app/src/main/java/be/scri/services/SpanishKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/SpanishKeyboardIME.kt @@ -1,7 +1,21 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class SpanishKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_spanish + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("Spanish")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } } diff --git a/app/src/main/java/be/scri/services/SwedishKeyboardIME.kt b/app/src/main/java/be/scri/services/SwedishKeyboardIME.kt index a03ee722..c93d2cfe 100644 --- a/app/src/main/java/be/scri/services/SwedishKeyboardIME.kt +++ b/app/src/main/java/be/scri/services/SwedishKeyboardIME.kt @@ -1,7 +1,21 @@ package be.scri.services +import android.content.Context +import android.util.Log import be.scri.R class SwedishKeyboardIME : SimpleKeyboardIME() { override fun getKeyboardLayoutXML(): Int = R.xml.keys_letters_spanish + private fun shouldCommitPeriodAfterSpace(language: String): Boolean { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return sharedPref.getBoolean("period_on_double_tap_$language", false) + } + + override fun commitPeriodAfterSpace() { + if (shouldCommitPeriodAfterSpace("Swedish")) { + val inputConnection = currentInputConnection ?: return + inputConnection.deleteSurroundingText(1, 0) + inputConnection.commitText(". ", 1) + } + } } From c6225c665c2551217408debe53991b91abbde519 Mon Sep 17 00:00:00 2001 From: angrezichatterbox Date: Thu, 22 Aug 2024 15:12:26 +0530 Subject: [PATCH 3/4] feat:Implemented the Language Setting option and Language Based Settings --- .../java/be/scri/activities/AboutActivity.kt | 30 +- .../be/scri/activities/LanguageSettings.kt | 83 +++++- .../be/scri/activities/SettingsActivity.kt | 260 ++++++++++++------ .../java/be/scri/helpers/CustomAdapter.kt | 11 +- app/src/main/java/be/scri/models/ImageItem.kt | 7 - .../java/be/scri/models/ItemsViewModel.kt | 7 + .../main/java/be/scri/models/SwitchItem.kt | 5 +- app/src/main/java/be/scri/models/TextItem.kt | 3 +- .../main/java/be/scri/views/MyKeyboardView.kt | 1 + .../main/res/drawable/rounded_all_corners.xml | 9 +- app/src/main/res/drawable/rounded_top.xml | 3 +- .../res/layout/activity_language_settings.xml | 44 ++- app/src/main/res/layout/activity_settings.xml | 150 ++++------ app/src/main/res/layout/card_view_text.xml | 41 ++- .../main/res/layout/card_view_with_switch.xml | 40 ++- 15 files changed, 463 insertions(+), 231 deletions(-) delete mode 100644 app/src/main/java/be/scri/models/ImageItem.kt create mode 100644 app/src/main/java/be/scri/models/ItemsViewModel.kt diff --git a/app/src/main/java/be/scri/activities/AboutActivity.kt b/app/src/main/java/be/scri/activities/AboutActivity.kt index 7b610b00..e01c11ea 100644 --- a/app/src/main/java/be/scri/activities/AboutActivity.kt +++ b/app/src/main/java/be/scri/activities/AboutActivity.kt @@ -13,7 +13,7 @@ import kotlinx.android.synthetic.main.activity_about.* import be.scri.R import be.scri.extensions.* import be.scri.helpers.* -import be.scri.models.ImageItem +import be.scri.models.ItemsViewModel import kotlin.math.abs class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{ @@ -90,26 +90,26 @@ class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{ } private fun getFirstRecyclerViewData(): List = listOf( - ImageItem(image = R.drawable.github_logo, textResId = R.string.app_about_github, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android", activity = null, action = null), - ImageItem(image = R.drawable.matrix_icon, textResId = R.string.app_about_matrix, image2 = R.drawable.external_link, url = "https://matrix.to/%23/%23scribe_community:matrix.org", activity = null, action = null), - ImageItem(image = R.drawable.mastodon_svg_icon, textResId = R.string.app_about_mastodon, image2 = R.drawable.external_link, url = "https://wikis.world/@scribe", activity = null, action = null), - ImageItem(image = R.drawable.share_icon, textResId = R.string.app_about_share, image2 = R.drawable.external_link, url = null, activity = null, action = ::shareScribe), - ImageItem(image = R.drawable.scribe_icon, textResId = R.string.app_about_scribe, image2 = R.drawable.external_link, url = null, activity = null, action = null), - ImageItem(image = R.drawable.wikimedia_logo_black, textResId = R.string.app_about_wikimedia, image2 = R.drawable.right_arrow, url = null, activity = WikimediaScribeActivity::class.java, action = null) + ItemsViewModel(image = R.drawable.github_logo, textResId = R.string.app_about_github, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android", activity = null, action = null), + ItemsViewModel(image = R.drawable.matrix_icon, textResId = R.string.app_about_matrix, image2 = R.drawable.external_link, url = "https://matrix.to/%23/%23scribe_community:matrix.org", activity = null, action = null), + ItemsViewModel(image = R.drawable.mastodon_svg_icon, textResId = R.string.app_about_mastodon, image2 = R.drawable.external_link, url = "https://wikis.world/@scribe", activity = null, action = null), + ItemsViewModel(image = R.drawable.share_icon, textResId = R.string.app_about_share, image2 = R.drawable.external_link, url = null, activity = null, action = ::shareScribe), + ItemsViewModel(image = R.drawable.scribe_icon, textResId = R.string.app_about_scribe, image2 = R.drawable.external_link, url = null, activity = null, action = null), + ItemsViewModel(image = R.drawable.wikimedia_logo_black, textResId = R.string.app_about_wikimedia, image2 = R.drawable.right_arrow, url = null, activity = WikimediaScribeActivity::class.java, action = null) ) private fun getSecondRecyclerViewData(): List = listOf( - ImageItem(image = R.drawable.star, textResId = R.string.app_about_rate, image2 = R.drawable.external_link, url = null, activity = null, action = null), - ImageItem(image = R.drawable.bug_report_icon, textResId = R.string.app_about_bugReport, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android/issues", activity = null, action = null), - ImageItem(image = R.drawable.mail_icon, textResId = R.string.app_about_email, image2 = R.drawable.external_link, url = null, activity = null, action = ::sendEmail), - ImageItem(image = R.drawable.bookmark_icon, textResId = R.string.app_version, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), - ImageItem(image = R.drawable.light_bulb_icon, textResId = R.string.app_about_appHints, image2 = R.drawable.counter_clockwise_icon, url = null, activity = null, action = null) + ItemsViewModel(image = R.drawable.star, textResId = R.string.app_about_rate, image2 = R.drawable.external_link, url = null, activity = null, action = null), + ItemsViewModel(image = R.drawable.bug_report_icon, textResId = R.string.app_about_bugReport, image2 = R.drawable.external_link, url = "https://github.com/scribe-org/Scribe-Android/issues", activity = null, action = null), + ItemsViewModel(image = R.drawable.mail_icon, textResId = R.string.app_about_email, image2 = R.drawable.external_link, url = null, activity = null, action = ::sendEmail), + ItemsViewModel(image = R.drawable.bookmark_icon, textResId = R.string.app_version, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), + ItemsViewModel(image = R.drawable.light_bulb_icon, textResId = R.string.app_about_appHints, image2 = R.drawable.counter_clockwise_icon, url = null, activity = null, action = null) ) - private fun getThirdRecyclerViewData(): List { + private fun getThirdRecyclerViewData(): List { return listOf( - ImageItem(image = R.drawable.shield_lock, R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), - ImageItem(image = R.drawable.license_icon, R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = null, action = null) + ItemsViewModel(image = R.drawable.shield_lock, R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = null, action = null), + ItemsViewModel(image = R.drawable.license_icon, R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = null, action = null) ) } diff --git a/app/src/main/java/be/scri/activities/LanguageSettings.kt b/app/src/main/java/be/scri/activities/LanguageSettings.kt index c6e27b74..34d9e938 100644 --- a/app/src/main/java/be/scri/activities/LanguageSettings.kt +++ b/app/src/main/java/be/scri/activities/LanguageSettings.kt @@ -1,20 +1,81 @@ -package be.scri +package be.scri.activities +import android.content.Context +import android.content.Intent import android.os.Bundle import androidx.activity.enableEdgeToEdge -import androidx.appcompat.app.AppCompatActivity -import androidx.core.view.ViewCompat -import androidx.core.view.WindowInsetsCompat +import androidx.recyclerview.widget.LinearLayoutManager +import be.scri.R +import be.scri.databinding.ActivityLanguageSettingsBinding +import be.scri.extensions.config +import be.scri.helpers.CustomAdapter +import be.scri.models.SwitchItem +import com.google.android.material.bottomnavigation.BottomNavigationView -class LanguageSettings : AppCompatActivity() { +class LanguageSettings : SimpleActivity() { + private lateinit var binding: ActivityLanguageSettingsBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() - setContentView(R.layout.activity_language_settings) - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> - val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) - v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) - insets + binding = ActivityLanguageSettingsBinding.inflate(layoutInflater) + val view = binding.root + val language = intent.getStringExtra("LANGUAGE_EXTRA") + setContentView(view) + if (language != null) { + setupRecyclerView(language=language) } + val bottomNavigationView = findViewById(R.id.bottom_navigation) + bottomNavigationView.setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener { item -> + when (item.itemId) { + R.id.info -> { + startActivity(Intent(applicationContext, AboutActivity::class.java)) + overridePendingTransition(0, 0) + return@OnNavigationItemSelectedListener true + } + + R.id.settings -> { + return@OnNavigationItemSelectedListener true } + R.id.installation -> { + startActivity(Intent(applicationContext, MainActivity::class.java)) + overridePendingTransition(0, 0) + return@OnNavigationItemSelectedListener true + } + } + false + }) + bottomNavigationView.selectedItemId = R.id.settings + + } + private fun setupRecyclerView(language: String) { + val recyclerView1 = binding.recyclerView + recyclerView1.layoutManager = LinearLayoutManager(this) + recyclerView1.adapter = CustomAdapter(getRecyclerViewData(language), this) + recyclerView1.suppressLayout(true) + } + + private fun getRecyclerViewData(language: String): List { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return listOf( + SwitchItem( + isChecked = sharedPref.getBoolean("period_on_double_tap_$language", false), + title = "Double space Periods", + action = { enablePeriodOnSpaceBarDoubleTap(language = language) }, + action2 = { disablePeriodOnSpaceBarDoubleTap(language = language) })) + } + private fun enablePeriodOnSpaceBarDoubleTap(language: String) { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("period_on_double_tap_$language", true) + editor.apply() } -} \ No newline at end of file + + private fun disablePeriodOnSpaceBarDoubleTap(language: String) { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("period_on_double_tap_$language", false) + editor.apply() + } + +} + + diff --git a/app/src/main/java/be/scri/activities/SettingsActivity.kt b/app/src/main/java/be/scri/activities/SettingsActivity.kt index 7dc08209..02955428 100644 --- a/app/src/main/java/be/scri/activities/SettingsActivity.kt +++ b/app/src/main/java/be/scri/activities/SettingsActivity.kt @@ -2,33 +2,63 @@ package be.scri.activities import android.content.Context import android.content.Intent -import android.content.res.Configuration +import android.net.Uri import android.os.Bundle +import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS +import android.provider.Settings.ACTION_APP_LOCALE_SETTINGS +import android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS import android.view.GestureDetector import android.view.Menu import android.view.MotionEvent +import android.view.View +import android.view.inputmethod.InputMethodManager import androidx.appcompat.app.AppCompatDelegate -import com.google.android.material.bottomnavigation.BottomNavigationView -import kotlinx.android.synthetic.main.activity_settings.* +import androidx.recyclerview.widget.LinearLayoutManager import be.scri.R -import be.scri.dialogs.RadioGroupDialog +import be.scri.databinding.ActivitySettingsBinding import be.scri.extensions.config import be.scri.extensions.updateTextColors -import be.scri.helpers.* -import be.scri.models.RadioItem +import be.scri.helpers.CustomAdapter +import be.scri.models.SwitchItem +import be.scri.models.TextItem +import com.google.android.material.bottomnavigation.BottomNavigationView +import kotlinx.android.synthetic.main.activity_settings.settings_scrollview import kotlin.math.abs + class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { private lateinit var gestureDetector: GestureDetector private val swipeThreshold = 100 private val swipeVelocityThreshold = 100 + private lateinit var binding: ActivitySettingsBinding + + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - - setContentView(R.layout.activity_settings) + binding = ActivitySettingsBinding.inflate(layoutInflater) + setContentView(binding.root) + setupRecycleView() + setupRecyclerView2() supportActionBar?.setDisplayHomeAsUpEnabled(false) gestureDetector = GestureDetector(this) + + val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager + val enabledInputMethods = imm.enabledInputMethodList + for(inputMethod in enabledInputMethods) { + if (inputMethod.packageName == "be.scri.debug") { + binding.btnInstall.visibility = View.INVISIBLE + binding.selectLanguage.visibility = View.VISIBLE + } + } + binding.btnInstall.setOnClickListener { + Intent(ACTION_INPUT_METHOD_SETTINGS).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + startActivity(this) + } + } + + val bottomNavigationView = findViewById(R.id.bottom_navigation) if (bottomNavigationView != null) { bottomNavigationView.selectedItemId = R.id.settings @@ -52,107 +82,166 @@ class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { } } - override fun onResume() { - super.onResume() - setupDarkTheme() - setupPeriodOnSpaceBarDoubleTap() - setupVibrateOnKeypress() - setupShowPopupOnKeypress() - setupKeyboardLanguage() - updateTextColors(settings_scrollview) + private fun setupRecycleView(){ + val recyclerView = binding.recyclerViewSettings + recyclerView.adapter = CustomAdapter(getFirstRecyclerViewData(),this) + + recyclerView.layoutManager = LinearLayoutManager(this) + recyclerView.suppressLayout(true) } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - updateMenuItemColors(menu) - return super.onCreateOptionsMenu(menu) + private fun getFirstRecyclerViewData():List = listOf( + TextItem(R.string.app_settings_appSettings_appLanguage , image = R.drawable.right_arrow , action = ::selectLanguage), + SwitchItem("Dark mode", isChecked = config.darkTheme , action = ::darkMode , action2 = ::lightMode), + SwitchItem("Vibrate on Keypress", isChecked = config.vibrateOnKeypress , action = ::enableVibrateOnKeypress , action2 = ::disableVibrateOnKeypress), + SwitchItem("Show a popup on keypress", isChecked = config.showPopupOnKeypress , action = ::enableShowPopupOnKeypress , action2 = ::disableShowPopupOnKeypress), + ) + + + private fun selectLanguage() { + val intent: Intent = Intent(ACTION_APP_LOCALE_SETTINGS) + val uri = Uri.fromParts("package", packageName, null) + intent.setData(uri) + startActivity(intent) + } - private fun setupVibrateOnKeypress() { - settings_vibrate_on_keypress.isChecked = config.vibrateOnKeypress - settings_vibrate_on_keypress_holder.setOnClickListener { - settings_vibrate_on_keypress.toggle() - config.vibrateOnKeypress = settings_vibrate_on_keypress.isChecked + private fun setupRecyclerView2() { + val recyclerView = binding.recyclerView2 + val adapter = CustomAdapter(getRecyclerViewElements(),this) + recyclerView.layoutManager = LinearLayoutManager(this) + recyclerView.adapter = adapter + recyclerView.suppressLayout(true) + } + + private fun getRecyclerViewElements(): MutableList { + val languages = setupKeyboardLanguage() + val list = mutableListOf() + for (language in languages) { + var localizeLanguage:Int = 0 + when(language) { + "English" -> localizeLanguage = R.string._global_english + "French" -> localizeLanguage = R.string._global_french + "German" -> localizeLanguage = R.string._global_german + "Russian" -> localizeLanguage = R.string._global_russian + "Spanish" -> localizeLanguage = R.string._global_spanish + "Italian" -> localizeLanguage = R.string._global_italian + "Portuguese" -> localizeLanguage = R.string._global_portuguese + } + list.add( + TextItem( + text = localizeLanguage, + image = R.drawable.right_arrow, + action = { loadLanguageSettings(language) }, + language = language + ) + ) } + return list } + private fun loadLanguageSettings(language: String) { + val intent = Intent(this, LanguageSettings::class.java) + intent.putExtra("LANGUAGE_EXTRA", language) + startActivity(intent) + } + - private fun setupPeriodOnSpaceBarDoubleTap() { - settings_period_on_space_bar.isChecked = config.periodOnDoubleTap - settings_period_on_space_bar_holder.setOnClickListener { - settings_period_on_space_bar.toggle() - config.periodOnDoubleTap = settings_period_on_space_bar.isChecked + private fun setupKeyboardLanguage(): MutableList { + val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager + val enabledInputMethods = imm.enabledInputMethodList + val result = mutableListOf() + + for (inputMethod in enabledInputMethods) { + when (inputMethod.serviceName) { + "be.scri.services.EnglishKeyboardIME" -> result.add("English") + "be.scri.services.GermanKeyboardIME" -> result.add("German") + "be.scri.services.RussianKeyboardIME" -> result.add("Russian") + "be.scri.services.SpanishKeyboardIME" -> result.add("Spanish") + "be.scri.services.FrenchKeyboardIME" -> result.add("French") + "be.scri.services.ItalianKeyboardIME" -> result.add("Italian") + "be.scri.services.PortugueseKeyboardIME" -> result.add("Portuguese") + } } + return result } - private fun setupDarkTheme() { + + private fun lightMode() { val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) val editor = sharedPref.edit() + editor.putBoolean("dark_mode", false) + editor.apply() + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + - val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - val isSystemDarkMode = currentNightMode == Configuration.UI_MODE_NIGHT_YES - val isUserDarkMode = sharedPref.getBoolean("dark_mode", isSystemDarkMode) + } + private fun darkMode(){ + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("dark_mode", true) + editor.apply() + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) + } - settings_dark_mode.isChecked = isUserDarkMode + private fun enableVibrateOnKeypress() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("vibrate_on_keypress", true) + editor.apply() + config.vibrateOnKeypress = true + } - settings_dark_mode_holder.setOnClickListener { - settings_dark_mode.toggle() - editor.putBoolean("dark_mode", settings_dark_mode.isChecked) - editor.apply() + private fun disableVibrateOnKeypress() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("vibrate_on_keypress", false) + editor.apply() + config.vibrateOnKeypress = false + } - if (settings_dark_mode.isChecked) { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) - } else { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) - } + private fun enableShowPopupOnKeypress() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("show_popup_on_keypress", true) + editor.apply() + config.showPopupOnKeypress = true + } - recreate() - } + private fun disableShowPopupOnKeypress() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("show_popup_on_keypress", false) + editor.apply() + config.showPopupOnKeypress = false } - private fun setupShowPopupOnKeypress() { - settings_show_popup_on_keypress.isChecked = config.showPopupOnKeypress - settings_show_popup_on_keypress_holder.setOnClickListener { - settings_show_popup_on_keypress.toggle() - config.showPopupOnKeypress = settings_show_popup_on_keypress.isChecked - } + private fun enablePeriodOnSpaceBarDoubleTap() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("period_on_double_tap", true) + editor.apply() + config.periodOnDoubleTap = true } - private fun setupKeyboardLanguage() { - settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage) - settings_keyboard_language_holder.setOnClickListener { - val items = arrayListOf( - RadioItem( - LANGUAGE_ENGLISH_QWERTY, - getKeyboardLanguageText(LANGUAGE_ENGLISH_QWERTY) - ), - RadioItem(LANGUAGE_FRENCH, getKeyboardLanguageText(LANGUAGE_FRENCH)), - RadioItem(LANGUAGE_GERMAN, getKeyboardLanguageText(LANGUAGE_GERMAN)), - RadioItem(LANGUAGE_ITALIAN, getKeyboardLanguageText(LANGUAGE_ITALIAN)), - RadioItem(LANGUAGE_PORTUGUESE, getKeyboardLanguageText(LANGUAGE_PORTUGUESE)), - RadioItem(LANGUAGE_RUSSIAN, getKeyboardLanguageText(LANGUAGE_RUSSIAN)), - RadioItem(LANGUAGE_SPANISH, getKeyboardLanguageText(LANGUAGE_SPANISH)), - RadioItem(LANGUAGE_SWEDISH, getKeyboardLanguageText(LANGUAGE_SWEDISH)) - ) + private fun disablePeriodOnSpaceBarDoubleTap() { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + val editor = sharedPref.edit() + editor.putBoolean("period_on_double_tap", false) + editor.apply() + config.periodOnDoubleTap = false + } - RadioGroupDialog(this@SettingsActivity, items, config.keyboardLanguage) { - config.keyboardLanguage = it as Int - settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage) - } - } + override fun onResume() { + super.onResume() + updateTextColors(settings_scrollview) } - private fun getKeyboardLanguageText(language: Int): String { - return when (language) { - LANGUAGE_FRENCH -> getString(R.string.translation_french) - LANGUAGE_GERMAN -> getString(R.string.translation_german) - LANGUAGE_ITALIAN -> getString(R.string.translation_italian) - LANGUAGE_PORTUGUESE -> getString(R.string.translation_portuguese) - LANGUAGE_RUSSIAN -> getString(R.string.translation_russian) - LANGUAGE_SPANISH -> getString(R.string.translation_spanish) - LANGUAGE_SWEDISH -> getString(R.string.translation_swedish) - else -> getString(R.string.translation_english) - } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + updateMenuItemColors(menu) + return super.onCreateOptionsMenu(menu) } + override fun onTouchEvent(event: MotionEvent): Boolean { return if (gestureDetector.onTouchEvent(event)) { true @@ -175,7 +264,7 @@ class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { } override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean { - return false + return false } override fun onLongPress(e: MotionEvent) { @@ -202,5 +291,4 @@ class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { } return true } - } - +} diff --git a/app/src/main/java/be/scri/helpers/CustomAdapter.kt b/app/src/main/java/be/scri/helpers/CustomAdapter.kt index e5826dbf..313cde68 100644 --- a/app/src/main/java/be/scri/helpers/CustomAdapter.kt +++ b/app/src/main/java/be/scri/helpers/CustomAdapter.kt @@ -3,7 +3,6 @@ package be.scri.helpers import android.app.Activity import android.content.Intent import android.net.Uri -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -14,11 +13,9 @@ import android.widget.Toast import androidx.core.content.ContextCompat.getString import androidx.recyclerview.widget.RecyclerView import be.scri.R -import be.scri.activities.AboutActivity -import be.scri.models.ImageItem +import be.scri.models.ItemsViewModel import be.scri.models.SwitchItem import be.scri.models.TextItem -import kotlinx.android.synthetic.main.card_view_with_switch.view.tvText class CustomAdapter(private val mList: List, private val context: Activity) : RecyclerView.Adapter() { @@ -68,7 +65,7 @@ class CustomAdapter(private val mList: List, private val context: Activity) } private fun bindImageViewHolder(holder: ImageViewHolder, position: Int) { - val item = mList[position] as ImageItem + val item = mList[position] as ItemsViewModel holder.imageView.setImageResource(item.image) holder.textView.text = getString(context, item.textResId) holder.imageView2.setImageResource(item.image2) @@ -95,7 +92,7 @@ class CustomAdapter(private val mList: List, private val context: Activity) private fun bindTextViewHolder(holder: TextViewHolder, position: Int) { val item = mList[position] as TextItem - holder.textView.text = item.text + holder.textView.text = getString(context,item.text) holder.imageView.setImageResource(item.image) holder.itemView.setOnClickListener { when(item.action){ @@ -128,7 +125,7 @@ class CustomAdapter(private val mList: List, private val context: Activity) override fun getItemViewType(position: Int): Int { return when (mList[position]) { - is ImageItem -> VIEW_TYPE_IMAGE + is ItemsViewModel -> VIEW_TYPE_IMAGE is SwitchItem -> VIEW_TYPE_SWITCH is TextItem -> VIEW_TYPE_TEXT else -> throw IllegalArgumentException("Invalid item type") diff --git a/app/src/main/java/be/scri/models/ImageItem.kt b/app/src/main/java/be/scri/models/ImageItem.kt deleted file mode 100644 index 4275d6f3..00000000 --- a/app/src/main/java/be/scri/models/ImageItem.kt +++ /dev/null @@ -1,7 +0,0 @@ -package be.scri.models - -import android.app.Activity -import kotlin.reflect.KFunction0 - - -data class ImageItem(val image: Int, val textResId: Int, val image2:Int, val url: String? = null, val activity: Class? = null, val action: KFunction0? = null):Item() diff --git a/app/src/main/java/be/scri/models/ItemsViewModel.kt b/app/src/main/java/be/scri/models/ItemsViewModel.kt new file mode 100644 index 00000000..9cd5baa2 --- /dev/null +++ b/app/src/main/java/be/scri/models/ItemsViewModel.kt @@ -0,0 +1,7 @@ +package be.scri.models + +import android.app.Activity +import kotlin.reflect.KFunction0 + + +data class ItemsViewModel(val image: Int, val textResId: Int, val image2:Int, val url: String? = null, val activity: Class? = null, val action: KFunction0? = null):Item() diff --git a/app/src/main/java/be/scri/models/SwitchItem.kt b/app/src/main/java/be/scri/models/SwitchItem.kt index 6da9b3e9..486f7a0b 100644 --- a/app/src/main/java/be/scri/models/SwitchItem.kt +++ b/app/src/main/java/be/scri/models/SwitchItem.kt @@ -1,3 +1,6 @@ package be.scri.models -data class SwitchItem() +import kotlin.reflect.KFunction1 + +sealed class Item +data class SwitchItem(val title: String, var isChecked: Boolean, val action: (() -> Unit)? = null, val action2: (() -> Unit)? = null ):Item() diff --git a/app/src/main/java/be/scri/models/TextItem.kt b/app/src/main/java/be/scri/models/TextItem.kt index 422391c6..586b0ff8 100644 --- a/app/src/main/java/be/scri/models/TextItem.kt +++ b/app/src/main/java/be/scri/models/TextItem.kt @@ -1,3 +1,4 @@ package be.scri.models -data class TextItem() + +data class TextItem(val text: Int, val image:Int, val action: (() -> Unit)? = null, val language: String? = null ):Item() diff --git a/app/src/main/java/be/scri/views/MyKeyboardView.kt b/app/src/main/java/be/scri/views/MyKeyboardView.kt index dbe80299..db32b60e 100644 --- a/app/src/main/java/be/scri/views/MyKeyboardView.kt +++ b/app/src/main/java/be/scri/views/MyKeyboardView.kt @@ -1,5 +1,6 @@ package be.scri.views + import android.annotation.SuppressLint import android.content.Context import android.content.Intent diff --git a/app/src/main/res/drawable/rounded_all_corners.xml b/app/src/main/res/drawable/rounded_all_corners.xml index 81de3664..7768faa6 100644 --- a/app/src/main/res/drawable/rounded_all_corners.xml +++ b/app/src/main/res/drawable/rounded_all_corners.xml @@ -1,4 +1,7 @@ - - - + + + + + diff --git a/app/src/main/res/drawable/rounded_top.xml b/app/src/main/res/drawable/rounded_top.xml index 0c279e95..f3adbe12 100644 --- a/app/src/main/res/drawable/rounded_top.xml +++ b/app/src/main/res/drawable/rounded_top.xml @@ -1,6 +1,7 @@ - + diff --git a/app/src/main/res/layout/activity_language_settings.xml b/app/src/main/res/layout/activity_language_settings.xml index 58f26217..5f785615 100644 --- a/app/src/main/res/layout/activity_language_settings.xml +++ b/app/src/main/res/layout/activity_language_settings.xml @@ -5,6 +5,48 @@ android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".LanguageSettings"> + android:background="@color/you_background_color" + tools:context=".activities.LanguageSettings"> + + + + + + + + diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 91e54ed9..247018b4 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1,126 +1,96 @@ - - + - - - - - - + + - - - + android:padding="2dp" /> - - - - - - + android:paddingStart="20dp" + android:paddingTop="10dp" + android:paddingEnd="10dp" + android:paddingBottom="10dp" + android:text="@string/app.settings.installedKeyboards" + android:textColor="@color/app_text_color" + android:textSize="20sp" + android:textStyle="bold" /> + android:layout_height="wrap_content"> - - + android:layout_margin="10dp" + android:background="@color/corner_polygon_color" + android:padding="10dp" + android:text="@string/app.install" /> - - - + android:padding="2dp" /> - + + - - + diff --git a/app/src/main/res/layout/card_view_text.xml b/app/src/main/res/layout/card_view_text.xml index 506660a8..8b150324 100644 --- a/app/src/main/res/layout/card_view_text.xml +++ b/app/src/main/res/layout/card_view_text.xml @@ -1,6 +1,39 @@ - + - + + + + + + + + diff --git a/app/src/main/res/layout/card_view_with_switch.xml b/app/src/main/res/layout/card_view_with_switch.xml index 506660a8..6943a277 100644 --- a/app/src/main/res/layout/card_view_with_switch.xml +++ b/app/src/main/res/layout/card_view_with_switch.xml @@ -1,6 +1,38 @@ - + - + + + + + + + + From 4888dce5d544492994643b24f0394364dbd74820 Mon Sep 17 00:00:00 2001 From: angrezichatterbox Date: Fri, 23 Aug 2024 17:36:09 +0530 Subject: [PATCH 4/4] fix:Fixed the Dark Mode toggle --- .../be/scri/activities/SettingsActivity.kt | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/be/scri/activities/SettingsActivity.kt b/app/src/main/java/be/scri/activities/SettingsActivity.kt index 02955428..7f26779e 100644 --- a/app/src/main/java/be/scri/activities/SettingsActivity.kt +++ b/app/src/main/java/be/scri/activities/SettingsActivity.kt @@ -3,6 +3,7 @@ package be.scri.activities import android.content.Context import android.content.Intent import android.net.Uri +import android.os.Build import android.os.Bundle import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS import android.provider.Settings.ACTION_APP_LOCALE_SETTINGS @@ -90,16 +91,31 @@ class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { recyclerView.suppressLayout(true) } - private fun getFirstRecyclerViewData():List = listOf( - TextItem(R.string.app_settings_appSettings_appLanguage , image = R.drawable.right_arrow , action = ::selectLanguage), - SwitchItem("Dark mode", isChecked = config.darkTheme , action = ::darkMode , action2 = ::lightMode), - SwitchItem("Vibrate on Keypress", isChecked = config.vibrateOnKeypress , action = ::enableVibrateOnKeypress , action2 = ::disableVibrateOnKeypress), - SwitchItem("Show a popup on keypress", isChecked = config.showPopupOnKeypress , action = ::enableShowPopupOnKeypress , action2 = ::disableShowPopupOnKeypress), - ) + private fun getFirstRecyclerViewData():List { + val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) + return listOf( + TextItem(R.string.app_settings_appSettings_appLanguage, image = R.drawable.right_arrow, action = ::selectLanguage), + SwitchItem("Dark mode", isChecked = sharedPref.getBoolean("dark_mode", false), action = ::darkMode, action2 = ::lightMode), + SwitchItem("Vibrate on Keypress", isChecked = config.vibrateOnKeypress, action = ::enableVibrateOnKeypress, action2 = ::disableVibrateOnKeypress), + SwitchItem( + "Show a popup on keypress", + isChecked = config.showPopupOnKeypress, + action = ::enableShowPopupOnKeypress, + action2 = ::disableShowPopupOnKeypress + ), + ) + } private fun selectLanguage() { - val intent: Intent = Intent(ACTION_APP_LOCALE_SETTINGS) + val intent: Intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + Intent(ACTION_APP_LOCALE_SETTINGS) + } else { + Intent(ACTION_APPLICATION_DETAILS_SETTINGS).apply { + data = Uri.fromParts("package", packageName, null) + putExtra("android.intent.extra.SHOW_FRAGMENT", "com.android.settings.localepicker.LocaleListEditor") + } + } val uri = Uri.fromParts("package", packageName, null) intent.setData(uri) startActivity(intent) @@ -214,22 +230,7 @@ class SettingsActivity : SimpleActivity(), GestureDetector.OnGestureListener { editor.apply() config.showPopupOnKeypress = false } - - private fun enablePeriodOnSpaceBarDoubleTap() { - val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) - val editor = sharedPref.edit() - editor.putBoolean("period_on_double_tap", true) - editor.apply() - config.periodOnDoubleTap = true - } - - private fun disablePeriodOnSpaceBarDoubleTap() { - val sharedPref = getSharedPreferences("app_preferences", Context.MODE_PRIVATE) - val editor = sharedPref.edit() - editor.putBoolean("period_on_double_tap", false) - editor.apply() - config.periodOnDoubleTap = false - } + override fun onResume() { super.onResume()