Browse Source

LuiActivity: implement a simple UI

This is needed to unblock SetupWizard.
Peter Cai 2 years ago
parent
commit
163ee27918

+ 11 - 2
app/src/main/java/im/angry/openeuicc/ui/LuiActivity.kt

@@ -1,12 +1,21 @@
 package im.angry.openeuicc.ui
 
 import android.content.Intent
+import android.view.View
 import androidx.appcompat.app.AppCompatActivity
+import im.angry.openeuicc.R
 
 class LuiActivity : AppCompatActivity() {
     override fun onStart() {
         super.onStart()
-        startActivity(Intent(this, PrivilegedMainActivity::class.java))
-        finish()
+        setContentView(R.layout.activity_lui)
+
+        findViewById<View>(R.id.lui_skip).setOnClickListener { finish() }
+        // TODO: Allow users to select slots, and then hand over directly to ProfileDownloadFragment
+        // TODO: Deactivate LuiActivity if there is no eSIM found.
+        // TODO: Support pre-filled download info (from carrier apps); UX
+        findViewById<View>(R.id.lui_download).setOnClickListener {
+            startActivity(Intent(this, PrivilegedMainActivity::class.java))
+        }
     }
 }

+ 5 - 0
app/src/main/res/drawable/ic_sim_card_download.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="?attr/colorControlNormal"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M18,2h-8L4,8v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C20,2.9 19.1,2 18,2zM12,17l-4,-4h3V9.02L13,9v4h3L12,17z"/>
+</vector>

+ 59 - 0
app/src/main/res/layout/activity_lui.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    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:background="?attr/colorSurfaceVariant">
+
+    <ImageView
+        android:id="@+id/lui_icon"
+        android:layout_width="64dp"
+        android:layout_height="64dp"
+        android:src="@drawable/ic_sim_card_download"
+        android:layout_margin="24dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <TextView
+        android:id="@+id/lui_title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="32dp"
+        android:text="@string/lui_title"
+        android:textSize="24sp"
+        android:textFontWeight="600"
+        app:layout_constraintTop_toBottomOf="@id/lui_icon"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <TextView
+        android:id="@+id/lui_desc"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="32dp"
+        android:text="@string/lui_desc"
+        android:textSize="16sp"
+        app:layout_constraintTop_toBottomOf="@id/lui_title"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <com.google.android.material.button.MaterialButton
+        android:id="@+id/lui_skip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="32dp"
+        android:text="@string/lui_skip"
+        android:textColor="?attr/colorOnSurfaceVariant"
+        android:background="?android:attr/selectableItemBackground"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <com.google.android.material.button.MaterialButton
+        android:id="@+id/lui_download"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="32dp"
+        android:text="@string/lui_download"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -16,4 +16,9 @@
     <string name="slot_mapping_help_dsds">\nDual SIM mode is supported but disabled. If your device comes with an internal eSIM chip, it might not be enabled by default. Change mapping above or enable dual SIM to access your eSIM.</string>
     <string name="slot_mapping_completed">Your new slot mapping has been set. Please wait until modem refreshes the slots.</string>
     <string name="slot_mapping_failure">The specified mapping might be invalid or unsupported by hardware.</string>
+
+    <string name="lui_title">Connect to mobile network by downloading an eSIM</string>
+    <string name="lui_desc">Your device supports eSIMs. To connect to mobile network, download your eSIM issued by a carrier, or insert a physical SIM.</string>
+    <string name="lui_skip">Skip</string>
+    <string name="lui_download">Download eSIM</string>
 </resources>