1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-22 19:08:03 +01:00

Allow most navigation items to hide as pref

This commit is contained in:
Gregor Santner 2016-08-13 14:13:14 +02:00
parent a4864714bf
commit 4f8215beee
14 changed files with 153 additions and 59 deletions

View file

@ -39,7 +39,6 @@ dependencies {
compile 'com.android.support:support-v4:24.1.1'
// More libraries
compile 'com.getbase:floatingactionbutton:1.9.1'
compile 'com.jakewharton:butterknife:8.0.1'
compile 'info.guardianproject.netcipher:netcipher:1.2.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'

View file

@ -53,7 +53,6 @@ import android.text.Html;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
@ -159,7 +158,6 @@ public class MainActivity extends AppCompatActivity
DrawerLayout navDrawer;
// NavHeader cannot be bound by Butterknife
private TextView navheaderTitle;
private TextView navheaderDescription;
@ -310,7 +308,7 @@ public class MainActivity extends AppCompatActivity
if (progress > 60) {
WebHelper.optimizeMobileSiteLayout(wv);
if(textToBeShared != null){
if (textToBeShared != null) {
WebHelper.shareTextIntoWebView(wv, textToBeShared);
}
}
@ -409,9 +407,18 @@ public class MainActivity extends AppCompatActivity
}
}
// Set visibility
Menu navMenu = navView.getMenu();
navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isShowExitButtonInNavAlso());
navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit());
navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities());
navMenu.findItem(R.id.nav_aspects).setVisible(appSettings.isVisibleInNavAspects());
navMenu.findItem(R.id.nav_commented).setVisible(appSettings.isVisibleInNavCommented());
navMenu.findItem(R.id.nav_followed_tags).setVisible(appSettings.isVisibleInNavFollowed_tags());
navMenu.findItem(R.id.nav_help_license).setVisible(appSettings.isVisibleInNavHelp_license());
navMenu.findItem(R.id.nav_liked).setVisible(appSettings.isVisibleInNavLiked());
navMenu.findItem(R.id.nav_mentions).setVisible(appSettings.isVisibleInNavMentions());
navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile());
navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities());
}
@OnClick(R.id.toolbar)
@ -467,7 +474,8 @@ public class MainActivity extends AppCompatActivity
if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
handleSendSubject(intent);
} else {
handleSendText(intent);}
handleSendText(intent);
}
break;
case "image/*":
handleSendImage(intent); //TODO: Add intent filter to Manifest and implement method
@ -632,7 +640,7 @@ public class MainActivity extends AppCompatActivity
}
case R.id.action_reload: {
if(WebHelper.isOnline(MainActivity.this)) {
if (WebHelper.isOnline(MainActivity.this)) {
webView.reload();
return true;
} else {
@ -848,7 +856,7 @@ public class MainActivity extends AppCompatActivity
void handleSendText(Intent intent) {
String content = WebHelper.replaceUrlWithMarkdown(intent.getStringExtra(Intent.EXTRA_TEXT));
if(appSettings.isAppendSharedViaApp()) {
if (appSettings.isAppendSharedViaApp()) {
// 
 = \n
content = content + "\n\n" + getString(R.string.shared_by_diaspora_android);
}
@ -865,6 +873,7 @@ public class MainActivity extends AppCompatActivity
/**
* Handle sent text + subject
*
* @param intent
*/
void handleSendSubject(Intent intent) {
@ -928,12 +937,12 @@ public class MainActivity extends AppCompatActivity
}
@JavascriptInterface
public void contentHasBeenShared(){
public void contentHasBeenShared() {
textToBeShared = null;
}
@JavascriptInterface
public void log(final String log){
public void log(final String log) {
//Log.d(App.TAG, "[wv] " + log);
}
}
@ -1037,7 +1046,7 @@ public class MainActivity extends AppCompatActivity
}
break;
case R.id.nav_license_help: {
case R.id.nav_help_license: {
final CharSequence[] options = {getString(R.string.help_license__name), getString(R.string.help_markdown__name)};
new AlertDialog.Builder(MainActivity.this)
.setItems(options, new DialogInterface.OnClickListener() {

View file

@ -125,7 +125,15 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
intent.setAction(MainActivity.ACTION_CLEAR_CACHE);
break;
}
case R.string.pref_title__show_exit_button_in_nav_also:
case R.string.nav_activities:
case R.string.nav_aspects:
case R.string.nav_commented:
case R.string.nav_followed_tags:
case R.string.nav_help_license:
case R.string.nav_liked:
case R.string.nav_mentions:
case R.string.nav_profile:
case R.string.nav_public_activities:
case R.string.pref_title__intellihide_toolbars: {
activityRestartRequired = true;
return true;

View file

@ -178,7 +178,7 @@ public class AppSettings {
setStringArray(prefPod, R.string.pref_key__podprofile_followed_tags, tags);
}
public int getUnreadMessageCount(){
public int getUnreadMessageCount() {
return getInt(prefPod, R.string.pref_key__podprofile_unread_message_count, 0);
}
@ -186,7 +186,7 @@ public class AppSettings {
setInt(prefPod, R.string.pref_key__podprofile_unread_message_count, unreadMessageCount);
}
public int getNotificationCount(){
public int getNotificationCount() {
return getInt(prefPod, R.string.pref_key__podprofile_notification_count, 0);
}
@ -255,7 +255,43 @@ public class AppSettings {
return getBoolean(prefApp, R.string.pref_key__intellihide_toolbars, true);
}
public boolean isShowExitButtonInNavAlso(){
return getBoolean(prefApp, R.string.pref_key__show_exit_button_in_nav_also, false);
public boolean isVisibleInNavExit() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__exit, false);
}
public boolean isVisibleInNavHelp_license() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__help_license, false);
}
public boolean isVisibleInNavPublic_activities() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__public_activities, false);
}
public boolean isVisibleInNavMentions() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__mentions, false);
}
public boolean isVisibleInNavCommented() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__commented, false);
}
public boolean isVisibleInNavLiked() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__liked, false);
}
public boolean isVisibleInNavActivities() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__activities, false);
}
public boolean isVisibleInNavAspects() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__aspects, false);
}
public boolean isVisibleInNavFollowed_tags() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__followed_tags, false);
}
public boolean isVisibleInNavProfile() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, false);
}
}

