rename WhatsNew* to Latest* to match source string name
This commit is contained in:
parent
b9efb143be
commit
4caab6a135
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
package org.fdroid.fdroid.views.main;
|
package org.fdroid.fdroid.views.main;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.views.PreferencesFragment;
|
import org.fdroid.fdroid.views.PreferencesFragment;
|
||||||
import org.fdroid.fdroid.views.updates.UpdatesViewBinder;
|
import org.fdroid.fdroid.views.updates.UpdatesViewBinder;
|
||||||
@ -49,10 +49,10 @@ class MainViewController extends RecyclerView.ViewHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see WhatsNewViewBinder
|
* @see LatestViewBinder
|
||||||
*/
|
*/
|
||||||
public void bindWhatsNewView() {
|
public void bindLatestView() {
|
||||||
new WhatsNewViewBinder(activity, frame);
|
new LatestViewBinder(activity, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
||||||
<item
|
<item
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/whats_new"/>
|
android:id="@+id/latest"/>
|
||||||
<item
|
<item
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/updates"/>
|
android:id="@+id/updates"/>
|
||||||
|
@ -32,10 +32,10 @@ class MainViewController extends RecyclerView.ViewHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see WhatsNewViewBinder
|
* @see LatestViewBinder
|
||||||
*/
|
*/
|
||||||
public void bindWhatsNewView() {
|
public void bindLatestView() {
|
||||||
new WhatsNewViewBinder(activity, frame);
|
new LatestViewBinder(activity, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
||||||
<item
|
<item
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/whats_new"/>
|
android:id="@+id/latest"/>
|
||||||
<item
|
<item
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/categories"/>
|
android:id="@+id/categories"/>
|
||||||
|
@ -408,7 +408,7 @@ public class AppDetailsRecyclerViewAdapter
|
|||||||
authorView = (TextView) view.findViewById(R.id.author);
|
authorView = (TextView) view.findViewById(R.id.author);
|
||||||
lastUpdateView = (TextView) view.findViewById(R.id.text_last_update);
|
lastUpdateView = (TextView) view.findViewById(R.id.text_last_update);
|
||||||
summaryView = (TextView) view.findViewById(R.id.summary);
|
summaryView = (TextView) view.findViewById(R.id.summary);
|
||||||
whatsNewView = (TextView) view.findViewById(R.id.whats_new);
|
whatsNewView = (TextView) view.findViewById(R.id.latest);
|
||||||
descriptionView = (TextView) view.findViewById(R.id.description);
|
descriptionView = (TextView) view.findViewById(R.id.description);
|
||||||
descriptionMoreView = (TextView) view.findViewById(R.id.description_more);
|
descriptionMoreView = (TextView) view.findViewById(R.id.description_more);
|
||||||
antiFeaturesSectionView = view.findViewById(R.id.anti_features_section);
|
antiFeaturesSectionView = view.findViewById(R.id.anti_features_section);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.fdroid.fdroid.views.whatsnew;
|
package org.fdroid.fdroid.views.main;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -16,15 +16,15 @@ import org.fdroid.fdroid.R;
|
|||||||
import org.fdroid.fdroid.data.App;
|
import org.fdroid.fdroid.data.App;
|
||||||
import org.fdroid.fdroid.views.categories.AppCardController;
|
import org.fdroid.fdroid.views.categories.AppCardController;
|
||||||
|
|
||||||
public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
public class LatestAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||||
|
|
||||||
private Cursor cursor;
|
private Cursor cursor;
|
||||||
private final AppCompatActivity activity;
|
private final AppCompatActivity activity;
|
||||||
private final RecyclerView.ItemDecoration appListDecorator;
|
private final RecyclerView.ItemDecoration appListDecorator;
|
||||||
|
|
||||||
public WhatsNewAdapter(AppCompatActivity activity) {
|
public LatestAdapter(AppCompatActivity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
appListDecorator = new WhatsNewAdapter.ItemDecorator(activity);
|
appListDecorator = new LatestAdapter.ItemDecorator(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,13 +44,13 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
public AppCardController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public AppCardController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
int layout;
|
int layout;
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case R.id.whats_new_large_tile:
|
case R.id.latest_large_tile:
|
||||||
layout = R.layout.app_card_large;
|
layout = R.layout.app_card_large;
|
||||||
break;
|
break;
|
||||||
case R.id.whats_new_small_tile:
|
case R.id.latest_small_tile:
|
||||||
layout = R.layout.app_card_horizontal;
|
layout = R.layout.app_card_horizontal;
|
||||||
break;
|
break;
|
||||||
case R.id.whats_new_regular_list:
|
case R.id.latest_regular_list:
|
||||||
layout = R.layout.app_card_list_item;
|
layout = R.layout.app_card_list_item;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -66,27 +66,27 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
|
|
||||||
if (BuildConfig.FLAVOR.startsWith("basic")) {
|
if (BuildConfig.FLAVOR.startsWith("basic")) {
|
||||||
if (relativePositionInCycle > 0) {
|
if (relativePositionInCycle > 0) {
|
||||||
return R.id.whats_new_small_tile;
|
return R.id.latest_small_tile;
|
||||||
} else {
|
} else {
|
||||||
return R.id.whats_new_regular_list;
|
return R.id.latest_regular_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
return R.id.whats_new_regular_list;
|
return R.id.latest_regular_list;
|
||||||
} else {
|
} else {
|
||||||
switch (relativePositionInCycle) {
|
switch (relativePositionInCycle) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
return R.id.whats_new_large_tile;
|
return R.id.latest_large_tile;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
return R.id.whats_new_small_tile;
|
return R.id.latest_small_tile;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
return R.id.whats_new_regular_list;
|
return R.id.latest_regular_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,8 +128,8 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
* Applies padding to items, ensuring that the spacing on the left, centre, and right all match.
|
* Applies padding to items, ensuring that the spacing on the left, centre, and right all match.
|
||||||
* The vertical padding is slightly shorter than the horizontal padding also.
|
* The vertical padding is slightly shorter than the horizontal padding also.
|
||||||
*
|
*
|
||||||
* @see org.fdroid.fdroid.R.dimen#whats_new__padding__app_card__horizontal
|
* @see org.fdroid.fdroid.R.dimen#latest__padding__app_card__horizontal
|
||||||
* @see org.fdroid.fdroid.R.dimen#whats_new__padding__app_card__vertical
|
* @see org.fdroid.fdroid.R.dimen#latest__padding__app_card__vertical
|
||||||
*/
|
*/
|
||||||
private static class ItemDecorator extends RecyclerView.ItemDecoration {
|
private static class ItemDecorator extends RecyclerView.ItemDecoration {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@ -142,8 +142,8 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
int position = parent.getChildAdapterPosition(view);
|
int position = parent.getChildAdapterPosition(view);
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
int horizontalPadding = (int) resources.getDimension(R.dimen.whats_new__padding__app_card__horizontal);
|
int horizontalPadding = (int) resources.getDimension(R.dimen.latest__padding__app_card__horizontal);
|
||||||
int verticalPadding = (int) resources.getDimension(R.dimen.whats_new__padding__app_card__vertical);
|
int verticalPadding = (int) resources.getDimension(R.dimen.latest__padding__app_card__vertical);
|
||||||
|
|
||||||
int relativePositionInCycle = position % 5;
|
int relativePositionInCycle = position % 5;
|
||||||
if (position == 0) {
|
if (position == 0) {
|
@ -26,42 +26,41 @@ import org.fdroid.fdroid.data.RepoProvider;
|
|||||||
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
||||||
import org.fdroid.fdroid.panic.HidingManager;
|
import org.fdroid.fdroid.panic.HidingManager;
|
||||||
import org.fdroid.fdroid.views.apps.AppListActivity;
|
import org.fdroid.fdroid.views.apps.AppListActivity;
|
||||||
import org.fdroid.fdroid.views.whatsnew.WhatsNewAdapter;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a list of newly added or recently updated apps and displays them to the user.
|
* Loads a list of newly added or recently updated apps and displays them to the user.
|
||||||
*/
|
*/
|
||||||
class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
class LatestViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
|
|
||||||
private static final int LOADER_ID = 978015789;
|
private static final int LOADER_ID = 978015789;
|
||||||
|
|
||||||
private final WhatsNewAdapter whatsNewAdapter;
|
private final LatestAdapter latestAdapter;
|
||||||
private final AppCompatActivity activity;
|
private final AppCompatActivity activity;
|
||||||
private final TextView emptyState;
|
private final TextView emptyState;
|
||||||
private final RecyclerView appList;
|
private final RecyclerView appList;
|
||||||
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
WhatsNewViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
LatestViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
|
||||||
View whatsNewView = activity.getLayoutInflater().inflate(R.layout.main_tab_whats_new, parent, true);
|
View latestView = activity.getLayoutInflater().inflate(R.layout.main_tab_latest, parent, true);
|
||||||
|
|
||||||
whatsNewAdapter = new WhatsNewAdapter(activity);
|
latestAdapter = new LatestAdapter(activity);
|
||||||
|
|
||||||
GridLayoutManager layoutManager = new GridLayoutManager(activity, 2);
|
GridLayoutManager layoutManager = new GridLayoutManager(activity, 2);
|
||||||
layoutManager.setSpanSizeLookup(new WhatsNewAdapter.SpanSizeLookup());
|
layoutManager.setSpanSizeLookup(new LatestAdapter.SpanSizeLookup());
|
||||||
|
|
||||||
emptyState = (TextView) whatsNewView.findViewById(R.id.empty_state);
|
emptyState = (TextView) latestView.findViewById(R.id.empty_state);
|
||||||
|
|
||||||
appList = (RecyclerView) whatsNewView.findViewById(R.id.app_list);
|
appList = (RecyclerView) latestView.findViewById(R.id.app_list);
|
||||||
appList.setHasFixedSize(true);
|
appList.setHasFixedSize(true);
|
||||||
appList.setLayoutManager(layoutManager);
|
appList.setLayoutManager(layoutManager);
|
||||||
appList.setAdapter(whatsNewAdapter);
|
appList.setAdapter(latestAdapter);
|
||||||
|
|
||||||
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) whatsNewView
|
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) latestView
|
||||||
.findViewById(R.id.swipe_to_refresh);
|
.findViewById(R.id.swipe_to_refresh);
|
||||||
Utils.applySwipeLayoutColors(swipeToRefresh);
|
Utils.applySwipeLayoutColors(swipeToRefresh);
|
||||||
swipeToRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeToRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@ -72,7 +71,7 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FloatingActionButton searchFab = (FloatingActionButton) whatsNewView.findViewById(R.id.fab_search);
|
FloatingActionButton searchFab = (FloatingActionButton) latestView.findViewById(R.id.fab_search);
|
||||||
searchFab.setOnClickListener(new View.OnClickListener() {
|
searchFab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -119,9 +118,9 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
whatsNewAdapter.setAppsCursor(cursor);
|
latestAdapter.setAppsCursor(cursor);
|
||||||
|
|
||||||
if (whatsNewAdapter.getItemCount() == 0) {
|
if (latestAdapter.getItemCount() == 0) {
|
||||||
emptyState.setVisibility(View.VISIBLE);
|
emptyState.setVisibility(View.VISIBLE);
|
||||||
appList.setVisibility(View.GONE);
|
appList.setVisibility(View.GONE);
|
||||||
explainEmptyStateToUser();
|
explainEmptyStateToUser();
|
||||||
@ -170,6 +169,6 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
whatsNewAdapter.setAppsCursor(null);
|
latestAdapter.setAppsCursor(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -86,8 +86,8 @@ class MainViewAdapter extends RecyclerView.Adapter<MainViewController> {
|
|||||||
public MainViewController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public MainViewController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
MainViewController holder = createEmptyView(activity);
|
MainViewController holder = createEmptyView(activity);
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case R.id.whats_new:
|
case R.id.latest:
|
||||||
holder.bindWhatsNewView();
|
holder.bindLatestView();
|
||||||
break;
|
break;
|
||||||
case R.id.categories:
|
case R.id.categories:
|
||||||
holder.bindCategoriesView();
|
holder.bindCategoriesView();
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
android:layout_above="@+id/bottom_navigation"
|
android:layout_above="@+id/bottom_navigation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:listitem="@layout/main_tab_whats_new" />
|
tools:listitem="@layout/main_tab_latest" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -182,7 +182,7 @@
|
|||||||
tools:text="App summary, one line - outlining what this app does" />
|
tools:text="App summary, one line - outlining what this app does" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/whats_new"
|
android:id="@+id/latest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/detailPanel"
|
android:background="?attr/detailPanel"
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
|
|
||||||
<dimen name="whats_new__padding__app_card__horizontal">12dp</dimen>
|
<dimen name="latest__padding__app_card__horizontal">12dp</dimen>
|
||||||
<dimen name="whats_new__padding__app_card__vertical">10dp</dimen>
|
<dimen name="latest__padding__app_card__vertical">10dp</dimen>
|
||||||
|
|
||||||
<!-- Used by the BottomNavigation library so that our text labels are not truncated so easily.
|
<!-- Used by the BottomNavigation library so that our text labels are not truncated so easily.
|
||||||
The default is 12dp or something like that which only really allows for very short labels. -->
|
The default is 12dp or something like that which only really allows for very short labels. -->
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<item type="id" name="preference_fragment_parent"/>
|
<item type="id" name="preference_fragment_parent"/>
|
||||||
|
|
||||||
<item type="id" name="whats_new_large_tile"/>
|
<item type="id" name="latest_large_tile"/>
|
||||||
<item type="id" name="whats_new_small_tile"/>
|
<item type="id" name="latest_small_tile"/>
|
||||||
<item type="id" name="whats_new_regular_list"/>
|
<item type="id" name="latest_regular_list"/>
|
||||||
|
|
||||||
<!-- Make sure these always exist, e.g. in the 'basic' build flavor -->
|
<!-- Make sure these always exist, e.g. in the 'basic' build flavor -->
|
||||||
<item type="id" name="whats_new"/>
|
<item type="id" name="latest"/>
|
||||||
<item type="id" name="categories"/>
|
<item type="id" name="categories"/>
|
||||||
<item type="id" name="nearby"/>
|
<item type="id" name="nearby"/>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user