Redo About screen UI and some refactors (#705)

Redo About screen UI and some refactors

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/705
This commit is contained in:
M M Arif 2020-09-26 07:54:31 +02:00
parent 02672aef3d
commit 1c1f73eafc
4 changed files with 208 additions and 167 deletions

View File

@ -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();
}
}

View File

@ -3,7 +3,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView android:layout_width="match_parent"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor">
@ -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" />
<TextView
@ -34,134 +35,200 @@
android:textIsSelectable="true"
android:layout_marginTop="5dp"
android:textSize="24sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor"
android:layout_gravity="center_horizontal"/>
android:layout_gravity="center_horizontal" />
<!-- version -->
<TextView
android:id="@+id/appVerBuild"
android:text="@string/appVerBuild"
android:layout_width="wrap_content"
android:id="@+id/appVersionHeader"
android:text="@string/appVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginTop="40dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerVersion"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:textSize="16sp"
android:textColor="?attr/primaryTextColor"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/appDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/appDesc"
android:textIsSelectable="true"
android:layout_marginTop="25dp"
android:textSize="16sp"
android:textColor="?attr/primaryTextColor"
android:padding="5dp"
android:background="?attr/primaryBackgroundColor"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/giteaVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/commitPage"
android:layout_marginTop="15dp"
android:textSize="16sp"
android:textColor="?attr/primaryTextColor"
android:padding="5dp"
android:background="?attr/primaryBackgroundColor"
android:autoLink="web" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical"
android:padding="5dp"
android:background="?attr/primaryBackgroundColor">
<TextView
android:id="@+id/donationLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/supportText"
android:textColor="@color/lightBlue"
android:textSize="16sp"
android:gravity="start"
android:autoLink="web"
android:visibility="visible"
android:layout_marginBottom="10dp"
android:textColorLink="@color/lightBlue" />
<TextView
android:id="@+id/donationLinkPatreon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/supportTextPatreon"
android:textColor="@color/lightBlue"
android:textSize="16sp"
android:gravity="start"
android:autoLink="web"
android:visibility="visible"
android:layout_marginBottom="10dp"
android:textColorLink="@color/lightBlue" />
<TextView
android:id="@+id/translateLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:gravity="start"
android:text="@string/translateText"
android:textColor="@color/lightBlue"
android:textColorLink="@color/lightBlue"
android:textSize="16sp"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical"
android:padding="5dp"
android:background="?attr/primaryBackgroundColor">
<TextView
android:id="@+id/appWebsite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/appWebsite"
android:textColor="@color/lightBlue"
android:textSize="16sp"
android:gravity="start"
android:autoLink="web"
android:visibility="visible"
android:layout_marginBottom="10dp"
android:textColorLink="@color/lightBlue" />
<TextView
android:id="@+id/appRepo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/appRepo"
android:textColor="@color/lightBlue"
android:textSize="16sp"
android:gravity="start"
android:autoLink="web"
android:visibility="visible"
android:textColorLink="@color/lightBlue" />
</LinearLayout>
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/appVersion"
android:layout_width="wrap_content"
android:layout_height="25dp" />
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="14sp"
android:textColor="?attr/primaryTextColor" />
<!-- version -->
<!-- build -->
<TextView
android:id="@+id/appBuildHeader"
android:text="@string/appBuild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerBuild"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/appBuild"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="14sp"
android:textColor="?attr/primaryTextColor" />
<!-- build -->
<!-- user server version -->
<TextView
android:id="@+id/userServerVersionHeader"
android:text="@string/commitPage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerUserServerVersion"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/userServerVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="14sp"
android:textColor="?attr/primaryTextColor" />
<!-- user server version -->
<!-- support -->
<TextView
android:id="@+id/supportHeader"
android:text="@string/supportText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerSupport"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/donationLinkLiberapay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/supportTextLiberapay"
android:textColor="@color/lightBlue"
android:textSize="14sp"
android:autoLink="web"
android:layout_marginBottom="10dp"
android:textColorLink="@color/lightBlue" />
<TextView
android:id="@+id/donationLinkPatreon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/supportTextPatreon"
android:textColor="@color/lightBlue"
android:textSize="14sp"
android:autoLink="web"
android:textColorLink="@color/lightBlue" />
<!-- support -->
<!-- translate -->
<TextView
android:id="@+id/translateHeader"
android:text="@string/translateText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerTranslate"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/translateLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:gravity="start"
android:text="@string/translateWithCrowdin"
android:textColor="@color/lightBlue"
android:textColorLink="@color/lightBlue"
android:textSize="14sp"
android:visibility="visible" />
<!-- translate -->
<!-- website -->
<TextView
android:id="@+id/websiteHeader"
android:text="@string/websiteText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?attr/primaryTextColor" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/dividerWebsite"
android:background="?attr/dividerColor"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView
android:id="@+id/appWebsite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/appWebsiteLink"
android:textColor="@color/lightBlue"
android:textSize="14sp"
android:autoLink="web"
android:layout_marginBottom="24dp"
android:textColorLink="@color/lightBlue" />
<!-- website -->
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -272,7 +272,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/infoTabRepoWebsite"
android:contentDescription="@string/websiteText"
app:srcCompat="@drawable/ic_link" />
<LinearLayout

View File

@ -4,18 +4,21 @@
<string name="appEmail" translatable="false">gitnex@swatian.com</string>
<string name="appRepo" translatable="false">Source code</string>
<string name="appRepoLink" translatable="false">https://codeberg.org/gitnex/GitNex</string>
<string name="appWebsite" translatable="false">Website</string>
<string name="appWebsiteLink" translatable="false">https://gitnex.com/</string>
<string name="commitPage" translatable="false">Your Gitea version\n</string>
<string name="commitPage" translatable="false">Your Gitea Version</string>
<string name="supportLink" translatable="false">https://liberapay.com/mmarif/donate</string>
<string name="supportLinkPatreon" translatable="false">https://www.patreon.com/mmarif</string>
<string name="appVerBuild" translatable="false">%1$s / build %2$d</string>
<string name="appVersion" translatable="false">Version</string>
<string name="appBuild" translatable="false">Build</string>
<string name="appDesc" translatable="false">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.</string>
<string name="crowdInLink" translatable="false">https://crowdin.com/project/gitnex</string>
<string name="crashReportEmailSubject" translatable="false">[GitNex] - Crash Report #%1$d</string>
<string name="translateWithCrowdin" translatable="false">Crowdin</string>
<string name="translateText" translatable="false">Translate</string>
<string name="supportText" translatable="false">Support</string>
<string name="supportText" translatable="false">Support the App on Liberapay</string>
<string name="supportTextPatreon" translatable="false">Become a Patreon</string>
<string name="supportTextLiberapay" translatable="false">Liberapay</string>
<string name="supportTextPatreon" translatable="false">Patreon</string>
<!-- menu items -->
<string name="navMyRepos">My Repositories</string>
@ -144,7 +147,6 @@
<string name="noDataIssueTab">No issues found</string>
<string name="infoTabRepoWebsite">Website</string>
<string name="infoTabRepoSize">Size</string>
<string name="infoTabRepoDefaultBranch">Default Branch</string>
<string name="infoTabRepoSshUrl">SSH URL</string>
@ -519,7 +521,6 @@
<string name="genericCopyUrl">Copy URL</string>
<!-- generic copy -->
<string name="translateText">Translate GitNex with Crowdin</string>
<string name="exploreTextBoxHint">Explore repositories</string>
<string name="starRepository">Star Repository</string>
<string name="unStarRepository">Unstar Repository</string>