summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-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
6 files changed, 66 insertions, 164 deletions
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;
}