Merge branch 'develop' into zhaolizhi
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 26
|
||||
|
||||
defaultConfig {
|
||||
|
||||
applicationId "com.example.ninefourone.nutritionmaster"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
@@ -10,19 +13,38 @@ android {
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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'
|
||||
//butterknife
|
||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||
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'
|
||||
//tablayout
|
||||
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.0.0@aar'
|
||||
//viewpager transforms
|
||||
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
|
||||
}
|
||||
|
||||
@@ -2,14 +2,31 @@
|
||||
<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"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
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,34 @@
|
||||
package com.example.ninefourone.nutritionmaster;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class NutritionMaster extends Application {
|
||||
public static NutritionMaster mInstance;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mInstance = this;
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化所有基础的东西
|
||||
*/
|
||||
private void init() {
|
||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||
Logger.d("Logger初始化成功");
|
||||
}
|
||||
|
||||
public static NutritionMaster getInstance() {
|
||||
return mInstance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page1.Page1;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page2.BodyInformationFragment;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page3.Page3;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Wangtianrui on 2018/5/1.
|
||||
*/
|
||||
|
||||
public class HomePagerAdapter extends FragmentPagerAdapter {
|
||||
private final String[] TITLES;
|
||||
private Fragment[] fragments;
|
||||
|
||||
public HomePagerAdapter(FragmentManager fm, Context context) {
|
||||
super(fm);
|
||||
TITLES = context.getResources().getStringArray(R.array.sections);
|
||||
fragments = new Fragment[TITLES.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
if (fragments[position] == null) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
fragments[position] = Page1.getInstance();
|
||||
break;
|
||||
case 1:
|
||||
fragments[position] = BodyInformationFragment.getInstance();
|
||||
break;
|
||||
case 2:
|
||||
fragments[position] = Page3.getInstance();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return fragments[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return TITLES.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return TITLES[position];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.example.ninefourone.nutritionmaster.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
private Unbinder unbinder;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getLayoutId());
|
||||
unbinder = ButterKnife.bind(this);
|
||||
initViews(savedInstanceState);
|
||||
initToolBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局layout
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract int getLayoutId();
|
||||
|
||||
/**
|
||||
* 初始化views
|
||||
*
|
||||
* @param savedInstanceState
|
||||
*/
|
||||
public abstract void initViews(Bundle savedInstanceState);
|
||||
|
||||
/**
|
||||
* 初始化toolbar
|
||||
*/
|
||||
public abstract void initToolBar();
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
*/
|
||||
public void loadData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示进度条
|
||||
*/
|
||||
public void showProgressBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏进度条
|
||||
*/
|
||||
public void hideProgressBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化recyclerView
|
||||
*/
|
||||
public void initRecyclerView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化refreshLayout
|
||||
*/
|
||||
public void initRefreshLayout() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据显示
|
||||
*/
|
||||
public void finishTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
unbinder.unbind();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.example.ninefourone.nutritionmaster.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public abstract class BaseFragment extends Fragment {
|
||||
private View parentView;
|
||||
private FragmentActivity activity;
|
||||
protected boolean isPrepared;
|
||||
protected boolean isVisible;
|
||||
private Unbinder unbinder;
|
||||
|
||||
public abstract
|
||||
@LayoutRes
|
||||
int getLayoutResId();
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
|
||||
parentView = inflater.inflate(getLayoutResId(), container, false);
|
||||
activity = getSupportActivity();
|
||||
return parentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
initView(savedInstanceState);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化自己的ui
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
public abstract void initView(Bundle state);
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
|
||||
public FragmentActivity getSupportActivity() {
|
||||
return super.getActivity();
|
||||
}
|
||||
|
||||
|
||||
public android.app.ActionBar getSupportActionBar() {
|
||||
return getSupportActivity().getActionBar();
|
||||
}
|
||||
|
||||
|
||||
public Context getApplicationContext() {
|
||||
return this.activity == null ? (getActivity() == null ?
|
||||
null : getActivity().getApplicationContext()) : this.activity.getApplicationContext();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fragment数据的懒加载
|
||||
*/
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (getUserVisibleHint()) {
|
||||
isVisible = true;
|
||||
onVisible();
|
||||
} else {
|
||||
isVisible = false;
|
||||
onInvisible();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fragment显示时才加载数据
|
||||
*/
|
||||
protected void onVisible() {
|
||||
lazyLoad();
|
||||
}
|
||||
|
||||
/**
|
||||
* fragment懒加载方法
|
||||
*/
|
||||
protected void lazyLoad() {
|
||||
}
|
||||
|
||||
/**
|
||||
* fragment隐藏
|
||||
*/
|
||||
protected void onInvisible() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
*/
|
||||
protected void loadData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示进度条
|
||||
*/
|
||||
protected void showProgressBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏进度条
|
||||
*/
|
||||
protected void hideProgressBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化recyclerView
|
||||
*/
|
||||
protected void initRecyclerView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化refreshLayout
|
||||
*/
|
||||
protected void initRefreshLayout() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据显示
|
||||
*/
|
||||
protected void finishTask() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
import com.ToxicBakery.viewpager.transforms.AccordionTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.CubeInTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.CubeOutTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.DepthPageTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.FlipHorizontalTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.FlipVerticalTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.RotateUpTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.StackTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.TabletTransformer;
|
||||
import com.ToxicBakery.viewpager.transforms.ZoomInTransformer;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.HomePagerAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.ui.NoScrollViewPager;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
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;
|
||||
@BindView(R.id.view_pager)
|
||||
NoScrollViewPager viewPager;
|
||||
@BindView(R.id.sliding_tab_layout)
|
||||
SlidingTabLayout slidingTabLayout;
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
});
|
||||
initViewPager();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化ViewPager
|
||||
*/
|
||||
private void initViewPager() {
|
||||
HomePagerAdapter homePagerAdapter = new HomePagerAdapter(getSupportFragmentManager(), this);
|
||||
viewPager.setOffscreenPageLimit(3);
|
||||
viewPager.setAdapter(homePagerAdapter);
|
||||
//CubeInTransformer 内旋
|
||||
//FlipHorizontalTransformer 像翻书一样
|
||||
//AccordionTransformer 风琴 拉压
|
||||
viewPager.setPageTransformer(true, new CubeOutTransformer());
|
||||
slidingTabLayout.setViewPager(viewPager);
|
||||
viewPager.setCurrentItem(1);
|
||||
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page1;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseFragment;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class Page1 extends BaseFragment {
|
||||
@Override
|
||||
public int getLayoutResId() {
|
||||
return R.layout.page_1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Bundle state) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static BaseFragment getInstance() {
|
||||
return new Page1();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page2;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseFragment;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class BodyInformationFragment extends BaseFragment {
|
||||
@Override
|
||||
public int getLayoutResId() {
|
||||
return R.layout.page_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Bundle state) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static BaseFragment getInstance() {
|
||||
return new BodyInformationFragment();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.page3;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseFragment;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class Page3 extends BaseFragment {
|
||||
@Override
|
||||
public int getLayoutResId() {
|
||||
return R.layout.page_3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Bundle state) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static BaseFragment getInstance() {
|
||||
return new Page3();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.example.ninefourone.nutritionmaster.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* Created by Wangtianrui on 2018/5/1.
|
||||
* 重写Viewpager解决点击tab去除滑动动画效果的问题
|
||||
*/
|
||||
public class NoScrollViewPager extends ViewPager {
|
||||
public NoScrollViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoScrollViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollTo(int x, int y) {
|
||||
super.scrollTo(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentItem(int item, boolean smoothScroll) {
|
||||
super.setCurrentItem(item, smoothScroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentItem(int item) {
|
||||
super.setCurrentItem(item, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class ConstantUtils {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
*/
|
||||
|
||||
public class MessageUtils {
|
||||
|
||||
public static void MakeToast(String message) {
|
||||
Toast.makeText(NutritionMaster.getInstance(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
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: 51 KiB |
@@ -1,18 +1,118 @@
|
||||
<?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>
|
||||
|
||||
<com.flyco.tablayout.SlidingTabLayout
|
||||
android:id="@+id/sliding_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
app:tl_indicator_corner_radius="1dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="40dp"
|
||||
app:tl_tab_space_equal="true">
|
||||
|
||||
</com.flyco.tablayout.SlidingTabLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<com.example.ninefourone.nutritionmaster.ui.NoScrollViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</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>
|
||||
|
||||
12
app/src/main/res/layout/page_1.xml
Normal file
12
app/src/main/res/layout/page_1.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/cardview_dark_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="page1" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
12
app/src/main/res/layout/page_2.xml
Normal file
12
app/src/main/res/layout/page_2.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimaryDark">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="page2" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
11
app/src/main/res/layout/page_3.xml
Normal file
11
app/src/main/res/layout/page_3.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorControlNormal">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="page3" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
8
app/src/main/res/values/arrays.xml
Normal file
8
app/src/main/res/values/arrays.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="sections">
|
||||
<item>page1</item>
|
||||
<item>page2</item>
|
||||
<item>page3</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -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>
|
||||
|
||||
@@ -5,14 +5,16 @@ buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
|
||||
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -20,8 +22,6 @@ allprojects {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user