summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Rizzoli <joey@cyanogenmoditalia.it>2016-06-01 14:04:38 +0200
committerArne Coucheron <arco68@gmail.com>2017-07-31 00:38:16 +0200
commita0dc1b87de08a5462396a750baa77827ee14f754 (patch)
treef4f5d9f4dae0594f759fbec1618aebab952054af
parentae2d5c13ce7847275b35a82074b07cf67ab59cee (diff)
downloadandroid_packages_apps_Gallery2-a0dc1b87de08a5462396a750baa77827ee14f754.tar.gz
android_packages_apps_Gallery2-a0dc1b87de08a5462396a750baa77827ee14f754.tar.bz2
android_packages_apps_Gallery2-a0dc1b87de08a5462396a750baa77827ee14f754.zip
Gallery2: Replace hamburger menu with bottom bar
Change-Id: I20caa58fe11ee6f4148cb0bcb0ccbcdcf3a9612e Signed-off-by: Joey Rizzoli <joey@cyanogenmoditalia.it>
-rwxr-xr-xAndroid.mk16
-rw-r--r--res/drawable/ic_album.xml9
-rw-r--r--res/drawable/ic_timeline.xml14
-rw-r--r--res/drawable/ic_video.xml13
-rw-r--r--res/layout/gallery_main.xml69
-rw-r--r--res/layout/gl_root_group.xml12
-rw-r--r--res/values/attrs.xml10
-rw-r--r--res/values/cm_colors.xml7
-rw-r--r--res/values/codeaurora_strings.xml12
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java22
-rwxr-xr-xsrc/com/android/gallery3d/app/AlbumSetPage.java6
-rwxr-xr-xsrc/com/android/gallery3d/app/GalleryActivity.java183
-rwxr-xr-xsrc/com/android/gallery3d/app/PhotoPage.java11
-rw-r--r--src/com/android/gallery3d/app/SlideshowPage.java4
-rwxr-xr-xsrc/com/android/gallery3d/app/TimeLinePage.java4
-rw-r--r--src/org/codeaurora/gallery3d/video/VideoSettingsActivity.java1
16 files changed, 154 insertions, 239 deletions
diff --git a/Android.mk b/Android.mk
index e6b2b949d..36bc61190 100755
--- a/Android.mk
+++ b/Android.mk
@@ -6,17 +6,25 @@ LOCAL_MODULE_TAGS := optional
LOCAL_JAVA_LIBRARIES := telephony-common
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13
+LOCAL_STATIC_JAVA_LIBRARIES := ahbottomnavigation
+LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
+LOCAL_STATIC_JAVA_LIBRARIES += android-support-v13
LOCAL_STATIC_JAVA_LIBRARIES += org.codeaurora.gallery.common
-LOCAL_STATIC_JAVA_LIBRARIES += xmp_toolkit
LOCAL_STATIC_JAVA_LIBRARIES += mp4parser
+LOCAL_STATIC_JAVA_LIBRARIES += xmp_toolkit
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, src_pd)
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
+LOCAL_RESOURCE_DIR += \
+ $(LOCAL_PATH)/res \
+ $(TOP)/external/ahbottomnavigation/ahbottomnavigation/src/main/res \
+ $(TOP)/frameworks/support/v7/appcompat/res
-LOCAL_AAPT_FLAGS := --auto-add-overlay
+LOCAL_AAPT_FLAGS := \
+ --auto-add-overlay \
+ --extra-packages com.aurelhubert.ahbottomnavigation \
+ --extra-packages android.support.v7.appcompat
LOCAL_PACKAGE_NAME := Gallery2
diff --git a/res/drawable/ic_album.xml b/res/drawable/ic_album.xml
new file mode 100644
index 000000000..3f0cfa2fb
--- /dev/null
+++ b/res/drawable/ic_album.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/tab_icon_2"
+ android:pathData="M17.999,2h-12c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C19.999,2.9 19.099,2 17.999,2zM5.999,4h5v8l-2.5,-1.5l-2.5,1.5V4zM5.999,19l3,-3.859l2.141,2.58l3,-3.861L17.999,19H5.999z"/>
+</vector>
diff --git a/res/drawable/ic_timeline.xml b/res/drawable/ic_timeline.xml
new file mode 100644
index 000000000..7c30ffa4e
--- /dev/null
+++ b/res/drawable/ic_timeline.xml
@@ -0,0 +1,14 @@
+<?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="@color/tab_icon_1"
+ android:pathData="M9.45605,12.4586 L16.2515,12.4586 L16.2515,19.7214 L9.45608,19.7214 Z M20,8 L4,8
+L4,6 L20,6 L20,8 Z M18,2 L6,2 L6,4 L18,4 L18,2 Z M22,12 L22,20
+C22,21.1,21.1,22,20,22 L4,22 C2.9,22,2,21.1,2,20 L2,12 C2,10.9,2.9,10,4,10
+L20,10 C21.1,10,22,10.9,22,12 Z M16,16 L10,12.73 L10,19.26 L16,16 Z" />
+</vector>
diff --git a/res/drawable/ic_video.xml b/res/drawable/ic_video.xml
new file mode 100644
index 000000000..1904d8b68
--- /dev/null
+++ b/res/drawable/ic_video.xml
@@ -0,0 +1,13 @@
+<?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="@color/tab_icon_3"
+ android:pathData="M18,4 L20,8 L17,8 L15,4 L13,4 L15,8 L12,8 L10,4 L8,4 L10,8 L7,8 L5,4 L4,4
+C2.9,4,2.01,4.9,2.01,6 L2,18 C2,19.1,2.9,20,4,20 L20,20 C21.1,20,22,19.1,22,18
+L22,4 L18,4 Z" />
+</vector>
diff --git a/res/layout/gallery_main.xml b/res/layout/gallery_main.xml
index 31d67c5ea..da9e76a8d 100644
--- a/res/layout/gallery_main.xml
+++ b/res/layout/gallery_main.xml
@@ -28,67 +28,36 @@
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
-<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <!-- MAIN CONTENT -->
-
<RelativeLayout
- android:id="@+id/gallery_root"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <include layout="@layout/gl_root_group" />
- </RelativeLayout>
-
- <LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <include
- android:id="@+id/toolbar"
- layout="@layout/toolbar" />
- </LinearLayout>
-
- <RelativeLayout
- android:id="@+id/drawerPane"
- android:layout_width="270dp"
- android:layout_height="match_parent"
- android:layout_gravity="start"
- android:background="@color/white"
- android:clickable="true" >
-
- <!-- Header -->
+ android:layout_height="match_parent">
+ <!-- MAIN CONTENT -->
<RelativeLayout
- android:id="@+id/header"
+ android:id="@+id/gallery_root"
android:layout_width="match_parent"
- android:layout_height="150dp"
- android:background="@drawable/drawer_bg" >
+ android:layout_height="match_parent">
- <TextView
- android:id="@+id/appName"
- android:layout_width="wrap_content"
+ <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
+ android:id="@+id/bottom_navigation"
+ android:elevation="8dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_marginBottom="16dp"
- android:layout_marginStart="16dp"
- android:fontFamily="sans-serif"
- android:text="@string/navigation_drawer_title"
- android:textColor="@color/white"
- android:textSize="24sp" />
+ android:layout_alignParentBottom="true" />
+
+ <include layout="@layout/gl_root_group"/>
</RelativeLayout>
- <ListView
- android:id="@+id/navList"
- android:layout_width="270dp"
- android:layout_height="match_parent"
- android:layout_below="@id/header"
- android:layout_marginTop="4dp"
- android:divider="@android:color/transparent" />
+ <!-- This layout will overlap all the others -->
+ <include
+ android:id="@+id/toolbar"
+ layout="@layout/toolbar" />
</RelativeLayout>
-
-</android.support.v4.widget.DrawerLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/gl_root_group.xml b/res/layout/gl_root_group.xml
index de0f66afe..eee2b49f8 100644
--- a/res/layout/gl_root_group.xml
+++ b/res/layout/gl_root_group.xml
@@ -15,13 +15,19 @@
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <com.android.gallery3d.ui.GLRootView
+
+ <RelativeLayout
+ android:id="@+id/gl_parent_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginBottom="56dp">
+ <com.android.gallery3d.ui.GLRootView
android:id="@+id/gl_root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
+ </RelativeLayout>
<View android:id="@+id/gl_root_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#fafafa"
- />
+ android:background="#fafafa"/>
</merge>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 80079dd46..52ac78ff9 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -14,16 +14,11 @@
limitations under the License.
-->
<resources>
- <declare-styleable name="Theme.GalleryBase">
- <attr name="listPreferredItemHeightSmall" format="dimension" />
- <attr name="switchStyle" format="reference" />
- </declare-styleable>
+ <declare-styleable name="Theme.GalleryBase"/>
<!-- Camera resources below -->
- <declare-styleable name="CameraPreference">
- <attr name="title" format="string" />
- </declare-styleable>
+ <declare-styleable name="CameraPreference"/>
<declare-styleable name="ListPreference">
<attr name="key" format="string" />
<attr name="defaultValue" format="string|reference" />
@@ -44,7 +39,6 @@
</declare-styleable>
<declare-styleable name="Knob">
<attr name="label" format="string" />
- <attr name="background" format="integer" />
<attr name="foreground" format="integer" />
</declare-styleable>
<declare-styleable name="FillColor">
diff --git a/res/values/cm_colors.xml b/res/values/cm_colors.xml
index 70fc269a8..4eb65aead 100644
--- a/res/values/cm_colors.xml
+++ b/res/values/cm_colors.xml
@@ -24,6 +24,13 @@
<color name="light_black">#424242</color>
+ <color name="tab_1">@color/primary</color>
+ <color name="tab_2">@color/primary</color>
+ <color name="tab_3">@color/primary</color>
+ <color name="tab_icon_1">@color/white</color>
+ <color name="tab_icon_2">@color/white</color>
+ <color name="tab_icon_3">@color/white</color>
+
<color name="black_transparent_1">#1a000000</color>
<color name="black_transparent_2">#26000000</color>
<color name="black_transparent_3">#75000000</color>
diff --git a/res/values/codeaurora_strings.xml b/res/values/codeaurora_strings.xml
index b05aaf45c..540707e3a 100644
--- a/res/values/codeaurora_strings.xml
+++ b/res/values/codeaurora_strings.xml
@@ -122,19 +122,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<string name="drm_license_info">DRM license info</string>
- <string-array name="title_array_nav_items">
- <item>Timeline</item>
- <item>Albums</item>
- <item>Videos</item>
- </string-array>
-
- <string name="navigation_drawer_title" translatable="false">@string/app_name</string>
<!-- Timeline screen title -->
<string name="timeline_title">Timeline</string>
<!-- Albums screen title -->
- <string name="albums_title" translatable="false">@string/tab_albums</string>
+ <string name="albums_title">Albums</string>
<!-- Videos screen title -->
<string name="videos_title">Videos</string>
+
<string name="action_viewtype_list">List view</string>
<string name="action_viewtype_grid" translatable="false">@string/switch_photo_grid</string>
<string name="tvEmptyAlbum">No photos found</string>
@@ -144,7 +138,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<string name="text_makeup_Soften">Soften</string>
<string name="text_makeup_trimface">Trimface</string>
<string name="text_makeup_bigeye">Bigeye</string>
- <string name="drawer_desc" translatable="false">drawer</string>
+
<string name="truescanner_normal">Normal</string>
<string name="truescanner_white">Whiteboard</string>
<string name="truescanner">TrueScanner</string>
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index a3d2d83be..9ff205454 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -282,13 +282,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
if (mInCameraApp) {
GalleryUtils.startGalleryActivity(mActivity);
} else if (mActivity.getStateManager().getStateCount() > 1) {
- Toolbar toolbar = mActivity.getToolbar();
- if (toolbar != null) {
- toolbar.setNavigationContentDescription(
- mActivity.getResources().getString(R.string.drawer_desc));
- toolbar.setNavigationIcon(R.drawable.drawer);
- ((GalleryActivity) mActivity).toggleNavDrawer(true);
- }
+ ((GalleryActivity) mActivity).toggleNavBar(true);
super.onBackPressed();
} else if (mParentMediaSetString != null) {
Bundle data = new Bundle(getData());
@@ -495,20 +489,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
setContentPane(mRootPane);
- boolean enableHomeButton = (mActivity.getStateManager().getStateCount() > 1) |
- mParentMediaSetString != null;
- //GalleryActionBar actionBar = mActivity.getGalleryActionBar();
- if (mIsVideoScreen) {
- //if from video screen, show display navigation icon as home and title
- mActionBar.setDisplayHome(true, true);
- } else {
- mActionBar.setDisplayOptions(enableHomeButton, true);
- }
- Toolbar toolBar = mActivity.getToolbar();
- if (enableHomeButton && toolBar != null) {
- toolBar.setNavigationContentDescription("back");
- toolBar.setNavigationIcon(R.drawable.back);
- }
// Set the reload bit here to prevent it exit this page in clearLoadingBit().
setLoadingBit(BIT_LOADING_RELOAD);
mLoadingFailed = false;
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index 09b095fd0..31872309c 100755
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -700,12 +700,12 @@ public class AlbumSetPage extends ActivityState implements
//mActionBar.disableClusterMenu(true);
mActionModeHandler.startActionMode();
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
- ((GalleryActivity)mActivity).toggleNavDrawer(false);
+ ((GalleryActivity)mActivity).toggleNavBar(false);
break;
}
case SelectionManager.LEAVE_SELECTION_MODE: {
mActionModeHandler.finishActionMode();
- ((GalleryActivity)mActivity).toggleNavDrawer(true);
+ ((GalleryActivity)mActivity).toggleNavBar(true);
/*if (mShowClusterMenu) {
mActionBar.enableClusterMenu(mSelectedAction, this);
}*/
@@ -731,11 +731,13 @@ public class AlbumSetPage extends ActivityState implements
mDetailsHelper.hide();
mAlbumSetView.setHighlightItemPath(null);
mSlotView.invalidate();
+ ((GalleryActivity)mActivity).toggleNavBar(true);
}
private void showDetails() {
mShowDetails = true;
if (mDetailsHelper == null) {
+ ((GalleryActivity)mActivity).toggleNavBar(false);
mDetailsHelper = new DetailsHelper(mActivity, mRootPane, mDetailsSource);
mDetailsHelper.setCloseListener(new CloseListener() {
@Override
diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java
index 0c6fbe49b..69c2b8d52 100755
--- a/src/com/android/gallery3d/app/GalleryActivity.java
+++ b/src/com/android/gallery3d/app/GalleryActivity.java
@@ -46,6 +46,8 @@ import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
+import android.widget.RelativeLayout;
+import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.Toolbar;
@@ -61,6 +63,9 @@ import com.android.gallery3d.util.GalleryUtils;
import java.util.Locale;
+import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
+import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
+
public final class GalleryActivity extends AbstractGalleryActivity implements OnCancelListener {
public static final String EXTRA_SLIDESHOW = "slideshow";
public static final String EXTRA_DREAM = "dream";
@@ -91,8 +96,13 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
private ListView mDrawerListView;
private DrawerLayout mDrawerLayout;
public static boolean mIsparentActivityFInishing;
- NavigationDrawerListAdapter mNavigationAdapter;
public Toolbar mToolbar;
+
+ private ArrayList<AHBottomNavigationItem> bottomNavigationItems = new ArrayList<>();
+ private AHBottomNavigation bottomNavigation;
+ private RelativeLayout mGLParentLayout;
+ private RelativeLayout.LayoutParams params;
+
/** DrawerLayout is not supported in some entrances.
* such as Intent.ACTION_VIEW, Intent.ACTION_GET_CONTENT, Intent.PICK. */
private boolean mDrawerLayoutSupported = true;
@@ -159,76 +169,51 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
R.string.videos_title, R.drawable.videos) };
public void initView() {
- mDrawerListView = (ListView) findViewById(R.id.navList);
- mNavigationAdapter = new NavigationDrawerListAdapter(this);
- mDrawerListView.setAdapter(mNavigationAdapter);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
+ bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_navigation);
setActionBar(mToolbar);
+ setToolbar(mToolbar);
- mDrawerListView
- .setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
- getGLRoot().lockRenderThread();
- showScreen(position);
-
- mNavigationAdapter.setClickPosition(position);
- mDrawerListView.invalidateViews();
- mDrawerLayout.closeDrawer(Gravity.START);
- getGLRoot().unlockRenderThread();
- }
- });
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
- mDrawerLayout.setDrawerListener(new DrawerListener() {
- @Override
- public void onDrawerStateChanged(int arg0) {
- toggleNavDrawer(getStateManager().getStateCount() == 1);
- }
-
- @Override
- public void onDrawerSlide(View arg0, float arg1) {
-
- }
-
- @Override
- public void onDrawerOpened(View arg0) {
-
- }
-
- @Override
- public void onDrawerClosed(View arg0) {
-
- }
- });
- mToolbar.setNavigationContentDescription("drawer");
- mToolbar.setNavigationOnClickListener(new OnClickListener() {
-
+ AHBottomNavigationItem item1 = new AHBottomNavigationItem(
+ R.string.timeline_title, R.drawable.ic_timeline, R.color.tab_1);
+ AHBottomNavigationItem item2 = new AHBottomNavigationItem(
+ R.string.albums_title, R.drawable.ic_album, R.color.tab_2);
+ AHBottomNavigationItem item3 = new AHBottomNavigationItem(
+ R.string.videos_title, R.drawable.ic_video, R.color.tab_3);
+
+ bottomNavigation.addItem(item1);
+ bottomNavigation.addItem(item2);
+ bottomNavigation.addItem(item3);
+ bottomNavigation.setBehaviorTranslationEnabled(true);
+ bottomNavigation.setForceTint(true);
+ bottomNavigation.setColored(true);
+
+ mGLParentLayout = (RelativeLayout) findViewById(R.id.gl_parent_layout);
+ params = (RelativeLayout.LayoutParams) mGLParentLayout.getLayoutParams();
+
+ bottomNavigation.setOnTabSelectedListener(
+ new AHBottomNavigation.OnTabSelectedListener() {
@Override
- public void onClick(View v) {
- if (mToolbar.getNavigationContentDescription().equals("drawer")) {
- mDrawerLayout.openDrawer(Gravity.START);
-
- } else {
- mToolbar.setNavigationContentDescription("drawer");
- mToolbar.setNavigationIcon(R.drawable.drawer);
- onBackPressed();
- }
+ public boolean onTabSelected(int position, boolean wasSelected) {
+ getGLRoot().lockRenderThread();
+ showScreen(position);
+ getGLRoot().unlockRenderThread();
+ return true;
}
});
- setToolbar(mToolbar);
}
- public void toggleNavDrawer(boolean setDrawerVisibility) {
- if (mDrawerLayout != null) {
- if (setDrawerVisibility && mDrawerLayoutSupported) {
- mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
- mToolbar.setNavigationIcon(R.drawable.drawer);
- } else {
- mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
- mToolbar.setNavigationIcon(null);
- }
+ public void toggleNavBar(boolean show) {
+ if (show) {
+ bottomNavigation.restoreBottomNavigation(true);
+ } else {
+ bottomNavigation.hideBottomNavigation(true);
}
+
+ // Convert dp to pixels
+ float dp = getApplicationContext().getResources().getDisplayMetrics().density;
+
+ params.setMargins(0, 0, 0, show ? Math.round(56 * dp) : 0);
}
public void showScreen(int position) {
@@ -254,75 +239,6 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
default:
break;
}
-
- mNavigationAdapter.setClickPosition(position);
-
- mDrawerListView.invalidateViews();
- mToolbar.setTitle(getResources().getStringArray(
- R.array.title_array_nav_items)[position]);
-
- mDrawerListView.setItemChecked(position, true);
- mDrawerListView.setSelection(position);
- mToolbar.setNavigationContentDescription("drawer");
- mToolbar.setNavigationIcon(R.drawable.drawer);
- }
-
- private class NavigationDrawerListAdapter extends BaseAdapter {
-
- private int curTab = 0;
- Context mContext;
-
- public NavigationDrawerListAdapter(Context context) {
- mContext = context;
-
- }
-
- @Override
- public int getCount() {
- return sActionItems.length;
- }
-
- @Override
- public Object getItem(int position) {
- return sActionItems[position];
- }
-
- @Override
- public long getItemId(int position) {
- return 0;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View view;
-
- if (convertView == null) {
- LayoutInflater inflater = (LayoutInflater) mContext
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- view = inflater.inflate(
- org.codeaurora.gallery.R.layout.drawer_list_item, null);
- } else {
- view = convertView;
- }
-
- TextView titleView = (TextView) view.findViewById(R.id.itemTitle);
- ImageView iconView = (ImageView) view.findViewById(R.id.ivItem);
-
- titleView.setText(sActionItems[position].title);
- iconView.setImageResource(sActionItems[position].icon);
-
- if (curTab == position) {
- view.setBackgroundResource(R.drawable.drawer_item_selected_bg);
- } else {
- view.setBackgroundColor(android.R.color.transparent);
- }
-
- return view;
- }
-
- public void setClickPosition(int position) {
- curTab = position;
- }
}
public static int getActionTitle(Context context, int type) {
@@ -341,6 +257,7 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
if (Intent.ACTION_GET_CONTENT.equalsIgnoreCase(action)) {
mDrawerLayoutSupported = false;
startGetContent(intent);
+ toggleNavBar(false);
} else if (Intent.ACTION_PICK.equalsIgnoreCase(action)) {
mDrawerLayoutSupported = false;
// We do NOT really support the PICK intent. Handle it as
@@ -353,6 +270,7 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
if (type.endsWith("/video")) intent.setType("video/*");
}
startGetContent(intent);
+ toggleNavBar(false);
} else if (Intent.ACTION_VIEW.equalsIgnoreCase(action)
|| ACTION_REVIEW.equalsIgnoreCase(action)){
mDrawerLayoutSupported = false;
@@ -368,12 +286,13 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
}
}
startViewAction(intent);
+ toggleNavBar(false);
} else {
mDrawerLayoutSupported = true;
startTimelinePage();
mToolbar.setTitle(R.string.albums_title);
}
- toggleNavDrawer(mDrawerLayoutSupported);
+ toggleNavBar(mDrawerLayoutSupported);
}
public void startAlbumPage() {
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 0fe96f99e..b4b3d9052 100755
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -1025,6 +1025,7 @@ public abstract class PhotoPage extends ActivityState implements
@Override
protected void onBackPressed() {
showBars();
+ ((GalleryActivity)mActivity).toggleNavBar(true);
if (mShowDetails) {
hideDetails();
} else if (mAppBridge == null || !switchWithCaptureAnimation(-1)) {
@@ -1043,10 +1044,7 @@ public abstract class PhotoPage extends ActivityState implements
mActionBar.setBackGroundDefault();
int count = mActivity.getStateManager().getStateCount();
if (mIsFromVideoScreen || count == 1 || mIsFromTimelineScreen) {
- mActivity.getToolbar().setNavigationContentDescription(
- "drawer");
- mActivity.getToolbar().setNavigationIcon(R.drawable.drawer);
- ((GalleryActivity)mActivity).toggleNavDrawer(true);
+ ((GalleryActivity)mActivity).toggleNavBar(true);
if (mModel instanceof PhotoDataAdapter) {
((PhotoDataAdapter) mModel).setDataListener(null);
}
@@ -1681,12 +1679,11 @@ public abstract class PhotoPage extends ActivityState implements
}
mActionBar.setDisplayOptions(
- ((mSecureAlbum == null) && (mSetPathString != null)), true);
+ (false && (mSetPathString != null)), true);
mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener);
refreshBottomControlsWhenReady();
if (((mSecureAlbum == null) && (mSetPathString != null))) {
- mActivity.getToolbar().setNavigationContentDescription("back");
- mActivity.getToolbar().setNavigationIcon(R.drawable.back);
+ ((GalleryActivity)mActivity).toggleNavBar(false);
}
// if (mShowSpinner && mPhotoView.getFilmMode()) {
// mActionBar.enableAlbumModeMenu(
diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java
index 97a4d5076..f1af8629c 100644
--- a/src/com/android/gallery3d/app/SlideshowPage.java
+++ b/src/com/android/gallery3d/app/SlideshowPage.java
@@ -113,6 +113,8 @@ public class SlideshowPage extends ActivityState {
@Override
public void onCreate(Bundle data, Bundle restoreState) {
super.onCreate(data, restoreState);
+ ((GalleryActivity) mActivity).toggleNavBar(false);
+
mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR | FLAG_SCREEN_FULL);
if (data.getBoolean(KEY_DREAM)) {
// Dream screensaver only keeps screen on for plugged devices.
@@ -173,6 +175,7 @@ public class SlideshowPage extends ActivityState {
@Override
public void onPause() {
super.onPause();
+ ((GalleryActivity) mActivity).toggleNavBar(true);
mIsActive = false;
mModel.pause();
mSlideshowView.release();
@@ -184,6 +187,7 @@ public class SlideshowPage extends ActivityState {
@Override
public void onResume() {
super.onResume();
+ ((GalleryActivity) mActivity).toggleNavBar(false);
mIsActive = true;
mModel.resume();
diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java
index d48bf3928..7810a1522 100755
--- a/src/com/android/gallery3d/app/TimeLinePage.java
+++ b/src/com/android/gallery3d/app/TimeLinePage.java
@@ -697,12 +697,12 @@ public class TimeLinePage extends ActivityState implements
case SelectionManager.ENTER_SELECTION_MODE: {
mActionModeHandler.startActionMode();
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
- ((GalleryActivity)mActivity).toggleNavDrawer(false);
+ ((GalleryActivity)mActivity).toggleNavBar(false);
break;
}
case SelectionManager.LEAVE_SELECTION_MODE: {
mActionModeHandler.finishActionMode();
- ((GalleryActivity)mActivity).toggleNavDrawer(true);
+ ((GalleryActivity)mActivity).toggleNavBar(true);
mRootPane.invalidate();
break;
}
diff --git a/src/org/codeaurora/gallery3d/video/VideoSettingsActivity.java b/src/org/codeaurora/gallery3d/video/VideoSettingsActivity.java
index c3e54ffc2..ad73765b6 100644
--- a/src/org/codeaurora/gallery3d/video/VideoSettingsActivity.java
+++ b/src/org/codeaurora/gallery3d/video/VideoSettingsActivity.java
@@ -49,7 +49,6 @@ public class VideoSettingsActivity extends ListActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
- actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(getResources().getString(R.string.settings));
setContentView(R.layout.setting_list);
ArrayList<HashMap<String, Object>> arrlist = new ArrayList<HashMap<String, Object>>(1);