Compare commits
4 commits
b606df5e44
...
c65fd5564b
Author | SHA1 | Date | |
---|---|---|---|
c65fd5564b | |||
df034fc03a | |||
761718d0fe | |||
19837494bb |
9 changed files with 38 additions and 37 deletions
|
@ -0,0 +1,16 @@
|
||||||
|
package im.angry.openeuicc.ui
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Window
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import im.angry.openeuicc.common.R
|
||||||
|
|
||||||
|
abstract class BaseMaterialDialogFragment: DialogFragment() {
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
return super.onCreateDialog(savedInstanceState).also {
|
||||||
|
it.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
||||||
|
it.window?.setBackgroundDrawableResource(R.drawable.dialog_background)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ import android.widget.ProgressBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import com.journeyapps.barcodescanner.ScanContract
|
import com.journeyapps.barcodescanner.ScanContract
|
||||||
|
@ -24,11 +23,10 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import net.typeblog.lpac_jni.LocalProfileNotification
|
|
||||||
import net.typeblog.lpac_jni.ProfileDownloadCallback
|
import net.typeblog.lpac_jni.ProfileDownloadCallback
|
||||||
import kotlin.Exception
|
import kotlin.Exception
|
||||||
|
|
||||||
class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.OnMenuItemClickListener {
|
class ProfileDownloadFragment : BaseMaterialDialogFragment(), EuiccFragmentMarker, Toolbar.OnMenuItemClickListener {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "ProfileDownloadFragment"
|
const val TAG = "ProfileDownloadFragment"
|
||||||
|
|
||||||
|
@ -136,7 +134,6 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
return super.onCreateDialog(savedInstanceState).also {
|
return super.onCreateDialog(savedInstanceState).also {
|
||||||
it.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
|
||||||
it.setCanceledOnTouchOutside(false)
|
it.setCanceledOnTouchOutside(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.view.Window
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.angry.openeuicc.common.R
|
import im.angry.openeuicc.common.R
|
||||||
|
@ -21,7 +20,7 @@ import kotlinx.coroutines.withContext
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import java.lang.RuntimeException
|
import java.lang.RuntimeException
|
||||||
|
|
||||||
class ProfileRenameFragment : DialogFragment(), EuiccFragmentMarker {
|
class ProfileRenameFragment : BaseMaterialDialogFragment(), EuiccFragmentMarker {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "ProfileRenameFragment"
|
const val TAG = "ProfileRenameFragment"
|
||||||
|
|
||||||
|
@ -83,7 +82,6 @@ class ProfileRenameFragment : DialogFragment(), EuiccFragmentMarker {
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
return super.onCreateDialog(savedInstanceState).also {
|
return super.onCreateDialog(savedInstanceState).also {
|
||||||
it.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
|
||||||
it.setCanceledOnTouchOutside(false)
|
it.setCanceledOnTouchOutside(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
app-common/src/main/res/drawable/dialog_background.xml
Normal file
7
app-common/src/main/res/drawable/dialog_background.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid
|
||||||
|
android:color="?attr/colorSurface"/>
|
||||||
|
<corners
|
||||||
|
android:radius="?attr/dialogCornerRadius" />
|
||||||
|
</shape>
|
|
@ -1,5 +1,5 @@
|
||||||
<vector android:autoMirrored="true" android:height="24dp"
|
<vector android:autoMirrored="true" android:height="24dp"
|
||||||
android:tint="#000000" android:viewportHeight="24"
|
android:tint="?attr/colorControlNormal" android:viewportHeight="24"
|
||||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:hint="@string/profile_download_server"
|
android:hint="@string/profile_download_server"
|
||||||
style="@style/Widget.OpenEUICC.Input"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -48,8 +47,7 @@
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" />
|
||||||
android:theme="@style/Theme.OpenEUICC.Input.Cursor"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -59,7 +57,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginVertical="15dp"
|
android:layout_marginVertical="15dp"
|
||||||
android:hint="@string/profile_download_code"
|
android:hint="@string/profile_download_code"
|
||||||
style="@style/Widget.OpenEUICC.Input"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/profile_download_server"
|
app:layout_constraintTop_toBottomOf="@id/profile_download_server"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -69,8 +66,7 @@
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword" />
|
||||||
android:theme="@style/Theme.OpenEUICC.Input.Cursor"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -80,7 +76,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginVertical="15dp"
|
android:layout_marginVertical="15dp"
|
||||||
android:hint="@string/profile_download_confirmation_code"
|
android:hint="@string/profile_download_confirmation_code"
|
||||||
style="@style/Widget.OpenEUICC.Input"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/profile_download_code"
|
app:layout_constraintTop_toBottomOf="@id/profile_download_code"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -90,8 +85,7 @@
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword" />
|
||||||
android:theme="@style/Theme.OpenEUICC.Input.Cursor"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -102,7 +96,6 @@
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
android:hint="@string/profile_download_imei"
|
android:hint="@string/profile_download_imei"
|
||||||
style="@style/Widget.OpenEUICC.Input"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/profile_download_confirmation_code"
|
app:layout_constraintTop_toBottomOf="@id/profile_download_confirmation_code"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -113,8 +106,7 @@
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword" />
|
||||||
android:theme="@style/Theme.OpenEUICC.Input.Cursor"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginVertical="15dp"
|
android:layout_marginVertical="15dp"
|
||||||
android:hint="@string/profile_rename_new_name"
|
android:hint="@string/profile_rename_new_name"
|
||||||
style="@style/Widget.OpenEUICC.Input"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -49,8 +48,7 @@
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" />
|
||||||
android:theme="@style/Theme.OpenEUICC.Input.Cursor"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
|
@ -5,23 +5,17 @@
|
||||||
<item name="alertDialogTheme">@style/AlertDialogTheme</item>
|
<item name="alertDialogTheme">@style/AlertDialogTheme</item>
|
||||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||||
<item name="android:windowLightNavigationBar">?attr/isLightTheme</item>
|
<item name="android:windowLightNavigationBar">?attr/isLightTheme</item>
|
||||||
<item name="dialogCornerRadius">28dp</item>
|
<item name="toolbarStyle">@style/ToolbarTheme</item>
|
||||||
<item name="toolbarStyle">@style/Widget.Material3.Toolbar</item>
|
<item name="android:statusBarColor">?attr/colorSurfaceVariant</item>
|
||||||
<item name="android:statusBarColor">?attr/colorSurface</item>
|
|
||||||
<item name="android:colorBackground">?attr/colorSurface</item>
|
<item name="android:colorBackground">?attr/colorSurface</item>
|
||||||
|
<item name="dialogCornerRadius">28dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.OpenEUICC.Input.Cursor" parent="ThemeOverlay.Material3.TextInputEditText.OutlinedBox">
|
<style name="ToolbarTheme" parent="Widget.Material3.Toolbar">
|
||||||
<item name="colorControlActivated">?attr/colorSecondary</item>
|
<item name="android:background">?attr/colorSurfaceVariant</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.OpenEUICC.Input" parent="Widget.Material3.TextInputLayout.OutlinedBox">
|
<style name="AlertDialogTheme" parent="Theme.Material3.DayNight.Dialog.Alert">
|
||||||
<item name="boxBackgroundColor">@android:color/transparent</item>
|
|
||||||
<item name="boxStrokeColor">?attr/colorSecondary</item>
|
|
||||||
<item name="hintTextColor">?attr/colorSecondary</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="AlertDialogTheme" parent="ThemeOverlay.Material3.Dialog.Alert">
|
|
||||||
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
|
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
|
||||||
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
|
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
|
||||||
<item name="dialogCornerRadius">28dp</item>
|
<item name="dialogCornerRadius">28dp</item>
|
||||||
|
|
|
@ -16,7 +16,6 @@ import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.appcompat.widget.Toolbar.OnMenuItemClickListener
|
import androidx.appcompat.widget.Toolbar.OnMenuItemClickListener
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -27,7 +26,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
class SlotMappingFragment: DialogFragment(), OnMenuItemClickListener {
|
class SlotMappingFragment: BaseMaterialDialogFragment(), OnMenuItemClickListener {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "SlotMappingFragment"
|
const val TAG = "SlotMappingFragment"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue