Browse Source

Update Sample

zhpanvip 4 years ago
parent
commit
4186f5e4d1

+ 7 - 1
README.md

@@ -43,7 +43,7 @@
 |--|--|--|
 | ![MULTI_PAGE](https://github.com/zhpanvip/Resource/blob/master/image/banner/page_style_multi.gif) |![MULTI_PAGE](https://github.com/zhpanvip/Resource/blob/master/image/banner/page_style_multi_scale.gif) |![MULTI_PAGE](https://github.com/zhpanvip/Resource/blob/master/image/banner/page_style_multi_overlay.gif) |
 
-### 2.[Indicator](https://github.com/zhpanvip/viewpagerindicator)
+### [2.Indicator](https://github.com/zhpanvip/viewpagerindicator)
 
 The Indicator library was split from BannerViewPager,the new repo is [ViewPagerIndicator](https://github.com/zhpanvip/viewpagerindicator),Click the link to see more information about [ViewPagerIndicator](https://github.com/zhpanvip/viewpagerindicator)
 
@@ -223,6 +223,12 @@ implementation 'com.github.zhpanvip:BannerViewPager:latestVersion'
         }
     }
 ```
+**If you need get position with getAdapterPosition() method,you can do like the following code to get real position:**
+
+```
+     int adapterPosition = getAdapterPosition();
+     int realPosition = BannerUtils.getRealPosition(isCanLoop, adapterPosition, mList.size());
+```
 ### 5.Extends BaseBannerAdapter,and override methods
 
 ```

+ 8 - 0
README_CN.md

@@ -220,6 +220,14 @@ implementation 'com.github.zhpanvip:BannerViewPager:latestVersion'
         }
     }
 ```
+
+**如果你需要通过getAdapterPosition()方法获取position,可参考如下代码:**
+
+```
+     int adapterPosition = getAdapterPosition();
+     int realPosition = BannerUtils.getRealPosition(isCanLoop, adapterPosition, mList.size());
+```
+
 ### 5.继承BaseBannerAdapter,并重写相关方法
 
 ```

+ 4 - 1
app/build.gradle

@@ -6,7 +6,7 @@ android {
     buildToolsVersion '28.0.3'
     defaultConfig {
         applicationId "com.example.zhpan.bannerviewpager"
-        minSdkVersion 19
+        minSdkVersion 21
         targetSdkVersion 28
         versionCode 1
         versionName "1.0"
@@ -59,4 +59,7 @@ dependencies {
     implementation 'androidx.cardview:cardview:1.0.0'
     implementation 'androidx.viewpager2:viewpager2:1.0.0'
     implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.2'
+    implementation 'com.google.android.material:material:1.1.0'
+    implementation "androidx.navigation:navigation-fragment:2.2.2"
+    implementation "androidx.navigation:navigation-ui:2.2.2"
 }

BIN
app/release/app-release.apk


+ 2 - 0
app/src/main/AndroidManifest.xml

@@ -12,6 +12,7 @@
         android:label="@string/app_name"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
+        <activity android:name=".activity.BaseCompatActivity"></activity>
         <activity
             android:name=".activity.WelcomeActivity"
             android:theme="@style/FullScreenTheme">
@@ -26,6 +27,7 @@
             android:name=".activity.PhotoViewActivity"
             android:theme="@style/FullScreenTheme" />
         <activity android:name=".activity.MainActivity" />
+        <activity android:name=".activity.WebViewActivity" />
     </application>
 
 </manifest>

+ 61 - 0
app/src/main/java/com/example/zhpan/circleviewpager/activity/BaseCompatActivity.java

@@ -0,0 +1,61 @@
+package com.example.zhpan.circleviewpager.activity;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+
+import com.example.zhpan.circleviewpager.R;
+import com.scwang.smartrefresh.header.MaterialHeader;
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
+
+public class BaseCompatActivity extends AppCompatActivity implements OnRefreshListener {
+    protected SmartRefreshLayout mRefreshLayout;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    // 设置下拉刷新
+    protected void setRefreshLayout(boolean isAutoRefresh) {
+        mRefreshLayout = findViewById(R.id.swipe_refresh_layout);
+        if (mRefreshLayout == null) return;
+        if (needRefreshHeader())
+            mRefreshLayout.setRefreshHeader(getRefreshHeader());
+        mRefreshLayout.setEnableLoadMore(needLoadMore());
+        if (isAutoRefresh) {
+            mRefreshLayout.post(new Runnable() {
+                @Override
+                public void run() {
+                    mRefreshLayout.autoRefresh();
+                }
+            });
+        }
+        mRefreshLayout.setOnRefreshListener(this);
+    }
+
+    //  是否需要上拉加载
+    protected boolean needLoadMore() {
+        return false;
+    }
+
+    //  是否需要添加刷新头部,如不需要可在子类中添加刷新头
+    protected boolean needRefreshHeader() {
+        return true;
+    }
+
+    //  获取刷新头
+    protected MaterialHeader getRefreshHeader() {
+        MaterialHeader materialHeader = new MaterialHeader(this);
+        materialHeader.setColorSchemeResources(R.color.red);
+        return materialHeader;
+    }
+
+    @Override
+    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+
+    }
+}

+ 37 - 3
app/src/main/java/com/example/zhpan/circleviewpager/activity/MainActivity.kt

@@ -3,13 +3,12 @@ package com.example.zhpan.circleviewpager.activity
 import android.content.Context
 import android.content.Intent
 import android.os.Bundle
-
+import androidx.appcompat.app.ActionBarDrawerToggle
 import androidx.appcompat.app.AppCompatActivity
 import androidx.viewpager2.widget.ViewPager2
-
 import com.example.zhpan.circleviewpager.R
 import com.example.zhpan.circleviewpager.adapter.AdapterFragmentPager
-
+import com.google.android.material.navigation.NavigationView
 import kotlinx.android.synthetic.main.activity_main.*
 
 
@@ -18,10 +17,31 @@ class MainActivity : AppCompatActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
+        initView()
         initData()
         setListener()
     }
 
