Use toolbar instead of actionbar

pull/253/head
Alex Baker 11 years ago
parent 96a95708e7
commit d2b1f95436

@ -8,6 +8,7 @@ package com.todoroo.astrid.activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent; import android.view.KeyEvent;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
@ -29,12 +30,14 @@ public class TaskEditActivity extends AstridActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
preferences.applyTheme(); preferences.applyTheme();
ActionBar actionBar = getSupportActionBar();
setContentView(R.layout.task_edit_wrapper_activity); setContentView(R.layout.task_edit_wrapper_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(false);
actionBar.setTitle("");
} }
/* (non-Javadoc) /* (non-Javadoc)

@ -16,6 +16,7 @@ import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -56,6 +57,7 @@ import javax.inject.Inject;
import static com.todoroo.astrid.voice.RecognizerApi.RecognizerApiListener; import static com.todoroo.astrid.voice.RecognizerApi.RecognizerApiListener;
import static com.todoroo.astrid.voice.VoiceRecognizer.voiceInputAvailable; import static com.todoroo.astrid.voice.VoiceRecognizer.voiceInputAvailable;
import static org.tasks.preferences.ResourceResolver.getData;
import static org.tasks.ui.NavigationDrawerFragment.OnFilterItemClickedListener; import static org.tasks.ui.NavigationDrawerFragment.OnFilterItemClickedListener;
public class TaskListActivity extends AstridActivity implements OnPageChangeListener, OnFilterItemClickedListener, RecognizerApiListener { public class TaskListActivity extends AstridActivity implements OnPageChangeListener, OnFilterItemClickedListener, RecognizerApiListener {
@ -86,15 +88,18 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
preferences.applyTheme(); preferences.applyTheme();
int contentView = getContentView(); setContentView(preferences.useTabletLayout()
setContentView(contentView); ? R.layout.task_list_wrapper_activity_3pane
: R.layout.task_list_wrapper_activity_no_swipe);
ActionBar actionBar = getSupportActionBar(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
actionBar.setDisplayUseLogoEnabled(true); setSupportActionBar(toolbar);
actionBar.setLogo(null);
navigationDrawer = getNavigationDrawerFragment(); navigationDrawer = getNavigationDrawerFragment();
navigationDrawer.setUp((DrawerLayout) findViewById(R.id.drawer_layout)); DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationDrawer.setUp(drawerLayout);
// drawerLayout.setStatusBarBackgroundColor(getResources().getColor(android.R.color.holo_blue_bright));
TypedValue typedValue = new TypedValue(); TypedValue typedValue = new TypedValue();
getTheme().resolveAttribute(R.attr.ic_drawer, typedValue, true); getTheme().resolveAttribute(R.attr.ic_drawer, typedValue, true);
@ -182,14 +187,6 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
return true; return true;
} }
private int getContentView() {
if (preferences.useTabletLayout()) {
return R.layout.task_list_wrapper_activity_3pane;
} else {
return R.layout.task_list_wrapper_activity_no_swipe;
}
}
protected Filter getDefaultFilter() { protected Filter getDefaultFilter() {
return CoreFilterExposer.buildInboxFilter(getResources()); return CoreFilterExposer.buildInboxFilter(getResources());
} }

@ -147,9 +147,9 @@ public class NavigationDrawerFragment extends InjectingFragment {
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// set up the drawer's list view with items and click listener // set up the drawer's list view with items and click listener
ActionBar actionBar = getActionBar(); // ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true); // actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true); // actionBar.setHomeButtonEnabled(true);
// ActionBarDrawerToggle ties together the the proper interactions // ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon. // between the navigation drawer and the action bar app icon.

@ -10,4 +10,5 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:cacheColorHint="@android:color/transparent" android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false" android:scrollingCache="false"
android:fitsSystemWindows="true"
tools:context=".NavigationDrawerFragment" /> tools:context=".NavigationDrawerFragment" />

@ -11,6 +11,8 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" > android:orientation="vertical" >
<include layout="@layout/toolbar" />
<ScrollView <ScrollView
android:id="@+id/edit_scroll" android:id="@+id/edit_scroll"
style="@style/Content_EditScroll" style="@style/Content_EditScroll"

@ -18,27 +18,6 @@
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<android.support.v4.widget.SwipeRefreshLayout <include layout="@layout/task_list_swipe_layout_empty" />
android:id="@+id/swipe_layout_empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/empty_text"
style="@style/TextAppearance.TLA_NoItems"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:drawableTop="@drawable/icon"
android:gravity="center"
android:text="@string/TLA_no_items" />
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout> </RelativeLayout>

@ -19,27 +19,6 @@
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<android.support.v4.widget.SwipeRefreshLayout <include layout="@layout/task_list_swipe_layout_empty" />
android:id="@+id/swipe_layout_empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/empty_text"
style="@style/TextAppearance.TLA_NoItems"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:drawableTop="@drawable/icon"
android:gravity="center"
android:text="@string/TLA_no_items" />
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout> </RelativeLayout>

@ -0,0 +1,22 @@
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_layout_empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/empty_text"
style="@style/TextAppearance.TLA_NoItems"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:drawableTop="@drawable/icon"
android:gravity="center"
android:text="@string/TLA_no_items" />
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>

@ -2,7 +2,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Content" style="@style/Content"
@ -10,6 +11,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<include layout="@layout/toolbar"/>
<View <View
android:layout_width="1px" android:layout_width="1px"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -43,6 +46,7 @@
android:layout_width="@dimen/navigation_drawer_width" android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:fitsSystemWindows="true"
tools:layout="@layout/fragment_navigation_drawer" /> tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

@ -2,13 +2,23 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tasklist_fragment_container" android:id="@+id/tasklist_fragment_container"
style="@style/Content" style="@style/Content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
</LinearLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat <!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right this as a sliding drawer on the left side for left-to-right
@ -23,6 +33,7 @@
android:layout_width="@dimen/navigation_drawer_width" android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:fitsSystemWindows="true"
tools:layout="@layout/fragment_navigation_drawer" /> tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

@ -0,0 +1,8 @@
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tasks="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/asAbBackgroundColor"
tasks:popupTheme="@style/ActionBarPopupThemeOverlay" />

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<style name="Tasks" parent="Theme.AppCompat.NoActionBar">-->
<!---->
<!--</style>-->
<!---->
<!--<style name="Tasks.Light" parent="Theme.AppCompat.Light.NoActionBar">-->
<!---->
<!--</style>-->
</resources>

@ -8,7 +8,9 @@
<!-- ========================================================== General --> <!-- ========================================================== General -->
<style name="Tasks" parent="@style/Theme.AppCompat"> <style name="Tasks" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowBackground">@null</item> <item name="android:windowBackground">@null</item>
<item name="asContentBackground">@android:color/black</item> <item name="asContentBackground">@android:color/black</item>
<item name="asTextColor">#ffffff</item> <item name="asTextColor">#ffffff</item>
@ -57,6 +59,8 @@
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
</style> </style>
<style name="ActionBarPopupThemeOverlay" parent="Widget.AppCompat.Light.PopupMenu" />
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">false</item> <item name="spinBars">false</item>
</style> </style>
@ -75,9 +79,11 @@
<item name="android:src">@drawable/ic_action_overflow_light</item> <item name="android:src">@drawable/ic_action_overflow_light</item>
</style> </style>
<style name="Tasks.Light" parent="@style/Theme.AppCompat.Light"> <style name="Tasks.Light" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="asContentBackground">@android:color/white</item> <item name="asContentBackground">@android:color/white</item>
<item name="asEditBackground">#e5e5e5</item> <item name="asEditBackground">@android:color/white</item>
<item name="asTextColor">#000000</item> <item name="asTextColor">#000000</item>
<item name="asTextColorInverse">#ffffff</item> <item name="asTextColorInverse">#ffffff</item>
<item name="asDetailsColor">#6666aa</item> <item name="asDetailsColor">#6666aa</item>
@ -111,6 +117,11 @@
<item name="drawer_background">#efefef</item> <item name="drawer_background">#efefef</item>
<item name="drawer_text">#000</item> <item name="drawer_text">#000</item>
<item name="drawer_selected">#dddddd</item> <item name="drawer_selected">#dddddd</item>
<item name="android:popupMenuStyle">@style/Widget.AppCompat.Light.PopupMenu</item>
<item name="android:listPopupWindowStyle">@style/Widget.AppCompat.Light.PopupMenu</item>
<item name="android:dropDownListViewStyle">@style/Widget.AppCompat.Light.ListView.DropDown</item>
<!-- actionbar-styling --> <!-- actionbar-styling -->
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:actionBarStyle">@style/AstridV11ActionBarStyle.Light</item> <item name="android:actionBarStyle">@style/AstridV11ActionBarStyle.Light</item>
@ -134,7 +145,6 @@
<item name="android:src">@drawable/ic_action_overflow</item> <item name="android:src">@drawable/ic_action_overflow</item>
</style> </style>
<style name="Tasks.FullTransparent" parent="@style/Theme.AppCompat"> <style name="Tasks.FullTransparent" parent="@style/Theme.AppCompat">
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>

Loading…
Cancel
Save