Activity to manage menu #278
This commit is contained in:
parent
7a779dbad4
commit
fa3f874826
|
@ -268,6 +268,11 @@
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
/>
|
/>
|
||||||
|
<activity android:name="app.fedilab.android.activities.HideItemActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
/>
|
||||||
<activity android:name="app.fedilab.android.activities.SettingsActivity"
|
<activity android:name="app.fedilab.android.activities.SettingsActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -370,7 +370,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
|
|
||||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
Helper.hideMenuItem(navigationView.getMenu());
|
Helper.hideMenuItem(BaseMainActivity.this, navigationView.getMenu());
|
||||||
|
|
||||||
|
|
||||||
toot = findViewById(R.id.toot);
|
toot = findViewById(R.id.toot);
|
||||||
|
@ -1431,6 +1431,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
}else if( extras.getInt(Helper.INTENT_ACTION) == Helper.BACKUP_NOTIFICATION_INTENT){
|
}else if( extras.getInt(Helper.INTENT_ACTION) == Helper.BACKUP_NOTIFICATION_INTENT){
|
||||||
Intent myIntent = new Intent(BaseMainActivity.this, OwnerNotificationActivity.class);
|
Intent myIntent = new Intent(BaseMainActivity.this, OwnerNotificationActivity.class);
|
||||||
startActivity(myIntent);
|
startActivity(myIntent);
|
||||||
|
}else if( extras.getInt(Helper.INTENT_ACTION) == Helper.REDRAW_MENU){
|
||||||
|
Helper.hideMenuItem(BaseMainActivity.this, navigationView.getMenu());
|
||||||
}
|
}
|
||||||
else if( extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_TAG){
|
else if( extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_TAG){
|
||||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -1661,7 +1663,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("isMainActivityRunning", false).apply();
|
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("isMainActivityRunning", false).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy(){
|
public void onDestroy(){
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
@ -1723,16 +1724,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
Intent intent = new Intent(getApplicationContext(), MutedInstanceActivity.class);
|
Intent intent = new Intent(getApplicationContext(), MutedInstanceActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return false;
|
return false;
|
||||||
} else if(id == R.id.nav_bug_report){
|
|
||||||
Intent i = new Intent(Intent.ACTION_SEND);
|
|
||||||
i.setType("message/rfc822");
|
|
||||||
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"incoming+tom79/mastalab@incoming.gitlab.com"});
|
|
||||||
try {
|
|
||||||
startActivity(Intent.createChooser(i, getString(R.string.bug_report_mail)));
|
|
||||||
} catch (android.content.ActivityNotFoundException ex) {
|
|
||||||
Toasty.info(getApplicationContext(), getString(R.string.no_mail_client), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
Helper.unCheckAllMenuItems(navigationView);
|
Helper.unCheckAllMenuItems(navigationView);
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/* Copyright 2019 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
package app.fedilab.android.activities;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
|
||||||
|
import app.fedilab.android.client.Entities.MainMenuItem;
|
||||||
|
import app.fedilab.android.helper.Helper;
|
||||||
|
import app.fedilab.android.sqlite.MainMenuDAO;
|
||||||
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 28/08/2019.
|
||||||
|
* Hide menu items activity
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HideItemActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
switch (theme){
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
setTheme(R.style.AppTheme);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
setTheme(R.style.AppThemeBlack);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if( actionBar != null ) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
assert inflater != null;
|
||||||
|
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
|
||||||
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
|
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
||||||
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbar_title.setText(R.string.hide_menu_items);
|
||||||
|
if (theme == Helper.THEME_LIGHT){
|
||||||
|
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||||
|
Helper.colorizeToolbar(toolbar, R.color.black, HideItemActivity.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setContentView(R.layout.activity_hide_menu_items);
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(HideItemActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
MainMenuItem mainMenu = new MainMenuDAO(getApplicationContext(), db).getMainMenu();
|
||||||
|
|
||||||
|
CheckBox nav_news = findViewById(R.id.nav_news);
|
||||||
|
CheckBox nav_list = findViewById(R.id.nav_list);
|
||||||
|
CheckBox nav_scheduled = findViewById(R.id.nav_scheduled);
|
||||||
|
CheckBox nav_archive = findViewById(R.id.nav_archive);
|
||||||
|
CheckBox nav_archive_notifications = findViewById(R.id.nav_archive_notifications);
|
||||||
|
CheckBox nav_peertube = findViewById(R.id.nav_peertube);
|
||||||
|
CheckBox nav_filters = findViewById(R.id.nav_filters);
|
||||||
|
CheckBox nav_who_to_follow = findViewById(R.id.nav_who_to_follow);
|
||||||
|
CheckBox nav_administration = findViewById(R.id.nav_administration);
|
||||||
|
CheckBox nav_blocked = findViewById(R.id.nav_blocked);
|
||||||
|
CheckBox nav_muted = findViewById(R.id.nav_muted);
|
||||||
|
CheckBox nav_blocked_domains = findViewById(R.id.nav_blocked_domains);
|
||||||
|
CheckBox nav_how_to = findViewById(R.id.nav_how_to);
|
||||||
|
Button validate = findViewById(R.id.validate);
|
||||||
|
|
||||||
|
nav_news.setChecked(mainMenu.isNav_news());
|
||||||
|
nav_list.setChecked(mainMenu.isNav_list());
|
||||||
|
nav_scheduled.setChecked(mainMenu.isNav_scheduled());
|
||||||
|
nav_archive.setChecked(mainMenu.isNav_archive());
|
||||||
|
nav_archive_notifications.setChecked(mainMenu.isNav_archive_notifications());
|
||||||
|
nav_peertube.setChecked(mainMenu.isNav_peertube());
|
||||||
|
nav_filters.setChecked(mainMenu.isNav_filters());
|
||||||
|
nav_who_to_follow.setChecked(mainMenu.isNav_how_to_follow());
|
||||||
|
nav_administration.setChecked(mainMenu.isNav_administration());
|
||||||
|
nav_blocked.setChecked(mainMenu.isNav_blocked());
|
||||||
|
nav_muted.setChecked(mainMenu.isNav_muted());
|
||||||
|
nav_blocked_domains.setChecked(mainMenu.isNav_blocked_domains());
|
||||||
|
nav_how_to.setChecked(mainMenu.isNav_howto());
|
||||||
|
|
||||||
|
|
||||||
|
validate.setOnClickListener(view -> {
|
||||||
|
MainMenuItem mainMenuItem = new MainMenuItem();
|
||||||
|
nav_news.setChecked(nav_news.isChecked());
|
||||||
|
nav_list.setChecked(nav_list.isChecked());
|
||||||
|
nav_scheduled.setChecked(nav_scheduled.isChecked());
|
||||||
|
nav_archive.setChecked(nav_archive.isChecked());
|
||||||
|
nav_archive_notifications.setChecked(nav_archive_notifications.isChecked());
|
||||||
|
nav_peertube.setChecked(nav_peertube.isChecked());
|
||||||
|
nav_filters.setChecked(nav_filters.isChecked());
|
||||||
|
nav_who_to_follow.setChecked(nav_who_to_follow.isChecked());
|
||||||
|
nav_administration.setChecked(nav_administration.isChecked());
|
||||||
|
nav_blocked.setChecked(nav_blocked.isChecked());
|
||||||
|
nav_muted.setChecked(nav_muted.isChecked());
|
||||||
|
nav_blocked_domains.setChecked(nav_blocked_domains.isChecked());
|
||||||
|
nav_how_to.setChecked(nav_how_to.isChecked());
|
||||||
|
MainMenuItem mainMenuItem1 = new MainMenuDAO(getApplicationContext(), db).getMainMenu();
|
||||||
|
if( mainMenuItem1 != null){
|
||||||
|
new MainMenuDAO(getApplicationContext(), db).updateMenu(mainMenuItem);
|
||||||
|
}else{
|
||||||
|
new MainMenuDAO(getApplicationContext(), db).insertMenu(mainMenuItem);
|
||||||
|
}
|
||||||
|
Intent mainActivity = new Intent(HideItemActivity.this, MainActivity.class);
|
||||||
|
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.REDRAW_MENU);
|
||||||
|
startActivity(mainActivity);
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -193,6 +193,7 @@ import app.fedilab.android.client.Entities.Attachment;
|
||||||
import app.fedilab.android.client.Entities.Card;
|
import app.fedilab.android.client.Entities.Card;
|
||||||
import app.fedilab.android.client.Entities.Emojis;
|
import app.fedilab.android.client.Entities.Emojis;
|
||||||
import app.fedilab.android.client.Entities.Filters;
|
import app.fedilab.android.client.Entities.Filters;
|
||||||
|
import app.fedilab.android.client.Entities.MainMenuItem;
|
||||||
import app.fedilab.android.client.Entities.Mention;
|
import app.fedilab.android.client.Entities.Mention;
|
||||||
import app.fedilab.android.client.Entities.RemoteInstance;
|
import app.fedilab.android.client.Entities.RemoteInstance;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
|
@ -200,6 +201,7 @@ import app.fedilab.android.client.Entities.Tag;
|
||||||
import app.fedilab.android.client.Entities.TagTimeline;
|
import app.fedilab.android.client.Entities.TagTimeline;
|
||||||
import app.fedilab.android.client.Entities.Version;
|
import app.fedilab.android.client.Entities.Version;
|
||||||
import app.fedilab.android.client.Tls12SocketFactory;
|
import app.fedilab.android.client.Tls12SocketFactory;
|
||||||
|
import app.fedilab.android.sqlite.MainMenuDAO;
|
||||||
import app.fedilab.android.sqlite.StatusCacheDAO;
|
import app.fedilab.android.sqlite.StatusCacheDAO;
|
||||||
import app.fedilab.android.sqlite.TimelineCacheDAO;
|
import app.fedilab.android.sqlite.TimelineCacheDAO;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
@ -314,6 +316,7 @@ public class Helper {
|
||||||
public static final int RELOAD_MYVIDEOS = 10;
|
public static final int RELOAD_MYVIDEOS = 10;
|
||||||
public static final int REFRESH_TIMELINE = 11;
|
public static final int REFRESH_TIMELINE = 11;
|
||||||
public static final int BACKUP_NOTIFICATION_INTENT = 12;
|
public static final int BACKUP_NOTIFICATION_INTENT = 12;
|
||||||
|
public static final int REDRAW_MENU = 13;
|
||||||
//Settings
|
//Settings
|
||||||
public static final int TOOTS_PER_PAGE = 20;
|
public static final int TOOTS_PER_PAGE = 20;
|
||||||
public static final int ACCOUNTS_PER_PAGE = 20;
|
public static final int ACCOUNTS_PER_PAGE = 20;
|
||||||
|
@ -1487,7 +1490,7 @@ public class Helper {
|
||||||
}else{
|
}else{
|
||||||
navigationView.getMenu().clear();
|
navigationView.getMenu().clear();
|
||||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||||
hideMenuItem(navigationView.getMenu());
|
hideMenuItem(activity, navigationView.getMenu());
|
||||||
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
||||||
switchLayout(activity);
|
switchLayout(activity);
|
||||||
}
|
}
|
||||||
|
@ -1495,7 +1498,7 @@ public class Helper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hideMenuItem(Menu menu){
|
public static void hideMenuItem(Activity activity, Menu menu){
|
||||||
|
|
||||||
if( BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
if( BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||||
MenuItem itemCom = menu.findItem(R.id.nav_main_com);
|
MenuItem itemCom = menu.findItem(R.id.nav_main_com);
|
||||||
|
@ -1557,6 +1560,48 @@ public class Helper {
|
||||||
nav_group.setVisible(true);
|
nav_group.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
MainMenuItem mainMenuItem = new MainMenuDAO(activity, db).getMainMenu();
|
||||||
|
if( !mainMenuItem.isNav_list()){
|
||||||
|
menu.getItem(R.id.nav_list).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_administration()){
|
||||||
|
menu.getItem(R.id.nav_administration).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_archive()){
|
||||||
|
menu.getItem(R.id.nav_archive).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_archive_notifications()){
|
||||||
|
menu.getItem(R.id.nav_archive_notifications).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_blocked()){
|
||||||
|
menu.getItem(R.id.nav_blocked).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_blocked_domains()){
|
||||||
|
menu.getItem(R.id.nav_blocked_domains).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_filters()){
|
||||||
|
menu.getItem(R.id.nav_filters).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_how_to_follow()){
|
||||||
|
menu.getItem(R.id.nav_who_to_follow).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_howto()){
|
||||||
|
menu.getItem(R.id.nav_how_to).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_muted()){
|
||||||
|
menu.getItem(R.id.nav_muted).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_news()){
|
||||||
|
menu.getItem(R.id.nav_news).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_peertube()){
|
||||||
|
menu.getItem(R.id.nav_peertube).setVisible(false);
|
||||||
|
}
|
||||||
|
if( !mainMenuItem.isNav_scheduled()){
|
||||||
|
menu.getItem(R.id.nav_scheduled).setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!BuildConfig.DONATIONS) {
|
if (!BuildConfig.DONATIONS) {
|
||||||
|
@ -1571,6 +1616,7 @@ public class Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the user in shared preferences
|
* Changes the user in shared preferences
|
||||||
* @param activity Activity
|
* @param activity Activity
|
||||||
|
@ -1584,7 +1630,7 @@ public class Helper {
|
||||||
MainActivity.lastNotificationId = null;
|
MainActivity.lastNotificationId = null;
|
||||||
MainActivity.lastHomeId = null;
|
MainActivity.lastHomeId = null;
|
||||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||||
hideMenuItem(navigationView.getMenu());
|
hideMenuItem(activity, navigationView.getMenu());
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(activity,db).getUniqAccount(userID, instance);
|
Account account = new AccountDAO(activity,db).getUniqAccount(userID, instance);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class MainMenuDAO {
|
||||||
* @param userId String
|
* @param userId String
|
||||||
* @param instance String
|
* @param instance String
|
||||||
*/
|
*/
|
||||||
public void insertInstance(MainMenuItem mainMenuItem, String userId, String instance) {
|
public void insertMenu(MainMenuItem mainMenuItem, String userId, String instance) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(Sqlite.COL_INSTANCE, instance);
|
values.put(Sqlite.COL_INSTANCE, instance);
|
||||||
values.put(Sqlite.COL_USER_ID, userId);
|
values.put(Sqlite.COL_USER_ID, userId);
|
||||||
|
@ -78,7 +78,7 @@ public class MainMenuDAO {
|
||||||
* Insert a menu configuration name in database
|
* Insert a menu configuration name in database
|
||||||
* @param mainMenuItem MainMenuItem
|
* @param mainMenuItem MainMenuItem
|
||||||
*/
|
*/
|
||||||
public void insertInstance(MainMenuItem mainMenuItem) {
|
public void insertMenu(MainMenuItem mainMenuItem) {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = Helper.getLiveInstance(context);
|
String instance = Helper.getLiveInstance(context);
|
||||||
|
@ -113,7 +113,7 @@ public class MainMenuDAO {
|
||||||
* update menu items in database
|
* update menu items in database
|
||||||
* @param mainMenuItem MainMenuItem
|
* @param mainMenuItem MainMenuItem
|
||||||
*/
|
*/
|
||||||
public void updateInstance(MainMenuItem mainMenuItem, String userId, String instance) {
|
public void updateMenu(MainMenuItem mainMenuItem, String userId, String instance) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(Sqlite.COL_INSTANCE, instance);
|
values.put(Sqlite.COL_INSTANCE, instance);
|
||||||
values.put(Sqlite.COL_USER_ID, userId);
|
values.put(Sqlite.COL_USER_ID, userId);
|
||||||
|
@ -141,7 +141,7 @@ public class MainMenuDAO {
|
||||||
* update menu items in database
|
* update menu items in database
|
||||||
* @param mainMenuItem MainMenuItem
|
* @param mainMenuItem MainMenuItem
|
||||||
*/
|
*/
|
||||||
public void updateInstance(MainMenuItem mainMenuItem) {
|
public void updateMenu(MainMenuItem mainMenuItem) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
@ -184,7 +184,7 @@ public class MainMenuDAO {
|
||||||
Cursor c = db.query(Sqlite.TABLE_MAIN_MENU_ITEMS, null, Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, null, "1");
|
Cursor c = db.query(Sqlite.TABLE_MAIN_MENU_ITEMS, null, Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, null, "1");
|
||||||
return cursorToMainMenu(c);
|
return cursorToMainMenu(c);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return new MainMenuItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ public class MainMenuDAO {
|
||||||
Cursor c = db.query(Sqlite.TABLE_MAIN_MENU_ITEMS, null, Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, null, "1");
|
Cursor c = db.query(Sqlite.TABLE_MAIN_MENU_ITEMS, null, Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, null, "1");
|
||||||
return cursorToMainMenu(c);
|
return cursorToMainMenu(c);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return new MainMenuItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2019 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of Fedilab
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Fedilab 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 Fedilab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/activity_vertical_margin"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/communication_menu_title"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_news"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/action_news"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/action_lists"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_scheduled"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/scheduled_toots"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_archive"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/owner_cached_toots"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_archive_notifications"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/owner_cached_notifications"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_peertube"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/peertube_favorites"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_filters"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/filters"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_who_to_follow"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/how_to_follow"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_administration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/administration"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/neutral_menu_title"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_blocked"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/blocked_menu"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_muted"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/muted_menu"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_blocked_domains"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/blocked_domains"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/neutral_menu_information"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?colorAccent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/nav_how_to"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/how_to_videos"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/validate"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/validate"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
|
@ -191,11 +191,6 @@
|
||||||
android:id="@+id/nav_how_to"
|
android:id="@+id/nav_how_to"
|
||||||
android:icon="@drawable/ic_videocam"
|
android:icon="@drawable/ic_videocam"
|
||||||
android:title="@string/how_to_videos" />
|
android:title="@string/how_to_videos" />
|
||||||
<item
|
|
||||||
android:visible="false"
|
|
||||||
android:id="@+id/nav_bug_report"
|
|
||||||
android:icon="@drawable/ic_bug_report"
|
|
||||||
android:title="@string/action_bug_report" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_about"
|
android:id="@+id/nav_about"
|
||||||
android:icon="@drawable/ic_info"
|
android:icon="@drawable/ic_info"
|
||||||
|
|
|
@ -1197,4 +1197,5 @@
|
||||||
<string name="cache_bookmarks_clear">Clear your bookmarks</string>
|
<string name="cache_bookmarks_clear">Clear your bookmarks</string>
|
||||||
<string name="file_cache">Files in cache</string>
|
<string name="file_cache">Files in cache</string>
|
||||||
<string name="total_notifications">Total notifications</string>
|
<string name="total_notifications">Total notifications</string>
|
||||||
|
<string name="hide_menu_items">Hide menu items</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue