some layout modifications to Updates and AppDetails headers

This commit is contained in:
dkanada 2018-10-17 02:53:30 +09:00
parent 3f00b2a4fb
commit 24a4da9d89
13 changed files with 106 additions and 138 deletions

View File

@ -396,16 +396,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
return app;
}
/**
* In order to format all in coming descriptions before they are written
* out to the database and used elsewhere, this is needed to intercept
* the setting of {@link App#description} to insert the format method.
*/
@JsonProperty("description")
private void setDescription(String description) { // NOPMD
this.description = formatDescription(description);
}
/**
* Parses the {@code localized} block in the incoming index metadata,
* choosing the best match in terms of locale/language while filling as
@ -508,8 +498,11 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
}
}
whatsNew = getLocalizedEntry(localized, localesToUse, "whatsNew");
String value = getLocalizedEntry(localized, localesToUse, "video");
String value = getLocalizedEntry(localized, localesToUse, "whatsNew");
if (!TextUtils.isEmpty(value)) {
whatsNew = value;
}
value = getLocalizedEntry(localized, localesToUse, "video");
if (!TextUtils.isEmpty(value)) {
video = value.split("\n", 1)[0];
}

View File

@ -505,7 +505,7 @@ public class AppDetailsRecyclerViewAdapter
suggestedApk.versionName).toUpperCase(locale));
sbWhatsNew.append("\n\n");
sbWhatsNew.append(app.whatsNew);
whatsNewView.setText(sbWhatsNew);
whatsNewView.setText(trimTrailingNewlines(sbWhatsNew));
whatsNewView.setVisibility(View.VISIBLE);
// Set focus on the header section to prevent auto scrolling to
@ -540,17 +540,15 @@ public class AppDetailsRecyclerViewAdapter
});
if (app.antiFeatures != null && app.antiFeatures.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append("<ul>");
for (String af : app.antiFeatures) {
String afdesc = descAntiFeature(af);
sb.append("<li><div><a href=\"https://f-droid.org/wiki/page/Antifeature:")
sb.append("<p><a href=\"https://f-droid.org/wiki/page/Antifeature:")
.append(af)
.append("\">")
.append(afdesc)
.append("</a></div></li>");
.append("</a></p>");
}
sb.append("</ul>");
antiFeaturesView.setText(Html.fromHtml(sb.toString()));
antiFeaturesView.setText(trimTrailingNewlines(Html.fromHtml(sb.toString())));
antiFeaturesView.setMovementMethod(LinkMovementMethod.getInstance());
} else {
antiFeaturesView.setVisibility(View.GONE);
@ -1093,7 +1091,7 @@ public class AppDetailsRecyclerViewAdapter
Repo repo = RepoProvider.Helper.findById(context, apk.repoId);
if (repo != null) {
repository.setVisibility(View.VISIBLE);
repository.setText("Repository: " + repo.getName());
repository.setText(String.format(repo.getName(), context.getString(R.string.app_repository)));
} else {
repository.setVisibility(View.INVISIBLE);
}
@ -1170,7 +1168,7 @@ public class AppDetailsRecyclerViewAdapter
}
private String getApiText(final Apk apk) {
String apiText = "Version: ";
String apiText = "Android: ";
if (apk.minSdkVersion > 0 && apk.maxSdkVersion < Apk.SDK_VERSION_MAX_VALUE) {
apiText += context.getString(R.string.minsdk_up_to_maxsdk,
Utils.getAndroidVersionName(apk.minSdkVersion),

View File

@ -138,6 +138,7 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
public void toggleAllUpdateableApps() {
showAllUpdateableApps = !showAllUpdateableApps;
populateItems();
notifyDataSetChanged();
}
/**

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" />
<solid android:color="#ffeff4f9" />
</shape>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#3c3c3e" />
</shape>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#eff4f9" />
</shape>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#262627" />
</shape>

View File

@ -12,13 +12,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="8dp">
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
@ -77,7 +77,6 @@
android:textAppearance="@style/DetailsLastUpdatedStyle"
android:textColor="@android:color/darker_gray"
tools:text="Update released 12 days ago" />
</LinearLayout>
</RelativeLayout>
@ -86,10 +85,6 @@
android:id="@+id/progress_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@id/icon_and_name"
tools:visibility="gone">
@ -120,7 +115,7 @@
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/progress_cancel"
android:layout_toStartOf="@id/progress_cancel"
android:text=""
tools:text="500%"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<ProgressBar
@ -141,10 +136,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/icon_and_name"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingBottom="2dp"
android:clipToPadding="false"
android:visibility="visible"
@ -178,32 +169,48 @@
android:id="@+id/whats_new"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:layout_marginTop="8dp"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:background="?attr/detailPanel"
tools:text="NEW IN VERSION 1.0.2233\n\nA lot has happened since the last build:\n\n\t• Improved UI\n\t• Bug fixes" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:scrollbars="none"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textIsSelectable="true"
tools:text="This is the app description of this awezome app. It can be several lines long, but will be truncated at just a few if it is. A 'read more' button will appear so that you can expand the view and view the full text, if you wish. Yes, it will be blue and beautiful." />
<TextView
android:id="@+id/anti_features_warning"
style="@style/DetailsAntiFeaturesWarningStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/antifeatureswarning"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:drawableStart="?attr/antiFeaturesWarning"
android:drawableLeft="?attr/antiFeaturesWarning"
android:drawablePadding="10dp"
android:gravity="center_vertical" />
<TextView
android:id="@+id/label_anti_features"
android:layout_width="match_parent"
@ -214,10 +221,10 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:scrollbars="none"
android:text="@string/antifeatures"
android:textStyle="bold"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:text="@string/antifeatures" />
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/text_anti_features"
@ -229,39 +236,17 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:scrollbars="none"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
tools:text="\t• This app tracks and reports your activity." />
tools:text="\t• This app tracks and reports your activity."
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/description_more"
style="@style/DetailsMoreButtonStyle"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="end"
android:gravity="center"
android:text="@string/more"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
tools:text="more" />
<TextView
android:id="@+id/anti_features_warning"
style="@style/DetailsAntiFeaturesWarningStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:drawableStart="?attr/antiFeaturesWarning"
android:drawableLeft="?attr/antiFeaturesWarning"
android:gravity="center_vertical"
android:drawablePadding="10dp"
android:text="@string/antifeatureswarning" />
style="@style/DetailsMoreButtonStyle" />
</LinearLayout>
</android.support.v7.widget.CardView>

View File

@ -41,9 +41,6 @@
android:layout_height="match_parent"
android:paddingTop="3dp">
<include layout="@layout/app_status_suggested"
android:id="@+id/status_suggested" />
<TextView android:id="@+id/status_installed"
style="@style/AppVersionStatus"
android:background="@drawable/app_version_item_status_installed"
@ -51,6 +48,9 @@
android:textStyle="bold"
android:text="@string/app_installed" />
<include layout="@layout/app_status_suggested"
android:id="@+id/status_suggested" />
<TextView android:id="@+id/status_incompatible"
style="@style/AppVersionStatus"
android:background="@drawable/app_version_item_status_incompatible"

View File

@ -4,43 +4,49 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="?appDetailsCardBackground">
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
when it will inevitably read out the name of the app straight after. -->
<ImageView
android:id="@+id/icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="48dp"
android:layout_height="48dp"
tools:src="@drawable/ic_launcher"
android:scaleType="fitCenter"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
tools:ignore="ContentDescription" />
android:layout_marginBottom="8dp"
android:scaleType="fitCenter"
tools:src="@drawable/ic_launcher"
tools:ignore="ContentDescription"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<LinearLayout
android:id="@+id/text_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintEnd_toStartOf="@+id/action_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/progress_bar"
android:orientation="vertical">
<TextView
android:id="@+id/app_name"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="F-Droid Application manager with a long name that will wrap and then ellipsize"
android:textSize="16sp"
android:textColor="?attr/installedApps"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintEnd_toStartOf="@+id/action_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
app:layout_constraintVertical_bias="0.333" />
android:ellipsize="end" />
<TextView
android:id="@+id/status"
@ -48,41 +54,34 @@
android:layout_height="wrap_content"
tools:text="@string/app_list_download_ready"
style="@style/AppListItemStatusText"
app:layout_constraintTop_toBottomOf="@+id/app_name"
app:layout_constraintStart_toEndOf="@+id/icon"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:visibility="gone"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/app_name"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintEnd_toStartOf="@+id/cancel_button"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible" />
<ImageButton
android:id="@+id/cancel_button"
android:contentDescription="@string/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cancel"
android:contentDescription="@string/cancel"
android:background="@android:color/transparent"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/progress_bar"
app:layout_constraintBottom_toBottomOf="@+id/progress_bar"
android:visibility="gone"
tools:visibility="visible" />
<Button
@ -94,9 +93,9 @@
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="Update" />
</android.support.constraint.ConstraintLayout>

View File

@ -25,13 +25,13 @@
android:id="@+id/text_apps_to_update"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="SAnd, Birthday Droid, Dados D, Other app, Another app"
android:maxLines="1"
android:ellipsize="end"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:maxLines="1"
android:ellipsize="end"
tools:text="SAnd, Birthday Droid, Dados D, Other app, Another app"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_download_all"
app:layout_constraintTop_toBottomOf="@+id/text_updates_available" />
@ -40,11 +40,10 @@
android:id="@+id/button_download_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="Update all"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:textAllCaps="true"
android:contentDescription="@string/updates__tts__download_updates_for_all_apps"
android:text="@string/updates__tts__download_updates_for_all_apps"
style="@style/DetailsPrimaryButtonStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/text_updates_available"
@ -52,7 +51,7 @@
<Button
android:id="@+id/button_toggle_apps_to_update"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="?attr/selectableItemBackground"

View File

@ -102,6 +102,7 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="app__install_downloaded_update">Update</string>
<string name="app_installed_media">File installed to %s</string>
<string name="app_permission_storage">F-Droid needs the storage permission to install this to storage. Please allow it on the next screen to proceed with installation.</string>
<string name="app_repository">Repository: %1$s</string>
<string name="app_size">Size: %1$s</string>
<string name="app_list__name__downloading_in_progress">Downloading %1$s</string>
@ -116,15 +117,15 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="send_installed_apps_csv">Apps installed by F-Droid as CSV file</string>
<string name="installed_app__updates_ignored">Updates ignored</string>
<string name="installed_app__updates_ignored_for_suggested_version">Updates ignored for Version %1$s</string>
<!-- The inline download button shown in the "Updates" screen only uses an icon and so requires
some descriptive text for the TTS engine -->
<string name="updates__tts__download_app">Download</string>
<string name="updates__tts__download_updates_for_all_apps">Download all updates</string>
<string name="updates__app_with_known_vulnerability__prompt_uninstall">We found a vulnerability with %1$s. We recommend uninstalling this app immediately.</string>
<string name="updates__app_with_known_vulnerability__prompt_upgrade">We found a vulnerability with %1$s. We recommend upgrading to the newest version immediately.</string>
<string name="updates__app_with_known_vulnerability__ignore">Ignore</string>
<!-- The inline download button shown in the "Updates" screen only uses an icon and so requires
some descriptive text for the TTS engine -->
<string name="updates__tts__download_app">Download</string>
<string name="updates__tts__download_updates_for_all_apps">Update all</string>
<string name="updates__hide_updateable_apps">Hide apps</string>
<string name="updates__show_updateable_apps">Show apps</string>
<plurals name="updates__download_updates_for_apps">

View File

@ -29,8 +29,8 @@
</style>
<style name="DetailsMoreButtonStyle">
<item name="android:padding">5dp</item>
<item name="android:textSize">15sp</item>
<item name="android:padding">8dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/fdroid_blue</item>
</style>