+    private fun initView() {
+        toolbar.apply {
+            title = getString(R.string.app_name)
+            setSupportActionBar(toolbar)
+        }
+        drawerLayout.apply {
+            val toggle = ActionBarDrawerToggle(
+                    this@MainActivity,
+                    this,
+                    toolbar
+                    , R.string.navigation_drawer_open,
+                    R.string.navigation_drawer_close)
+            addDrawerListener(toggle)
+            toggle.syncState()
+        }
+        nav_view.apply {
+            setNavigationItemSelectedListener(onDrawerNavigationItemSelectedListener)
+        }
+    }
+
     private fun initData() {
         with(vp_fragment) {
             adapter = AdapterFragmentPager(this@MainActivity)
@@ -61,4 +81,18 @@ class MainActivity : AppCompatActivity() {
             context.startActivity(Intent(context, MainActivity::class.java))
         }
     }
+
+    private val onDrawerNavigationItemSelectedListener =
+            NavigationView.OnNavigationItemSelectedListener { item ->
+                when (item.itemId) {
+                    R.id.nav_banner -> {
+                        WebViewActivity.start(this@MainActivity, getString(R.string.app_name), "https://github.com/zhpanvip/BannerViewPager")
+                    }
+
+                    R.id.nav_indicator -> {
+                        WebViewActivity.start(this@MainActivity, getString(R.string.indicator_name), "https://github.com/zhpanvip/ViewPagerIndicator")
+                    }
+                }
+                true
+            }
 }

+ 150 - 0
app/src/main/java/com/example/zhpan/circleviewpager/activity/WebViewActivity.java