View file

@ -61,7 +61,7 @@
android:title="@string/nav_settings_view" />
<item
android:id="@+id/nav_license_help"
android:id="@+id/nav_help_license"
android:icon="@drawable/ic_info_black_48px"
android:title="@string/nav_help_license" />
</menu>

View file

@ -18,8 +18,6 @@
<string name="pref_desc__proxy_enabled">Nutze einen Proxyserver, um Firewalls zu umgehen</string>
<string name="pref_title__proxy_host">Host</string>
<string name="pref_title__proxy_port">Port</string>
<string name="pref_title__show_exit_button_in_nav_also">Beenden Button im Slider</string>
<string name="pref_desc__show_exit_button_in_nav_also">Fügt einen zusätzlichen »App beenden« Button zum Navigations-Slider hinzu</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Persönliche Einstellungen</string>
<string name="pref_desc__personal_settings">Öffne die Einstellungen deines Diaspora Accounts</string>

View file

@ -18,8 +18,6 @@
<string name="pref_desc__proxy_enabled">Serveur Proxy.\n(Nécessite un redémarrage)</string>
<string name="pref_title__proxy_host">Hôte</string>
<string name="pref_title__proxy_port">Port</string>
<string name="pref_title__show_exit_button_in_nav_also">Bouton \"Quitter\" dans la barre de navigation</string>
<string name="pref_desc__show_exit_button_in_nav_also">Ajouter le bouton »Quitter l\'application« dans la barre de navigation</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Paramètres personnels</string>
<string name="pref_desc__personal_settings">Ouvrir vos paramètres de compte Diaspora</string>

View file

@ -18,8 +18,6 @@
<string name="pref_desc__proxy_enabled">Diaspora の通信をプロキシして、ファイアウォールに回避します。\n再起動が必要になることがあります</string>
<string name="pref_title__proxy_host">ホスト</string>
<string name="pref_title__proxy_port">ポート</string>
<string name="pref_title__show_exit_button_in_nav_also">ナビゲーション スライダーに終了ボタン</string>
<string name="pref_desc__show_exit_button_in_nav_also">ナビゲーション スライダーに »アプリを終了« ボタンを追加します</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">個人用設定</string>
<string name="pref_desc__personal_settings">Diaspora アカウント設定を開きます</string>

View file

