Replace "Recently updated" and "Whats new" with "New" tag.
As per the newer design iteration. Also re-order the items on the main page so new items always come before recently updated ones from the same day.
This commit is contained in:
parent
a1a7427cd2
commit
2eab1d0e6d
@ -790,7 +790,11 @@ public class AppProvider extends FDroidProvider {
|
||||
break;
|
||||
|
||||
case RECENTLY_UPDATED:
|
||||
sortOrder = getTableName() + "." + Cols.LAST_UPDATED + " DESC";
|
||||
String table = getTableName();
|
||||
String isNew = table + "." + Cols.LAST_UPDATED + " <= " + table + "." + Cols.ADDED + " DESC";
|
||||
String lastUpdated = table + "." + Cols.LAST_UPDATED + " DESC";
|
||||
sortOrder = lastUpdated + ", " + isNew;
|
||||
|
||||
selection = selection.add(queryRecentlyUpdated());
|
||||
includeSwap = false;
|
||||
break;
|
||||
|
@ -23,32 +23,39 @@ import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
|
||||
import org.fdroid.fdroid.AppDetails;
|
||||
import org.fdroid.fdroid.AppDetails2;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.views.apps.FeatureImage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* The {@link AppCardController} can bind an app to several different layouts, as long as the layout
|
||||
* contains the following elements:
|
||||
* + {@link R.id#icon} ({@link ImageView}, required)
|
||||
* + {@link R.id#summary} ({@link TextView}, required)
|
||||
* + {@link R.id#new_tag} ({@link TextView}, optional)
|
||||
* + {@link R.id#featured_image} ({@link ImageView}, optional)
|
||||
* + {@link R.id#status} ({@link TextView}, optional)
|
||||
*/
|
||||
public class AppCardController extends RecyclerView.ViewHolder implements ImageLoadingListener, View.OnClickListener {
|
||||
@NonNull
|
||||
private final ImageView icon;
|
||||
|
||||
/**
|
||||
* Text starting with the app name (in bold) followed by a short summary of the app.
|
||||
*/
|
||||
@NonNull
|
||||
private final TextView summary;
|
||||
|
||||
/**
|
||||
* A little blue tag which says "New" to indicate an app was added to the repository recently.
|
||||
*/
|
||||
@Nullable
|
||||
private final TextView status;
|
||||
private final TextView newTag;
|
||||
|
||||
/**
|
||||
* Wide and short image for branding the app. If it is not present in the metadata then F-Droid
|
||||
* will draw some abstract art instead.
|
||||
*/
|
||||
@Nullable
|
||||
private final FeatureImage featuredImage;
|
||||
|
||||
@ -58,20 +65,16 @@ public class AppCardController extends RecyclerView.ViewHolder implements ImageL
|
||||
private final Activity activity;
|
||||
private final DisplayImageOptions displayImageOptions;
|
||||
|
||||
private final Date recentCuttoffDate;
|
||||
|
||||
public AppCardController(Activity activity, View itemView) {
|
||||
super(itemView);
|
||||
|
||||
this.activity = activity;
|
||||
|
||||
recentCuttoffDate = Preferences.get().calcMaxHistory();
|
||||
|
||||
icon = (ImageView) findViewAndEnsureNonNull(itemView, R.id.icon);
|
||||
summary = (TextView) findViewAndEnsureNonNull(itemView, R.id.summary);
|
||||
|
||||
featuredImage = (FeatureImage) itemView.findViewById(R.id.featured_image);
|
||||
status = (TextView) itemView.findViewById(R.id.status);
|
||||
newTag = (TextView) itemView.findViewById(R.id.new_tag);
|
||||
|
||||
displayImageOptions = Utils.getImageLoadingOptions().build();
|
||||
|
||||
@ -99,15 +102,11 @@ public class AppCardController extends RecyclerView.ViewHolder implements ImageL
|
||||
|
||||
summary.setText(Utils.formatAppNameAndSummary(app.name, app.summary));
|
||||
|
||||
if (status != null) {
|
||||
if (app.added != null && app.added.after(recentCuttoffDate) && (app.lastUpdated == null || app.added.equals(app.lastUpdated))) {
|
||||
status.setText(activity.getString(R.string.category_Whats_New));
|
||||
status.setVisibility(View.VISIBLE);
|
||||
} else if (app.lastUpdated != null && app.lastUpdated.after(recentCuttoffDate)) {
|
||||
status.setText(activity.getString(R.string.category_Recently_Updated));
|
||||
status.setVisibility(View.VISIBLE);
|
||||
if (newTag != null) {
|
||||
if (app.added != null && app.lastUpdated != null && app.added.equals(app.lastUpdated)) {
|
||||
newTag.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
status.setVisibility(View.GONE);
|
||||
newTag.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
5
app/src/main/res/drawable/app_tag_new_background.xml
Normal file
5
app/src/main/res/drawable/app_tag_new_background.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?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>
|
17
app/src/main/res/layout-v14/app_status_new.xml
Normal file
17
app/src/main/res/layout-v14/app_status_new.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app__newly_added"
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/fdroid_blue"
|
||||
android:background="@drawable/app_tag_new_background"
|
||||
/>
|
@ -66,19 +66,14 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
tools:text="Recently added"
|
||||
<include layout="@layout/app_status_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/status"
|
||||
android:lines="1"
|
||||
android:textSize="12sp"
|
||||
android:ellipsize="end"
|
||||
android:id="@+id/new_tag"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/summary"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon"
|
||||
android:textStyle="italic"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
@ -27,7 +27,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/summary"
|
||||
android:lines="4"
|
||||
android:maxLines="4"
|
||||
android:textSize="13sp"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginLeft="8dp"
|
||||
@ -36,18 +36,14 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
tools:text="Recently added"
|
||||
<include layout="@layout/app_status_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/status"
|
||||
android:lines="1"
|
||||
android:textSize="12sp"
|
||||
android:ellipsize="end"
|
||||
android:id="@+id/new_tag"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/summary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:textStyle="italic"
|
||||
android:layout_marginTop="4dp" />
|
||||
app:layout_constraintStart_toStartOf="@+id/summary"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/summary" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
@ -42,18 +42,14 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<TextView
|
||||
tools:text="Recently added"
|
||||
<include layout="@layout/app_status_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/status"
|
||||
android:lines="1"
|
||||
android:textSize="12sp"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:textStyle="italic"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:id="@+id/new_tag"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/summary"
|
||||
app:layout_constraintStart_toStartOf="@+id/summary"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/summary" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
@ -37,20 +37,14 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_editor_absoluteY="8dp" />
|
||||
|
||||
<TextView
|
||||
tools:text="Recently added"
|
||||
<include layout="@layout/app_status_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/status"
|
||||
android:lines="1"
|
||||
android:textSize="12sp"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:id="@+id/new_tag"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/summary"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon"
|
||||
android:textStyle="italic"
|
||||
android:layout_marginTop="8dp" />
|
||||
app:layout_constraintStart_toStartOf="@+id/summary"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/summary" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
16
app/src/main/res/layout/app_status_new.xml
Normal file
16
app/src/main/res/layout/app_status_new.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app__newly_added"
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textColor="@color/fdroid_blue"
|
||||
android:background="@drawable/app_tag_new_background"
|
||||
/>
|
@ -66,6 +66,7 @@
|
||||
<string name="app_version_x_available">Version %1$s available</string>
|
||||
<string name="app_version_x_installed">Version %1$s</string>
|
||||
<string name="app_recommended_version_installed">Version %1$s (Recommended)</string>
|
||||
<string name="app__newly_added">New</string>
|
||||
|
||||
<string name="installed_apps__activity_title">Installed Apps</string>
|
||||
<string name="installed_app__updates_ignored">Updates ignored</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user