@@ -0,0 +1,150 @@
+package com.example.zhpan.circleviewpager.activity;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.Toolbar;
+
+import com.example.zhpan.circleviewpager.R;
+import com.scwang.smartrefresh.header.MaterialHeader;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+
+/**
+ * Created by zhpan on 2017/4/16.
+ * Describe: 通用 WebView 考虑以后所有展示 WebView 的界面都从这个类继承
+ */
+@SuppressLint("SetJavaScriptEnabled")
+public class WebViewActivity extends BaseCompatActivity {
+
+    protected static final String INTENT_KEY_TITLE = "title";
+    public static final String INTENT_KEY_URL = "url";
+    protected WebView mWebView;
+    private String mTitle;
+    private String mUrl;
+    private Toolbar mToolbar;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_webview);
+        initView();
+        initData();
+        initWebView();
+    }
+
+    private void initView() {
+        mToolbar = findViewById(R.id.toolbar);
+        mWebView = findViewById(R.id.webView);
+        mRefreshLayout = findViewById(R.id.swipe_refresh_layout);
+        MaterialHeader materialHeader = findViewById(R.id.material_header);
+        materialHeader.setColorSchemeColors(getResources().getColor(R.color.colorAccent));
+    }
+
+    private void initData() {
+        Intent intent = getIntent();
+        if (intent != null) {
+            mTitle = intent.getStringExtra(INTENT_KEY_TITLE);
+            mUrl = intent.getStringExtra(INTENT_KEY_URL);
+        }
+        mToolbar.setNavigationOnClickListener(v -> onBackPressed());
+        mToolbar.setTitle(mTitle);
+        setRefreshLayout(true);
+    }
+
+
+    @Override
+    protected boolean needRefreshHeader() {
+        return false;
+    }
+
+    @Override
+    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+        super.onRefresh(refreshLayout);
+        mWebView.clearHistory();
+        mWebView.reload();
+    }
+
+    private void initWebView() {
+        mWebView.setWebViewClient(new WebViewClient() {
+            @Override
+            public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) {
+                return false;
+            }
+        });
+        // mWebView.setBackgroundColor(getResources().getColor(R.color.background));
+        WebSettings setting = mWebView.getSettings();
+        setting.setJavaScriptEnabled(true);
+        setting.setDisplayZoomControls(false);
+        setting.setSupportZoom(false);
+        setting.setBuiltInZoomControls(false);
+//        setting.setSavePassword(false); // 安全要求
+
+        if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
+            WebView.setWebContentsDebuggingEnabled(true);
+        }
+        mWebView.setWebViewClient(new WebViewClient() {
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView view, String url) {
+                view.loadUrl(url);
+                return true;
+            }
+
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                super.onPageFinished(view, url);
+                mRefreshLayout.finishRefresh();
+            }
+        });
+        mWebView.loadUrl(mUrl);
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (mWebView != null) {
+            mWebView.destroy();
+        }
+        mWebView = null;
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        //判断是否可以返回操作
+        if (mWebView.canGoBack()) {
+            mWebView.goBack();
+            return true;
+        } else {
+            finish();
+            return true;
+        }
+    }
+
+    public static void start(@NonNull Context context, @NonNull String title, @NonNull String url) {
+        Intent intent = new Intent(context, WebViewActivity.class);
+        intent.putExtra(INTENT_KEY_TITLE, title);
+        intent.putExtra(INTENT_KEY_URL, url);
+        context.startActivity(intent);
+    }
+
+    public static void start(@NonNull Context context, @NonNull String url) {
+        Intent intent = new Intent(context, WebViewActivity.class);
+        intent.putExtra(INTENT_KEY_TITLE, "");
+        intent.putExtra(INTENT_KEY_URL, url);
+        context.startActivity(intent);
+    }
+
+    public static void start(@NonNull Context context, Class<? extends WebViewActivity> baseActivity, @NonNull String url) {
+        Intent intent = new Intent(context, baseActivity);
+        intent.putExtra(INTENT_KEY_TITLE, "");
+        intent.putExtra(INTENT_KEY_URL, url);
+        context.startActivity(intent);
+    }
+}

+ 11 - 0
app/src/main/res/drawable-anydpi/ic_back.xml

@@ -0,0 +1,11 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="#FFFFFF"
+    android:alpha="0.8">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
+</vector>

BIN
app/src/main/res/drawable-hdpi/ic_back.png


BIN
app/src/main/res/drawable-mdpi/ic_back.png


BIN
app/src/main/res/drawable-xhdpi/ic_back.png


BIN
app/src/main/res/drawable-xxhdpi/ic_back.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_banner.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_email.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_indicator.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_qq_group.png


+ 128 - 74
app/src/main/res/layout/activity_main.xml

@@ -1,94 +1,148 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+
+<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/drawerLayout"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:fitsSystemWindows="true">
 
     <RelativeLayout
+
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <RadioGroup
-            android:id="@+id/rg_tab"
+        <com.google.android.material.appbar.AppBarLayout
+            android:id="@+id/app_bar_layout"
             android:layout_width="match_parent"
