fix for small displays that cannot import settings due to scroll and display too large texts problem like Jelley
This commit is contained in:
parent
870c9bb23d
commit
7b7a0e0d5e
6 changed files with 52 additions and 30 deletions
|
@ -167,7 +167,7 @@ class ImportExportPrefs @Inject constructor(
|
|||
if (!prefsEncryptionIsDisabled() && !assureMasterPasswordSet(activity, R.string.nav_export)) return
|
||||
|
||||
TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_export),
|
||||
resourceHelper.gs(R.string.export_to) + " " + fileToExport + " ?",
|
||||
resourceHelper.gs(R.string.export_to) + " " + fileToExport.name + " ?",
|
||||
resourceHelper.gs(R.string.password_preferences_encrypt_prompt), {
|
||||
askForMasterPassIfNeeded(activity, R.string.preferences_export_canceled, then)
|
||||
}, null, R.drawable.ic_header_export)
|
||||
|
@ -177,9 +177,8 @@ class ImportExportPrefs @Inject constructor(
|
|||
|
||||
if (fileToImport.handler == PrefsFormatsHandler.ENCRYPTED) {
|
||||
if (!assureMasterPasswordSet(activity, R.string.nav_import)) return
|
||||
|
||||
TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_import),
|
||||
resourceHelper.gs(R.string.import_from) + " " + fileToImport.file + " ?",
|
||||
resourceHelper.gs(R.string.import_from) + " " + fileToImport.name + " ?",
|
||||
resourceHelper.gs(R.string.password_preferences_decrypt_prompt), {
|
||||
askForMasterPass(activity, R.string.preferences_import_canceled, then)
|
||||
}, null, R.drawable.ic_header_import)
|
||||
|
|
|
@ -34,6 +34,7 @@ enum class PrefsImportDir {
|
|||
|
||||
@Parcelize
|
||||
data class PrefsFile(
|
||||
val name: String,
|
||||
val file: File,
|
||||
val baseDir: File,
|
||||
val dirKind: PrefsImportDir,
|
||||
|
@ -96,7 +97,7 @@ class PrefFileListProvider @Inject constructor(
|
|||
val detectedOld = !detectedNew && classicPrefsFormat.isPreferencesFile(it, contents)
|
||||
if (detectedNew || detectedOld) {
|
||||
val formatHandler = if (detectedNew) PrefsFormatsHandler.ENCRYPTED else PrefsFormatsHandler.CLASSIC
|
||||
prefFiles.add(PrefsFile(it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents)))
|
||||
prefFiles.add(PrefsFile(it.name , it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ class PrefFileListProvider @Inject constructor(
|
|||
aapsPath.walk().filter { it.isFile && it.name.endsWith(".json") }.forEach {
|
||||
val contents = storage.getFileContents(it)
|
||||
if (encryptedPrefsFormat.isPreferencesFile(it, contents)) {
|
||||
prefFiles.add(PrefsFile(it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents)))
|
||||
prefFiles.add(PrefsFile(it.name, it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scroll_content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -9,8 +20,8 @@
|
|||
android:id="@+id/summary_table"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:stretchColumns="2" />
|
||||
|
||||
<Button
|
||||
|
@ -19,12 +30,16 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:text="@string/check_preferences_details_btn"
|
||||
android:textColor="@color/colorTreatmentButton"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -3,7 +3,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/password_prompt_title"
|
||||
|
|
|
@ -25,6 +25,7 @@ object AlertDialogHelper {
|
|||
val titleLayout = LayoutInflater.from(ContextThemeWrapper(context, themeResId)).inflate(layoutResource, null)
|
||||
(titleLayout.findViewById<View>(R.id.alertdialog_title) as TextView).text = title
|
||||
(titleLayout.findViewById<View>(R.id.alertdialog_icon) as ImageView).setImageResource(iconResource)
|
||||
titleLayout.findViewById<View>(R.id.alertdialog_title).setSelected(true)
|
||||
return titleLayout
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
android:layout_marginEnd="50dp"
|
||||
android:layout_toEndOf="@id/alertdialog_icon"
|
||||
android:textAlignment="center"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?dialogTitleColor" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue