From 1c1f73eafc4e97b8a930ca5244033cf9967aa002 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Sat, 26 Sep 2020 07:54:31 +0200 Subject: [PATCH] Redo About screen UI and some refactors (#705) Redo About screen UI and some refactors Co-authored-by: M M Arif Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/705 --- .../mian/gitnex/fragments/AboutFragment.java | 51 +-- app/src/main/res/layout/fragment_about.xml | 307 +++++++++++------- .../main/res/layout/fragment_repo_info.xml | 2 +- app/src/main/res/values/strings.xml | 15 +- 4 files changed, 208 insertions(+), 167 deletions(-) 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 1f888ee2..5ff05892 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/AboutFragment.java @@ -6,14 +6,12 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import org.mian.gitnex.R; +import org.mian.gitnex.databinding.FragmentAboutBinding; import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.TinyDB; -import java.util.Objects; /** * Author M M Arif @@ -21,30 +19,17 @@ import java.util.Objects; public class AboutFragment extends Fragment { - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - - View v = inflater.inflate(R.layout.fragment_about, container, false); + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + FragmentAboutBinding viewBinding = FragmentAboutBinding.inflate(inflater, container, false); TinyDB tinyDb = new TinyDB(getContext()); - final TextView appVerBuild; - final TextView donationLink; - final TextView donationLinkPatreon; - final TextView translateLink; - final TextView appWebsite; - final TextView appRepo; + viewBinding.appVersion.setText(AppUtil.getAppVersion(requireContext())); + viewBinding.userServerVersion.setText(tinyDb.getString("giteaVersion")); + viewBinding.appBuild.setText(String.valueOf(AppUtil.getAppBuildNo(requireContext()))); - appVerBuild = v.findViewById(R.id.appVerBuild); - TextView viewTextGiteaVersion = v.findViewById(R.id.giteaVersion); - donationLink = v.findViewById(R.id.donationLink); - donationLinkPatreon = v.findViewById(R.id.donationLinkPatreon); - translateLink = v.findViewById(R.id.translateLink); - appWebsite = v.findViewById(R.id.appWebsite); - appRepo = v.findViewById(R.id.appRepo); - - appVerBuild.setText(getString(R.string.appVerBuild, AppUtil.getAppVersion(Objects.requireNonNull(getContext())), AppUtil.getAppBuildNo(getContext()))); - - donationLink.setOnClickListener(v1 -> { + viewBinding.donationLinkLiberapay.setOnClickListener(v1 -> { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); @@ -53,7 +38,7 @@ public class AboutFragment extends Fragment { startActivity(intent); }); - donationLinkPatreon.setOnClickListener(v12 -> { + viewBinding.donationLinkPatreon.setOnClickListener(v12 -> { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); @@ -62,7 +47,7 @@ public class AboutFragment extends Fragment { startActivity(intent); }); - translateLink.setOnClickListener(v13 -> { + viewBinding.translateLink.setOnClickListener(v13 -> { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); @@ -71,7 +56,7 @@ public class AboutFragment extends Fragment { startActivity(intent); }); - appWebsite.setOnClickListener(v14 -> { + viewBinding.appWebsite.setOnClickListener(v14 -> { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); @@ -80,19 +65,7 @@ public class AboutFragment extends Fragment { startActivity(intent); }); - appRepo.setOnClickListener(v15 -> { - - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_VIEW); - intent.addCategory(Intent.CATEGORY_BROWSABLE); - intent.setData(Uri.parse(getResources().getString(R.string.appRepoLink))); - startActivity(intent); - }); - - String commit = getResources().getString(R.string.commitPage) + tinyDb.getString("giteaVersion"); - viewTextGiteaVersion.setText(commit); - - return v; + return viewBinding.getRoot(); } } diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 5c3788e1..f320e1a8 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -3,7 +3,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - @@ -23,7 +24,7 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="20dp" android:baselineAligned="false" - android:contentDescription="@string/logo" + android:contentDescription="@string/app_name" android:src="@mipmap/app_logo" /> + android:layout_gravity="center_horizontal" /> + + + - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginBottom="5dp" /> + android:layout_height="wrap_content" + android:textIsSelectable="true" + android:textSize="14sp" + android:textColor="?attr/primaryTextColor" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/app/src/main/res/layout/fragment_repo_info.xml b/app/src/main/res/layout/fragment_repo_info.xml index d4ccea8a..2c447b88 100644 --- a/app/src/main/res/layout/fragment_repo_info.xml +++ b/app/src/main/res/layout/fragment_repo_info.xml @@ -272,7 +272,7 @@ gitnex@swatian.com Source code https://codeberg.org/gitnex/GitNex - Website https://gitnex.com/ - Your Gitea version\n + Your Gitea Version https://liberapay.com/mmarif/donate https://www.patreon.com/mmarif - %1$s / build %2$d + Version + Build GitNex is a free, open-source Android client for Git repository management tool Gitea. GitNex is Licensed under GPLv3.\n\nThanks to all the contributors and donators for your generous work and donations. https://crowdin.com/project/gitnex [GitNex] - Crash Report #%1$d + Crowdin + Translate + Support - Support the App on Liberapay - Become a Patreon + Liberapay + Patreon My Repositories @@ -144,7 +147,6 @@ No issues found - Website Size Default Branch SSH URL @@ -519,7 +521,6 @@ Copy URL - Translate GitNex with Crowdin Explore repositories Star Repository Unstar Repository