Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add setup wizard support #350

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="app.grapheneos.setupwizard.action.APPS" />
dot166 marked this conversation as resolved.
Show resolved Hide resolved
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/app/grapheneos/apps/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.navigation.NavController
import androidx.navigation.NavOptions
Expand All @@ -35,6 +36,16 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
val views = MainActivityBinding.inflate(layoutInflater)
this.views = views
//get the current intent
val intent = intent
dot166 marked this conversation as resolved.
Show resolved Hide resolved

//get the attached extras from the intent
//we should use the same key as we used to attach the data.
val isSuW = intent.getBooleanExtra("SuW", false)
dot166 marked this conversation as resolved.
Show resolved Hide resolved

if (isSuW) {
dot166 marked this conversation as resolved.
Show resolved Hide resolved
views.done.isVisible = true
}

window.setDecorFitsSystemWindows(false)

Expand Down Expand Up @@ -78,6 +89,8 @@ class MainActivity : AppCompatActivity() {
if (Build.VERSION.SDK_INT >= 33) {
maybeAskForNotificationPermission()
}

views.done.setOnClickListener { finish() }
}

override fun onNewIntent(intent: Intent) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@

</androidx.coordinatorlayout.widget.CoordinatorLayout>

<Button
android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/done" />

</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@
<string name="notification_permission_dialog_message">Allow the notification permission to get notified of app updates, download and installation status.</string>

<string name="dont_show_again">Don\'t show again</string>
<string name="done">Done</string>
</resources>