mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-19 14:27:01 -04:00
Merge branch 'repo-details-view-apps' into 'master'
Small Repository UI Improvements Closes #2701 and #2699 See merge request fdroid/fdroidclient!1305
This commit is contained in:
@@ -141,6 +141,7 @@ public class Apk implements Comparable<Apk>, Parcelable {
|
||||
packageName = packageInfo.packageName;
|
||||
versionName = packageInfo.versionName;
|
||||
versionCode = packageInfo.versionCode;
|
||||
targetSdkVersion = packageInfo.applicationInfo.targetSdkVersion;
|
||||
releaseChannels = Collections.emptyList();
|
||||
|
||||
// zero for "we don't know". If we require this in the future,
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CategorySpan extends ReplacementSpan {
|
||||
private static final int ICON_PADDING = (ICON_BACKGROUND_SIZE - ICON_SIZE) / 2;
|
||||
private static final int TEXT_LEADING_PADDING = 8;
|
||||
private static final int TEXT_TRAILING_PADDING = 12;
|
||||
private static final int TEXT_BELOW_PADDING = 4;
|
||||
private static final int TEXT_BELOW_PADDING = 2;
|
||||
private static final int WHITE_SPACE_PADDING_AT_END = 4;
|
||||
private static final float DROP_SHADOW_HEIGHT = 1.5f;
|
||||
|
||||
@@ -92,9 +92,10 @@ public class CategorySpan extends ReplacementSpan {
|
||||
int textWidth = (int) paint.measureText(categoryName.toString());
|
||||
int textLeadingPadding = (int) (TEXT_LEADING_PADDING * density);
|
||||
int textTrailingPadding = (int) (TEXT_TRAILING_PADDING * density);
|
||||
int textBelowPadding = (int) (TEXT_BELOW_PADDING * density);
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(x, bottom - height + TEXT_BELOW_PADDING * density);
|
||||
canvas.translate(x, bottom - height + textBelowPadding);
|
||||
|
||||
RectF backgroundRect = new RectF(0, 0, iconBackgroundSize + textLeadingPadding
|
||||
+ textWidth + textTrailingPadding, height);
|
||||
@@ -137,7 +138,8 @@ public class CategorySpan extends ReplacementSpan {
|
||||
// The category name drawn to the right of the category name.
|
||||
Paint textPaint = new Paint(paint);
|
||||
textPaint.setColor(grey < 186 ? Color.WHITE : Color.BLACK);
|
||||
canvas.drawText(categoryName.toString(), iconBackgroundSize + textLeadingPadding, bottom, textPaint);
|
||||
canvas.drawText(categoryName.toString(), iconBackgroundSize + textLeadingPadding, bottom - textBelowPadding,
|
||||
textPaint);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Widget.MaterialComponents.Toolbar.PrimarySurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/repo_details"
|
||||
style="@style/Widget.MaterialComponents.Toolbar.PrimarySurface" />
|
||||
app:title="@string/repo_details" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -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">
|
||||
|
||||
<!-- URL of this repo -->
|
||||
<TextView
|
||||
@@ -65,20 +65,39 @@
|
||||
android:id="@+id/text_description"
|
||||
style="@style/BodyText" />
|
||||
|
||||
<!-- Number of apps belonging to this repo -->
|
||||
<TextView
|
||||
android:id="@+id/label_num_apps"
|
||||
style="@style/CaptionText"
|
||||
android:text="@string/repo_num_apps" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_num_apps"
|
||||
style="@style/BodyText"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:textSize="22sp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?android:attr/textColorLink"
|
||||
tools:text="@string/repo_num_apps_link" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Number of apps belonging to this repo -->
|
||||
<TextView
|
||||
android:id="@+id/label_num_apps"
|
||||
style="@style/CaptionText"
|
||||
android:text="@string/repo_num_apps" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_num_apps"
|
||||
style="@style/BodyText"
|
||||
tools:text="1337" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_view_apps"
|
||||
style="@style/Widget.App.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="@string/repo_num_apps_button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- The last time this repo was updated -->
|
||||
<TextView
|
||||
|
||||
@@ -436,7 +436,7 @@ This often occurs with apps installed via Google Play or other sources, if they
|
||||
<string name="repo_details">Repository</string>
|
||||
<string name="repo_url">Address</string>
|
||||
<string name="repo_num_apps">Number of apps</string>
|
||||
<string name="repo_num_apps_link">%s (tap to list all apps)</string>
|
||||
<string name="repo_num_apps_button">Show apps</string>
|
||||
<string name="repo_fingerprint">Fingerprint of the signing key (SHA-256)</string>
|
||||
<string name="repo_description">Description</string>
|
||||
<string name="repo_last_update">Last update</string>
|
||||
|
||||
Reference in New Issue
Block a user