Skip to content

Commit

Permalink
Add titlebar in about page
Browse files Browse the repository at this point in the history
This addition will provide easy navigation back to the main menu,
as well as improve the user experience and consistent design.
  • Loading branch information
Biswa96 committed Nov 18, 2023
1 parent 5ea7ae9 commit 0915fd8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
10 changes: 9 additions & 1 deletion app/src/main/java/com/github/tmo1/sms_ie/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@ class AboutActivity : AppCompatActivity() {
setContentView(R.layout.activity_about)
val aboutText: TextView = findViewById(R.id.aboutText)
aboutText.text = getString(R.string.app_about_text, BuildConfig.VERSION_NAME)
setSupportActionBar(findViewById(R.id.toolbar))
supportActionBar?.setTitle(R.string.about)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
}

override fun onSupportNavigateUp(): Boolean {
finish()
return true
}
}
19 changes: 14 additions & 5 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@
~ along with SMS Import / Export. If not, see <https://www.gnu.org/licenses/>.
-->

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AboutActivity">
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.constraintlayout.widget.ConstraintLayout
<include layout="@layout/app_bar" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".AboutActivity">

<TextView
android:id="@+id/aboutText"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -158,4 +165,6 @@

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>
</ScrollView>

</LinearLayout>
12 changes: 12 additions & 0 deletions app/src/main/res/layout/app_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleTextAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
app:subtitleTextAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Subtitle" />

0 comments on commit 0915fd8

Please sign in to comment.