@ -18,8 +18,6 @@
<string name="pref_desc__proxy_enabled">Usar proxy para o tráfego da diáspora para contornar firewalls.\nPode requerer reinicialização</string>
<string name="pref_title__proxy_host">Servidor</string>
<string name="pref_title__proxy_port">Porta</string>
<string name="pref_title__show_exit_button_in_nav_also">Botão de sair na barra de navegação</string>
<string name="pref_desc__show_exit_button_in_nav_also">Adiciona um botão extra » Sair App «na barra de navegação</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Configurações pessoais</string>
<string name="pref_desc__personal_settings">Abra suas configurações de usuário diáspora</string>

View file

@ -18,8 +18,6 @@
<string name="pref_desc__proxy_enabled">Перенаправить трафик Диаспоры в обход брандмауэров.\nМожет потребовать перезапуска</string>
<string name="pref_title__proxy_host">Хост</string>
<string name="pref_title__proxy_port">Порт</string>
<string name="pref_title__show_exit_button_in_nav_also">Кнопка выхода на навигационном слайдере</string>
<string name="pref_desc__show_exit_button_in_nav_also">Добавляет дополнительную кнопку »Выйти« на навигационный слайдер</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Личные настройки</string>
<string name="pref_desc__personal_settings">Открыть настройки аккаунта диаспоры</string>

View file

@ -10,7 +10,5 @@
<color name="accent">#8b685b</color> <!-- #4CAF50 -->
<!-- End colors from Palette -->
<color name="fab_big">@color/accent</color>
<color name="white">#ffffff</color>
</resources>

View file

@ -14,7 +14,6 @@
<string name="pref_catkey__network" translatable="false">pref_key_category_network</string>
<string name="pref_key__load_images" translatable="false">pref_key_load_images</string>
<string name="pref_key__clear_cache" translatable="false">pref_key_clear_cache</string>
<string name="pref_key__show_exit_button_in_nav_also" translatable="false">pref_key__show_exit_button_in_nav_also</string>
<string name="pref_key__append_shared_via_app" translatable="false">pref_key_append_shared_via_app</string>
<string name="pref_key__proxy_enabled" translatable="false">pref_key_proxy_enabled</string>
@ -22,9 +21,24 @@
<string name="pref_key__proxy_port" translatable="false">pref_key_proxy_port</string>
<string name="pref_key__proxy_was_enabled" translatable="false">wasProxyEnabled</string>
<!-- Navigiation Slider -->
<string name="pref_title__submenu_nav_slider" translatable="false">Navigation Slider</string>
<string name="pref_desc__submenu_nav_slider" translatable="false">Multiple settings for the navigation drawer</string>
<string name="pref_catkey__visibility_nav" translatable="false">pref_catkey__visibility_navslider</string>
<string name="pref_cat__visibility_nav" translatable="false">Item visibility</string>
<string name="pref_key__visibility_nav__exit" translatable="false">pref_key__visibility_navslider__exit</string>
<string name="pref_key__visibility_nav__help_license" translatable="false">pref_key__visibility_nav__help_license</string>
<string name="pref_key__visibility_nav__public_activities" translatable="false">pref_key__visibility_nav__public_activities</string>
<string name="pref_key__visibility_nav__mentions" translatable="false">pref_key__visibility_nav__mentions</string>
<string name="pref_key__visibility_nav__commented" translatable="false">pref_key__visibility_nav__commented</string>
<string name="pref_key__visibility_nav__liked" translatable="false">pref_key__visibility_nav__liked</string>
<string name="pref_key__visibility_nav__activities" translatable="false">pref_key__visibility_nav__activities</string>
<string name="pref_key__visibility_nav__aspects" translatable="false">pref_key__visibility_nav__aspects</string>
<string name="pref_key__visibility_nav__followed_tags" translatable="false">pref_key__visibility_nav__followed_tags</string>
<string name="pref_key__visibility_nav__profile" translatable="false">pref_key__visibility_nav__profile</string>
<!-- PodProfile -->
<string name="pref_key__podprofile_avatar_url" translatable="false">podUserProfile_avatar</string>
<string name="pref_key__podprofile_name" translatable="false">podUserProfile_name</string>
<string name="pref_key__podprofile_id" translatable="false">podUserProfile_guid</string>
@ -40,6 +54,8 @@
<string name="pref_cat__pod_settings">Pod settings</string>
<!-- Visuals -->
<!-- Font size -->
<string name="pref_title__font_size">Font size</string>
<array name="pref_entries__font_size">
@ -64,9 +80,6 @@
<string name="pref_title__proxy_host">Host</string>
<string name="pref_title__proxy_port">Port</string>
<string name="pref_title__show_exit_button_in_nav_also">Exit button in navigation slider</string>
<string name="pref_desc__show_exit_button_in_nav_also">Adds an additional »Exit App« button to the navigation slider</string>
<!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Personal settings</string>

