mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +01:00
Added back stream loading on topbar click. Made it toggleable in settings
This commit is contained in:
parent
d6c6920840
commit
00e238a028
5 changed files with 57 additions and 0 deletions
|
@ -38,6 +38,7 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
|
@ -82,6 +83,7 @@ import com.github.dfa.diaspora_android.web.custom_tab.CustomTabActivityHelper;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class MainActivity extends ThemedActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener,
|
||||
|
@ -223,6 +225,10 @@ public class MainActivity extends ThemedActivity
|
|||
|
||||
// Setup toolbar
|
||||
setSupportActionBar(toolbarTop);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if(actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
toolbarBottom.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
CustomFragment top = getTopFragment();
|
||||
|
@ -408,6 +414,18 @@ public class MainActivity extends ThemedActivity
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward toolbar clicks to onNavigationItemSelected
|
||||
* @param view selected view
|
||||
*/
|
||||
@OnClick(R.id.main__topbar)
|
||||
public void onToolBarClicked(View view) {
|
||||
AppLog.i(this, "onToolBarClicked()");
|
||||
if(appSettings.isTopbarStreamShortcutEnabled()) {
|
||||
onNavigationItemSelected(navView.getMenu().findItem(R.id.nav_stream));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward incoming intents to handleIntent()
|
||||
*
|
||||
|
|
|
@ -398,6 +398,10 @@ public class AppSettings {
|
|||
return getBoolean(prefApp, R.string.pref_key__visibility_nav__reports, false);
|
||||
}
|
||||
|
||||
public boolean isTopbarStreamShortcutEnabled() {
|
||||
return getBoolean(prefApp, R.string.pref_key__topbar_stream_shortcut, false);
|
||||
}
|
||||
|
||||
public void setPrimaryColorSettings(int base, int shade) {
|
||||
setInt(prefApp, R.string.pref_key__primary_color_base, base);
|
||||
setInt(prefApp, R.string.pref_key__primary_color_shade, shade);
|
||||
|
|
16
app/src/main/res/drawable/ic_touch_app_black_24px.xml
Normal file
16
app/src/main/res/drawable/ic_touch_app_black_24px.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16
|
||||
5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56 .79 2.93 2 3.74zm9.84
|
||||
4.63l-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10
|
||||
7.5v10.74l-3.43-.72c-.08-.01-.15-.03-.24-.03-.31 0-.59 .13 -.79 .33 l-.79 .8
|
||||
4.94 4.94c.27 .27 .65 .44 1.06 .44 h6.79c.75 0 1.33-.55
|
||||
1.44-1.28l.75-5.27c.01-.07 .02 -.14 .02 -.2 0-.62-.38-1.16-.91-1.38z" />
|
||||
</vector>
|
|
@ -14,6 +14,7 @@
|
|||
<string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string>
|
||||
<string name="pref_key__http_proxy_load_tor_preset" translatable="false">pref_key__http_proxy_load_tor_preset</string>
|
||||
<string name="pref_key__extended_notifications" translatable="false">pref_key__extended_notifications</string>
|
||||
<string name="pref_key__topbar_stream_shortcut" translatable="false">pref_key__topbar_stream_shortcut</string>
|
||||
|
||||
<!-- Themes -->
|
||||
<string name="pref_key__primary_color__preference_click" translatable="false">@string/pref_key__primary_color_shade</string>
|
||||
|
@ -29,6 +30,10 @@
|
|||
<string name="pref_key__http_proxy_port" translatable="false">pref_key_proxy_port</string>
|
||||
<string name="pref_key__proxy_was_enabled" translatable="false">wasProxyEnabled</string>
|
||||
|
||||
<!-- Operability -->
|
||||
<string name="pref_title__topbar_stream_shortcut">Top toolbar loads stream</string>
|
||||
<string name="pref_desc__topbar_stream_shortcut">Click an empty space in the top toolbar to open the stream</string>
|
||||
|
||||
<!-- Navigiation Slider -->
|
||||
<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>
|
||||
|
@ -64,6 +69,7 @@
|
|||
<string name="pref_cat__network">Network</string>
|
||||
<string name="pref_cat__pod_settings">Pod settings</string>
|
||||
<string name="pref_cat__more" translatable="false">@string/nav_menu_more</string>
|
||||
<string name="pref_cat__operability">Operability</string>
|
||||
|
||||
<!-- Visuals -->
|
||||
<!-- Navigiation Slider -->
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
android:title="@string/pref_title__intellihide_toolbars"
|
||||
android:icon="@drawable/ic_zoom_out_map_black_24px"/>
|
||||
|
||||
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
||||
|
||||
<!-- Operability -->
|
||||
<com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory
|
||||
android:title="@string/pref_cat__operability">
|
||||
|
||||
<com.github.dfa.diaspora_android.ui.theme.ThemedCheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key__extended_notifications"
|
||||
|
@ -54,6 +60,13 @@
|
|||
android:title="@string/pref_title__chrome_custom_tabs_enabled"
|
||||
android:icon="@drawable/ic_open_in_new_black_24px"/>
|
||||
|
||||
<com.github.dfa.diaspora_android.ui.theme.ThemedCheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key__topbar_stream_shortcut"
|
||||
android:summary="@string/pref_desc__topbar_stream_shortcut"
|
||||
android:title="@string/pref_title__topbar_stream_shortcut"
|
||||
android:icon="@drawable/ic_touch_app_black_24px"/>
|
||||
|
||||
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
||||
|
||||
<!-- Diaspora Pod Settings -->
|
||||
|
|
Loading…
Reference in a new issue