├── .gitignore
├── .idea
├── caches
│ └── build_file_checksums.ser
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── jinlong
│ │ └── newmaterialdesign
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── jinlong
│ │ │ └── newmaterialdesign
│ │ │ ├── MainActivity.java
│ │ │ ├── animation
│ │ │ ├── HandleViewActivity.java
│ │ │ ├── SceneActivity.java
│ │ │ ├── SharedActivity.java
│ │ │ └── TransitionManagerActivity.java
│ │ │ ├── behavior
│ │ │ ├── BehaviorActivity.java
│ │ │ ├── BottomSheetFragment.java
│ │ │ ├── OneBehavior.java
│ │ │ ├── OneBehaviorActivity.java
│ │ │ ├── TwoBehavior.java
│ │ │ └── TwoBehaviorActivity.java
│ │ │ ├── cardView
│ │ │ └── CardViewActivity.java
│ │ │ ├── fab
│ │ │ ├── BaseRVAdapter.java
│ │ │ ├── FABActivity.java
│ │ │ ├── FABAndRecyclerViewActivity.java
│ │ │ ├── FABLocationActivity.java
│ │ │ └── ScrollAwareFABBehaviorDefault.java
│ │ │ ├── input
│ │ │ └── InputActivity.java
│ │ │ ├── material
│ │ │ ├── AppBarLayoutActivity.java
│ │ │ ├── MaterialActivity.java
│ │ │ ├── SupperMaterialActivity.java
│ │ │ └── TabRVAdapter.java
│ │ │ ├── navigation
│ │ │ └── NavigationActivity.java
│ │ │ ├── tablayout
│ │ │ ├── ItemFragment.java
│ │ │ ├── NewTabLayoutActivity.java
│ │ │ └── TabLayoutActivity.java
│ │ │ ├── toolbar
│ │ │ ├── DefaultFragment.java
│ │ │ ├── DefaultToolbarActivity.java
│ │ │ ├── Main1Fragment.java
│ │ │ ├── MainFragment.java
│ │ │ ├── MainVPAdapter.java
│ │ │ ├── SearchFragment.java
│ │ │ ├── WithFragmentActivity.java
│ │ │ ├── YunActivity.java
│ │ │ └── ZhiHuToolbarActivity.java
│ │ │ └── widget
│ │ │ └── SelectableRoundedImageView.java
│ └── res
│ │ ├── anim
│ │ ├── fab_in.xml
│ │ └── fab_out.xml
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── draw_toolbar_bg.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_search_black_24dp.xml
│ │ ├── select_pwd_visible.xml
│ │ ├── select_tint_visible.xml
│ │ ├── tab_item_textbg.xml
│ │ └── top_tab_bg.xml
│ │ ├── layout
│ │ ├── activity_app_bar_layout.xml
│ │ ├── activity_behavior.xml
│ │ ├── activity_card_view.xml
│ │ ├── activity_default_toolbar.xml
│ │ ├── activity_fab.xml
│ │ ├── activity_faband_recycler_view.xml
│ │ ├── activity_fablocation.xml
│ │ ├── activity_handle_view.xml
│ │ ├── activity_input.xml
│ │ ├── activity_main.xml
│ │ ├── activity_material.xml
│ │ ├── activity_navigation.xml
│ │ ├── activity_new_tab_layout.xml
│ │ ├── activity_one_behavior.xml
│ │ ├── activity_scene.xml
│ │ ├── activity_shared.xml
│ │ ├── activity_supper_material.xml
│ │ ├── activity_tab_layout.xml
│ │ ├── activity_transition_manager.xml
│ │ ├── activity_two_behavior.xml
│ │ ├── activity_with_fragment.xml
│ │ ├── activity_yun.xml
│ │ ├── activity_zhi_hu_toolbar.xml
│ │ ├── fragment_bottom_sheet.xml
│ │ ├── fragment_default.xml
│ │ ├── fragment_item.xml
│ │ ├── fragment_main.xml
│ │ ├── fragment_main1.xml
│ │ ├── fragment_search.xml
│ │ ├── item.xml
│ │ ├── item_tab.xml
│ │ ├── nav_header.xml
│ │ ├── scene1.xml
│ │ ├── scene2.xml
│ │ ├── sheet_dialog.xml
│ │ └── tb_item_view.xml
│ │ ├── menu
│ │ ├── menu_default_toolbar.xml
│ │ ├── menu_fragment.xml
│ │ ├── menu_main_fragment.xml
│ │ ├── menu_main_fragment1.xml
│ │ ├── menu_navation_drawer.xml
│ │ ├── menu_yun.xml
│ │ └── menu_zhihu.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── back_icon.png
│ │ ├── bg.png
│ │ ├── heard_1.jpg
│ │ ├── heard_2.jpg
│ │ ├── ic_blur_linear_white_24dp.png
│ │ ├── ic_blur_off_white_24dp.png
│ │ ├── ic_blur_off_white_36dp.png
│ │ ├── ic_blur_off_white_48dp.png
│ │ ├── ic_blur_on_white_36dp.png
│ │ ├── ic_blur_on_white_48dp.png
│ │ ├── ic_call_merge_white_24dp.png
│ │ ├── ic_call_missed_outgoing_white_24dp.png
│ │ ├── ic_call_white_24dp.png
│ │ ├── ic_chat_bubble_outline_white_24dp.png
│ │ ├── ic_delete.png
│ │ ├── ic_dialer_sip_white_24dp.png
│ │ ├── ic_directions_bike_white_24dp.png
│ │ ├── ic_flash_auto_white_24dp.png
│ │ ├── ic_flash_off_white_24dp.png
│ │ ├── ic_import_export_white_24dp.png
│ │ ├── ic_invert_colors_off_white_24dp.png
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── ic_linear_scale_white_24dp.png
│ │ ├── ic_search.png
│ │ ├── ic_search_white_36pt_2x.png
│ │ ├── ic_zhbook_show_directory.png
│ │ └── top_bg.jpg
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── transition
│ │ ├── changebounds_and_fade.xml
│ │ ├── changebounds_with_arcmotion.xml
│ │ ├── enter_animation.xml
│ │ └── exit_animation.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── jinlong
│ └── newmaterialdesign
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 |
6 | defaultConfig {
7 | applicationId "com.jinlong.newmaterialdesign"
8 | minSdkVersion 16
9 | targetSdkVersion 27
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(include: ['*.jar'], dir: 'libs')
24 | implementation 'com.android.support:appcompat-v7:27.1.1'
25 | implementation 'com.android.support.constraint:constraint-layout:1.1.0'
26 | implementation 'com.android.support:support-v4:27.1.1'
27 | testImplementation 'junit:junit:4.12'
28 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
29 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
30 | implementation 'com.android.support:design:27.1.1'
31 | implementation 'de.hdodenhof:circleimageview:2.2.0'
32 | implementation 'com.android.support:cardview-v7:27.1.1'
33 | }
34 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/jinlong/newmaterialdesign/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.jinlong.newmaterialdesign", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.TableLayout;
8 |
9 | import com.jinlong.newmaterialdesign.animation.TransitionManagerActivity;
10 | import com.jinlong.newmaterialdesign.behavior.BehaviorActivity;
11 | import com.jinlong.newmaterialdesign.cardView.CardViewActivity;
12 | import com.jinlong.newmaterialdesign.fab.FABActivity;
13 | import com.jinlong.newmaterialdesign.input.InputActivity;
14 | import com.jinlong.newmaterialdesign.material.AppBarLayoutActivity;
15 | import com.jinlong.newmaterialdesign.material.MaterialActivity;
16 | import com.jinlong.newmaterialdesign.material.SupperMaterialActivity;
17 | import com.jinlong.newmaterialdesign.navigation.NavigationActivity;
18 | import com.jinlong.newmaterialdesign.tablayout.NewTabLayoutActivity;
19 | import com.jinlong.newmaterialdesign.tablayout.TabLayoutActivity;
20 | import com.jinlong.newmaterialdesign.toolbar.DefaultToolbarActivity;
21 |
22 | public class MainActivity extends AppCompatActivity {
23 |
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_main);
29 | }
30 |
31 |
32 | /**
33 | * Toolbar的使用展示
34 | */
35 | public void toolbar(View view) {
36 | Intent toolbarIntent = new Intent(this, DefaultToolbarActivity.class);
37 | startActivity(toolbarIntent);
38 | }
39 |
40 | /**
41 | * NavigationAndDrawer的联合使用
42 | */
43 | public void NavigationAndDrawer(View view) {
44 | Intent navigationIntent = new Intent(this, NavigationActivity.class);
45 | startActivity(navigationIntent);
46 | }
47 |
48 | /**
49 | * 作者 贺金龙
50 | *
51 | * 方法描述: 动画的演示
52 | * 创建时间: 2018/4/25
53 | */
54 | public void animation(View view) {
55 | Intent transitionAnimation = new Intent(this, TransitionManagerActivity.class);
56 | startActivity(transitionAnimation);
57 | }
58 |
59 | /**
60 | * Fab的使用演示
61 | */
62 | public void fab(View view) {
63 | Intent intent = new Intent(this, FABActivity.class);
64 | startActivity(intent);
65 | }
66 |
67 | /**
68 | * behavior的演示
69 | */
70 | public void behavior(View view) {
71 | Intent intent = new Intent(this, BehaviorActivity.class);
72 | startActivity(intent);
73 | }
74 |
75 | /**
76 | * materialDesign的联动
77 | */
78 | public void materialDesign(View view) {
79 | Intent intent = new Intent(this, MaterialActivity.class);
80 | startActivity(intent);
81 | }
82 |
83 | /**
84 | * materialDesign更酷炫的联动
85 | */
86 | public void supperMaterialDesign(View view) {
87 | Intent intent = new Intent(this, SupperMaterialActivity.class);
88 | startActivity(intent);
89 | }
90 |
91 | /**
92 | * materialDesign更酷炫的联动
93 | */
94 | public void AppBarLayout(View view) {
95 | Intent intent = new Intent(this, AppBarLayoutActivity.class);
96 | startActivity(intent);
97 | }
98 |
99 | /**
100 | * TabLayout的使用
101 | */
102 | public void tabLayout(View view) {
103 | Intent intent = new Intent(this, TabLayoutActivity.class);
104 | startActivity(intent);
105 | }
106 |
107 | /**
108 | * TabLayout自定义布局的使用
109 | */
110 | public void newTabLayout(View view) {
111 | Intent intent = new Intent(this, NewTabLayoutActivity.class);
112 | startActivity(intent);
113 | }
114 |
115 | /**
116 | * CardView的使用
117 | */
118 | public void cardView(View view) {
119 | Intent intent = new Intent(this, CardViewActivity.class);
120 | startActivity(intent);
121 | }
122 |
123 | /**
124 | * CardView的使用
125 | */
126 | public void textInputLayout(View view) {
127 | Intent intent = new Intent(this, InputActivity.class);
128 | startActivity(intent);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/animation/HandleViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.animation;
2 |
3 | import android.support.constraint.ConstraintLayout;
4 | import android.support.transition.Explode;
5 | import android.support.transition.Fade;
6 | import android.support.transition.Slide;
7 | import android.support.transition.Transition;
8 | import android.support.transition.TransitionManager;
9 | import android.support.transition.Visibility;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.os.Bundle;
12 | import android.view.Gravity;
13 | import android.view.View;
14 | import android.widget.TextView;
15 |
16 | import com.jinlong.newmaterialdesign.R;
17 |
18 | /**
19 | * 操作View的动画
20 | */
21 | public class HandleViewActivity extends AppCompatActivity {
22 |
23 | private ConstraintLayout mClRoot;
24 | private TextView mTvShow;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_handle_view);
30 |
31 | initView();
32 | }
33 |
34 | private void initView() {
35 | mClRoot = findViewById(R.id.cl_root);
36 | mTvShow = findViewById(R.id.tv_show);
37 | }
38 |
39 |
40 | /**
41 | * fade动画,淡入淡出
42 | *
43 | * @param view
44 | */
45 | public void fadeTransition(View view) {
46 | Fade fade = new Fade();
47 | TransitionManager.beginDelayedTransition(mClRoot, fade);
48 | show();
49 | }
50 |
51 |
52 | /**
53 | * Slide动画,移动
54 | */
55 | public void slideTransition(View view) {
56 | Slide slide = new Slide();
57 | TransitionManager.beginDelayedTransition(mClRoot, slide);
58 | show();
59 | }
60 |
61 | public void explodeTransition(View view) {
62 | Explode explode = new Explode();
63 | TransitionManager.beginDelayedTransition(mClRoot, explode);
64 | show();
65 | }
66 |
67 | /**
68 | * 公共的显示和隐藏的方法
69 | */
70 | private void show() {
71 | if (mTvShow.getVisibility() == View.VISIBLE) {
72 | mTvShow.setVisibility(View.GONE);
73 | } else {
74 | mTvShow.setVisibility(View.VISIBLE);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/animation/SceneActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.animation;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.NonNull;
5 | import android.support.transition.ChangeBounds;
6 | import android.support.transition.ChangeScroll;
7 | import android.support.transition.Explode;
8 | import android.support.transition.Fade;
9 | import android.support.transition.Scene;
10 | import android.support.transition.Slide;
11 | import android.support.transition.Transition;
12 | import android.support.transition.TransitionInflater;
13 | import android.support.transition.TransitionManager;
14 | import android.support.v7.app.AppCompatActivity;
15 | import android.view.View;
16 | import android.widget.FrameLayout;
17 |
18 | import com.jinlong.newmaterialdesign.R;
19 |
20 | /**
21 | * 展示布局的过渡动画
22 | */
23 | public class SceneActivity extends AppCompatActivity {
24 |
25 | private Scene mScene1;
26 | private Scene mScene2;
27 | private boolean isScene2;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_scene);
33 |
34 |
35 | initScene();
36 | }
37 |
38 | private void initScene() {
39 | FrameLayout layout = findViewById(R.id.rl_root);
40 | mScene1 = Scene.getSceneForLayout(layout, R.layout.scene1, this);
41 | mScene2 = Scene.getSceneForLayout(layout, R.layout.scene2, this);
42 | TransitionManager.go(mScene1);
43 | }
44 |
45 | /**
46 | * 操作Scene动画
47 | */
48 | public void scene(View view) {
49 | TransitionManager.go(isScene2 ? mScene1 : mScene2, new ChangeBounds());
50 | isScene2 = !isScene2;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/animation/SharedActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.animation;
2 |
3 | import android.animation.Animator;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.os.PersistableBundle;
8 | import android.support.annotation.Nullable;
9 | import android.support.annotation.RequiresApi;
10 | import android.support.design.widget.FloatingActionButton;
11 | import android.support.transition.TransitionManager;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.transition.Transition;
14 | import android.transition.TransitionInflater;
15 | import android.util.Log;
16 | import android.view.ViewAnimationUtils;
17 | import android.widget.LinearLayout;
18 |
19 | import com.jinlong.newmaterialdesign.R;
20 |
21 | public class SharedActivity extends AppCompatActivity {
22 |
23 | private static final String TAG = SharedActivity.class.getSimpleName();
24 | private LinearLayout mImage_bg;
25 | private FloatingActionButton mFab;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_shared);
31 |
32 | mImage_bg = findViewById(R.id.fl_top);
33 | mFab = findViewById(R.id.fab);
34 |
35 | if (Build.VERSION.SDK_INT > 20) {
36 | //设置进入动画
37 | getWindow().setEnterTransition(TransitionInflater.from(this).inflateTransition(R.transition.enter_animation));
38 | //设置退出动画
39 | getWindow().setReturnTransition(TransitionInflater.from(this).inflateTransition(R.transition.exit_animation));
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/animation/TransitionManagerActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.animation;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.constraint.ConstraintLayout;
6 | import android.support.transition.AutoTransition;
7 | import android.support.transition.ChangeBounds;
8 | import android.support.transition.ChangeClipBounds;
9 | import android.support.transition.ChangeScroll;
10 | import android.support.transition.Explode;
11 | import android.support.transition.Fade;
12 | import android.support.transition.Scene;
13 | import android.support.transition.Slide;
14 | import android.support.transition.TransitionManager;
15 | import android.support.transition.TransitionSet;
16 | import android.support.v4.app.ActivityOptionsCompat;
17 | import android.support.v4.util.Pair;
18 | import android.support.v7.app.AppCompatActivity;
19 | import android.view.Gravity;
20 | import android.view.View;
21 | import android.view.animation.AccelerateDecelerateInterpolator;
22 | import android.widget.FrameLayout;
23 | import android.widget.RelativeLayout;
24 | import android.widget.TextView;
25 |
26 | import com.jinlong.newmaterialdesign.R;
27 |
28 | import de.hdodenhof.circleimageview.CircleImageView;
29 |
30 | /**
31 | * 这个适用于展示TransitionManager的动画效果
32 | */
33 | public class TransitionManagerActivity extends AppCompatActivity {
34 |
35 | private ConstraintLayout mCl_root;
36 | private TextView mTvText;
37 | private Scene mScene1;
38 | private Scene mScene2;
39 | private boolean isScene2;//这个标识是显示的是否是Scene2的页面
40 |
41 | @Override
42 | protected void onCreate(Bundle savedInstanceState) {
43 | super.onCreate(savedInstanceState);
44 | setContentView(R.layout.activity_transition_manager);
45 | }
46 |
47 | /**
48 | * 操作单独View的
49 | */
50 | public void handleView(View view) {
51 | Intent intent = new Intent(this, HandleViewActivity.class);
52 | startActivity(intent);
53 | }
54 |
55 | /**
56 | * 操作Scene的
57 | */
58 | public void handleScene(View view) {
59 | Intent intent = new Intent(this, SceneActivity.class);
60 | startActivity(intent);
61 | }
62 |
63 | /**
64 | * 共享动画
65 | */
66 | public void sharedAnimation(View view) {
67 | CircleImageView civHead = findViewById(R.id.civ_heard);
68 | TextView tvTitle = findViewById(R.id.tv_title);
69 |
70 | Intent intent = new Intent(this, SharedActivity.class);
71 | ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(this,
72 | new Pair(civHead, "shared_image"),
73 | new Pair(tvTitle, "shared_textview"));
74 |
75 | startActivity(intent, optionsCompat.toBundle());
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/BehaviorActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.behavior;
2 |
3 | import android.content.Intent;
4 | import android.support.annotation.NonNull;
5 | import android.support.design.widget.BottomSheetBehavior;
6 | import android.support.design.widget.BottomSheetDialog;
7 | import android.support.design.widget.CoordinatorLayout;
8 | import android.support.design.widget.SwipeDismissBehavior;
9 | import android.support.v4.widget.NestedScrollView;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.os.Bundle;
12 | import android.support.v7.widget.Toolbar;
13 | import android.view.View;
14 | import android.widget.LinearLayout;
15 | import android.widget.TextView;
16 |
17 | import com.jinlong.newmaterialdesign.R;
18 |
19 | /**
20 | * Behavior的初始页面
21 | */
22 | public class BehaviorActivity extends AppCompatActivity {
23 |
24 | private LinearLayout mLlBottomSheet;//底部展示的Behavior
25 | private SwipeDismissBehavior mSwipe;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_behavior);
31 | initView();
32 | initSwipeDismiss();
33 | }
34 |
35 | private void initSwipeDismiss() {
36 | TextView tvTitle = findViewById(R.id.tv_title);
37 |
38 | SwipeDismissBehavior mSwipe = new SwipeDismissBehavior();
39 |
40 | /*
41 | * SWIPE_DIRECTION_START_TO_END 只能从左向右滑动
42 | * SWIPE_DIRECTION_END_TO_START 只能从右向左滑动
43 | * SWIPE_DIRECTION_ANY 左右滑动都可以
44 | */
45 | mSwipe.setSwipeDirection(SwipeDismissBehavior.SWIPE_DIRECTION_ANY);
46 |
47 | mSwipe.setListener(new SwipeDismissBehavior.OnDismissListener() {
48 | @Override
49 | public void onDismiss(View view) {
50 | //View消失的回调
51 | }
52 |
53 | @Override
54 | public void onDragStateChanged(int state) {
55 | /*
56 | * STATE_IDLE 空闲状态
57 | * STATE_DRAGGING 滑动中
58 | * STATE_SETTLING 消失
59 | */
60 | }
61 | });
62 |
63 | CoordinatorLayout.LayoutParams coordinatorParams = (CoordinatorLayout.LayoutParams) tvTitle.getLayoutParams();
64 |
65 | coordinatorParams.setBehavior(mSwipe);
66 | }
67 |
68 | private void initView() {
69 | mLlBottomSheet = findViewById(R.id.ll_bottom);
70 | }
71 |
72 | /**
73 | * 展示BottomSheet
74 | */
75 | public void bottomSheet(View view) {
76 | BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(mLlBottomSheet);
77 | if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
78 | bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
79 | } else {
80 | bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
81 | }
82 | }
83 |
84 | /**
85 | * 展示BottomSheetDialog
86 | */
87 | public void bottomSheetDialog(View view) {
88 | BottomSheetDialog sheetDialog = new BottomSheetDialog(this);
89 | sheetDialog.setContentView(R.layout.sheet_dialog);
90 | sheetDialog.show();
91 | }
92 |
93 | /**
94 | * BottomSheetFragment
95 | */
96 | public void bottomSheetFragment(View view) {
97 | new BottomSheetFragment().show(getSupportFragmentManager(), "tag");
98 | }
99 |
100 | /**
101 | * 底部跟随ActionBarLayout移动的演示
102 | */
103 | public void bottomBehavior(View view) {
104 | Intent intent = new Intent(this, TwoBehaviorActivity.class);
105 | startActivity(intent);
106 | }
107 |
108 | /**
109 | * 顶部头部保持不动的Behavior
110 | */
111 | public void oneBehavior(View view) {
112 | Intent intent = new Intent(this, OneBehaviorActivity.class);
113 | startActivity(intent);
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/BottomSheetFragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.behavior;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.design.widget.BottomSheetDialogFragment;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.jinlong.newmaterialdesign.R;
12 |
13 | /**
14 | * A simple {@link Fragment} subclass.
15 | */
16 | public class BottomSheetFragment extends BottomSheetDialogFragment {
17 |
18 |
19 | public BottomSheetFragment() {
20 | // Required empty public constructor
21 | }
22 |
23 |
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
26 | Bundle savedInstanceState) {
27 | // Inflate the layout for this fragment
28 | return inflater.inflate(R.layout.fragment_bottom_sheet, container, false);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/OneBehavior.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.behavior;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.support.v4.view.ViewCompat;
7 | import android.util.AttributeSet;
8 | import android.util.Log;
9 | import android.view.View;
10 |
11 | /**
12 | * 实现一个FAB的behavior
13 | */
14 |
15 | public class OneBehavior extends CoordinatorLayout.Behavior {
16 |
17 | private String TAG = OneBehavior.class.getSimpleName();
18 |
19 | public OneBehavior(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 |
24 | @Override
25 | public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int type) {
26 | super.onStopNestedScroll(coordinatorLayout, child, target, type);
27 | }
28 |
29 | @Override
30 | public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
31 | //如果是水平移动的话响应响应的事件
32 | return axes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type);
33 | }
34 |
35 | @Override
36 | public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
37 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
38 | // 在这个方法里只处理向下滑动
39 | if(dyUnconsumed >0){
40 | return;
41 | }
42 |
43 | float transY = child.getTranslationY() - dyUnconsumed;
44 | Log.i(TAG,"------>transY:"+transY+"****** child.getTranslationY():"+child.getTranslationY()+"--->dyUnconsumed"+dyUnconsumed);
45 | if(transY > 0 && transY < getHeaderHeight()){
46 | child.setTranslationY(transY);
47 | }
48 | }
49 |
50 |
51 | @Override
52 | public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
53 | super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
54 | // 在这个方法里面只处理向上滑动
55 | if(dy < 0){
56 | return;
57 | }
58 |
59 | float transY = child.getTranslationY() - dy;
60 | Log.i(TAG,"transY:"+transY+"++++child.getTranslationY():"+child.getTranslationY()+"---->dy:"+dy);
61 | if(transY > 0){
62 | child.setTranslationY(transY);
63 | consumed[1]= dy;
64 | }
65 | }
66 |
67 | @Override
68 | public boolean onLayoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
69 | //设置了behavior的布局
70 | CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
71 | if(params!=null && params.height == CoordinatorLayout.LayoutParams.MATCH_PARENT){
72 | child.layout(0,0,parent.getWidth(),parent.getHeight());
73 | child.setTranslationY(getHeaderHeight());
74 | return true;
75 | }
76 |
77 | return super.onLayoutChild(parent, child, layoutDirection);
78 | }
79 |
80 | /**
81 | * 这里是Header的高度,可以设置成任何你想的高度
82 | */
83 | public int getHeaderHeight(){
84 | // 当你设置到相应的清单文件的时候,你就这么弄
85 | // return Context.getResources().getDimensionPixelOffset(R.dimen.header_height);
86 | return 500;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/OneBehaviorActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.behavior;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.jinlong.newmaterialdesign.R;
7 |
8 | public class OneBehaviorActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_one_behavior);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/TwoBehavior.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.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.util.Log;
8 | import android.view.View;
9 |
10 | /**
11 | * 和顶部AppBarLayout联动的behavior
12 | */
13 |
14 | public class TwoBehavior extends CoordinatorLayout.Behavior {
15 |
16 | private String TAG = TwoBehavior.class.getSimpleName();
17 |
18 | //这个千万要写,否则会出异常
19 | public TwoBehavior(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 | @Override
24 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
25 | //依赖于AppBarLayout的
26 | return dependency instanceof AppBarLayout;
27 | }
28 |
29 | @Override
30 | public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
31 | //计算出AppBarLayout移动的距离
32 | float top = Math.abs(dependency.getTop());
33 | Log.e(TAG, "AppBarLayout移动的距离" + top);
34 | child.setTranslationY(top);
35 | return true;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/behavior/TwoBehaviorActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.behavior;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.jinlong.newmaterialdesign.R;
7 |
8 | public class TwoBehaviorActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_two_behavior);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/cardView/CardViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.cardView;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.jinlong.newmaterialdesign.R;
7 |
8 | /**
9 | * CardView的展示
10 | */
11 | public class CardViewActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_card_view);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/fab/BaseRVAdapter.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.fab;
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.jinlong.newmaterialdesign.R;
10 |
11 | /**
12 | * 作者: 贺金龙 QQ:753355530
13 | * 项目名称: NewMaterialDesign
14 | * 类名称:com.jinlong.newmaterialdesign.fab
15 | * 类描述:
16 | * 创建时间: 2018/5/5 9:48
17 | * 修改内容:
18 | * 修改时间:
19 | * 修改描述:
20 | */
21 | public class BaseRVAdapter extends RecyclerView.Adapter {
22 |
23 | @Override
24 | public BaseRVAdapter.Holder onCreateViewHolder(ViewGroup parent, int viewType) {
25 | View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false);
26 | return new Holder(itemView);
27 | }
28 |
29 | @Override
30 | public void onBindViewHolder(BaseRVAdapter.Holder holder, int position) {
31 | holder.tv.setText("条目是第" + position + "条");
32 | }
33 |
34 | @Override
35 | public int getItemCount() {
36 | return 50;
37 | }
38 |
39 |
40 | class Holder extends RecyclerView.ViewHolder {
41 | private TextView tv;
42 |
43 | public Holder(View itemView) {
44 | super(itemView);
45 | tv = itemView.findViewById(R.id.tv);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/fab/FABActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.fab;
2 |
3 | import android.content.Intent;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 |
9 | import com.jinlong.newmaterialdesign.R;
10 |
11 | /**
12 | * FAB的演示
13 | */
14 | public class FABActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_fab);
20 | }
21 |
22 | /**
23 | * FAB与RecyclerView的联动
24 | */
25 | public void recyclerView(View view) {
26 | Intent intent = new Intent(this, FABAndRecyclerViewActivity.class);
27 | startActivity(intent);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/fab/FABAndRecyclerViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.fab;
2 |
3 | import android.support.design.widget.FloatingActionButton;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.Toast;
11 |
12 | import com.jinlong.newmaterialdesign.R;
13 |
14 | /**
15 | * RecyclerViewFAB联动
16 | */
17 | public class FABAndRecyclerViewActivity extends AppCompatActivity {
18 |
19 | private RecyclerView mRvContent;
20 | private String TAG = FABAndRecyclerViewActivity.class.getSimpleName();
21 | private FloatingActionButton mFab;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_faband_recycler_view);
27 |
28 | mFab = findViewById(R.id.fab);
29 |
30 | mFab.setOnClickListener(new View.OnClickListener() {
31 | @Override
32 | public void onClick(View v) {
33 | Toast.makeText(FABAndRecyclerViewActivity.this, "点击了FAB按钮", Toast.LENGTH_SHORT).show();
34 | }
35 | });
36 |
37 | mRvContent = findViewById(R.id.rv_content);
38 | mRvContent.setLayoutManager(new LinearLayoutManager(this));
39 | mRvContent.setAdapter(new BaseRVAdapter());
40 |
41 | mRvContent.addOnScrollListener(new RecyclerView.OnScrollListener() {
42 | @Override
43 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
44 | super.onScrollStateChanged(recyclerView, newState);
45 | }
46 |
47 | @Override
48 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
49 | super.onScrolled(recyclerView, dx, dy);
50 | Log.e(TAG, "onScrolled: " + dy);
51 | if (dy > 0 && mFab.getVisibility() == View.VISIBLE) {
52 | mFab.hide();
53 | } else if (dy < 0 && mFab.getVisibility() != View.VISIBLE) {
54 | mFab.show();
55 | }
56 | }
57 | });
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/fab/FABLocationActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.fab;
2 |
3 | import android.support.design.widget.FloatingActionButton;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 |
7 | import com.jinlong.newmaterialdesign.R;
8 |
9 | public class FABLocationActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_fablocation);
15 |
16 |
17 |
18 | final FloatingActionButton fab = findViewById(R.id.lyj_showbut);
19 | fab.post(new Runnable() {
20 | @Override
21 | public void run() {
22 | fab.animate()
23 | .scaleX(1)
24 | .scaleY(1)
25 | .start();
26 | }
27 | });
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/fab/ScrollAwareFABBehaviorDefault.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.fab;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.support.design.widget.FloatingActionButton;
7 | import android.support.v4.view.ViewCompat;
8 | import android.support.v4.view.ViewPropertyAnimatorListener;
9 | import android.support.v4.view.animation.FastOutSlowInInterpolator;
10 | import android.util.AttributeSet;
11 | import android.view.View;
12 | import android.view.animation.Animation;
13 | import android.view.animation.AnimationUtils;
14 | import android.view.animation.Interpolator;
15 |
16 | import com.jinlong.newmaterialdesign.R;
17 |
18 | /**
19 | * 作者: 贺金龙 QQ:753355530
20 | * 项目名称: NewMaterialDesign
21 | * 类名称:com.jinlong.newmaterialdesign.fab
22 | * 类描述:
23 | * 创建时间: 2018/5/5 16:24
24 | * 修改内容:
25 | * 修改时间:
26 | * 修改描述:
27 | */
28 | public class ScrollAwareFABBehaviorDefault extends FloatingActionButton.Behavior {
29 | public ScrollAwareFABBehaviorDefault(Context context, AttributeSet attrs) {
30 | super();
31 | }
32 |
33 | @Override
34 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
35 | final View directTargetChild, final View target, final int nestedScrollAxes) {
36 | // Ensure we react to vertical scrolling
37 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
38 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
39 |
40 | }
41 |
42 | public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
43 | final View target, final int dxConsumed, final int dyConsumed,
44 | final int dxUnconsumed, final int dyUnconsumed) {
45 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
46 | child.hide();
47 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
48 | child.show();
49 | }
50 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
51 | }
52 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/input/InputActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.input;
2 |
3 | import android.support.design.widget.TextInputLayout;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 |
7 | import com.jinlong.newmaterialdesign.R;
8 |
9 | public class InputActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_input);
15 |
16 | TextInputLayout til2 = findViewById(R.id.til2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/material/AppBarLayoutActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.material;
2 |
3 | import android.animation.ObjectAnimator;
4 | import android.support.design.widget.AppBarLayout;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.support.v7.widget.LinearLayoutManager;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.util.Log;
10 | import android.view.ViewGroup;
11 | import android.view.animation.Animation;
12 | import android.view.animation.LinearInterpolator;
13 | import android.view.animation.RotateAnimation;
14 | import android.widget.LinearLayout;
15 | import android.widget.TextView;
16 |
17 | import com.jinlong.newmaterialdesign.R;
18 |
19 | public class AppBarLayoutActivity extends AppCompatActivity {
20 |
21 | private static final String TAG = AppBarLayoutActivity.class.getSimpleName();
22 | private AppBarLayout mAbl;
23 | private TextView mTvTitle;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_app_bar_layout);
29 |
30 | mAbl = findViewById(R.id.appBar);
31 | mTvTitle = findViewById(R.id.tv_title);
32 |
33 | RecyclerView rvTab = findViewById(R.id.rv_tab);
34 | rvTab.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
35 | TabRVAdapter adapter = new TabRVAdapter();
36 | rvTab.setAdapter(adapter);
37 |
38 |
39 | mAbl.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
40 | @Override
41 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
42 |
43 | //这个是计算App bar Layout的总高度的API
44 | int totalScrollRange = appBarLayout.getTotalScrollRange();
45 |
46 | float ratio = Math.abs((float) verticalOffset / totalScrollRange);
47 |
48 | mTvTitle.setAlpha(1 - ratio);
49 |
50 | Log.e(TAG, "onOffsetChanged: " + ratio + "---" + verticalOffset);
51 | }
52 | });
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/material/MaterialActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.material;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.jinlong.newmaterialdesign.R;
7 |
8 | public class MaterialActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_material);
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/material/SupperMaterialActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.material;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.jinlong.newmaterialdesign.R;
7 |
8 | public class SupperMaterialActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_supper_material);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/material/TabRVAdapter.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.material;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.jinlong.newmaterialdesign.R;
10 |
11 | public class TabRVAdapter extends RecyclerView.Adapter {
12 |
13 |
14 | @NonNull
15 | @Override
16 | public TabHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
17 | View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_tab,parent,false);
18 | return new TabHolder(itemView);
19 | }
20 |
21 | @Override
22 | public void onBindViewHolder(@NonNull TabHolder holder, int position) {
23 |
24 | }
25 |
26 | @Override
27 | public int getItemCount() {
28 | return 5;
29 | }
30 |
31 | class TabHolder extends RecyclerView.ViewHolder{
32 | public TabHolder(View itemView) {
33 | super(itemView);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/navigation/NavigationActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.navigation;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.design.widget.NavigationView;
5 | import android.support.v4.widget.DrawerLayout;
6 | import android.support.v7.app.ActionBarDrawerToggle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 | import android.support.v7.widget.Toolbar;
10 | import android.util.Log;
11 | import android.view.Gravity;
12 | import android.view.MenuItem;
13 |
14 | import com.jinlong.newmaterialdesign.R;
15 |
16 | public class NavigationActivity extends AppCompatActivity {
17 |
18 | private String TAG = NavigationActivity.class.getSimpleName();
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_navigation);
24 |
25 | initNavigation();
26 | }
27 |
28 | private void initNavigation() {
29 | Toolbar toolbar = findViewById(R.id.toolbar);
30 | NavigationView nv_left = findViewById(R.id.nv_left);
31 | final DrawerLayout dl_content = findViewById(R.id.dl_content);
32 | nv_left.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
33 | @Override
34 | public boolean onNavigationItemSelected(@NonNull MenuItem item) {
35 | switch (item.getItemId()) {
36 | case R.id.nav_camera:
37 | Log.e(TAG, "onNavigationItemSelected: ");
38 | dl_content.closeDrawer(Gravity.LEFT);
39 | break;
40 | }
41 | return true;
42 | }
43 | });
44 |
45 | //这是带Home旋转开关按钮
46 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, dl_content,
47 | toolbar,
48 | R.string.navigation_drawer_open, R.string.navigation_drawer_close);
49 | dl_content.addDrawerListener(toggle);
50 | toggle.syncState();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/tablayout/ItemFragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.tablayout;
2 |
3 |
4 | import android.os.Bundle;
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.jinlong.newmaterialdesign.R;
11 |
12 | /**
13 | * TabLayout的条目
14 | */
15 | public class ItemFragment extends Fragment {
16 |
17 | @Override
18 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
19 | Bundle savedInstanceState) {
20 | return inflater.inflate(R.layout.fragment_item, container, false);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/tablayout/NewTabLayoutActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.tablayout;
2 |
3 | import android.support.design.widget.TabItem;
4 | import android.support.design.widget.TabLayout;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v4.app.FragmentTransaction;
7 | import android.support.v4.view.ViewPager;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.widget.TextView;
13 |
14 | import com.jinlong.newmaterialdesign.R;
15 | import com.jinlong.newmaterialdesign.toolbar.MainVPAdapter;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | /**
21 | * 动态改变标签的TabLayout
22 | */
23 | public class NewTabLayoutActivity extends AppCompatActivity {
24 |
25 | private TabLayout mTb;
26 | private ViewPager mVp;
27 | private TabLayout mTbTop;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_new_tab_layout);
33 |
34 |
35 | mTb = findViewById(R.id.tb);
36 | mTbTop = findViewById(R.id.tb_top);
37 | mVp = findViewById(R.id.vp_content);
38 |
39 | initTabVP();
40 | initListener();
41 | }
42 |
43 | private void initListener() {
44 | mTb.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
45 | @Override
46 | public void onTabSelected(TabLayout.Tab tab) {
47 |
48 | }
49 |
50 | @Override
51 | public void onTabUnselected(TabLayout.Tab tab) {
52 |
53 | }
54 |
55 | @Override
56 | public void onTabReselected(TabLayout.Tab tab) {
57 |
58 | }
59 | });
60 | }
61 |
62 | private void initTabVP() {
63 | List list = new ArrayList();
64 | for (int i = 0; i < 10; i++) {
65 | ItemFragment itemFragment = new ItemFragment();
66 | list.add(itemFragment);
67 | }
68 | MainVPAdapter vpAdapter = new MainVPAdapter(getSupportFragmentManager(), list);
69 | mVp.setAdapter(vpAdapter);
70 |
71 | mTb.setupWithViewPager(mVp);
72 | // 如果添加这句话的话,内部条目会变成20个,一般不会出现这种状态的
73 | // mTbTop.setupWithViewPager(mVp);
74 |
75 | for (int i = 0; i < list.size(); i++) {
76 | mTbTop.addTab(mTbTop.newTab().setText("标签" + i));
77 |
78 | TabLayout.Tab tabAt = mTb.getTabAt(i);
79 | tabAt.setCustomView(R.layout.tb_item_view);
80 | View customView = tabAt.getCustomView();
81 | TextView tv = customView.findViewById(R.id.tv);
82 | tv.setText("标签" + i);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/tablayout/TabLayoutActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.tablayout;
2 |
3 | import android.support.design.widget.TabLayout;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentTransaction;
6 | import android.support.v4.view.ViewPager;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 |
10 | import com.jinlong.newmaterialdesign.R;
11 | import com.jinlong.newmaterialdesign.toolbar.MainVPAdapter;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | /**
17 | * TabLayout的显示
18 | */
19 | public class TabLayoutActivity extends AppCompatActivity {
20 |
21 | private TabLayout mTb;
22 | private ViewPager mVp;
23 | private TabLayout mTbToolbar;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_tab_layout);
29 |
30 | mTb = findViewById(R.id.tb);
31 | mTbToolbar = findViewById(R.id.tb_toolbar);
32 | mVp = findViewById(R.id.vp_content);
33 |
34 | initTabVP();
35 | }
36 |
37 | /**
38 | * 设置联动
39 | */
40 | private void initTabVP() {
41 | // mTb.getTabAt(1).select();
42 | List list = new ArrayList();
43 | for (int i = 0; i < 2; i++) {
44 | ItemFragment itemFragment = new ItemFragment();
45 | list.add(itemFragment);
46 | }
47 |
48 | MainVPAdapter vpAdapter = new MainVPAdapter(getSupportFragmentManager(), list, new String[]{"标签1", "标签2"});
49 | mVp.setAdapter(vpAdapter);
50 | mTb.setupWithViewPager(mVp);
51 | mTbToolbar.setupWithViewPager(mVp);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/DefaultFragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 |
4 | import android.os.Bundle;
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.jinlong.newmaterialdesign.R;
11 |
12 | /**
13 | * 默认搜索的Fragment
14 | */
15 | public class DefaultFragment extends Fragment {
16 |
17 |
18 | public DefaultFragment() {
19 | // Required empty public constructor
20 | }
21 |
22 |
23 | @Override
24 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
25 | Bundle savedInstanceState) {
26 | // Inflate the layout for this fragment
27 | return inflater.inflate(R.layout.fragment_default, container, false);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/DefaultToolbarActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.Menu;
8 | import android.view.MenuInflater;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.jinlong.newmaterialdesign.R;
15 |
16 | /**
17 | * 这个是默认的Toolbar的展示
18 | */
19 | public class DefaultToolbarActivity extends AppCompatActivity {
20 |
21 | private Toolbar mToolbar;
22 | private TextView mTvTitle;
23 |
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_default_toolbar);
29 | mTvTitle = findViewById(R.id.tv_title);
30 |
31 | initToolbar();
32 | initToolbarListener();
33 | }
34 |
35 |
36 | private void initToolbar() {
37 | mToolbar = findViewById(R.id.toolbar);
38 | mToolbar.setTitle("");
39 | setSupportActionBar(mToolbar);
40 | }
41 |
42 | private void initToolbarListener() {
43 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View v) {
46 | Toast.makeText(DefaultToolbarActivity.this, "点击了navigationIcon", Toast.LENGTH_SHORT).show();
47 | }
48 | });
49 | mTvTitle.setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View v) {
52 | Toast.makeText(DefaultToolbarActivity.this, "点击了标题", Toast.LENGTH_SHORT).show();
53 | }
54 | });
55 | }
56 |
57 | @Override
58 | public boolean onCreateOptionsMenu(Menu menu) {
59 | //设置menu文件
60 | MenuInflater menuInflater = getMenuInflater();
61 | menuInflater.inflate(R.menu.menu_default_toolbar, menu);
62 | return true;
63 | }
64 |
65 | @Override
66 | public boolean onOptionsItemSelected(MenuItem item) {
67 | Intent intent;
68 | //menu的监听
69 | switch (item.getItemId()) {
70 | case R.id.menu_cycling:
71 | intent = new Intent(DefaultToolbarActivity.this, ZhiHuToolbarActivity.class);
72 | startActivity(intent);
73 | break;
74 | case R.id.menu_other:
75 | Toast.makeText(this, "其他", Toast.LENGTH_SHORT).show();
76 | break;
77 | case R.id.menu_yun:
78 | intent = new Intent(DefaultToolbarActivity.this, YunActivity.class);
79 | startActivity(intent);
80 | break;
81 | case R.id.menu_fragment:
82 | intent = new Intent(DefaultToolbarActivity.this, WithFragmentActivity.class);
83 | startActivity(intent);
84 | break;
85 | }
86 | return true;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/Main1Fragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
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.Toolbar;
7 | import android.view.LayoutInflater;
8 | import android.view.Menu;
9 | import android.view.MenuInflater;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 |
14 | import com.jinlong.newmaterialdesign.R;
15 |
16 | /**
17 | *
18 | */
19 | public class Main1Fragment extends Fragment {
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setHasOptionsMenu(true);
25 | }
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
29 | Bundle savedInstanceState) {
30 | return inflater.inflate(R.layout.fragment_main1, container, false);
31 | }
32 |
33 | @Override
34 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
35 | inflater.inflate(R.menu.menu_main_fragment1, menu);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.util.Log;
8 | import android.view.LayoutInflater;
9 | import android.view.Menu;
10 | import android.view.MenuInflater;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 |
15 | import com.jinlong.newmaterialdesign.R;
16 |
17 |
18 | /**
19 | * A simple {@link Fragment} subclass.
20 | */
21 | public class MainFragment extends Fragment {
22 |
23 |
24 | private static final String TAG = MainFragment.class.getSimpleName();
25 | private boolean isRefeesh;//是否刷新menu条目的标识
26 |
27 | @Override
28 | public void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setHasOptionsMenu(true);
31 | }
32 |
33 | @Override
34 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
35 | Bundle savedInstanceState) {
36 | // Inflate the layout for this fragment
37 | return inflater.inflate(R.layout.fragment_main, container, false);
38 | }
39 |
40 | @Override
41 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
42 | inflater.inflate(R.menu.menu_main_fragment, menu);
43 | }
44 |
45 | @Override
46 | public boolean onOptionsItemSelected(MenuItem item) {
47 | switch (item.getItemId()) {
48 | case R.id.fragment1:
49 | Log.e(TAG, "onOptionsItemSelected: fragment1");
50 | isRefeesh = true;
51 | getActivity().invalidateOptionsMenu();
52 | return true;
53 | case R.id.fragment2:
54 | Log.e(TAG, "onOptionsItemSelected: fragment2");
55 | return true;
56 | default:
57 | return super.onOptionsItemSelected(item);
58 | }
59 | }
60 |
61 | @Override
62 | public void onPrepareOptionsMenu(Menu menu) {
63 | MenuItem item = menu.findItem(R.id.fragment1);
64 | if (isRefeesh) {
65 | item.setTitle("刷新后的fragment1");
66 | } else {
67 | item.setTitle(item.getTitle());
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/MainVPAdapter.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v4.app.FragmentPagerAdapter;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * Created by 75335 on 2018/4/21.
13 | * 主页ViewPager的适配器
14 | */
15 |
16 | public class MainVPAdapter extends FragmentPagerAdapter {
17 | private List mList;
18 | private String[] mArrs;
19 |
20 | public MainVPAdapter(FragmentManager fm, List list) {
21 | super(fm);
22 | if (list == null) {
23 | mList = new ArrayList<>();
24 | } else {
25 | mList = list;
26 | }
27 | }
28 |
29 | public MainVPAdapter(FragmentManager fm, List list, String[] arr) {
30 | super(fm);
31 | if (list == null) {
32 | mList = new ArrayList<>();
33 | } else {
34 | mList = list;
35 | }
36 | mArrs = arr;
37 | }
38 |
39 | @Override
40 | public Fragment getItem(int position) {
41 | return mList.get(position);
42 | }
43 |
44 | @Override
45 | public int getCount() {
46 | return mList.size();
47 | }
48 |
49 | @Nullable
50 | @Override
51 | public CharSequence getPageTitle(int position) {
52 | if (mArrs == null)
53 | return super.getPageTitle(position);
54 | else
55 | return mArrs[position];
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/SearchFragment.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.text.TextUtils;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import com.jinlong.newmaterialdesign.R;
13 |
14 | /**
15 | * 搜索页面的Fragment
16 | */
17 | public class SearchFragment extends Fragment {
18 |
19 |
20 | private TextView mTvSearch;
21 |
22 | public SearchFragment() {
23 | // Required empty public constructor
24 | }
25 |
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
29 | Bundle savedInstanceState) {
30 | // Inflate the layout for this fragment
31 |
32 | View rootView = inflater.inflate(R.layout.fragment_search, container, false);
33 |
34 | mTvSearch = rootView.findViewById(R.id.tv_search);
35 | return rootView;
36 | }
37 |
38 | public void setSearchStr(String query) {
39 | if (!TextUtils.isEmpty(query))
40 | mTvSearch.setText("搜索的内容是" + query);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/WithFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.view.ViewPager;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 |
12 | import com.jinlong.newmaterialdesign.R;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * Activity和Fragment同时使用menu
19 | */
20 | public class WithFragmentActivity extends AppCompatActivity {
21 |
22 | private static final String TAG = WithFragmentActivity.class.getSimpleName();
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_with_fragment);
28 |
29 |
30 | initToolbar();
31 | setViewPager();
32 | }
33 |
34 | private void initToolbar() {
35 | Toolbar toolbar = findViewById(R.id.toolbar);
36 | toolbar.setTitle("");
37 | setSupportActionBar(toolbar);
38 | }
39 |
40 | private void setViewPager() {
41 | List list = new ArrayList<>();
42 | list.add(new MainFragment());
43 | list.add(new Main1Fragment());
44 | MainVPAdapter adapter = new MainVPAdapter(getSupportFragmentManager(), list);
45 |
46 | ViewPager vp = findViewById(R.id.vp_content);
47 | vp.setAdapter(adapter);
48 | }
49 |
50 | @Override
51 | public boolean onCreateOptionsMenu(Menu menu) {
52 | getMenuInflater().inflate(R.menu.menu_fragment, menu);
53 | return true;
54 | }
55 |
56 | @Override
57 | public boolean onOptionsItemSelected(MenuItem item) {
58 | switch (item.getItemId()) {
59 | case R.id.menu_setting:
60 | Log.e(TAG, "onOptionsItemSelected: setting");
61 | return true;
62 | case R.id.menu_other:
63 | Log.e(TAG, "onOptionsItemSelected: other" );
64 | return true;
65 | default:
66 | return super.onOptionsItemSelected(item);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/YunActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.view.MenuItemCompat;
5 | import android.support.v4.view.ViewPager;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.support.v7.widget.SearchView;
9 | import android.support.v7.widget.Toolbar;
10 | import android.util.Log;
11 | import android.view.Menu;
12 | import android.view.MenuInflater;
13 | import android.view.MenuItem;
14 | import android.view.View;
15 |
16 | import com.jinlong.newmaterialdesign.R;
17 |
18 | import java.lang.reflect.Method;
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | /**
23 | * 模仿网易云音乐的Toolbar
24 | */
25 | public class YunActivity extends AppCompatActivity {
26 |
27 | private static final String TAG = YunActivity.class.getSimpleName();
28 | private SearchView mSearchView;
29 | private ViewPager mVpContent;
30 | private SearchFragment mSearchFragment;
31 | private SearchView.SearchAutoComplete mSearchAutoComplete;
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_yun);
37 |
38 | Log.e(TAG, "onCreate: ");
39 |
40 | initToolbar();
41 | initViewPager();
42 | }
43 |
44 |
45 | private void initToolbar() {
46 | Toolbar toolbar = findViewById(R.id.toolbar);
47 | toolbar.setTitle("");
48 | setSupportActionBar(toolbar);
49 |
50 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {
51 | @Override
52 | public void onClick(View v) {
53 | if (mSearchAutoComplete.isShown()) {
54 | try {
55 | mSearchAutoComplete.setText("");//清除文本
56 | //利用反射调用收起SearchView的onCloseClicked()方法
57 | Method method = mSearchView.getClass().getDeclaredMethod("onCloseClicked");
58 | method.setAccessible(true);
59 | method.invoke(mSearchView);
60 | } catch (Exception e) {
61 | e.printStackTrace();
62 | }
63 | } else {
64 | finish();
65 | }
66 | }
67 | });
68 | }
69 |
70 | private void initViewPager() {
71 | mVpContent = findViewById(R.id.vp_content);
72 |
73 | List list = new ArrayList<>();
74 | DefaultFragment defaultFragment = new DefaultFragment();
75 | list.add(defaultFragment);
76 | mSearchFragment = new SearchFragment();
77 | list.add(mSearchFragment);
78 |
79 | MainVPAdapter adapter = new MainVPAdapter(getSupportFragmentManager(), list);
80 |
81 | mVpContent.setAdapter(adapter);
82 | }
83 |
84 | @Override
85 | public boolean onCreateOptionsMenu(Menu menu) {
86 | Log.e(TAG, "onCreateOptionsMenu: ");
87 | MenuInflater menuInflater = getMenuInflater();
88 | menuInflater.inflate(R.menu.menu_yun, menu);
89 |
90 | //获取SearchView对象
91 | MenuItem searchItem = menu.findItem(R.id.search);
92 | mSearchView = (SearchView) searchItem.getActionView();
93 |
94 | //searchView中的一些设置
95 | mSearchView.setIconifiedByDefault(false);
96 | //修改searchView的文字颜色
97 | mSearchAutoComplete = mSearchView.findViewById(R.id.search_src_text);
98 | //设置输入框提示文字样式
99 | mSearchAutoComplete.setHintTextColor(getResources().getColor(android.R.color.white));//设置提示文字颜色
100 | mSearchAutoComplete.setTextColor(getResources().getColor(android.R.color.white));//设置内容文字颜色
101 |
102 |
103 | //设置相应的监听,文字变化的监听
104 | mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
105 | @Override
106 | public boolean onQueryTextSubmit(String query) {
107 | //在文字改变的时候回调,query是改变之后的文字
108 | mSearchFragment.setSearchStr(query);
109 | return false;
110 | }
111 |
112 | @Override
113 | public boolean onQueryTextChange(String newText) {
114 | //文字提交的时候哦回调,newText是最后提交搜索的文字
115 | return false;
116 | }
117 | });
118 |
119 | mSearchView.setOnSearchClickListener(new View.OnClickListener() {
120 | @Override
121 | public void onClick(View v) {
122 | //开始搜索的时候,设置显示搜索页面
123 | mVpContent.setCurrentItem(1);
124 | }
125 | });
126 |
127 |
128 | mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
129 | @Override
130 | public boolean onClose() {
131 | //关闭搜索按钮的时候,设置显示默认页面
132 | mVpContent.setCurrentItem(0);
133 | return false;
134 | }
135 | });
136 |
137 | return super.onCreateOptionsMenu(menu);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jinlong/newmaterialdesign/toolbar/ZhiHuToolbarActivity.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign.toolbar;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.Menu;
7 | import android.view.MenuInflater;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.widget.Toast;
11 |
12 | import com.jinlong.newmaterialdesign.R;
13 |
14 | public class ZhiHuToolbarActivity extends AppCompatActivity {
15 |
16 | private Toolbar mToolbar;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_zhi_hu_toolbar);
22 |
23 | setToolBar();
24 | setToolBarListener();
25 | }
26 |
27 |
28 | private void setToolBar() {
29 | mToolbar = findViewById(R.id.toolbarZhiHu);
30 | setSupportActionBar(mToolbar);
31 | }
32 |
33 | private void setToolBarListener() {
34 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
35 | @Override
36 | public void onClick(View v) {
37 | finish();
38 | }
39 | });
40 | }
41 |
42 | @Override
43 | public boolean onCreateOptionsMenu(Menu menu) {
44 | MenuInflater menuInflater = getMenuInflater();
45 | menuInflater.inflate(R.menu.menu_zhihu, menu);
46 | return true;
47 | }
48 |
49 | @Override
50 | public boolean onOptionsItemSelected(MenuItem item) {
51 | switch (item.getItemId()) {
52 | case R.id.menu_delete:
53 | Toast.makeText(this, "删除按钮", Toast.LENGTH_SHORT).show();
54 | break;
55 | case R.id.menu_other:
56 | Toast.makeText(this, "其他按钮", Toast.LENGTH_SHORT).show();
57 | break;
58 | case R.id.menu_setting:
59 | Toast.makeText(this, "设置按钮", Toast.LENGTH_SHORT).show();
60 | break;
61 | }
62 | return true;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fab_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
13 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fab_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/draw_toolbar_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/select_pwd_visible.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/select_tint_visible.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_item_textbg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/top_tab_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_app_bar_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
25 |
26 |
34 |
35 |
43 |
44 |
45 |
46 |
51 |
52 |
53 |
58 |
59 |
64 |
65 |
71 |
72 |
78 |
79 |
85 |
86 |
92 |
93 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_behavior.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
22 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
46 |
47 |
48 |
55 |
56 |
63 |
64 |
70 |
71 |
77 |
78 |
84 |
85 |
91 |
92 |
98 |
99 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_card_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
21 |
22 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_default_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
22 |
23 |
24 |
36 |
37 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_faband_recycler_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
19 |
20 |
21 |
26 |
27 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fablocation.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
21 |
24 |
25 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_handle_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_input.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
18 |
19 |
22 |
23 |
24 |
25 |
40 |
41 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
14 |
26 |
27 |
35 |
36 |
37 |
38 |
43 |
44 |
48 |
49 |
54 |
55 |
60 |
61 |
62 |
67 |
68 |
73 |
74 |
79 |
80 |
85 |
86 |
91 |
92 |
97 |
98 |
103 |
104 |
109 |
110 |
115 |
116 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
14 |
15 |
20 |
21 |
28 |
29 |
30 |
35 |
36 |
40 |
41 |
45 |
46 |
47 |
48 |
53 |
54 |
59 |
60 |
65 |
66 |
72 |
73 |
79 |
80 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
23 |
24 |
28 |
29 |
34 |
35 |
36 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_new_tab_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
25 |
26 |
27 |
41 |
42 |
55 |
56 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_one_behavior.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
15 |
21 |
22 |
26 |
27 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_shared.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
17 |
18 |
19 |
26 |
27 |
33 |
34 |
41 |
42 |
43 |
51 |
52 |
62 |
63 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_supper_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
24 |
25 |
31 |
32 |
38 |
39 |
40 |
41 |
42 |
47 |
48 |
53 |
54 |
59 |
60 |
66 |
67 |
73 |
74 |
80 |
81 |
87 |
88 |
94 |
95 |
96 |
97 |
104 |
105 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_tab_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
30 |
31 |
32 |
33 |
46 |
47 |
51 |
52 |
56 |
57 |
58 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_transition_manager.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
26 |
27 |
32 |
33 |
40 |
41 |
42 |
47 |
48 |
52 |
53 |
58 |
59 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_two_behavior.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
20 |
21 |
22 |
26 |
27 |
31 |
32 |
38 |
39 |
45 |
46 |
52 |
53 |
59 |
60 |
66 |
67 |
68 |
69 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_with_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
23 |
24 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_yun.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
26 |
27 |
28 |
29 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_zhi_hu_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
19 |
20 |
26 |
27 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_default.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main1.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scene1.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scene2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/sheet_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
29 |
30 |
36 |
37 |
43 |
44 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tb_item_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_default_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 | -
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main_fragment1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_navation_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 |
17 |
21 |
22 |
23 | -
24 |
25 |
29 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_yun.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
12 |
13 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_zhihu.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 |
15 |
20 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/back_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/back_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/bg.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/heard_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/heard_1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/heard_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/heard_2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_linear_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_linear_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_36dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_off_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_on_white_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_on_white_36dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_blur_on_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_blur_on_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_call_merge_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_call_merge_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_call_missed_outgoing_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_call_missed_outgoing_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_call_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_call_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_chat_bubble_outline_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_chat_bubble_outline_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_delete.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_dialer_sip_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_dialer_sip_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_directions_bike_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_directions_bike_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_flash_auto_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_flash_auto_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_flash_off_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_flash_off_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_import_export_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_import_export_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_invert_colors_off_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_invert_colors_off_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_linear_scale_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_linear_scale_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_search.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_search_white_36pt_2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_search_white_36pt_2x.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_zhbook_show_directory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/ic_zhbook_show_directory.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/top_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xhdpi/top_bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/transition/changebounds_and_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/changebounds_with_arcmotion.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/enter_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/exit_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NewMaterialDesign
3 |
4 |
5 | Hello blank fragment
6 | Main2Activity
7 |
8 | Open navigation drawer
9 | Close navigation drawer
10 |
11 | Settings
12 | 这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区这里就是内容展示区
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
51 |
52 |
53 |
61 |
62 |
63 |
67 |
68 |
69 |
73 |
74 |
75 |
78 |
79 |
80 |
83 |
84 |
85 |
88 |
89 |
90 |
95 |
96 |
97 |
102 |
103 |
--------------------------------------------------------------------------------
/app/src/test/java/com/jinlong/newmaterialdesign/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.jinlong.newmaterialdesign;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.2'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/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 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngleLong/NewMaterialDesign/6d37009d5020dd9317056873e68c33260ef0c627/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 13 10:23:44 CST 2018
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-4.4-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 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------