Skip to content

Commit

Permalink
perf(app/ui): about page follow bark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xz-dev committed Sep 7, 2024
1 parent cee038e commit 7602fdd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 69 deletions.
8 changes: 3 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
android:usesCleartextTraffic="true"
android:dataExtractionRules="@xml/data_extraction_rules"
tools:targetApi="s">
<activity
android:name=".ui.home.AboutActivity"
android:exported="false"
android:label="@string/about"
android:theme="@style/AppTheme" />
<activity
android:name=".ui.restore.RestoreActivity"
android:exported="false" />
Expand Down Expand Up @@ -91,6 +86,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.home.AboutActivity"
android:label="@string/about" />
<activity
android:name=".ui.hubmanager.HubManagerActivity"
android:label="@string/app_hub" />
Expand Down
91 changes: 29 additions & 62 deletions app/src/main/java/net/xzos/upgradeall/ui/home/AboutActivity.kt
Original file line number Diff line number Diff line change
@@ -1,71 +1,38 @@
package net.xzos.upgradeall.ui.home

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.viewinterop.AndroidViewBinding
import androidx.core.content.ContextCompat
import android.view.View
import androidx.appcompat.widget.Toolbar
import net.xzos.upgradeall.R
import net.xzos.upgradeall.databinding.LayoutHomeTitleBarBinding
import net.xzos.upgradeall.databinding.LayoutHomeUpdatingCardBinding
import net.xzos.upgradeall.ui.base.BaseActivity
import net.xzos.upgradeall.databinding.ActivityAboutBinding
import net.xzos.upgradeall.ui.base.AppBarActivity
import net.xzos.upgradeall.utils.MiscellaneousUtils

class AboutActivity : BaseActivity() {
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
@Composable
fun AboutText() {
Text(stringResource(R.string.about))
class AboutActivity : AppBarActivity() {

private lateinit var binding: ActivityAboutBinding

override fun initBinding(): View =
ActivityAboutBinding.inflate(layoutInflater).apply {
binding = this
}.root

override fun getAppBar(): Toolbar = binding.appbar.toolbar
override fun initView() {
binding.layoutWebsiteCard.apply {
ivIcon.setImageResource(R.drawable.ic_url)
tsTitle.setText(getString(R.string.official_website))
val url = "https://up-a.org/"
tvSubtitle.text = url
layoutCard.setOnClickListener {
MiscellaneousUtils.accessByBrowser(url, layoutCard.context)
}
Scaffold(
topBar = {
TopAppBar(title = { AboutText() },
navigationIcon = {
IconButton(onClick = { finish() }) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = "Back"
)
}
}
)
}
) { innerPadding ->
Column(modifier = Modifier.padding(innerPadding)) {
AndroidViewBinding(LayoutHomeTitleBarBinding::inflate)
AndroidViewBinding(LayoutHomeUpdatingCardBinding::inflate) {
ivIcon.setImageResource(R.drawable.ic_url)
tsTitle.setText(getString(R.string.official_website))
val url = "https://up-a.org/"
tvSubtitle.text = url
layoutCard.setOnClickListener {
MiscellaneousUtils.accessByBrowser(url, layoutCard.context)
}
}
AndroidViewBinding(LayoutHomeUpdatingCardBinding::inflate) {
tsTitle.setText(getString(R.string.donate))
val url = "https://afdian.net/a/inkflaw"
tvSubtitle.text = url
layoutCard.setOnClickListener {
MiscellaneousUtils.accessByBrowser(url, layoutCard.context)
}
}
}
}
binding.layoutDonateCard.apply {
tsTitle.setText(getString(R.string.donate))
val url = "https://afdian.net/a/inkflaw"
tvSubtitle.text = url
layoutCard.setOnClickListener {
MiscellaneousUtils.accessByBrowser(url, layoutCard.context)
}
}
}
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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:fitsSystemWindows="false"
app:consumeSystemWindowsInsets="start|end"
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<include
android:id="@+id/appbar"
layout="@layout/app_bar" />

<include
android:id="@+id/layout_title_bar"
layout="@layout/layout_home_title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/appbar" />

<include
android:id="@+id/layout_website_card"
layout="@layout/layout_home_updating_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
app:layout_constraintTop_toBottomOf="@id/layout_title_bar" />

<include
android:id="@+id/layout_donate_card"
layout="@layout/layout_home_updating_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/layout_website_card" />
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_discover.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fitsSystemWindows="false"
app:consumeSystemWindowsInsets="start|end"
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
app:fitsSystemWindowsInsets="start|end"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<include
android:id="@+id/appbar"
Expand Down

0 comments on commit 7602fdd

Please sign in to comment.