improve dialog layout

This commit is contained in:
Bnyro 2022-08-14 17:35:17 +02:00
parent 03b2e8e937
commit 109f47f43f
9 changed files with 45 additions and 52 deletions

View File

@ -19,7 +19,6 @@ import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.ExceptionHandler
import com.github.libretube.util.NotificationHelper
import java.lang.Exception
class MyApp : Application() {
override fun onCreate() {
@ -170,7 +169,8 @@ class MyApp : Application() {
DatabaseHolder.db.watchHistoryDao().insertAll(
*watchHistoryItems.toTypedArray()
)
} catch (e: Exception) {}
} catch (e: Exception) {
}
prefs.edit().putString("watch_history", "").commit()
}
val legacyWatchPositions = prefs.getString("watch_positions", "")
@ -181,7 +181,8 @@ class MyApp : Application() {
DatabaseHolder.db.watchPositionDao().insertAll(
*watchPositions.toTypedArray()
)
} catch (e: Exception) {}
} catch (e: Exception) {
}
prefs.edit().remove("watch_positions").commit()
}
prefs.edit()

View File

@ -1,7 +1,7 @@
package com.github.libretube.util
import java.util.*
import kotlin.reflect.KProperty
import java.util.*
class ResettableLazyManager {
// we synchronize to make sure the timing of a reset() call and new inits do not collide

View File

@ -92,6 +92,7 @@ import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
import com.google.android.exoplayer2.util.RepeatModeUtil
import com.google.android.exoplayer2.video.VideoSize
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlin.math.abs
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -99,7 +100,6 @@ import org.chromium.net.CronetEngine
import retrofit2.HttpException
import java.io.IOException
import java.util.concurrent.Executors
import kotlin.math.abs
class PlayerFragment : BaseFragment() {

View File

@ -23,7 +23,7 @@
<Button
android:id="@+id/addToPlaylist"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/addToPlaylist" />
</LinearLayout>

View File

@ -14,22 +14,22 @@
android:text="@string/app_name"
android:textSize="20sp" />
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/playlistName">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/playlist_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/playlistName"
android:inputType="text"
android:padding="12dp" />
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:gravity="end"
android:orientation="horizontal">
<Button
@ -40,7 +40,7 @@
<Button
android:id="@+id/create_new_playlist"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/createPlaylist" />
</LinearLayout>

View File

@ -4,7 +4,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
@ -14,37 +13,37 @@
android:text="@string/app_name"
android:textSize="20sp" />
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/instance_name">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/instanceName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance_name"
android:inputType="text"
android:padding="12dp" />
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/instance_frontend_url">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/instanceFrontendUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance_frontend_url"
android:inputType="text"
android:padding="12dp" />
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/instance_api_url">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/instanceApiUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance_api_url"
android:inputType="text"
android:padding="12dp" />
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
@ -61,7 +60,7 @@
<Button
android:id="@+id/addInstance"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/addInstance" />
</LinearLayout>

View File

@ -13,22 +13,22 @@
android:text="@string/app_name"
android:textSize="20sp" />
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/password">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/delete_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"
android:padding="12dp" />
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:gravity="end"
android:orientation="horizontal">
<Button
@ -39,7 +39,7 @@
<Button
android:id="@+id/delete_account_confirm"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/deleteAccount" />
</LinearLayout>

View File

@ -4,7 +4,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
@ -14,33 +13,33 @@
android:text="@string/app_name"
android:textSize="20sp" />
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/username">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:inputType="text"
android:padding="12dp" />
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout style="@style/CustomDialogTextInputLayout">
<com.google.android.material.textfield.TextInputLayout
style="@style/CustomDialogTextInputLayout"
android:hint="@string/password">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"
android:padding="12dp" />
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:gravity="end"
android:orientation="horizontal">
<Button
@ -51,7 +50,7 @@
<Button
android:id="@+id/login"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/login" />
</LinearLayout>

View File

@ -63,7 +63,7 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">right</item>
<item name="android:layout_gravity">end</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:padding">8dp</item>
@ -73,16 +73,10 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="hintEnabled">false</item>
<item name="android:layout_marginLeft">15dp</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginBottom">5dp</item>
<item name="boxCornerRadiusBottomStart">15dp</item>
<item name="boxCornerRadiusBottomEnd">15dp</item>
<item name="boxCornerRadiusTopEnd">15dp</item>
<item name="boxCornerRadiusTopStart">15dp</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:layout_marginBottom">10dp</item>
</style>