-            android:layout_height="@dimen/dp_55"
-            android:layout_alignParentBottom="true"
-            android:layout_centerInParent="true"
-            android:background="@color/white"
-            android:padding="@dimen/dp_5"
-            android:orientation="horizontal">
-
-            <RadioButton
-                android:id="@+id/rb_home"
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_gravity="bottom"
-                android:layout_weight="1"
-                android:button="@null"
-                android:checked="true"
-                android:drawableTop="@drawable/tab1_selector"
-                android:gravity="center_horizontal|bottom"
-                android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab1"
-                android:textColor="@drawable/text_color_selector" />
-
-            <RadioButton
-                android:id="@+id/rb_add"
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_gravity="bottom"
-                android:layout_weight="1"
-                android:button="@null"
-                android:drawableTop="@drawable/tab3_selector"
-                android:gravity="center_horizontal|bottom"
-                android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab2"
-                android:textColor="@drawable/text_color_selector" />
-
-            <RadioButton
-                android:id="@+id/rb_find"
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_gravity="bottom"
-                android:layout_weight="1"
-                android:button="@null"
-                android:drawableTop="@drawable/tab2_selector"
-                android:gravity="center_horizontal|bottom"
-                android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab3"
-                android:textColor="@drawable/text_color_selector" />
-
-            <RadioButton
-                android:id="@+id/rb_others"
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_gravity="bottom"
-                android:layout_weight="1"
-                android:button="@null"
-                android:drawableTop="@drawable/tab4_selector"
-                android:gravity="center_horizontal|bottom"
-                android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab4"
-                android:textColor="@drawable/text_color_selector" />
+            android:layout_height="wrap_content"
+            android:fitsSystemWindows="true"
+            android:theme="@style/AppTheme.AppBarOverlay"
+            app:elevation="0dp">
+
+            <androidx.appcompat.widget.Toolbar
+                android:id="@+id/toolbar"
+                android:layout_width="match_parent"
+                android:layout_height="?attr/actionBarSize"
+                app:layout_scrollFlags="scroll|enterAlways"
+                app:popupTheme="@style/AppTheme.PopupOverlay">
 
+                <TextView
+                    android:id="@+id/tv_title"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:ellipsize="marquee"
+                    android:singleLine="true"
+                    android:text="@string/app_name"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/sp_18" />
 
-        </RadioGroup>
+            </androidx.appcompat.widget.Toolbar>
+        </com.google.android.material.appbar.AppBarLayout>
 
-        <androidx.viewpager2.widget.ViewPager2
-            android:id="@+id/vp_fragment"
+        <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_above="@id/rg_tab" />
-        <View
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/dp_0_5"
-            android:background="@color/line_color"
-            android:layout_below="@id/vp_fragment"/>
+            android:layout_below="@id/app_bar_layout">
+
+            <RadioGroup
+                android:id="@+id/rg_tab"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/dp_55"
+                android:layout_alignParentBottom="true"
+                android:layout_centerInParent="true"
+                android:background="@color/white"
+                android:orientation="horizontal"
+                android:padding="@dimen/dp_5">
+
+                <RadioButton
+                    android:id="@+id/rb_home"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_gravity="bottom"
+                    android:layout_weight="1"
+                    android:button="@null"
+                    android:checked="true"
+                    android:drawableTop="@drawable/tab1_selector"
+                    android:gravity="center_horizontal|bottom"
+                    android:paddingBottom="@dimen/dp_5"
+                    android:text="@string/tab1"
+                    android:textColor="@drawable/text_color_selector" />
+
+                <RadioButton
+                    android:id="@+id/rb_add"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_gravity="bottom"
+                    android:layout_weight="1"
+                    android:button="@null"
+                    android:drawableTop="@drawable/tab3_selector"
+                    android:gravity="center_horizontal|bottom"
+                    android:paddingBottom="@dimen/dp_5"
+                    android:text="@string/tab2"
+                    android:textColor="@drawable/text_color_selector" />
+
+                <RadioButton
+                    android:id="@+id/rb_find"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_gravity="bottom"
+                    android:layout_weight="1"
+                    android:button="@null"
+                    android:drawableTop="@drawable/tab2_selector"
+                    android:gravity="center_horizontal|bottom"
+                    android:paddingBottom="@dimen/dp_5"
+                    android:text="@string/tab3"
+                    android:textColor="@drawable/text_color_selector" />
+
+                <RadioButton
+                    android:id="@+id/rb_others"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_gravity="bottom"
+                    android:layout_weight="1"
+                    android:button="@null"
+                    android:drawableTop="@drawable/tab4_selector"
+                    android:gravity="center_horizontal|bottom"
+                    android:paddingBottom="@dimen/dp_5"
+                    android:text="@string/tab4"
+                    android:textColor="@drawable/text_color_selector" />
+
+
+            </RadioGroup>
+
+            <androidx.viewpager2.widget.ViewPager2
+                android:id="@+id/vp_fragment"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_above="@id/rg_tab" />
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/dp_0_5"
+                android:layout_below="@id/vp_fragment"
+                android:background="@color/line_color" />
+
+        </RelativeLayout>
+
 
     </RelativeLayout>
-    <!--<ImageView
+
+
+    <com.google.android.material.navigation.NavigationView
+        android:id="@+id/nav_view"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="start"
+        android:fitsSystemWindows="true"
+        app:headerLayout="@layout/nav_header_main"
+        app:itemTextColor="#19191B"
+        app:menu="@menu/nav_menu" />
+
+
+</androidx.drawerlayout.widget.DrawerLayout><!--<ImageView
         android:id="@+id/iv_add"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@drawable/add_bg"/>-->
