-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in-app instruction activity. After the module is activated, the…
… activity is disabled and the app icon is removed from the app drawer.
- Loading branch information
1 parent
6b3088b
commit c503f3c
Showing
6 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/berdik/letmedowngrade/InstructionsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.berdik.letmedowngrade | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.ComposeView | ||
import androidx.compose.ui.platform.ViewCompositionStrategy | ||
import com.mukesh.MarkDown | ||
import java.io.File | ||
|
||
class InstructionsActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_instructions) | ||
|
||
// Create a temporary file copy of the embedded instructions markdown file. | ||
val markdownSource: File = File.createTempFile(R.string.app_name.toString(), "tmp") | ||
markdownSource.writeBytes(resources.openRawResource(R.raw.setup_instructions).readBytes()) | ||
|
||
// Load the temporary file copy of the instructions in the activity. | ||
findViewById<ComposeView>(R.id.instructions_md_renderer).apply { | ||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) | ||
setContent { | ||
MaterialTheme { | ||
MarkDown( | ||
file = markdownSource, | ||
modifier = Modifier.fillMaxSize() | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".InstructionsActivity"> | ||
|
||
<androidx.compose.ui.platform.ComposeView | ||
android:id="@+id/instructions_md_renderer" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
Large diffs are not rendered by default.
Oops, something went wrong.