├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── lwp
│ │ └── design
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── example
│ │ └── lwp
│ │ └── design
│ │ ├── BehaviorActivity.java
│ │ ├── MainActivity.java
│ │ ├── ProductDetailActivity.java
│ │ ├── adapter
│ │ └── FragmentRecyclerAdapter.java
│ │ ├── bean
│ │ ├── User.java
│ │ └── UserBuilder.java
│ │ ├── behavior
│ │ ├── JianShuBehavior.java
│ │ ├── QqBehavior.java
│ │ └── ZhiHuBehavior.java
│ │ ├── fragment
│ │ ├── FragmentOne.java
│ │ ├── FragmentThree.java
│ │ └── FragmentTwo.java
│ │ └── ui
│ │ └── masonry
│ │ ├── MasonryAdapter.java
│ │ ├── Product.java
│ │ ├── RecycleItemClickListener.java
│ │ └── SpacesItemDecoration.java
│ └── res
│ ├── layout
│ ├── detail_activity.xml
│ ├── detail_fragment_item.xml
│ ├── detail_fragment_one.xml
│ ├── detail_fragment_three.xml
│ ├── detail_fragment_two.xml
│ ├── home_activity.xml
│ ├── home_masonry_item.xml
│ ├── jianshu_behavior_activity.xml
│ ├── nav_header.xml
│ ├── widget_footer_behavior_2.xml
│ └── zhihu_behavior_activity.xml
│ ├── menu
│ ├── home_tb_menu.xml
│ └── menu_drawer.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ ├── ic_favorite.png
│ ├── ic_launcher.png
│ ├── ic_message.png
│ └── ic_photo_camera_white.png
│ ├── mipmap-xxhdpi
│ ├── header.png
│ ├── ic_add_white.png
│ ├── ic_arrow_back_white.png
│ ├── ic_launcher.png
│ ├── ic_photo_camera_white.png
│ ├── lvye.png
│ ├── p1.png
│ ├── p2.png
│ ├── p3.png
│ ├── p4.png
│ ├── p5.png
│ └── p6.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── images
├── anim.png
├── floatActionBtn.png
├── jianshu.gif
├── nav.png
├── recycleView.png
├── tab.png
└── zhihu.gif
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | *.iml
8 | .idea
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MaterialDesignLearn
2 | 主要是学习design lib里面的控件使用
3 |
4 | ##NavigationView
5 | 
6 | ##RecyclerView实现瀑布流
7 | 
8 | ##CoordinatorLayout结合ToolBar显示隐藏 类似淘宝商品详情
9 | ###里面还可以看到TabLayout使用,结合了ViewPager
10 | 
11 | ##FloatActionButton点击实现淘宝加入购物车动画
12 | 
13 |
14 | ##自定义Behavior实现知乎 简书效果
15 | ####知乎效果
16 | 
17 | ####简书效果
18 | 
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "22"
6 |
7 | defaultConfig {
8 | applicationId "com.example.lwp.design"
9 | minSdkVersion 14
10 | targetSdkVersion 21
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:appcompat-v7:22.2.0'
25 | compile 'com.android.support:recyclerview-v7:22.2.0'
26 | compile 'com.android.support:design:22.2.0'
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\dev\adt-bundle-windows-x86_64-20140321\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/lwp/design/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/BehaviorActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 |
9 | import com.example.lwp.design.adapter.FragmentRecyclerAdapter;
10 |
11 | /**
12 | * Created by clevo on 2015/9/12.
13 | */
14 | public class BehaviorActivity extends AppCompatActivity {
15 |
16 | private RecyclerView recyclerView;
17 |
18 |
19 |
20 | @Override
21 | protected void onCreate(@Nullable Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | /**
24 | * zhihu_behavior_activity 知乎效果
25 | *jianshu_behavior_activity 简书效果
26 | */
27 | setContentView(R.layout.jianshu_behavior_activity);
28 | recyclerView= (RecyclerView) findViewById(R.id.rv_behavior);
29 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
30 | FragmentRecyclerAdapter adapter=new FragmentRecyclerAdapter();
31 | recyclerView.setAdapter(adapter);
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v4.widget.DrawerLayout;
6 | import android.support.v7.app.ActionBarDrawerToggle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.support.v7.widget.StaggeredGridLayoutManager;
10 | import android.support.v7.widget.Toolbar;
11 | import android.view.View;
12 |
13 | import com.example.lwp.design.ui.masonry.MasonryAdapter;
14 | import com.example.lwp.design.ui.masonry.Product;
15 | import com.example.lwp.design.ui.masonry.RecycleItemClickListener;
16 | import com.example.lwp.design.ui.masonry.SpacesItemDecoration;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 |
22 | public class MainActivity extends AppCompatActivity {
23 |
24 | private DrawerLayout drawerLayout;
25 | private RecyclerView recyclerView;
26 | private Toolbar toolbar;
27 | private List productList;
28 | private ActionBarDrawerToggle drawerToggle;
29 |
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.home_activity);
35 |
36 | //set drawlayout
37 | drawerLayout= (DrawerLayout) findViewById(R.id.drawer_layout);
38 |
39 | //set a toolbar
40 | toolbar= (Toolbar) findViewById(R.id.toolbar);
41 | // toolbar.setTitle("首页");
42 | // toolbar.setTitleTextColor(Color.WHITE);
43 | setSupportActionBar(toolbar);
44 | getSupportActionBar().setHomeButtonEnabled(true);
45 | getSupportActionBar().setDisplayShowTitleEnabled(false);
46 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
47 | drawerToggle=new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.open,R.string.close){
48 | @Override
49 | public void onDrawerOpened(View drawerView) {
50 | super.onDrawerOpened(drawerView);
51 | }
52 |
53 | @Override
54 | public void onDrawerClosed(View drawerView) {
55 | super.onDrawerClosed(drawerView);
56 | }
57 | };
58 | drawerToggle.syncState();
59 | drawerLayout.setDrawerListener(drawerToggle);
60 |
61 | //set recycleview
62 | recyclerView= (RecyclerView) findViewById(R.id.recycler);
63 | recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL));
64 | initData();
65 | RecycleItemClickListener itemClickListener=new RecycleItemClickListener() {
66 | @Override
67 | public void onItemClick(View view, int position) {
68 | // Log.e("position","="+position);
69 | // Toast.makeText(MainActivity.this, productList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
70 | Intent intent=new Intent();
71 | intent.setClass(MainActivity.this,ProductDetailActivity.class);
72 | startActivity(intent);
73 | }
74 | };
75 | MasonryAdapter adapter=new MasonryAdapter(productList,itemClickListener);
76 | recyclerView.setAdapter(adapter);
77 | SpacesItemDecoration decoration=new SpacesItemDecoration(16);
78 | recyclerView.addItemDecoration(decoration);
79 | }
80 |
81 | // @Override
82 | // public boolean onCreateOptionsMenu(Menu menu) {
83 | // getMenuInflater().inflate(R.menu.home_tb_menu,menu);
84 | // return super.onCreateOptionsMenu(menu);
85 | // }
86 |
87 | private void initData() {
88 | productList=new ArrayList();
89 | Product p1=new Product(R.mipmap.p1,"我是照片1");
90 | productList.add(p1);
91 | Product p2=new Product(R.mipmap.p2,"我是照片2");
92 | productList.add(p2);
93 | Product p3=new Product(R.mipmap.p3,"我是照片3");
94 | productList.add(p3);
95 | Product p4=new Product(R.mipmap.p4,"我是照片4");
96 | productList.add(p4);
97 | Product p5=new Product(R.mipmap.p5,"我是照片5");
98 | productList.add(p5);
99 | Product p6=new Product(R.mipmap.p6,"我是照片6");
100 | productList.add(p6);
101 | Product p7=new Product(R.mipmap.p2,"我是照片7");
102 | productList.add(p7);
103 | Product p8=new Product(R.mipmap.p1,"我是照片8");
104 | productList.add(p8);
105 | Product p9=new Product(R.mipmap.p4,"我是照片9");
106 | productList.add(p9);
107 | Product p10=new Product(R.mipmap.p6,"我是照片10");
108 | productList.add(p10);
109 | Product p11=new Product(R.mipmap.p3,"我是照片11");
110 | productList.add(p11);
111 |
112 | }
113 |
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/ProductDetailActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.os.Bundle;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.support.design.widget.TabLayout;
10 | import android.support.v4.app.Fragment;
11 | import android.support.v4.app.FragmentManager;
12 | import android.support.v4.app.FragmentStatePagerAdapter;
13 | import android.support.v4.view.ViewPager;
14 | import android.support.v7.app.AppCompatActivity;
15 | import android.support.v7.widget.Toolbar;
16 | import android.view.View;
17 | import android.view.ViewTreeObserver;
18 | import android.widget.LinearLayout;
19 | import android.widget.TextView;
20 |
21 | import com.example.lwp.design.fragment.FragmentOne;
22 | import com.example.lwp.design.fragment.FragmentThree;
23 | import com.example.lwp.design.fragment.FragmentTwo;
24 |
25 | /**
26 | * Created by clevo on 2015/7/30.
27 | */
28 | public class ProductDetailActivity extends AppCompatActivity implements View.OnClickListener{
29 | private LinearLayout frontView, bottomView;
30 | private FloatingActionButton fab;
31 | private AnimatorSet showAnim,hiddenAnim;
32 | private long fWidth,fHeight, bHeight;
33 | private TextView tvCloseBottom;
34 |
35 | @Override
36 | protected void onCreate( Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.detail_activity);
39 |
40 | Toolbar tb= (Toolbar) findViewById(R.id.tb_detail );
41 | tb.setNavigationIcon(R.mipmap.ic_arrow_back_white);
42 |
43 |
44 | fab= (FloatingActionButton) findViewById(R.id.fab);
45 | fab.setOnClickListener(this);
46 |
47 | tvCloseBottom= (TextView) findViewById(R.id.tv_close_bottom);
48 | tvCloseBottom.setOnClickListener(this);
49 |
50 | ViewPager viewPager= (ViewPager) findViewById(R.id.view_pager_detail );
51 | MyPagerAdapter adapter=new MyPagerAdapter(getSupportFragmentManager());
52 | viewPager.setAdapter(adapter);
53 |
54 | TabLayout tabLayout= (TabLayout) findViewById(R.id.tab_layout);
55 | tabLayout.setTabsFromPagerAdapter(adapter);
56 | tabLayout.setupWithViewPager(viewPager);
57 |
58 | initView();
59 |
60 | }
61 |
62 | private void initView() {
63 | frontView = (LinearLayout) findViewById(R.id.front);
64 | ViewTreeObserver vto= frontView.getViewTreeObserver();
65 | vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
66 | @Override
67 | public void onGlobalLayout() {
68 | fWidth = frontView.getMeasuredWidth();
69 | fHeight = frontView.getMeasuredHeight();
70 |
71 | }
72 | });
73 | bottomView = (LinearLayout) findViewById(R.id.bottom );
74 | ViewTreeObserver sVto= bottomView.getViewTreeObserver();
75 | sVto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
76 | @Override
77 | public void onGlobalLayout() {
78 | bHeight = bottomView.getMeasuredHeight();
79 | initShowAnim();
80 | initHiddenAnim();
81 | }
82 | });
83 |
84 | }
85 |
86 | private void initShowAnim(){
87 | ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(frontView,"scaleX",1.0f,0.8f);
88 | fViewScaleXAnim.setDuration(350);
89 | ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(frontView,"scaleY",1.0f,0.8f);
90 | fViewScaleYAnim.setDuration(350);
91 | ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(frontView,"alpha",1.0f,0.5f);
92 | fViewAlphaAnim.setDuration(350);
93 | ObjectAnimator fViewRotationXAnim = ObjectAnimator.ofFloat(frontView, "rotationX", 0f, 10f);
94 | fViewRotationXAnim.setDuration(200);
95 | ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(frontView, "rotationX", 10f, 0f);
96 | fViewResumeAnim.setDuration(150);
97 | fViewResumeAnim.setStartDelay(200);
98 | ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(frontView,"translationY",0,-0.1f* fHeight);
99 | fViewTransYAnim.setDuration(350);
100 | ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(bottomView,"translationY", bHeight,0);
101 | sViewTransYAnim.setDuration(350);
102 | sViewTransYAnim.addListener(new AnimatorListenerAdapter() {
103 | @Override
104 | public void onAnimationStart(Animator animation) {
105 | super.onAnimationStart(animation);
106 | bottomView.setVisibility(View.VISIBLE);
107 | }
108 | });
109 | showAnim=new AnimatorSet();
110 | showAnim.playTogether(fViewScaleXAnim,fViewRotationXAnim,fViewResumeAnim,fViewTransYAnim,fViewAlphaAnim,fViewScaleYAnim,sViewTransYAnim);
111 | }
112 |
113 | private void initHiddenAnim(){
114 | ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(frontView,"scaleX",0.8f,1.0f);
115 | fViewScaleXAnim.setDuration(350);
116 | ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(frontView,"scaleY",0.8f,1.0f);
117 | fViewScaleYAnim.setDuration(350);
118 | ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(frontView,"alpha",0.5f,1.0f);
119 | fViewAlphaAnim.setDuration(350);
120 | ObjectAnimator fViewRotationAnim = ObjectAnimator.ofFloat(frontView, "rotationX",0f, 10f);
121 | fViewRotationAnim.setDuration(150);
122 | ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(frontView, "rotationX",10f, 0f);
123 | fViewResumeAnim.setDuration(200);
124 | fViewResumeAnim.setStartDelay(150);
125 | ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(frontView,"translationY",-fHeight *0.1f,0);
126 | fViewTransYAnim.setDuration(350);
127 | ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(bottomView,"translationY",0, bHeight);
128 | sViewTransYAnim.setDuration(350);
129 | sViewTransYAnim.addListener(new AnimatorListenerAdapter() {
130 | @Override
131 | public void onAnimationEnd(Animator animation) {
132 | super.onAnimationEnd(animation);
133 | bottomView.setVisibility(View.INVISIBLE);
134 | }
135 | });
136 | hiddenAnim=new AnimatorSet();
137 | hiddenAnim.playTogether(fViewScaleXAnim, fViewAlphaAnim,fViewRotationAnim,fViewResumeAnim, fViewScaleYAnim,fViewTransYAnim, sViewTransYAnim);
138 | hiddenAnim.setDuration(350);
139 | }
140 |
141 | @Override
142 | public void onClick(View v) {
143 | if (v.getId()==fab.getId()){
144 | showAnim.start();
145 | }else if(v.getId()==tvCloseBottom.getId()){
146 | hiddenAnim.start();
147 | }
148 |
149 | }
150 |
151 | private class MyPagerAdapter extends FragmentStatePagerAdapter{
152 |
153 |
154 | private MyPagerAdapter(FragmentManager fm) {
155 | super(fm);
156 | }
157 |
158 | @Override
159 | public Fragment getItem(int position) {
160 | switch (position){
161 | case 0:return FragmentOne.newInstance();
162 | case 1:return FragmentTwo.newInstance();
163 | case 2:return FragmentThree.newInstance();
164 | default:return FragmentOne.newInstance();
165 | }
166 | }
167 |
168 | @Override
169 | public int getCount() {
170 | return 3;
171 | }
172 |
173 | @Override
174 | public CharSequence getPageTitle(int position) {
175 | switch (position){
176 | case 0:return "评论";
177 | case 1:return "照片参数";
178 | case 2:return "其他照片推荐";
179 | default:return "评论";
180 | }
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/adapter/FragmentRecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.adapter;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import com.example.lwp.design.R;
10 |
11 | /**
12 | * Created by clevo on 2015/8/2.
13 | */
14 | public class FragmentRecyclerAdapter extends RecyclerView.Adapter{
15 |
16 | private String[] names={"非常好","还不错","好烂啊","天下良心啊","下次还来","必须顶","beatiful","非常好","还不错","好烂啊","天下良心啊","下次还来","必须顶","beatiful"};
17 |
18 |
19 | public FragmentRecyclerAdapter() {
20 | }
21 |
22 | @Override
23 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
24 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.detail_fragment_item, parent, false);
25 | return new ViewHolder(view);
26 | }
27 |
28 | @Override
29 | public void onBindViewHolder(ViewHolder holder, int position) {
30 | holder.textView.setText(names[position]);
31 |
32 | }
33 |
34 | @Override
35 | public int getItemCount() {
36 | return names.length;
37 | }
38 |
39 | public static class ViewHolder extends RecyclerView.ViewHolder{
40 | private TextView textView;
41 |
42 | public ViewHolder(View itemView) {
43 | super(itemView);
44 | textView= (TextView) itemView.findViewById(R.id.tv_fragment_item);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/bean/User.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.bean;
2 |
3 | /**
4 | * Created by clevo on 2015/9/3.
5 | */
6 | public class User {
7 | private String name;
8 | private String pwd;
9 |
10 | public User(String name, String pwd) {
11 | this.name = name;
12 | this.pwd = pwd;
13 | }
14 |
15 | public String getName() {
16 | return name;
17 | }
18 |
19 | public void setName(String name) {
20 | this.name = name;
21 | }
22 |
23 | public String getPwd() {
24 | return pwd;
25 | }
26 |
27 | public void setPwd(String pwd) {
28 | this.pwd = pwd;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/bean/UserBuilder.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.bean;
2 |
3 | public class UserBuilder {
4 | private String name;
5 | private String pwd;
6 |
7 | public UserBuilder setName(String name) {
8 | this.name = name;
9 | return this;
10 | }
11 |
12 | public UserBuilder setPwd(String pwd) {
13 | this.pwd = pwd;
14 | return this;
15 | }
16 |
17 | public User createUser() {
18 | return new User(name, pwd);
19 | }
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/behavior/JianShuBehavior.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.behavior;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.AppBarLayout;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 |
9 | /**
10 | * 简书效果
11 | * Created by clevo on 2015/9/12.
12 | */
13 | public class JianShuBehavior extends CoordinatorLayout.Behavior {
14 |
15 |
16 | public JianShuBehavior(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | @Override
21 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
22 | return dependency instanceof AppBarLayout;
23 | }
24 |
25 |
26 | @Override
27 | public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
28 | float translationY = Math.abs(dependency.getTranslationY());
29 | child.setTranslationY(translationY);
30 | return true;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/behavior/QqBehavior.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.behavior;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.AppBarLayout;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.support.v7.widget.Toolbar;
7 | import android.util.AttributeSet;
8 | import android.view.View;
9 |
10 | /**
11 | * QQ 淘宝透明栏渐变效果
12 | * Created by clevo on 2015/9/15.
13 | */
14 | public class QqBehavior extends CoordinatorLayout.Behavior {
15 |
16 | public QqBehavior(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | @Override
21 | public boolean layoutDependsOn(CoordinatorLayout parent, Toolbar child, View dependency) {
22 | return dependency instanceof AppBarLayout;
23 | }
24 |
25 | @Override
26 | public boolean onDependentViewChanged(CoordinatorLayout parent, Toolbar child, View dependency) {
27 | if (dependency instanceof AppBarLayout) {
28 | float ratio = (float) getCurrentScrollValue(child, dependency) / getTotalScrollRange(child, dependency);
29 | float alpha = 1f - Math.min(1f, Math.max(0f, ratio));
30 | int drawableAlpha = (int) (alpha * 255);
31 | child.getBackground().setAlpha(drawableAlpha);
32 | parent.getStatusBarBackground().setAlpha(drawableAlpha);
33 | }
34 | return false;
35 | }
36 |
37 | private int getCurrentScrollValue(Toolbar child, View dependency) {
38 | return dependency.getBottom() - child.getTop();
39 | }
40 |
41 | private float getTotalScrollRange(Toolbar child, View dependency) {
42 | return ((AppBarLayout) dependency).getTotalScrollRange() - child.getTop();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/behavior/ZhiHuBehavior.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.behavior;
2 |
3 | import android.animation.Animator;
4 | import android.content.Context;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.support.v4.view.ViewCompat;
7 | import android.support.v4.view.animation.FastOutSlowInInterpolator;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 | import android.view.ViewPropertyAnimator;
11 | import android.view.animation.Interpolator;
12 |
13 | /**
14 | * 知乎效果
15 | * Created by clevo on 2015/9/12.
16 | */
17 | public class ZhiHuBehavior extends CoordinatorLayout.Behavior {
18 |
19 | private static final Interpolator INTERPOLATOR = new FastOutSlowInInterpolator();
20 |
21 |
22 | private int sinceDirectionChange;
23 |
24 |
25 | public ZhiHuBehavior(Context context, AttributeSet attrs) {
26 | super(context, attrs);
27 | }
28 |
29 |
30 | @Override
31 | public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes) {
32 | return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
33 | }
34 |
35 |
36 | @Override
37 | public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, View child, View target, int dx, int dy, int[] consumed) {
38 | if (dy > 0 && sinceDirectionChange < 0 || dy < 0 && sinceDirectionChange > 0) {
39 | child.animate().cancel();
40 | sinceDirectionChange = 0;
41 | }
42 | sinceDirectionChange += dy;
43 | if (sinceDirectionChange > child.getHeight() && child.getVisibility() == View.VISIBLE) {
44 | hide(child);
45 | } else if (sinceDirectionChange < 0 && child.getVisibility() == View.GONE) {
46 | show(child);
47 | }
48 | }
49 |
50 |
51 | private void hide(final View view) {
52 | ViewPropertyAnimator animator = view.animate().translationY(view.getHeight()).setInterpolator(INTERPOLATOR).setDuration(200);
53 | animator.setListener(new Animator.AnimatorListener() {
54 | @Override
55 | public void onAnimationStart(Animator animator) {
56 |
57 | }
58 |
59 | @Override
60 | public void onAnimationEnd(Animator animator) {
61 | view.setVisibility(View.GONE);
62 | }
63 |
64 | @Override
65 | public void onAnimationCancel(Animator animator) {
66 | show(view);
67 | }
68 |
69 | @Override
70 | public void onAnimationRepeat(Animator animator) {
71 |
72 | }
73 | });
74 | animator.start();
75 | }
76 |
77 |
78 | private void show(final View view) {
79 | ViewPropertyAnimator animator = view.animate().translationY(0).setInterpolator(INTERPOLATOR).setDuration(200);
80 | animator.setListener(new Animator.AnimatorListener() {
81 | @Override
82 | public void onAnimationStart(Animator animator) {
83 |
84 | }
85 |
86 | @Override
87 | public void onAnimationEnd(Animator animator) {
88 | view.setVisibility(View.VISIBLE);
89 | }
90 |
91 | @Override
92 | public void onAnimationCancel(Animator animator) {
93 | hide(view);
94 | }
95 |
96 | @Override
97 | public void onAnimationRepeat(Animator animator) {
98 |
99 | }
100 | });
101 | animator.start();
102 |
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/fragment/FragmentOne.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.example.lwp.design.R;
13 | import com.example.lwp.design.adapter.FragmentRecyclerAdapter;
14 |
15 | /**
16 | * Created by clevo on 2015/7/30.
17 | */
18 | public class FragmentOne extends Fragment {
19 |
20 |
21 | public static FragmentOne newInstance(){
22 | return new FragmentOne();
23 | }
24 |
25 |
26 | public FragmentOne() {
27 | }
28 |
29 | @Override
30 | public void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View view= inflater.inflate(R.layout.detail_fragment_one,container,false );
38 | RecyclerView recyclerView= (RecyclerView) view.findViewById(R.id.recycler_fragment);
39 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
40 | FragmentRecyclerAdapter adapter=new FragmentRecyclerAdapter();
41 | recyclerView.setAdapter(adapter);
42 |
43 | return view;
44 | }
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/fragment/FragmentThree.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.example.lwp.design.R;
11 |
12 | /**
13 | * Created by clevo on 2015/7/30.
14 | */
15 | public class FragmentThree extends Fragment{
16 |
17 |
18 | public static FragmentThree newInstance(){
19 | return new FragmentThree();
20 | }
21 |
22 |
23 | public FragmentThree() {
24 | }
25 |
26 | @Override
27 | public void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | }
30 |
31 | @Nullable
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
34 | return inflater.inflate(R.layout.detail_fragment_three,container,false );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/fragment/FragmentTwo.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.example.lwp.design.R;
11 |
12 | /**
13 | * Created by clevo on 2015/7/30.
14 | */
15 | public class FragmentTwo extends Fragment{
16 | public static FragmentTwo newInstance(){
17 | return new FragmentTwo();
18 | }
19 |
20 |
21 | public FragmentTwo() {
22 | }
23 |
24 | @Override
25 | public void onCreate(@Nullable Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | }
28 |
29 | @Nullable
30 | @Override
31 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
32 | return inflater.inflate(R.layout.detail_fragment_two,container,false );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/ui/masonry/MasonryAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.ui.masonry;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import com.example.lwp.design.R;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Created by clevo on 2015/7/27.
16 | */
17 |
18 | public class MasonryAdapter extends RecyclerView.Adapter{
19 | private List products;
20 | private static RecycleItemClickListener itemClickListener;
21 |
22 |
23 | public MasonryAdapter(List list,RecycleItemClickListener clickListener) {
24 | products=list;
25 | itemClickListener=clickListener;
26 | }
27 |
28 | @Override
29 | public MasonryView onCreateViewHolder(ViewGroup viewGroup, int i) {
30 | View view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.home_masonry_item, viewGroup, false);
31 | return new MasonryView(view);
32 | }
33 |
34 | @Override
35 | public void onBindViewHolder(MasonryView masonryView, int position) {
36 | masonryView.imageView.setImageResource(products.get(position).getImg());
37 | masonryView.textView.setText(products.get(position).getTitle());
38 |
39 | }
40 |
41 |
42 | @Override
43 | public int getItemCount() {
44 | return products.size();
45 | }
46 |
47 | //viewholder
48 | public static class MasonryView extends RecyclerView.ViewHolder implements View.OnClickListener{
49 |
50 | private ImageView imageView;
51 | private TextView textView;
52 |
53 |
54 | public MasonryView(View itemView){
55 | super(itemView);
56 | imageView= (ImageView) itemView.findViewById(R.id.masonry_item_img );
57 | textView= (TextView) itemView.findViewById(R.id.masonry_item_title);
58 | itemView.setOnClickListener(this);
59 |
60 | }
61 |
62 | @Override
63 | public void onClick(View v) {
64 | itemClickListener.onItemClick(v,this.getLayoutPosition());
65 | }
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/ui/masonry/Product.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.ui.masonry;
2 |
3 | /**
4 | * Created by clevo on 2015/7/27.
5 | */
6 | public class Product {
7 | private int img;
8 | private String title;
9 |
10 | public Product(int img, String title) {
11 | this.img = img;
12 | this.title = title;
13 | }
14 |
15 | public int getImg() {
16 | return img;
17 | }
18 |
19 | public void setImg(int img) {
20 | this.img = img;
21 | }
22 |
23 | public String getTitle() {
24 | return title;
25 | }
26 |
27 | public void setTitle(String title) {
28 | this.title = title;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/ui/masonry/RecycleItemClickListener.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.ui.masonry;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by clevo on 2015/7/30.
7 | */
8 | public interface RecycleItemClickListener {
9 |
10 | void onItemClick(View view,int position);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/lwp/design/ui/masonry/SpacesItemDecoration.java:
--------------------------------------------------------------------------------
1 | package com.example.lwp.design.ui.masonry;
2 |
3 | import android.graphics.Rect;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | /**
8 | * Created by clevo on 2015/7/27.
9 | */
10 | public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
11 |
12 | private int space;
13 |
14 | public SpacesItemDecoration(int space) {
15 | this.space=space;
16 | }
17 |
18 | @Override
19 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
20 | outRect.left=space;
21 | outRect.right=space;
22 | outRect.bottom=space;
23 | if(parent.getChildAdapterPosition(view)==0){
24 | outRect.top=space;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_activity.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
19 |
20 |
21 |
25 |
26 |
29 |
30 |
38 |
39 |
46 |
47 |
48 |
49 |
50 |
55 |
56 |
57 |
67 |
68 |
69 |
70 |
71 |
79 |
80 |
86 |
87 |
96 |
97 |
104 |
105 |
113 |
114 |
115 |
116 |
122 |
123 |
129 |
130 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_fragment_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_fragment_one.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_fragment_three.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_fragment_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/home_activity.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
11 |
14 |
15 |
20 |
21 |
27 |
28 |
34 |
35 |
36 |
37 |
38 |
44 |
45 |
46 |
47 |
48 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/home_masonry_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/jianshu_behavior_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
35 |
36 |
43 |
44 |
45 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget_footer_behavior_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/zhihu_behavior_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
34 |
35 |
42 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/home_tb_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_drawer.xml:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_favorite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xhdpi/ic_favorite.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xhdpi/ic_message.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_photo_camera_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xhdpi/ic_photo_camera_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/header.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_add_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/ic_add_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_arrow_back_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/ic_arrow_back_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_photo_camera_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/ic_photo_camera_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/lvye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/lvye.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p3.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p4.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p5.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/p6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/app/src/main/res/mipmap-xxhdpi/p6.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF0000
4 | #1BA1E2
5 | #FF7d23
6 |
7 | #303F9F
8 |
9 | #3F51B5
10 | #FFFFFF
11 | #000000
12 | #999999
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Design
3 |
4 | Hello world!
5 | Settings
6 | 平如海棠
7 | 首页
8 | 搜索
9 | 导航
10 | 摇一摇
11 | open
12 | close
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/images/anim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/anim.png
--------------------------------------------------------------------------------
/images/floatActionBtn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/floatActionBtn.png
--------------------------------------------------------------------------------
/images/jianshu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/jianshu.gif
--------------------------------------------------------------------------------
/images/nav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/nav.png
--------------------------------------------------------------------------------
/images/recycleView.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/recycleView.png
--------------------------------------------------------------------------------
/images/tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/tab.png
--------------------------------------------------------------------------------
/images/zhihu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/web3citizen/MaterialDesignLearn/a065d3b9b42ebd291aa2324d6246aa053a6eb619/images/zhihu.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------