-</FrameLayout>
 

+ 42 - 0
app/src/main/res/layout/activity_webview.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fitsSystemWindows="true"
+    android:orientation="vertical">
+
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="?attr/actionBarSize"
+        android:background="@color/colorPrimary"
+        android:fitsSystemWindows="true"
+        app:navigationIcon="@drawable/ic_back"
+        app:titleTextColor="@color/white" />
+
+
+    <com.scwang.smartrefresh.layout.SmartRefreshLayout
+        android:id="@+id/swipe_refresh_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        app:srlAccentColor="@android:color/white"
+        app:srlEnableHeaderTranslationContent="false"
+        app:srlEnablePreviewInEditMode="false"
+        app:srlPrimaryColor="@color/colorPrimary">
+
+        <com.scwang.smartrefresh.header.MaterialHeader
+            android:id="@+id/material_header"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_45" />
+
+        <WebView
+            android:id="@+id/webView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:clipToPadding="false"
+            android:paddingTop="?attr/actionBarSize" />
+
+    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
+</LinearLayout>

+ 41 - 0
app/src/main/res/layout/nav_header_main.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/nav_view_header"
+    android:layout_width="match_parent"
+    android:layout_height="@dimen/dp_220"
+    android:background="?attr/colorPrimary"
+    android:clickable="true"
+    android:focusable="true"
+    android:foreground="?attr/selectableItemBackground"
+    android:gravity="bottom"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/dp_40"
+    android:theme="@style/ThemeOverlay.AppCompat.Dark">
+
+
+    <ImageView
+        android:layout_width="@dimen/dp_70"
+        android:layout_height="@dimen/dp_70"
+        android:layout_gravity="center_horizontal"
+        android:src="@mipmap/ic_launcher" />
+
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="@dimen/dp_8"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tv_user_id"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/app_name"
+            android:textSize="@dimen/sp_16" />
+
+    </LinearLayout>
+
+
+</LinearLayout>

+ 30 - 0
app/src/main/res/menu/nav_menu.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <group android:id="@+id/other">
+
+        <item
+            android:id="@+id/nav_banner"
+            android:icon="@drawable/ic_banner"
+            android:title="@string/app_name"
+            app:actionViewClass="android.widget.TextView" />
+
+        <item
+            android:id="@+id/nav_indicator"
+            android:icon="@drawable/ic_indicator"
+            android:title="@string/indicator_name" />
+
+        <item
+            android:id="@+id/nav_qq_group"
+            android:icon="@drawable/ic_qq_group"
+            android:title="@string/qq_group" />
+
+        <item
+            android:id="@+id/nav_email"
+            android:icon="@drawable/ic_email"
+            android:title="@string/email" />
+
+    </group>
+
+</menu>

+ 2 - 2
app/src/main/res/values/colors.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <color name="colorPrimary">#008577</color>
-    <color name="colorPrimaryDark">#00574B</color>
+    <color name="colorPrimary">#5187f4</color>
+    <color name="colorPrimaryDark">#5187f4</color>
     <color name="colorAccent">#D81B60</color>
 
     <color name="red">#FF5252</color>

+ 7 - 0
app/src/main/res/values/strings.xml

@@ -1,5 +1,7 @@
 <resources>
     <string name="app_name">BannerViewPager</string>
+    <string name="navigation_drawer_open">Open navigation drawer</string>
+    <string name="navigation_drawer_close">Close navigation drawer</string>
     <string name="wrapper_photo_view">With PhotoView</string>
     <string name="start_now">Start Now</string>
     <string name="guide">guide</string>
@@ -14,4 +16,9 @@
     <string name="text_indicator_style">Indicator Style:</string>
     <string name="custom_style">Custom Style</string>
     <string name="text_slide_mode">Indicator Slide Mode</string>
+    <string name="pager_indicator">About ViewPagerIndicator</string>
+    <string name="qq_group">60902509</string>
+    <string name="about_banner">About BannerViewPager</string>
+    <string name="indicator_name">ViewPagerIndicator</string>
+    <string name="email">zhpanvip@outlook.com</string>
 </resources>

+ 3 - 3
app/src/main/res/values/styles.xml

@@ -1,16 +1,16 @@
 <resources>
 
     <!-- Base application theme. -->
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
         <item name="colorAccent">@color/colorAccent</item>
     </style>
-
     <style name="FullScreenTheme" parent="Theme.AppCompat.NoActionBar">
         <item name="android:windowNoTitle">true</item>
         <item name="android:windowFullscreen">true</item>
     </style>
-
+    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
 </resources>