Browse Source

ui: Add a input details fragment for download wizard

Peter Cai 1 year ago
parent
commit
9cf95ad47c

+ 9 - 0
app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardActivity.kt

@@ -143,6 +143,15 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
         abstract fun createNextFragment(): DownloadWizardStepFragment?
         abstract fun createNextFragment(): DownloadWizardStepFragment?
         abstract fun createPrevFragment(): DownloadWizardStepFragment?
         abstract fun createPrevFragment(): DownloadWizardStepFragment?
 
 
+        protected fun gotoNextFragment(next: DownloadWizardStepFragment? = null) {
+            val realNext = next ?: createNextFragment()
+            (requireActivity() as DownloadWizardActivity).showFragment(
+                realNext!!,
+                R.anim.slide_in_right,
+                R.anim.slide_out_left
+            )
+        }
+
         protected fun hideProgressBar() {
         protected fun hideProgressBar() {
             (requireActivity() as DownloadWizardActivity).progressBar.visibility = View.GONE
             (requireActivity() as DownloadWizardActivity).progressBar.visibility = View.GONE
         }
         }

+ 30 - 0
app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardDetailsFragment.kt

@@ -0,0 +1,30 @@
+package im.angry.openeuicc.ui.wizard
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import im.angry.openeuicc.common.R
+
+class DownloadWizardDetailsFragment : DownloadWizardActivity.DownloadWizardStepFragment() {
+    override val hasNext: Boolean
+        get() = false
+    override val hasPrev: Boolean
+        get() = true
+
+    override fun createNextFragment(): DownloadWizardActivity.DownloadWizardStepFragment? {
+        TODO("Not yet implemented")
+    }
+
+    override fun createPrevFragment(): DownloadWizardActivity.DownloadWizardStepFragment =
+        DownloadWizardMethodSelectFragment()
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        val view = inflater.inflate(R.layout.fragment_download_details, container, false)
+        return view
+    }
+}

+ 1 - 1
app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardMethodSelectFragment.kt

@@ -27,7 +27,7 @@ class DownloadWizardMethodSelectFragment : DownloadWizardActivity.DownloadWizard
 
 
         },
         },
         DownloadMethod(R.drawable.ic_edit, R.string.download_wizard_method_manual) {
         DownloadMethod(R.drawable.ic_edit, R.string.download_wizard_method_manual) {
-
+            gotoNextFragment(DownloadWizardDetailsFragment())
         }
         }
     )
     )
 
 

+ 97 - 0
app-common/src/main/res/layout/fragment_download_details.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fillViewport="true">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:id="@+id/download_wizard_details_title"
+            android:text="@string/download_wizard_details"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center_horizontal"
+            android:textSize="20sp"
+            android:layout_marginTop="20sp"
+            android:layout_marginBottom="20sp"
+            android:layout_marginStart="60sp"
+            android:layout_marginEnd="60sp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constrainedWidth="true"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/profile_download_server"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:hint="@string/profile_download_server">
+
+            <com.google.android.material.textfield.TextInputEditText
+                android:layout_width="match_parent"
+                android:layout_height="match_parent" />
+
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/profile_download_code"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:hint="@string/profile_download_code">
+
+            <com.google.android.material.textfield.TextInputEditText
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:inputType="textPassword" />
+
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/profile_download_confirmation_code"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:hint="@string/profile_download_confirmation_code">
+
+            <com.google.android.material.textfield.TextInputEditText
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:inputType="textPassword" />
+
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/profile_download_imei"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="15dp"
+            android:layout_marginBottom="6dp"
+            android:hint="@string/profile_download_imei"
+            app:passwordToggleEnabled="true">
+
+            <com.google.android.material.textfield.TextInputEditText
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:inputType="textPassword" />
+
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <androidx.constraintlayout.helper.widget.Flow
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:layout_marginHorizontal="20dp"
+            app:constraint_referenced_ids="profile_download_server,profile_download_code,profile_download_confirmation_code,profile_download_imei"
+            app:flow_verticalGap="16dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/download_wizard_details_title"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constrainedWidth="true" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</ScrollView>

+ 1 - 0
app-common/src/main/res/values/strings.xml

@@ -74,6 +74,7 @@
     <string name="download_wizard_method_qr_code">Scan a QR code with camera</string>
     <string name="download_wizard_method_qr_code">Scan a QR code with camera</string>
     <string name="download_wizard_method_gallery">Load a QR code from gallery</string>
     <string name="download_wizard_method_gallery">Load a QR code from gallery</string>
     <string name="download_wizard_method_manual">Enter manually</string>
     <string name="download_wizard_method_manual">Enter manually</string>
+    <string name="download_wizard_details">Input or confirm details for downloading your eSIM:</string>
 
 
     <string name="profile_rename_new_name">New nickname</string>
     <string name="profile_rename_new_name">New nickname</string>