diff --git a/app/src/main/java/org/fdroid/fdroid/views/main/MainViewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/main/MainViewAdapter.java index e6c583082..729fcd458 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/main/MainViewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/main/MainViewAdapter.java @@ -1,42 +1,65 @@ +/* + * Copyright (C) 2016-2017 Peter Serwylo + * Copyright (C) 2017 Mikael von Pfaler + * Copyright (C) 2018 Senecto Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 3 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + package org.fdroid.fdroid.views.main; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.util.SparseIntArray; +import android.view.Menu; import android.view.ViewGroup; import android.widget.FrameLayout; - +import android.widget.PopupMenu; import org.fdroid.fdroid.R; /** - * Represents the five main views that are accessible from the main view. These are: - * + Whats new - * + Categories - * + Nearby - * + Updates - * + Settings - * - * It is responsible for understanding the relationship between each main view that is reachable - * from the bottom navigation, and its position. - * - * It doesn't need to do very much other than redirect requests from the {@link MainActivity}s - * {@link RecyclerView} to the relevant "bind*()" method - * of the {@link MainViewController}. + * Represents the main views that are accessible from the main screen via each + * tab. They are set and loaded dynamically from {@code menu/main_activity_screens.xml} + * This class is responsible for understanding the relationship between each + * tab view that is reachable from the bottom navigation, and its position. + *
+ * It doesn't need to do very much other than redirect requests from the {@link MainActivity}s + * {@link RecyclerView} to the relevant "bind*()" method + * of the {@link MainViewController}. + *
+ * {@link PopupMenu} is used as a hack to get a disposable {@link Menu} instance
+ * for parsing and reading the menu XML.
*/
class MainViewAdapter extends RecyclerView.Adapter