Add left drawer
This commit is contained in:
1 parent
7b21001af0
commit
8572665ce3
36 files changed
+1120
-129
No files matched your search
@@ -18,6 +18,7 @@ package com.hippo.ehviewer.ui;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
@@ -27,9 +28,11 @@ import com.hippo.content.VectorContext;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.ui.scene.GalleryListScene;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.widget.DrawerLeftPanel;
|
||||
import com.hippo.ehviewer.widget.StatusBarLayout;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.scene.StageLayout;
|
||||
import com.hippo.widget.DrawerListView;
|
||||
|
||||
public class ContentActivity extends StageActivity
|
||||
implements StatusBarLayout.OnGetFitPaddingBottomListener {
|
||||
@@ -39,6 +42,8 @@ public class ContentActivity extends StageActivity
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private StatusBarLayout mStatusBarLayout;
|
||||
private StageLayout mContentLayout;
|
||||
private DrawerLeftPanel mDrawerLeftPanel;
|
||||
private DrawerListView mDrawerListView;
|
||||
|
||||
@Override
|
||||
protected boolean isShowStats() {
|
||||
@@ -53,13 +58,36 @@ public class ContentActivity extends StageActivity
|
||||
mResources = getResources();
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mStatusBarLayout = (StatusBarLayout) mDrawerLayout.findViewById(R.id.status_bar_layout);
|
||||
mStatusBarLayout = (StatusBarLayout) mDrawerLayout.getChildAt(0);
|
||||
mContentLayout = (StageLayout) mStatusBarLayout.findViewById(R.id.stage);
|
||||
mDrawerLeftPanel = (DrawerLeftPanel) mDrawerLayout.getChildAt(1);
|
||||
mDrawerListView = mDrawerLeftPanel.getDrawerListView();
|
||||
|
||||
mStatusBarLayout.setOnGetFitPaddingBottomListener(this);
|
||||
|
||||
// Drawer
|
||||
Drawable[] drawerListDrawables = new Drawable[] {
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_home),
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_fire),
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_history),
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_heart),
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_download),
|
||||
mResources.getDrawable(R.drawable.ic_drawer_list_settings)
|
||||
};
|
||||
CharSequence[] drawerListStrings = new CharSequence[] {
|
||||
mResources.getString(R.string.homepage),
|
||||
mResources.getString(R.string.whatshot),
|
||||
mResources.getString(R.string.history),
|
||||
mResources.getString(R.string.favorite),
|
||||
mResources.getString(R.string.download),
|
||||
mResources.getString(R.string.settings)
|
||||
};
|
||||
mDrawerListView.setData(drawerListDrawables, drawerListStrings);
|
||||
|
||||
// First time
|
||||
if (savedInstanceState == null) {
|
||||
startScene(GalleryListScene.class, null);
|
||||
mDrawerListView.setActivatedPosition(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user