侧拉
This commit is contained in:
@@ -3,7 +3,6 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.3"
|
||||
|
||||
defaultConfig {
|
||||
|
||||
@@ -27,7 +26,8 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'com.android.support:design:26.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
@@ -36,4 +36,11 @@ dependencies {
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||
//logger
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
//超帅侧拉ui
|
||||
implementation 'com.mxn.soul:flowingdrawer-core:2.0.0'
|
||||
implementation 'com.nineoldandroids:library:2.4.0'
|
||||
//图片形状库
|
||||
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
|
||||
//cardview
|
||||
compile 'com.android.support:cardview-v7:26.1.0'
|
||||
}
|
||||
|
||||
@@ -2,6 +2,22 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.ninefourone.nutritionmaster">
|
||||
|
||||
<!-- 允许联网 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 获取GSM(2g)、WCDMA(联通3g)等网络状态的信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- 获取wifi网络状态的信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<!-- 保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<!-- 获取sd卡写的权限,用于文件上传和下载 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- 允许读取手机状态 用于创建BmobInstallation -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
<!-- 相机权限 -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
android:name="com.example.ninefourone.nutritionmaster.NutritionMaster"
|
||||
android:allowBackup="true"
|
||||
@@ -10,7 +26,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<activity android:name=".modules.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.example.ninefourone.nutritionmaster;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.mxn.soul.flowingdrawer_core.ElasticDrawer;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.drawerlayout)
|
||||
FlowingDrawer mDrawer;
|
||||
@BindView(R.id.navigation_layout)
|
||||
LinearLayout navigationLayout;
|
||||
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
|
||||
mDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() {
|
||||
@Override
|
||||
public void onDrawerStateChange(int oldState, int newState) {
|
||||
if (newState == ElasticDrawer.STATE_CLOSED) {
|
||||
// Logger.i("Drawer STATE_CLOSED");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerSlide(float openRatio, int offsetPixels) {
|
||||
// Logger.i("openRatio=" + openRatio + " ,offsetPixels=" + offsetPixels);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initToolBar() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// TODO: add setContentView(...) invocation
|
||||
ButterKnife.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击事件
|
||||
*/
|
||||
@OnClick(R.id.navigation_layout)
|
||||
public void onViewClicked() {
|
||||
mDrawer.openMenu();
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-v24/ic_drawer_home.png
Normal file
BIN
app/src/main/res/drawable-v24/ic_drawer_home.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 B |
BIN
app/src/main/res/drawable/test_avatar.jpg
Normal file
BIN
app/src/main/res/drawable/test_avatar.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -1,18 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<com.mxn.soul.flowingdrawer_core.FlowingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.ninefourone.nutritionmaster.MainActivity">
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:edMenuBackground="@color/colorPrimary"
|
||||
app:edMenuSize="230dp"
|
||||
app:edPosition="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/colorPrimary"
|
||||
app:contentInsetStart="0dp"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/navigation_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<ImageView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_drawer_home" />
|
||||
|
||||
<com.github.siyamed.shapeimageview.CircularImageView
|
||||
android:id="@+id/toolbar_user_avatar"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="31dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:src="@drawable/test_avatar" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:maxLines="1"
|
||||
android:text="营养大师"
|
||||
android:textColor="#FFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<!--menu-->
|
||||
<com.mxn.soul.flowingdrawer_core.FlowingMenuLayout
|
||||
android:id="@+id/menulayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="sidjisd" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="hahahah" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.mxn.soul.flowingdrawer_core.FlowingMenuLayout>
|
||||
|
||||
</com.mxn.soul.flowingdrawer_core.FlowingDrawer>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
|
||||
<color name="colorPrimary">#FF03A9F4</color>
|
||||
<color name="colorPrimaryDark">#ff0171c9</color>
|
||||
<color name="colorAccent">#FF00E5FF</color>
|
||||
<color name="colorControlNormal">#FF78909C</color>
|
||||
<color name="colorControlActivated">#FF03A9F4</color>
|
||||
<color name="colorSwitchThumbNormal">#FF78909C</color>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
15
app/src/main/res/values/dimens.xml
Normal file
15
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="fab_size_normal">100dp</dimen>
|
||||
<dimen name="text_size">12sp</dimen>
|
||||
|
||||
<dimen name="drawer_width">240dp</dimen>
|
||||
<dimen name="drawer_text">20sp</dimen>
|
||||
<dimen name="title_text">16sp</dimen>
|
||||
|
||||
<dimen name="bt_height">36dp</dimen>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -1,7 +1,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
|
||||
Reference in New Issue
Block a user