add Latest view to basic flavor
This is a quick hack to reuse the Latest view with a slightly simpler layout. It makes the "basic" flavor fully functional as an fdroid client. The goal here is just to have something simpler with as little new code as possible. It is essential that the whitelabeling and "Light" aka "basic" flavor does not increase the maintenance load. closes fdroid/fdroidclient#48 fdroid/fdroidclient!692 fdroid/fdroidclient!695
This commit is contained in:
parent
8e0c355534
commit
af7b94ff4c
@ -29,4 +29,9 @@ public class HidingManager {
|
||||
public static boolean isHidden(Context context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void showHideDialog(final Context context) {
|
||||
throw new IllegalStateException("unimplemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,8 +48,11 @@ class MainViewController extends RecyclerView.ViewHolder {
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WhatsNewViewBinder
|
||||
*/
|
||||
public void bindWhatsNewView() {
|
||||
throw new IllegalStateException("unimplemented");
|
||||
new WhatsNewViewBinder(activity, frame);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:title="@string/main_menu__latest_apps"
|
||||
android:icon="@drawable/ic_latest"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/whats_new" />
|
||||
<item
|
||||
android:title="@string/updates"
|
||||
android:icon="@drawable/ic_updates"
|
||||
|
@ -115,9 +115,10 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
|
||||
updatesBadge = new TextBadgeItem().hide(false);
|
||||
|
||||
bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
|
||||
bottomNavigation
|
||||
.addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps));
|
||||
if (BuildConfig.FLAVOR.startsWith("full")) {
|
||||
bottomNavigation
|
||||
.addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps))
|
||||
.addItem(new BottomNavigationItem(R.drawable.ic_categories, R.string.main_menu__categories))
|
||||
.addItem(new BottomNavigationItem(R.drawable.ic_nearby, R.string.main_menu__swap_nearby));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.views.categories.AppCardController;
|
||||
@ -57,10 +58,19 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
int relativePositionInCycle = position % 5;
|
||||
|
||||
if (BuildConfig.FLAVOR.startsWith("basic")) {
|
||||
if (relativePositionInCycle > 0) {
|
||||
return R.id.whats_new_small_tile;
|
||||
} else {
|
||||
return R.id.whats_new_regular_list;
|
||||
}
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
return R.id.whats_new_feature;
|
||||
} else {
|
||||
int relativePositionInCycle = position % 5;
|
||||
switch (relativePositionInCycle) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
Loading…
x
Reference in New Issue
Block a user