diff --git a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
index 96e7bc4c..9c3c3327 100644
--- a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
@@ -1,13 +1,11 @@
package org.mian.gitnex.activities;
import android.app.Activity;
-import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
-import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
@@ -33,7 +31,6 @@ import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount;
-import org.mian.gitnex.fragments.AboutFragment;
import org.mian.gitnex.fragments.AdministrationFragment;
import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
import org.mian.gitnex.fragments.DraftsFragment;
@@ -188,9 +185,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
else if(fragmentById instanceof ProfileFragment) {
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
}
- else if(fragmentById instanceof AboutFragment) {
- toolbarTitle.setText(getResources().getString(R.string.pageTitleAbout));
- }
else if(fragmentById instanceof DraftsFragment) {
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
}
@@ -455,6 +449,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
}
}
+ public void setActionBarTitle(String title) {
+
+ toolbarTitle.setText(title);
+ }
+
@Override
public void onButtonClicked(String text) {
@@ -544,15 +543,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
break;
- case R.id.nav_about:
- toolbarTitle.setText(getResources().getString(R.string.pageTitleAbout));
- getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit();
- break;
-
- case R.id.nav_rate_app:
- rateThisApp();
- break;
-
case R.id.nav_starred_repos:
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new StarredRepositoriesFragment()).commit();
@@ -584,16 +574,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
return true;
}
- public void rateThisApp() {
-
- try {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
- }
- catch(ActivityNotFoundException e) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())));
- }
- }
-
public static void logout(Activity activity, Context ctx) {
TinyDB tinyDb = new TinyDB(ctx.getApplicationContext());
diff --git a/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java b/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java
index 461ac50a..9f43bd12 100644
--- a/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java
+++ b/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java
@@ -9,6 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
+import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.databinding.FragmentAboutBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.TinyDB;
@@ -29,6 +30,8 @@ public class AboutFragment extends Fragment {
viewBinding.userServerVersion.setText(tinyDb.getString("giteaVersion"));
viewBinding.appBuild.setText(String.valueOf(AppUtil.getAppBuildNo(requireContext())));
+ ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.pageTitleAbout));
+
viewBinding.donationLinkLiberapay.setOnClickListener(v1 -> {
Intent intent = new Intent();
diff --git a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
index 2548857d..93bc84f5 100644
--- a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
+++ b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
@@ -1,6 +1,8 @@
package org.mian.gitnex.fragments;
+import android.content.ActivityNotFoundException;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -17,7 +19,6 @@ import org.mian.gitnex.activities.SettingsReportsActivity;
import org.mian.gitnex.activities.SettingsSecurityActivity;
import org.mian.gitnex.activities.SettingsTranslationActivity;
import org.mian.gitnex.helpers.TinyDB;
-import java.util.Objects;
/**
* Author M M Arif
@@ -37,6 +38,8 @@ public class SettingsFragment extends Fragment {
LinearLayout securityFrame = v.findViewById(R.id.securityFrame);
LinearLayout languagesFrame = v.findViewById(R.id.languagesFrame);
LinearLayout reportsFrame = v.findViewById(R.id.reportsFrame);
+ LinearLayout rateAppFrame = v.findViewById(R.id.rateAppFrame);
+ LinearLayout aboutAppFrame = v.findViewById(R.id.aboutAppFrame);
appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsAppearanceActivity.class)));
@@ -50,10 +53,24 @@ public class SettingsFragment extends Fragment {
reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsReportsActivity.class)));
+ rateAppFrame.setOnClickListener(aboutApp -> rateThisApp());
+
+ aboutAppFrame.setOnClickListener(aboutApp -> requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit());
+
return v;
}
+ public void rateThisApp() {
+
+ try {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + requireActivity().getPackageName())));
+ }
+ catch(ActivityNotFoundException e) {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + requireActivity().getPackageName())));
+ }
+ }
+
@Override
public void onResume() {
@@ -62,8 +79,8 @@ public class SettingsFragment extends Fragment {
TinyDB tinyDb = new TinyDB(getContext());
if(tinyDb.getBoolean("refreshParent")) {
- Objects.requireNonNull(getActivity()).recreate();
- getActivity().overridePendingTransition(0, 0);
+ requireActivity().recreate();
+ requireActivity().overridePendingTransition(0, 0);
tinyDb.putBoolean("refreshParent", false);
}
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index 399f1ce8..af07824b 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor">
-
@@ -208,8 +208,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/app/src/main/res/menu/drawer_menu.xml b/app/src/main/res/menu/drawer_menu.xml
index 760ef480..22a04944 100644
--- a/app/src/main/res/menu/drawer_menu.xml
+++ b/app/src/main/res/menu/drawer_menu.xml
@@ -56,19 +56,6 @@
android:icon="@drawable/ic_settings"
android:title="@string/navSettings" />
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4d6f4637..997eb3f2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -634,6 +634,8 @@
SSL certificates, cache, polling delay
Languages
Crash reports
+ If you like GitNex you can give it a thumbs up
+ App version, build, user gitea version
Archived