mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix create account dialog on RTL locale & remove update cache
This commit is contained in:
parent
7f475ba059
commit
d6aa0e576c
2 changed files with 125 additions and 115 deletions
|
@ -200,16 +200,23 @@ class InAppUpdater {
|
||||||
private suspend fun Activity.downloadUpdate(url: String): Boolean {
|
private suspend fun Activity.downloadUpdate(url: String): Boolean {
|
||||||
try {
|
try {
|
||||||
Log.d(LOG_TAG, "Downloading update: $url")
|
Log.d(LOG_TAG, "Downloading update: $url")
|
||||||
|
val appUpdateName = "CloudStream"
|
||||||
|
val appUpdateSuffix = "apk"
|
||||||
|
|
||||||
val localContext = this
|
// Delete all old updates
|
||||||
|
this.cacheDir.listFiles()?.filter {
|
||||||
|
it.name.startsWith(appUpdateName) && it.extension == appUpdateSuffix
|
||||||
|
}?.forEach {
|
||||||
|
it.deleteOnExit()
|
||||||
|
}
|
||||||
|
|
||||||
val downloadedFile = File.createTempFile("CloudStream", ".apk")
|
val downloadedFile = File.createTempFile(appUpdateName, ".$appUpdateSuffix")
|
||||||
val sink: BufferedSink = downloadedFile.sink().buffer()
|
val sink: BufferedSink = downloadedFile.sink().buffer()
|
||||||
|
|
||||||
updateLock.withLock {
|
updateLock.withLock {
|
||||||
sink.writeAll(app.get(url).body.source())
|
sink.writeAll(app.get(url).body.source())
|
||||||
sink.close()
|
sink.close()
|
||||||
openApk(localContext, Uri.fromFile(downloadedFile))
|
openApk(this, Uri.fromFile(downloadedFile))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text1"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_rowWeight="1"
|
android:layout_rowWeight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
@ -27,105 +30,105 @@
|
||||||
tools:text="Test" />
|
tools:text="Test" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="@style/WhiteButton"
|
|
||||||
android:layout_gravity="center_vertical|end"
|
|
||||||
app:icon="@drawable/ic_baseline_add_24"
|
|
||||||
android:text="@string/create_account"
|
|
||||||
android:id="@+id/create_account"
|
android:id="@+id/create_account"
|
||||||
android:layout_width="wrap_content" />
|
style="@style/WhiteButton"
|
||||||
</FrameLayout>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/create_account"
|
||||||
|
app:icon="@drawable/ic_baseline_add_24" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_marginBottom="60dp"
|
|
||||||
android:layout_marginHorizontal="10dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:textColorHint="?attr/grayTextColor"
|
|
||||||
android:hint="@string/example_username"
|
|
||||||
android:autofillHints="username"
|
|
||||||
android:id="@+id/login_username_input"
|
android:id="@+id/login_username_input"
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints="username"
|
||||||
|
android:hint="@string/example_username"
|
||||||
|
android:inputType="text"
|
||||||
android:nextFocusLeft="@id/apply_btt"
|
android:nextFocusLeft="@id/apply_btt"
|
||||||
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
android:nextFocusDown="@id/login_email_input"
|
android:nextFocusDown="@id/login_email_input"
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
android:layout_width="match_parent"
|
android:textColorHint="?attr/grayTextColor"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="text"
|
|
||||||
tools:ignore="LabelFor" />
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:textColorHint="?attr/grayTextColor"
|
android:id="@+id/login_email_input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:autofillHints="emailAddress"
|
android:autofillHints="emailAddress"
|
||||||
android:hint="@string/example_email"
|
android:hint="@string/example_email"
|
||||||
android:id="@+id/login_email_input"
|
android:inputType="textEmailAddress"
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
|
||||||
android:nextFocusLeft="@id/apply_btt"
|
android:nextFocusLeft="@id/apply_btt"
|
||||||
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
|
|
||||||
android:nextFocusUp="@id/login_username_input"
|
android:nextFocusUp="@id/login_username_input"
|
||||||
android:nextFocusDown="@id/login_server_input"
|
android:nextFocusDown="@id/login_server_input"
|
||||||
|
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
android:layout_width="match_parent"
|
android:textColorHint="?attr/grayTextColor"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textEmailAddress"
|
|
||||||
tools:ignore="LabelFor" />
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:textColorHint="?attr/grayTextColor"
|
|
||||||
android:hint="@string/example_ip"
|
|
||||||
android:id="@+id/login_server_input"
|
android:id="@+id/login_server_input"
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/example_ip"
|
||||||
|
android:inputType="textUri"
|
||||||
android:nextFocusLeft="@id/apply_btt"
|
android:nextFocusLeft="@id/apply_btt"
|
||||||
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
android:nextFocusUp="@id/login_email_input"
|
android:nextFocusUp="@id/login_email_input"
|
||||||
android:nextFocusDown="@id/login_password_input"
|
android:nextFocusDown="@id/login_password_input"
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
android:layout_width="match_parent"
|
android:textColorHint="?attr/grayTextColor"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textUri"
|
|
||||||
tools:ignore="LabelFor" />
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:textColorHint="?attr/grayTextColor"
|
|
||||||
android:hint="@string/example_password"
|
|
||||||
android:id="@+id/login_password_input"
|
android:id="@+id/login_password_input"
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
|
||||||
android:nextFocusLeft="@id/apply_btt"
|
|
||||||
android:nextFocusUp="@id/login_server_input"
|
|
||||||
android:nextFocusDown="@id/apply_btt"
|
|
||||||
|
|
||||||
android:requiresFadingEdge="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints="password"
|
||||||
|
android:hint="@string/example_password"
|
||||||
android:inputType="textVisiblePassword"
|
android:inputType="textVisiblePassword"
|
||||||
tools:ignore="LabelFor"
|
android:nextFocusLeft="@id/apply_btt"
|
||||||
android:autofillHints="password" />
|
|
||||||
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
|
android:nextFocusUp="@id/login_server_input"
|
||||||
|
android:nextFocusDown="@id/apply_btt"
|
||||||
|
android:requiresFadingEdge="vertical"
|
||||||
|
android:textColorHint="?attr/grayTextColor"
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/apply_btt_holder"
|
android:id="@+id/apply_btt_holder"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:gravity="bottom|end"
|
|
||||||
android:layout_marginTop="-60dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp">
|
android:layout_height="60dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_marginTop="-60dp"
|
||||||
|
android:gravity="bottom|end"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="@style/WhiteButton"
|
|
||||||
android:layout_gravity="center_vertical|end"
|
|
||||||
android:text="@string/login"
|
|
||||||
android:id="@+id/apply_btt"
|
android:id="@+id/apply_btt"
|
||||||
android:layout_width="wrap_content" />
|
style="@style/WhiteButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/login" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="@style/BlackButton"
|
|
||||||
android:layout_gravity="center_vertical|end"
|
|
||||||
android:text="@string/sort_cancel"
|
|
||||||
android:id="@+id/cancel_btt"
|
android:id="@+id/cancel_btt"
|
||||||
android:layout_width="wrap_content" />
|
style="@style/BlackButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/sort_cancel" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in a new issue