Skip to content

Commit

Permalink
about: refactor to fragment with navigation (fixes #2570) (#2572)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Okuro3499 and dogi authored Oct 5, 2023
1 parent bfc051f commit 0e668eb
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1079
versionName "0.10.79"
versionCode 1080
versionName "0.10.80"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
android:name=".ui.news.NewsDetailActivity"
android:label="@string/title_activity_news_detail"
android:theme="@style/MyMaterialTheme.NoActionBar" />
<activity
android:name=".ui.dashboard.AboutActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".ui.dashboard.DisclaimerActivity"
android:theme="@style/AppTheme" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.ole.planet.myplanet.ui.dashboard

import android.os.Build
import android.os.Bundle
import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.core.text.HtmlCompat
import androidx.fragment.app.Fragment
import org.ole.planet.myplanet.databinding.FragmentAboutBinding
import org.ole.planet.myplanet.utilities.Constants

class AboutFragment : Fragment() {
private lateinit var fragmentAboutBinding: FragmentAboutBinding
@RequiresApi(Build.VERSION_CODES.N)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
fragmentAboutBinding = FragmentAboutBinding.inflate(inflater, container, false)
fragmentAboutBinding.tvDisclaimer.text = Html.fromHtml(getString(Constants.ABOUT), HtmlCompat.FROM_HTML_MODE_LEGACY)
return fragmentAboutBinding.root
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public boolean onMenuItemClick(MenuItem item) {
startActivity(new Intent(DashboardActivity.this, DisclaimerActivity.class));
break;
case R.id.action_about:
startActivity(new Intent(DashboardActivity.this, AboutActivity.class));
openCallFragment(new AboutFragment());
break;
case R.id.action_logout:
logout();
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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"
android:padding="@dimen/padding_normal"
tools:context=".ui.dashboard.AboutFragment">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="@dimen/_200dp"
android:layout_height="@dimen/_200dp"
android:layout_gravity="center"
android:src="@drawable/ole_logo" />

<TextView
android:id="@+id/tv_disclaimer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="textStart"
android:textColor="@color/md_black_1000" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

0 comments on commit 0e668eb

Please sign in to comment.