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;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
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.views.PreferencesFragment;
|
||||
import org.fdroid.fdroid.views.updates.UpdatesViewBinder;
|
||||
@ -49,10 +49,10 @@ class MainViewController extends RecyclerView.ViewHolder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WhatsNewViewBinder
|
||||
* @see LatestViewBinder
|
||||
*/
|
||||
public void bindWhatsNewView() {
|
||||
new WhatsNewViewBinder(activity, frame);
|
||||
public void bindLatestView() {
|
||||
new LatestViewBinder(activity, frame);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@
|
||||
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
||||
<item
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/whats_new"/>
|
||||
android:id="@+id/latest"/>
|
||||
<item
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/updates"/>
|
||||
|
@ -32,10 +32,10 @@ class MainViewController extends RecyclerView.ViewHolder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WhatsNewViewBinder
|
||||
* @see LatestViewBinder
|
||||
*/
|
||||
public void bindWhatsNewView() {
|
||||
new WhatsNewViewBinder(activity, frame);
|
||||
public void bindLatestView() {
|
||||
new LatestViewBinder(activity, frame);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@
|
||||
<!-- android:title and android:icon are set dynamically in MainActivity -->
|
||||
<item
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/whats_new"/>
|
||||
android:id="@+id/latest"/>
|
||||
<item
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/categories"/>
|
||||
|
@ -408,7 +408,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
authorView = (TextView) view.findViewById(R.id.author);
|
||||
lastUpdateView = (TextView) view.findViewById(R.id.text_last_update);
|
||||
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);
|
||||
descriptionMoreView = (TextView) view.findViewById(R.id.description_more);
|
||||
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 android.content.Context;
|
||||
@ -16,15 +16,15 @@ import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
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 final AppCompatActivity activity;
|
||||
private final RecyclerView.ItemDecoration appListDecorator;
|
||||
|
||||
public WhatsNewAdapter(AppCompatActivity activity) {
|
||||
public LatestAdapter(AppCompatActivity activity) {
|
||||
this.activity = activity;
|
||||
appListDecorator = new WhatsNewAdapter.ItemDecorator(activity);
|
||||
appListDecorator = new LatestAdapter.ItemDecorator(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,13 +44,13 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||
public AppCardController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
int layout;
|
||||
switch (viewType) {
|
||||
case R.id.whats_new_large_tile:
|
||||
case R.id.latest_large_tile:
|
||||
layout = R.layout.app_card_large;
|
||||
break;
|
||||
case R.id.whats_new_small_tile:
|
||||
case R.id.latest_small_tile:
|
||||
layout = R.layout.app_card_horizontal;
|
||||
break;
|
||||
case R.id.whats_new_regular_list:
|
||||
case R.id.latest_regular_list:
|
||||
layout = R.layout.app_card_list_item;
|
||||
break;
|
||||
default:
|
||||
@ -66,27 +66,27 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||
|
||||
if (BuildConfig.FLAVOR.startsWith("basic")) {
|
||||
if (relativePositionInCycle > 0) {
|
||||
return R.id.whats_new_small_tile;
|
||||
return R.id.latest_small_tile;
|
||||
} else {
|
||||
return R.id.whats_new_regular_list;
|
||||
return R.id.latest_regular_list;
|
||||
}
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
return R.id.whats_new_regular_list;
|
||||
return R.id.latest_regular_list;
|
||||
} else {
|
||||
switch (relativePositionInCycle) {
|
||||
case 1:
|
||||
case 2:
|
||||
return R.id.whats_new_large_tile;
|
||||
return R.id.latest_large_tile;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
return R.id.whats_new_small_tile;
|
||||
return R.id.latest_small_tile;
|
||||
|
||||
case 0:
|
||||
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.
|
||||
* 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#whats_new__padding__app_card__vertical
|
||||
* @see org.fdroid.fdroid.R.dimen#latest__padding__app_card__horizontal
|
||||
* @see org.fdroid.fdroid.R.dimen#latest__padding__app_card__vertical
|
||||
*/
|
||||
private static class ItemDecorator extends RecyclerView.ItemDecoration {
|
||||
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) {
|
||||
int position = parent.getChildAdapterPosition(view);
|
||||
Resources resources = context.getResources();
|
||||
int horizontalPadding = (int) resources.getDimension(R.dimen.whats_new__padding__app_card__horizontal);
|
||||
int verticalPadding = (int) resources.getDimension(R.dimen.whats_new__padding__app_card__vertical);
|
||||
int horizontalPadding = (int) resources.getDimension(R.dimen.latest__padding__app_card__horizontal);
|
||||
int verticalPadding = (int) resources.getDimension(R.dimen.latest__padding__app_card__vertical);
|
||||
|
||||
int relativePositionInCycle = position % 5;
|
||||
if (position == 0) {
|
@ -26,42 +26,41 @@ import org.fdroid.fdroid.data.RepoProvider;
|
||||
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
||||
import org.fdroid.fdroid.panic.HidingManager;
|
||||
import org.fdroid.fdroid.views.apps.AppListActivity;
|
||||
import org.fdroid.fdroid.views.whatsnew.WhatsNewAdapter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 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 final WhatsNewAdapter whatsNewAdapter;
|
||||
private final LatestAdapter latestAdapter;
|
||||
private final AppCompatActivity activity;
|
||||
private final TextView emptyState;
|
||||
private final RecyclerView appList;
|
||||
|
||||
private ProgressBar progressBar;
|
||||
|
||||
WhatsNewViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
||||
LatestViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
||||
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);
|
||||
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.setLayoutManager(layoutManager);
|
||||
appList.setAdapter(whatsNewAdapter);
|
||||
appList.setAdapter(latestAdapter);
|
||||
|
||||
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) whatsNewView
|
||||
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) latestView
|
||||
.findViewById(R.id.swipe_to_refresh);
|
||||
Utils.applySwipeLayoutColors(swipeToRefresh);
|
||||
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() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -119,9 +118,9 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
return;
|
||||
}
|
||||
|
||||
whatsNewAdapter.setAppsCursor(cursor);
|
||||
latestAdapter.setAppsCursor(cursor);
|
||||
|
||||
if (whatsNewAdapter.getItemCount() == 0) {
|
||||
if (latestAdapter.getItemCount() == 0) {
|
||||
emptyState.setVisibility(View.VISIBLE);
|
||||
appList.setVisibility(View.GONE);
|
||||
explainEmptyStateToUser();
|
||||
@ -170,6 +169,6 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
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) {
|
||||
MainViewController holder = createEmptyView(activity);
|
||||
switch (viewType) {
|
||||
case R.id.whats_new:
|
||||
holder.bindWhatsNewView();
|
||||
case R.id.latest:
|
||||
holder.bindLatestView();
|
||||
break;
|
||||
case R.id.categories:
|
||||
holder.bindCategoriesView();
|
||||
|
@ -17,6 +17,6 @@
|
||||
android:layout_above="@+id/bottom_navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/main_tab_whats_new" />
|
||||
tools:listitem="@layout/main_tab_latest" />
|
||||
|
||||
</RelativeLayout>
|
@ -182,7 +182,7 @@
|
||||
tools:text="App summary, one line - outlining what this app does" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/whats_new"
|
||||
android:id="@+id/latest"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/detailPanel"
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
|
||||
<dimen name="whats_new__padding__app_card__horizontal">12dp</dimen>
|
||||
<dimen name="whats_new__padding__app_card__vertical">10dp</dimen>
|
||||
<dimen name="latest__padding__app_card__horizontal">12dp</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.
|
||||
The default is 12dp or something like that which only really allows for very short labels. -->
|
||||
|
@ -2,12 +2,12 @@
|
||||
<resources>
|
||||
<item type="id" name="preference_fragment_parent"/>
|
||||
|
||||
<item type="id" name="whats_new_large_tile"/>
|
||||
<item type="id" name="whats_new_small_tile"/>
|
||||
<item type="id" name="whats_new_regular_list"/>
|
||||
<item type="id" name="latest_large_tile"/>
|
||||
<item type="id" name="latest_small_tile"/>
|
||||
<item type="id" name="latest_regular_list"/>
|
||||
|
||||
<!-- 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="nearby"/>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user