View file

@ -130,6 +130,5 @@
&lt;i>The splashscreen images can be found on flickr:
https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123.
They were published by \"Lydia\" and are licensed under cc by-nc-sa.&lt;/i></string>
<!-- Recently added - Please move to right section-->
</resources>

View file

@ -4,31 +4,78 @@
<PreferenceCategory
android:key="@string/pref_catkey__category_visuals"
android:title="@string/pref_cat__visuals">
<PreferenceScreen
android:summary="@string/pref_desc__submenu_nav_slider"
android:title="@string/pref_title__submenu_nav_slider">
<PreferenceCategory
android:key="@string/pref_catkey__visibility_nav"
android:title="@string/pref_cat__visibility_nav">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__profile"
android:title="@string/nav_profile" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__followed_tags"
android:title="@string/nav_followed_tags" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__aspects"
android:title="@string/nav_aspects" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__activities"
android:title="@string/nav_activities" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__liked"
android:title="@string/nav_liked" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__commented"
android:title="@string/nav_commented" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__mentions"
android:title="@string/nav_mentions" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__exit"
android:title="@string/action_exit_app" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__help_license"
android:title="@string/nav_help_license" />
</PreferenceCategory>
</PreferenceScreen>
<ListPreference
android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size"
android:entryValues="@array/pref_entries_values__font_size"
android:key="@string/pref_key__font_size"
android:summary="%s"
android:title="@string/pref_title__font_size"/>
android:title="@string/pref_title__font_size" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__intellihide_toolbars"
android:summary="@string/pref_desc__intellihide_toolbars"
android:title="@string/pref_title__intellihide_toolbars"/>
android:title="@string/pref_title__intellihide_toolbars" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__append_shared_via_app"
android:summary="@string/pref_desc__append_shared_via_app"
android:title="@string/pref_title__append_shared_via_app"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__show_exit_button_in_nav_also"
android:summary="@string/pref_desc__show_exit_button_in_nav_also"
android:title="@string/pref_title__show_exit_button_in_nav_also"/>
android:title="@string/pref_title__append_shared_via_app" />
</PreferenceCategory>
@ -39,26 +86,22 @@
<Preference
android:key="@string/pref_key__personal_settings"
android:summary="@string/pref_desc__personal_settings"
android:title="@string/pref_title__personal_settings">
</Preference>
android:title="@string/pref_title__personal_settings" />
<Preference
android:key="@string/pref_key__manage_tags"
android:summary="@string/pref_desc__manage_tags"
android:title="@string/pref_title__manage_tags">
</Preference>
android:title="@string/pref_title__manage_tags" />
<Preference
android:key="@string/pref_key__manage_contacts"
android:summary="@string/pref_desc__manage_contacts"
android:title="@string/pref_title__manage_contacts">
</Preference>
android:title="@string/pref_title__manage_contacts" />
<Preference
android:key="@string/pref_key__change_account"
android:summary="@string/pref_desc__change_account"
android:title="@string/pref_title__change_account">
</Preference>
android:title="@string/pref_title__change_account" />
</PreferenceCategory>
<!-- Networking -->
@ -69,28 +112,27 @@
android:defaultValue="true"
android:key="@string/pref_key__load_images"
android:summary="@string/pref_desc__load_images"
android:title="@string/pref_title__load_images"/>
android:title="@string/pref_title__load_images" />
<Preference
android:key="@string/pref_key__clear_cache"
android:summary="@string/pref_desc__clear_cache"
android:title="@string/pref_title__clear_cache">
</Preference>
android:title="@string/pref_title__clear_cache" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__proxy_enabled"
android:summary="@string/pref_desc__proxy_enabled"
android:title="@string/pref_title__proxy_enabled"/>
android:title="@string/pref_title__proxy_enabled" />
<EditTextPreference
android:dependency="@string/pref_key__proxy_enabled"
android:inputType="textNoSuggestions"
android:key="@string/pref_key__proxy_host"
android:title="@string/pref_title__proxy_host"/>
android:title="@string/pref_title__proxy_host" />
<EditTextPreference
android:dependency="@string/pref_key__proxy_enabled"
android:inputType="number"
android:key="@string/pref_key__proxy_port"
android:title="@string/pref_title__proxy_port"/>
android:title="@string/pref_title__proxy_port" />
</PreferenceCategory>
</PreferenceScreen>