From c7debe2f8de9bf5819dd1b7b4936d39afcf45994 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 20 Oct 2023 11:04:08 -0300 Subject: [PATCH 1/3] [app] show button instead of link in repo details screen to show list of apps in that repo --- .../views/repos/RepoDetailsActivity.java | 18 +++--- .../main/res/layout/activity_repo_details.xml | 61 ++++++++++++------- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/views/repos/RepoDetailsActivity.java b/app/src/main/java/org/fdroid/fdroid/views/repos/RepoDetailsActivity.java index 228e7f720..85670a9c2 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/repos/RepoDetailsActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/views/repos/RepoDetailsActivity.java @@ -75,11 +75,15 @@ public class RepoDetailsActivity extends AppCompatActivity { private static final int[] SHOW_IF_EXISTS = { R.id.label_repo_name, R.id.text_repo_name, + R.id.label_description, R.id.text_description, R.id.label_num_apps, R.id.text_num_apps, + R.id.button_view_apps, R.id.label_last_update, R.id.text_last_update, + R.id.label_last_update_downloaded, + R.id.text_last_update_downloaded, R.id.label_username, R.id.text_username, R.id.button_edit_credentials, @@ -413,6 +417,7 @@ public class RepoDetailsActivity extends AppCompatActivity { TextView name = repoView.findViewById(R.id.text_repo_name); TextView numApps = repoView.findViewById(R.id.text_num_apps); + TextView numAppsButton = repoView.findViewById(R.id.button_view_apps); TextView lastUpdated = repoView.findViewById(R.id.text_last_update); TextView lastDownloaded = repoView.findViewById(R.id.text_last_update_downloaded); @@ -423,22 +428,17 @@ public class RepoDetailsActivity extends AppCompatActivity { .observeOn(AndroidSchedulers.mainThread()) .subscribe(appCount -> { String countStr = String.format(LocaleCompat.getDefault(), "%d", appCount); - String numStr; - if (repo.getEnabled()) { - numStr = getString(R.string.repo_num_apps_link, countStr); - } else { - numStr = countStr; - } - numApps.setText(numStr); + numApps.setText(countStr); }); if (repo.getEnabled()) { - numApps.setOnClickListener(view -> { + numAppsButton.setOnClickListener(view -> { Intent i = new Intent(this, AppListActivity.class); i.putExtra(AppListActivity.EXTRA_REPO_ID, repo.getRepoId()); startActivity(i); }); + numAppsButton.setVisibility(View.VISIBLE); } else { - numApps.setTextColor(lastUpdated.getTextColors().getDefaultColor()); + numAppsButton.setVisibility(View.GONE); } setupDescription(repoView, repo); diff --git a/app/src/main/res/layout/activity_repo_details.xml b/app/src/main/res/layout/activity_repo_details.xml index 5be44c338..9f7800ed7 100644 --- a/app/src/main/res/layout/activity_repo_details.xml +++ b/app/src/main/res/layout/activity_repo_details.xml @@ -1,11 +1,11 @@ + android:fitsSystemWindows="true" + android:orientation="vertical"> + app:title="@string/repo_details" /> @@ -31,10 +31,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingEnd="?attr/listPreferredItemPaddingRight" + android:paddingStart="?attr/listPreferredItemPaddingLeft" android:paddingLeft="?attr/listPreferredItemPaddingLeft" - android:paddingRight="?attr/listPreferredItemPaddingRight" - android:paddingStart="?attr/listPreferredItemPaddingLeft"> + android:paddingEnd="?attr/listPreferredItemPaddingRight" + android:paddingRight="?attr/listPreferredItemPaddingRight"> - - - - + android:orientation="horizontal"> + + + + + + + + + +