├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── dictionaries
│ └── Pooholah.xml
├── encodings.xml
├── gradle.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── ColorMatrix.png
├── ImmersiveMode
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── example
│ │ └── android
│ │ └── immersive
│ │ ├── ImmersiveActivity.java
│ │ └── ImmersiveStickyActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_translucent_actionbar.png
│ ├── layout
│ ├── immersive_activity.xml
│ ├── immersive_sticky_activity.xml
│ └── include_content.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── halohoop
│ │ └── androiddigin
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── com
│ │ │ └── halohoop
│ │ │ └── androiddigin
│ │ │ ├── BaseAct.java
│ │ │ ├── MainActivity.java
│ │ │ ├── NavMainActivity.java
│ │ │ ├── categoris
│ │ │ └── Contents.java
│ │ │ ├── frags
│ │ │ ├── CardViewShowFragment.java
│ │ │ ├── ListDataFragment.java
│ │ │ ├── MyDialogFragment.java
│ │ │ ├── MyPerferenceFragment.java
│ │ │ ├── OneClickFragment.java
│ │ │ ├── RecyclerDataFragment.java
│ │ │ ├── RecyclerFragment.java
│ │ │ ├── ShowFragment.java
│ │ │ ├── ThreadChangeFragment.java
│ │ │ ├── TmpFragment.java
│ │ │ ├── TouchDelegateFragment.java
│ │ │ ├── VpTransformerFragment.java
│ │ │ ├── WaveWithTextsFragmentKt.kt
│ │ │ └── callbacks
│ │ │ │ └── ProgressListener.java
│ │ │ ├── managers
│ │ │ └── App.java
│ │ │ ├── materialdesign
│ │ │ ├── MDMainActivity.java
│ │ │ └── datas
│ │ │ │ ├── Cheeses.java
│ │ │ │ └── Contents.java
│ │ │ ├── showacts
│ │ │ ├── ColorMatrixActivity.java
│ │ │ ├── FragmentPopStackActivity.java
│ │ │ ├── FragmentPopStackFragment.java
│ │ │ ├── MenuUsageActivity.java
│ │ │ ├── RadialGradientActivity.java
│ │ │ ├── RevealActivity.java
│ │ │ ├── ShowActivity.java
│ │ │ ├── SweepGradientActivity.java
│ │ │ └── TmpShowActivity.java
│ │ │ ├── utils
│ │ │ └── Utils.java
│ │ │ └── widgets
│ │ │ ├── BaseSurfaceWaveView.java
│ │ │ ├── ColorMatrixView.java
│ │ │ ├── DragViewGroup.java
│ │ │ ├── EraserView_SRCOUT.java
│ │ │ ├── MagnifierView.java
│ │ │ ├── NestedScrollLayout.java
│ │ │ ├── RadialGradientRippleView.java
│ │ │ ├── RevealDrawable.java
│ │ │ ├── ScratchView.java
│ │ │ ├── SurfaceWaveView.java
│ │ │ ├── SurfaceWaveView2.java
│ │ │ ├── SweepGradientRadarView.java
│ │ │ ├── TouchDelegateViewGroup.java
│ │ │ ├── VelocityTrackerDemoView.java
│ │ │ ├── VpTransformer.java
│ │ │ ├── WaveView.java
│ │ │ └── WaveViewTmp.java
│ └── res
│ │ ├── animator
│ │ ├── slide_in_left.xml
│ │ ├── slide_in_right.xml
│ │ ├── slide_out_left.xml
│ │ └── slide_out_right.xml
│ │ ├── drawable
│ │ ├── custom_ripple.xml
│ │ ├── custom_ripple_with_item.xml
│ │ ├── cyan_clo.png
│ │ ├── ic_brightness_6_black_24dp.xml
│ │ ├── ic_build.xml
│ │ ├── ic_dashboard_black_24dp.xml
│ │ ├── ic_home_black_24dp.xml
│ │ ├── ic_notifications_black_24dp.xml
│ │ └── pic.jpg
│ │ ├── layout
│ │ ├── activity_color_matrix.xml
│ │ ├── activity_fragment_pop_stack.xml
│ │ ├── activity_magnifier.xml
│ │ ├── activity_main.xml
│ │ ├── activity_md_main.xml
│ │ ├── activity_md_main_with_parallax.xml
│ │ ├── activity_menu_usage.xml
│ │ ├── activity_nav_main.xml
│ │ ├── activity_radial_gradient.xml
│ │ ├── activity_reveal.xml
│ │ ├── activity_scratch.xml
│ │ ├── activity_sweep_gradient.xml
│ │ ├── content_menu_usage.xml
│ │ ├── dialog_fragment.xml
│ │ ├── fragment_drag.xml
│ │ ├── fragment_pop_stack.xml
│ │ ├── fragment_recycleview.xml
│ │ ├── fragment_velocitytracker.xml
│ │ ├── fragment_vp_transformer.xml
│ │ ├── fragment_wave_texts.xml
│ │ ├── item.xml
│ │ ├── item2.xml
│ │ ├── layout_cardview.xml
│ │ ├── layout_surface_wave.xml
│ │ ├── layout_thread_exchange.xml
│ │ ├── layout_wave.xml
│ │ ├── nav_header_view.xml
│ │ ├── nested_scroll_layout.xml
│ │ ├── one_click_frag.xml
│ │ ├── touch_delegate_layout.xml
│ │ ├── welcome1.xml
│ │ ├── welcome2.xml
│ │ └── welcome3.xml
│ │ ├── menu
│ │ ├── drawer_menu.xml
│ │ ├── main_menu.xml
│ │ ├── menu1.xml
│ │ └── navigation.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── raw
│ │ └── xyjy
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── ids.xml
│ │ ├── integers.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ ├── demo1.xml
│ │ └── demo2.xml
│ └── test
│ └── java
│ └── com
│ └── halohoop
│ └── androiddigin
│ └── ExampleUnitTest.java
├── build.gradle
├── device-2017-05-04-120156.gif
├── device-2017-05-04-181727.gif
├── device-2017-05-06-002903.gif
├── device-2017-05-12-010202.gif
├── device-2017-05-13-092925.gif
├── device-2017-05-15-182750.gif
├── device-2017-05-28-215217.gif
├── device-2017-06-03-183409.gif
├── device-2017-06-22-104132.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── halojbox2d-lib
├── .gitignore
├── build.gradle
├── libs
│ └── halo-jbox2d-2.3.1.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── halohoop
│ │ └── halojbox2d_lib
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── halohoop
│ └── halojbox2d_lib
│ └── ExampleUnitTest.java
├── material_design.gif
├── pics
├── 24demo0.png
├── device-2017-07-08-145619.gif
└── device-2017-07-13-004908.gif
├── settings.gradle
├── tableview
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── halohoop
│ │ └── tableview
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── halohoop
│ │ │ └── tableview
│ │ │ ├── MainActivity.java
│ │ │ ├── MyRela.java
│ │ │ ├── TableView.java
│ │ │ └── TestView.java
│ └── res
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── halohoop
│ └── tableview
│ └── ExampleUnitTest.java
├── viewpagertransdemo
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── halohoop
│ │ └── viewpagertransdemo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── halohoop
│ │ │ └── viewpagertransdemo
│ │ │ ├── MainActivity.java
│ │ │ ├── TranslateFragment.java
│ │ │ └── WelcompagerTransformer.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── welcome1.xml
│ │ ├── welcome2.xml
│ │ └── welcome3.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── halohoop
│ └── viewpagertransdemo
│ └── ExampleUnitTest.java
└── wavefloatview-lib
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── halohoop
│ └── wavefloatview
│ └── ExampleInstrumentedTest.java
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── halohoop
│ │ └── wavefloatview
│ │ ├── BaseSurfaceWaveWithTextsViewKotlin.kt
│ │ ├── WaveSurfaceWithTextsViewKotlin.kt
│ │ └── WaveWithTextView.kt
└── res
│ └── values
│ └── strings.xml
└── test
└── java
└── com
└── halohoop
└── wavefloatview
└── ExampleUnitTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /flowerfloat
9 | /volley
10 | /viewpagertransdemo
11 | /tableview
12 | /ImmersiveMode
13 | /captures
14 | /practise
15 | /prac
16 | .externalNativeBuild
17 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/dictionaries/Pooholah.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.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 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.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 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 1.8
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ColorMatrix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/ColorMatrix.png
--------------------------------------------------------------------------------
/ImmersiveMode/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ImmersiveMode/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | buildscript {
18 | repositories {
19 | mavenCentral()
20 | google()
21 | }
22 | dependencies {
23 | classpath 'com.android.tools.build:gradle:3.3.2'
24 | }
25 | }
26 | apply plugin: 'android'
27 |
28 | repositories {
29 | mavenCentral()
30 | }
31 |
32 | android {
33 | compileSdkVersion 19
34 | buildToolsVersion '25.0.0'
35 |
36 | defaultConfig {
37 | minSdkVersion 19
38 | targetSdkVersion 19
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
22 |
23 |
24 |
27 |
28 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/java/com/example/android/immersive/ImmersiveStickyActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example.android.immersive;
18 |
19 | import android.app.Activity;
20 | import android.os.Bundle;
21 | import android.os.Handler;
22 | import android.os.Message;
23 | import android.view.GestureDetector;
24 | import android.view.MotionEvent;
25 | import android.view.View;
26 |
27 | public class ImmersiveStickyActivity extends Activity {
28 | private View mDecorView;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.immersive_sticky_activity);
34 | mDecorView = getWindow().getDecorView();
35 | }
36 |
37 | @Override
38 | public void onWindowFocusChanged(boolean hasFocus) {
39 | super.onWindowFocusChanged(hasFocus);
40 | if (hasFocus) {
41 | mDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
42 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
43 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
44 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
45 | | View.SYSTEM_UI_FLAG_FULLSCREEN
46 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/ImmersiveMode/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/drawable-xxhdpi/ic_launcher_translucent_actionbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/ImmersiveMode/src/main/res/drawable-xxhdpi/ic_launcher_translucent_actionbar.png
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/layout/immersive_activity.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
21 |
22 |
23 |
28 |
32 |
33 |
39 |
40 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/layout/immersive_sticky_activity.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/layout/include_content.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
32 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | #f80
19 | #66000000
20 |
21 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Immersive Mode
19 | Immersive/Sticky
20 | Placeholder Button
21 | IMMERSIVE\nCONTENT
22 |
23 |
--------------------------------------------------------------------------------
/ImmersiveMode/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
25 |
26 |
30 |
31 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | def android_lib_version = '25.3.1'
6 |
7 | android {
8 | compileSdkVersion 25
9 | defaultConfig {
10 | applicationId "com.halohoop.androiddigin"
11 | minSdkVersion 14
12 | targetSdkVersion 25
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | vectorDrawables.useSupportLibrary = true
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(include: ['*.jar'], dir: 'libs')
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | // implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
32 | implementation "com.android.support:appcompat-v7:$android_lib_version"
33 | implementation "com.android.support:cardview-v7:$android_lib_version"
34 | implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
35 | implementation "com.android.support:design:$android_lib_version"
36 | implementation "com.android.support:support-vector-drawable:$android_lib_version"
37 | implementation "com.android.support:support-v4:$android_lib_version"
38 | implementation "com.android.support:recyclerview-v7:$android_lib_version"
39 | implementation 'com.zhy:base-adapter:2.0.0'
40 | androidTestImplementation 'junit:junit:4.12'
41 | // implementation 'com.android.volley:volley:1.0.0'
42 | // implementation project(':volley')
43 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
44 | implementation project(':wavefloatview-lib')
45 | }
46 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-studio-ide-145.3128856-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/halohoop/androiddigin/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin;
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 | * Instrumentation 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.halohoop.androiddigin", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
30 |
33 |
34 |
35 |
40 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin;
2 |
3 | import android.content.Intent;
4 | import android.content.res.Configuration;
5 | import android.os.Bundle;
6 | import android.view.Menu;
7 | import android.view.MenuInflater;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.halohoop.androiddigin.frags.ListDataFragment;
13 | import com.halohoop.androiddigin.utils.Utils;
14 |
15 | public class MainActivity extends BaseAct {
16 |
17 | private ViewGroup mViewGroup;
18 | private ListDataFragment listDataFragment;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_main);
24 | mViewGroup = (ViewGroup) findViewById(R.id.frag_container);
25 | if (!mIsBeenThroughOnSaveInstanceState) {
26 | mViewGroup.setOnClickListener(new View.OnClickListener() {
27 | @Override
28 | public void onClick(View v) {
29 | listDataFragment = ListDataFragment.newInstance(-1);
30 | getSupportFragmentManager().beginTransaction()
31 | .add(R.id.frag_container, listDataFragment, "")
32 | .commit();
33 | mIsBeenThroughOnSaveInstanceState = true;
34 | mViewGroup.setOnClickListener(null);
35 | }
36 | });
37 | Utils.showToast(this, "点击任意空白加载界面");
38 | }
39 | }
40 |
41 | @Override
42 | public boolean onCreateOptionsMenu(Menu menu) {
43 | MenuInflater inflater = getMenuInflater();
44 | inflater.inflate(R.menu.main_menu, menu);
45 | MenuItem item = menu.getItem(0);
46 | item.setTitle("切换为分类模式");
47 | return true;
48 | }
49 |
50 | //R.menu.menu1
51 | public void onMenuClick(MenuItem item) {
52 | Intent intent = new Intent(this, NavMainActivity.class);
53 | startAct(intent);
54 | finish();
55 | }
56 |
57 | @Override
58 | public void onConfigurationChanged(Configuration newConfig) {
59 | super.onConfigurationChanged(newConfig);
60 | Utils.log("MainActivity onConfigurationChanged");
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/NavMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.NonNull;
6 | import android.support.design.widget.BottomNavigationView;
7 | import android.support.v4.app.Fragment;
8 | import android.support.v4.app.FragmentManager;
9 | import android.support.v4.app.FragmentStatePagerAdapter;
10 | import android.support.v4.view.ViewPager;
11 | import android.view.Menu;
12 | import android.view.MenuInflater;
13 | import android.view.MenuItem;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 |
17 | import com.halohoop.androiddigin.categoris.Contents;
18 | import com.halohoop.androiddigin.frags.ListDataFragment;
19 | import com.halohoop.androiddigin.utils.Utils;
20 |
21 | public class NavMainActivity extends BaseAct {
22 |
23 | private ViewPager mVp;
24 | private BottomNavigationView mNavigation;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_nav_main);
30 | mNavigation = (BottomNavigationView) findViewById(R.id.navigation);
31 | mNavigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
32 | mVp = (ViewPager) findViewById(R.id.vp);
33 | mVp.setAdapter(new PagerAdapter(getSupportFragmentManager()));
34 | mVp.addOnPageChangeListener(new PageSelectedListener());
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | MenuInflater inflater = getMenuInflater();
40 | inflater.inflate(R.menu.main_menu, menu);
41 | MenuItem item = menu.getItem(0);
42 | item.setTitle("切换为全部模式");
43 | return true;
44 | }
45 |
46 | private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
47 | = new BottomNavigationView.OnNavigationItemSelectedListener() {
48 |
49 | @Override
50 | public boolean onNavigationItemSelected(@NonNull MenuItem item) {
51 | switch (item.getItemId()) {
52 | case R.id.navigation_effect:
53 | mVp.setCurrentItem(0);
54 | return true;
55 | case R.id.navigation_templete:
56 | mVp.setCurrentItem(1);
57 | return true;
58 | case R.id.navigation_interact:
59 | mVp.setCurrentItem(2);
60 | return true;
61 | }
62 | return false;
63 | }
64 | };
65 |
66 | //R.menu.menu1
67 | public void onMenuClick(MenuItem item) {
68 | Intent intent = new Intent(this, MainActivity.class);
69 | startAct(intent);
70 | finish();
71 | }
72 |
73 | private class PageSelectedListener implements ViewPager.OnPageChangeListener {
74 | @Override
75 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
76 | }
77 |
78 | @Override
79 | public void onPageSelected(int position) {
80 | //此处以后需要维护,因为需要把BottomNavigationView换掉
81 | View childAt = ((ViewGroup) mNavigation.getChildAt(0)).getChildAt(position);
82 | mNavigation.setSelectedItemId(childAt.getId());
83 | }
84 |
85 | @Override
86 | public void onPageScrollStateChanged(int state) {
87 |
88 | }
89 | }
90 |
91 | private static class PagerAdapter extends FragmentStatePagerAdapter {
92 |
93 | public PagerAdapter(FragmentManager fm) {
94 | super(fm);
95 | }
96 |
97 | @Override
98 | public Fragment getItem(int position) {
99 | Utils.log("getItem");
100 | ListDataFragment listDataFragment = ListDataFragment.newInstance(position);
101 | return listDataFragment;
102 | }
103 |
104 | @Override
105 | public int getCount() {
106 | return Contents.CATEGORIS_COUNT;
107 | }
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/CardViewShowFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.CardView;
6 | import android.view.View;
7 | import android.widget.SeekBar;
8 |
9 | import com.halohoop.androiddigin.R;
10 | import com.halohoop.androiddigin.utils.Utils;
11 |
12 | /**
13 | * Created by Pooholah on 2017/5/22.
14 | */
15 |
16 | public class CardViewShowFragment extends ShowFragment {
17 |
18 | private CardView mCardView1;
19 | private SeekBar mRadiusSeekBar;
20 | private SeekBar mElevationSeekBar;
21 | private CardView mCardView2;
22 | private CardView mCardView3;
23 | private CardView mCardView4;
24 | private CardView mCardView5;
25 |
26 | public static CardViewShowFragment newInstance(int resId) {
27 | Bundle args = new Bundle();
28 | args.putInt(LAYOUT_ID_KEY, resId);
29 | CardViewShowFragment fragment = new CardViewShowFragment();
30 | fragment.setArguments(args);
31 | return fragment;
32 | }
33 |
34 | @Override
35 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
36 | mCardView1 = (CardView) view.findViewById(R.id.cardview1);
37 | mRadiusSeekBar = (SeekBar) view.findViewById(R.id.cardview_radius_seekbar);
38 | mRadiusSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
39 | @Override
40 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
41 | Utils.log(String.format("SeekBar Radius progress : %d", progress));
42 | mCardView1.setRadius(progress);
43 | }
44 | @Override
45 | public void onStartTrackingTouch(SeekBar seekBar) {
46 | //Do nothing
47 | }
48 |
49 | @Override
50 | public void onStopTrackingTouch(SeekBar seekBar) {
51 | //Do nothing
52 | }
53 | });
54 |
55 | mElevationSeekBar = (SeekBar) view.findViewById(R.id.cardview_elevation_seekbar);
56 | mElevationSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
57 | @Override
58 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
59 | Utils.log(String.format("SeekBar Elevation progress : %d", progress));
60 | // mCardView.setElevation(progress);//api require 21
61 | mCardView1.setCardElevation(progress);
62 | }
63 | @Override
64 | public void onStartTrackingTouch(SeekBar seekBar) {
65 | //Do nothing
66 | }
67 |
68 | @Override
69 | public void onStopTrackingTouch(SeekBar seekBar) {
70 | //Do nothing
71 | }
72 | });
73 | mCardView2 = (CardView) view.findViewById(R.id.cardview2);
74 | mCardView3 = (CardView) view.findViewById(R.id.cardview3);
75 | mCardView4 = (CardView) view.findViewById(R.id.cardview4);
76 | mCardView5 = (CardView) view.findViewById(R.id.cardview5);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/MyPerferenceFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.preference.PreferenceFragment;
6 | import android.support.annotation.Nullable;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | /**
12 | * Created by Pooholah on 2017/5/18.
13 | */
14 |
15 | /**
16 | * 代表一组设置
17 | */
18 | public class MyPerferenceFragment extends PreferenceFragment {
19 |
20 | private final static String XML_RESIDS_COUNT = "xml_resids_count";
21 | private int mXmlResIdsCount = 0;
22 | private final static String XML_RESIDS = "xml_resids";
23 | private int[] mXmlResIds;
24 |
25 | public static MyPerferenceFragment newInstance(int... xmlResIds) {
26 |
27 | Bundle args = new Bundle();
28 | args.putInt(XML_RESIDS_COUNT, xmlResIds != null ? xmlResIds.length : 0);
29 | args.putIntArray(XML_RESIDS, xmlResIds);
30 | MyPerferenceFragment fragment = new MyPerferenceFragment();
31 | fragment.setArguments(args);
32 | return fragment;
33 | }
34 |
35 | @Override
36 | public void onCreate(@Nullable Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | Bundle arguments = getArguments();
39 | if (arguments != null) {
40 | mXmlResIdsCount = arguments.getInt(XML_RESIDS_COUNT);
41 | mXmlResIds = arguments.getIntArray(XML_RESIDS);
42 | if (mXmlResIdsCount > 0) {
43 | for (int i = 0; i < mXmlResIdsCount; i++) {
44 | addPreferencesFromResource(mXmlResIds[i]);
45 | }
46 | }
47 | }
48 | }
49 |
50 | @Override
51 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
52 | View view = super.onCreateView(inflater, container, savedInstanceState);
53 | view.setBackgroundColor(Color.WHITE);
54 | return view;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/OneClickFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import com.halohoop.androiddigin.R;
14 | import com.halohoop.androiddigin.utils.Utils;
15 |
16 | /**
17 | * Created by Pooholah on 2017/5/21.
18 | */
19 |
20 | public class OneClickFragment extends Fragment {
21 |
22 | private ClickListener mClickListener;
23 | private final static String WHICH = "WHICH";
24 | private final static String BG_COLOR = "BG_COLOR";
25 | private int mWhich = -1;
26 | private int mBgColor = -1;
27 |
28 | public static OneClickFragment newInstance(int which,int bgColor) {
29 |
30 | Bundle args = new Bundle();
31 | args.putInt(WHICH, which);
32 | args.putInt(BG_COLOR, bgColor);
33 | OneClickFragment fragment = new OneClickFragment();
34 | fragment.setArguments(args);
35 | return fragment;
36 | }
37 |
38 | @Override
39 | public void onAttach(Context context) {
40 | super.onAttach(context);
41 | if (context instanceof ClickListener) {
42 | mClickListener = (ClickListener) context;
43 | }
44 | }
45 |
46 | @Override
47 | public void onCreate(@Nullable Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | Bundle arguments = getArguments();
50 | if (arguments != null) {
51 | mWhich = arguments.getInt(WHICH, -1);
52 | mBgColor = arguments.getInt(BG_COLOR, Color.CYAN);
53 | }
54 | }
55 |
56 | @Nullable
57 | @Override
58 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
59 | TextView inflate = (TextView) inflater.inflate(R.layout.one_click_frag, container, false);
60 | inflate.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | if (mClickListener != null) {
64 | mClickListener.onClickInOneClick(v, mWhich);
65 | }
66 | }
67 | });
68 | inflate.setBackgroundColor(mBgColor);
69 | // inflate.setTextColor(Utils.getComplimentColor(mBgColor));
70 | //the better
71 | inflate.setTextColor(Utils.getContrastColor(mBgColor));
72 | return inflate;
73 | }
74 |
75 | @Override
76 | public void onDestroyView() {
77 | super.onDestroyView();
78 | }
79 |
80 | @Override
81 | public void onDestroy() {
82 | super.onDestroy();
83 | }
84 |
85 | public interface ClickListener {
86 | void onClickInOneClick(View v, int which);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/RecyclerDataFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import com.halohoop.androiddigin.materialdesign.datas.Cheeses;
14 |
15 | /**
16 | * Created by Pooholah on 2017/5/21.
17 | */
18 |
19 | public class RecyclerDataFragment extends RecyclerFragment {
20 | // TODO: Customize parameter argument names
21 | private static final String ITEM_DATAS = "item_datas";
22 | // TODO: Customize parameters
23 | private OnRecyclerFragmentInteractionListener mListener;
24 |
25 | public RecyclerDataFragment() {
26 | }
27 |
28 | public static RecyclerDataFragment newInstance() {
29 |
30 | Bundle args = new Bundle();
31 |
32 | RecyclerDataFragment fragment = new RecyclerDataFragment();
33 | fragment.setArguments(args);
34 | return fragment;
35 | }
36 |
37 | @Override
38 | public void onAttach(Context context) {
39 | super.onAttach(context);
40 | if (context instanceof OnRecyclerFragmentInteractionListener) {
41 | mListener = (OnRecyclerFragmentInteractionListener) context;
42 | } else {
43 | throw new RuntimeException(context.toString()
44 | + " must implement OnRecyclerFragmentInteractionListener");
45 | }
46 | }
47 |
48 | @Nullable
49 | @Override
50 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
51 | View view = super.onCreateView(inflater, container, savedInstanceState);
52 | setLayoutManager(createLayoutManager());
53 | setRecyclerAdapter(createAdapter());
54 | return view;
55 | }
56 |
57 | @Override
58 | protected RecyclerView.Adapter createAdapter() {
59 | return new Adapter();
60 | }
61 |
62 | @Override
63 | protected RecyclerView.LayoutManager createLayoutManager() {
64 | return new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
65 | }
66 |
67 | public interface OnRecyclerFragmentInteractionListener {
68 | // TODO: Update argument type and name
69 | void onListFragmentInteraction(int clickIndex);
70 | }
71 |
72 | class Adapter extends RecyclerView.Adapter{
73 |
74 | @Override
75 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
76 | View inflate = View.inflate(getActivity(), android.R.layout.simple_list_item_1, null);
77 | return new ViewHolder(inflate);
78 | }
79 |
80 | @Override
81 | public void onBindViewHolder(ViewHolder holder, int position) {
82 | holder.tv.setText(Cheeses.NAMES[position]);
83 | final ViewHolder holderTmp = holder;
84 | holder.tv.setOnClickListener(new View.OnClickListener() {
85 | @Override
86 | public void onClick(View v) {
87 | if (mListener!=null) {
88 | mListener.onListFragmentInteraction(holderTmp.getAdapterPosition());
89 | }
90 | }
91 | });
92 | }
93 |
94 | @Override
95 | public int getItemCount() {
96 | return Cheeses.NAMES.length;
97 | }
98 | }
99 |
100 | class ViewHolder extends RecyclerView.ViewHolder{
101 |
102 | TextView tv;
103 |
104 | public ViewHolder(View itemView) {
105 | super(itemView);
106 | tv = (TextView) itemView.findViewById(android.R.id.text1);
107 | }
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/ShowFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | /**
12 | * Created by Pooholah on 2017/5/17.
13 | */
14 |
15 | /**
16 | * 如果只是展示一个简单的界面的话,可以用这个
17 | */
18 | public class ShowFragment extends Fragment {
19 |
20 | private int mLayoutId = -1;
21 | protected final static String LAYOUT_ID_KEY = "layout_id_key";
22 |
23 | public ShowFragment() {
24 | }
25 |
26 | public static ShowFragment newInstance(int resId) {
27 | Bundle args = new Bundle();
28 | args.putInt(LAYOUT_ID_KEY, resId);
29 | ShowFragment fragment = new ShowFragment();
30 | fragment.setArguments(args);
31 | return fragment;
32 | }
33 |
34 | @Override
35 | public void onAttach(Context context) {
36 | super.onAttach(context);
37 | }
38 |
39 | @Override
40 | public void onCreate(@Nullable Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | }
43 |
44 | @Nullable
45 | @Override
46 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
47 | Bundle arguments = getArguments();
48 | if (arguments != null) {
49 | mLayoutId = arguments.getInt(LAYOUT_ID_KEY);
50 | return inflater.inflate(mLayoutId, null);
51 | }
52 | return null;
53 | }
54 | public static int dip2px(Context context, float dipValue){
55 | final float scale = context.getResources().getDisplayMetrics().density;
56 | return (int)(dipValue * scale + 0.5f); //+0.5是为了向上取整
57 | }
58 |
59 | @Override
60 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {
61 | super.onActivityCreated(savedInstanceState);
62 | }
63 |
64 | @Override
65 | public void onStart() {
66 | super.onStart();
67 | }
68 |
69 | @Override
70 | public void onResume() {
71 | super.onResume();
72 | }
73 |
74 | @Override
75 | public void onPause() {
76 | super.onPause();
77 | }
78 |
79 | @Override
80 | public void onStop() {
81 | super.onStop();
82 | }
83 |
84 | @Override
85 | public void onDestroyView() {
86 | super.onDestroyView();
87 | }
88 |
89 | @Override
90 | public void onDestroy() {
91 | super.onDestroy();
92 | }
93 |
94 | @Override
95 | public void onDetach() {
96 | super.onDetach();
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/ThreadChangeFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 | import android.os.SystemClock;
7 | import android.support.annotation.Nullable;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ProgressBar;
12 | import android.widget.TextView;
13 |
14 | import com.halohoop.androiddigin.R;
15 | import com.halohoop.androiddigin.frags.callbacks.ProgressListener;
16 |
17 | /**
18 | * Created by Pooholah on 2017/6/3.
19 | * 当你再一个独立的类中如何拿到主线程
20 | */
21 |
22 | public class ThreadChangeFragment extends ShowFragment implements View.OnClickListener, ProgressListener {
23 | private ProgressBar progressBar;
24 | private TextView tvProCount;
25 |
26 | public static ThreadChangeFragment newInstance(int resId) {
27 | Bundle args = new Bundle();
28 | args.putInt(LAYOUT_ID_KEY, resId);
29 | ThreadChangeFragment fragment = new ThreadChangeFragment();
30 | fragment.setArguments(args);
31 | return fragment;
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View view = super.onCreateView(inflater, container, savedInstanceState);
38 | progressBar = (ProgressBar) view.findViewById(R.id.pro_count);
39 | progressBar.setProgress(0);
40 | progressBar.setMax(100);
41 | tvProCount = (TextView) view.findViewById(R.id.tv_progress_count);
42 | view.findViewById(R.id.btn_do_sth).setOnClickListener(this);
43 | return view;
44 | }
45 |
46 | @Override
47 | public void onClick(View v) {
48 | progressBar.setProgress(0);
49 | new MyThread(this).start();
50 | }
51 |
52 | @Override
53 | public void onUpdateProgress(int progress) {
54 | progressBar.setProgress(progress);
55 | tvProCount.setText("进度:" + progress);
56 | }
57 |
58 | public static class MyThread extends Thread {
59 | Handler handler = new Handler(Looper.getMainLooper());//线程切换
60 | ProgressListener progressListener = null;
61 |
62 | public MyThread(ProgressListener progressListener) {
63 | this.progressListener = progressListener;
64 | }
65 |
66 | @Override
67 | public void run() {
68 | int count = 100;
69 | int delta = 5;
70 | int progress = 0;
71 | while (true) {
72 | final int progressFinal = progress;
73 | SystemClock.sleep(250);
74 | handler.post(new Runnable() {
75 | @Override
76 | public void run() {
77 | if (progressListener != null) {
78 | progressListener.onUpdateProgress(progressFinal);
79 | }
80 | }
81 | });
82 | progress += delta;
83 | if (progress > count) {
84 | break;
85 | }
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/TmpFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by Pooholah on 2017/5/19.
15 | */
16 |
17 | public class TmpFragment extends Fragment {
18 | public static final String TITLE = "title";
19 | private String mTitle = "Defaut Value";
20 | private List mDatas = new ArrayList();
21 |
22 | @Nullable
23 | @Override
24 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
25 | return null;
26 | }
27 |
28 |
29 | public static TmpFragment newInstance(String title) {
30 | TmpFragment TmpFragment = new TmpFragment();
31 | Bundle bundle = new Bundle();
32 | bundle.putString(TITLE, title);
33 | TmpFragment.setArguments(bundle);
34 | return TmpFragment;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/TouchDelegateFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.graphics.Color;
4 | import android.graphics.Rect;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.view.LayoutInflater;
8 | import android.view.TouchDelegate;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.RadioButton;
12 |
13 | import com.halohoop.androiddigin.R;
14 | import com.halohoop.androiddigin.widgets.TouchDelegateViewGroup;
15 |
16 | /**
17 | * Created by Pooholah on 2017/5/28.
18 | */
19 |
20 | public class TouchDelegateFragment extends ShowFragment {
21 |
22 | private TouchDelegateViewGroup delegateContainer;
23 | private RadioButton rtn;
24 |
25 | public static TouchDelegateFragment newInstance(int resId) {
26 | Bundle args = new Bundle();
27 | args.putInt(LAYOUT_ID_KEY, resId);
28 | TouchDelegateFragment fragment = new TouchDelegateFragment();
29 | fragment.setArguments(args);
30 | return fragment;
31 | }
32 |
33 | @Nullable
34 | @Override
35 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
36 | View view = super.onCreateView(inflater, container, savedInstanceState);
37 | delegateContainer = (TouchDelegateViewGroup) view.findViewById(R.id.delegate_container);
38 | rtn = (RadioButton) view.findViewById(R.id.rtn);
39 | Rect rect = new Rect(500, 500, 800, 800);
40 | delegateContainer.setDelegateAreaColor(Color.RED, rect);
41 | delegateContainer.setTouchDelegate(new TouchDelegate(rect, rtn));
42 | return view;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/VpTransformerFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.app.FragmentManager;
8 | import android.support.v4.app.FragmentPagerAdapter;
9 | import android.support.v4.view.ViewPager;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 |
14 | import com.halohoop.androiddigin.R;
15 | import com.halohoop.androiddigin.widgets.VpTransformer;
16 |
17 | /**
18 | * Created by Pooholah on 2017/5/17.
19 | */
20 |
21 | public class VpTransformerFragment extends ShowFragment {
22 |
23 | public VpTransformerFragment() {
24 | }
25 |
26 | public static VpTransformerFragment newInstance() {
27 | Bundle args = new Bundle();
28 | VpTransformerFragment fragment = new VpTransformerFragment();
29 | fragment.setArguments(args);
30 | return fragment;
31 | }
32 |
33 | @Override
34 | public void onAttach(Context context) {
35 | super.onAttach(context);
36 | }
37 |
38 | @Override
39 | public void onCreate(@Nullable Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | }
42 |
43 | @Nullable
44 | @Override
45 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
46 | View inflate = inflater.inflate(R.layout.fragment_vp_transformer, null);
47 | ViewPager vp = (ViewPager) inflate.findViewById(R.id.vp);
48 | WelcomePagerAdapter adapter = new WelcomePagerAdapter(getActivity().getSupportFragmentManager());
49 | vp.setPageTransformer(true, new VpTransformer());
50 | vp.setAdapter(adapter);
51 |
52 | return inflate;
53 | }
54 |
55 | private int[] layouts = {
56 | R.layout.welcome1,
57 | R.layout.welcome2,
58 | R.layout.welcome3
59 | };
60 | class WelcomePagerAdapter extends FragmentPagerAdapter {
61 |
62 | public WelcomePagerAdapter(FragmentManager fm) {
63 | super(fm);
64 | }
65 |
66 | @Override
67 | public Fragment getItem(int position) {
68 | return ShowFragment.newInstance(layouts[position]);
69 | }
70 |
71 | @Override
72 | public int getCount() {
73 | return 3;
74 | }
75 | }
76 |
77 | @Override
78 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {
79 | super.onActivityCreated(savedInstanceState);
80 | }
81 |
82 | @Override
83 | public void onStart() {
84 | super.onStart();
85 | }
86 |
87 | @Override
88 | public void onResume() {
89 | super.onResume();
90 | }
91 |
92 | @Override
93 | public void onPause() {
94 | super.onPause();
95 | }
96 |
97 | @Override
98 | public void onStop() {
99 | super.onStop();
100 | }
101 |
102 | @Override
103 | public void onDestroyView() {
104 | super.onDestroyView();
105 | }
106 |
107 | @Override
108 | public void onDestroy() {
109 | super.onDestroy();
110 | }
111 |
112 | @Override
113 | public void onDetach() {
114 | super.onDetach();
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/WaveWithTextsFragmentKt.kt:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.SeekBar
8 | import com.halohoop.androiddigin.R
9 | import com.halohoop.wavefloatview.WaveSurfaceWithTextsViewKotlin
10 |
11 | /**
12 | * Created by Pooholah on 2017/7/13.
13 | */
14 | class WaveWithTextsFragmentKt : ShowFragment() {
15 |
16 | companion object {
17 | @JvmStatic fun newInstance(resId: Int) : WaveWithTextsFragmentKt {
18 | val args = Bundle()
19 | args.putInt(ShowFragment.LAYOUT_ID_KEY, resId)
20 | val fragment = WaveWithTextsFragmentKt()
21 | fragment.arguments = args
22 | return fragment
23 | }
24 | }
25 |
26 | lateinit var wav: WaveSurfaceWithTextsViewKotlin;
27 | lateinit var progress: SeekBar;
28 | override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
29 | val view = super.onCreateView(inflater, container, savedInstanceState)
30 | wav = view?.findViewById(R.id.wav) as WaveSurfaceWithTextsViewKotlin
31 | progress = view?.findViewById(R.id.progress) as SeekBar
32 | progress.max = WaveSurfaceWithTextsViewKotlin.MAX_SPEED.toInt()
33 | progress.progress = 10
34 | progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
35 | override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
36 | val value = progress.toFloat()
37 | wav.mSpeed = if (value<=0) 1F else value
38 | }
39 |
40 | override fun onStartTrackingTouch(seekBar: SeekBar?) {
41 | }
42 | override fun onStopTrackingTouch(seekBar: SeekBar?) {
43 | }
44 | })
45 | /*
46 | val viewGroup = findViewById(android.R.id.content) as ViewGroup
47 | view.setOnClickListener {
48 | val progressBar = ProgressBar(this)
49 | val layoutParams = FrameLayout.LayoutParams(200, 200, Gravity.CENTER)
50 | viewGroup.addView(progressBar,layoutParams)
51 | }*/
52 | view.setOnLongClickListener {
53 | wav.text = "中abcdefghijkl文"
54 | true
55 | }
56 | return view
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/frags/callbacks/ProgressListener.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.frags.callbacks;
2 |
3 | /**
4 | * Created by Pooholah on 2017/6/3.
5 | * {@link com.halohoop.androiddigin.frags.ThreadChangeFragment}
6 | */
7 |
8 | public interface ProgressListener {
9 | void onUpdateProgress(int progress);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/managers/App.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.managers;
2 |
3 | import android.app.Application;
4 |
5 | import com.halohoop.androiddigin.categoris.Contents;
6 |
7 | /**
8 | * Created by Pooholah on 2017/5/17.
9 | */
10 |
11 | public class App extends Application {
12 | @Override
13 | public void onCreate() {
14 | super.onCreate();
15 | if (Contents.CONTENTS.length != Contents.CATEGORIS.length) {
16 | throw new RuntimeException("数量不对1");
17 | }
18 | if (Contents.CONTENTS.length != Contents.ITEM_TYPES.length) {
19 | throw new RuntimeException("数量不对2");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/materialdesign/datas/Contents.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.materialdesign.datas;
2 |
3 | /**
4 | * Created by Pooholah on 2017/5/21.
5 | * 这些数据需要换成数据库存储
6 | */
7 |
8 | public class Contents {
9 | public static String[] TABS = {
10 | "Drawer","ToolBar","Nested Scrolling"
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/FragmentPopStackFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.app.Fragment;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.util.Log;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import com.halohoop.androiddigin.R;
13 |
14 | /**
15 | * Created by Pooholah on 2017/6/15.
16 | */
17 |
18 | public class FragmentPopStackFragment extends Fragment {
19 |
20 | private TextView tv;
21 |
22 | public static FragmentPopStackFragment newInstance(String name) {
23 |
24 | Bundle args = new Bundle();
25 | args.putString("name", name);
26 | FragmentPopStackFragment fragment = new FragmentPopStackFragment();
27 | fragment.setArguments(args);
28 | return fragment;
29 | }
30 |
31 | @Nullable
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
34 | View view = inflater.inflate(R.layout.fragment_pop_stack, null);
35 | return view;
36 | }
37 |
38 | @Override
39 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
40 | super.onViewCreated(view, savedInstanceState);
41 | tv = (TextView) view.findViewById(R.id.tv);
42 | String name = getArguments().getString("name");
43 | tv.setText(name);
44 | }
45 |
46 | @Override
47 | public void onPause() {
48 | super.onPause();
49 | Log.i(TAG, "FragmentPopStackFragment: onPause:"+getTag());
50 | }
51 |
52 | @Override
53 | public void onDetach() {
54 | super.onDetach();
55 | Log.i(TAG, "FragmentPopStackFragment: onDetach:"+getTag());
56 | }
57 |
58 |
59 |
60 | private static final String TAG = "FragmentPopStackFragmen";
61 |
62 | // @Override
63 | // public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
64 | // return super.onCreateAnimation(transit, enter, nextAnim);
65 | // }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/MenuUsageActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.support.design.widget.FloatingActionButton;
6 | import android.support.design.widget.Snackbar;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.view.Menu;
10 | import android.view.MenuInflater;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 |
14 | import com.halohoop.androiddigin.R;
15 | import com.halohoop.androiddigin.utils.Utils;
16 |
17 | public class MenuUsageActivity extends AppCompatActivity {
18 |
19 | private CoordinatorLayout coordinar;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_menu_usage);
25 | coordinar = (CoordinatorLayout) findViewById(R.id.coordinar);
26 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
27 | setSupportActionBar(toolbar);
28 |
29 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
30 | fab.setOnClickListener(new View.OnClickListener() {
31 | @Override
32 | public void onClick(View view) {
33 | Utils.log("onClick 's view is:"+view.getClass().getSimpleName());
34 | //Snackbar出现的同时fab按钮会向上调整位置,以腾出空间
35 | // Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
36 | // .setAction("Action", null).show();
37 | Snackbar.make(coordinar, "Replace with your own action", Snackbar.LENGTH_LONG)
38 | .setAction("Action", null).show();
39 | //Snackbar出现的同时fab按钮不会向上调整位置,不能腾出空间
40 | // Snackbar.make(coordinar的父亲view,如果有的话, "Replace with your own action", Snackbar.LENGTH_LONG)
41 | // .setAction("Action", null).show();
42 | }
43 | });
44 | }
45 |
46 | @Override
47 | public boolean onCreateOptionsMenu(Menu menu) {
48 | MenuInflater inflater = getMenuInflater();
49 | inflater.inflate(R.menu.menu1, menu);
50 | return true;
51 | }
52 |
53 | //R.menu.menu1
54 | public void onSettingsClick(MenuItem item) {
55 | Utils.showToast(this,"吐司1");
56 | }
57 |
58 | //R.menu.menu1
59 | public void onTestPrefClick(MenuItem item) {
60 | Utils.showToast(this,"吐司2");
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/RadialGradientActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | import com.halohoop.androiddigin.R;
8 | import com.halohoop.androiddigin.widgets.RadialGradientRippleView;
9 |
10 | public class RadialGradientActivity extends AppCompatActivity {
11 |
12 | private RadialGradientRippleView mRgwv;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_radial_gradient);
18 | mRgwv = (RadialGradientRippleView) findViewById(R.id.rgwv);
19 | }
20 |
21 | public void minusRippleWidth(View view) {
22 | mRgwv.setmRadiusWidth(mRgwv.getmRadiusWidth() - 10);
23 | }
24 |
25 | public void plusRippleWidth(View view) {
26 | mRgwv.setmRadiusWidth(mRgwv.getmRadiusWidth() + 10);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/RevealActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.graphics.drawable.Drawable;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.ImageView;
9 | import android.widget.Toast;
10 |
11 | import com.halohoop.androiddigin.R;
12 | import com.halohoop.androiddigin.utils.Utils;
13 | import com.halohoop.androiddigin.widgets.RevealDrawable;
14 |
15 | public class RevealActivity extends AppCompatActivity implements View.OnClickListener {
16 |
17 | private RevealDrawable revealDrawable;
18 | private int level = 0;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | ImageView imageView = new ImageView(RevealActivity.this);
24 | Drawable unSelectedDrawable = getResources().getDrawable(R.drawable.pic);
25 | Drawable selectedDrawable = Utils.handleDrawable(getResources(),
26 | ((BitmapDrawable) unSelectedDrawable).getBitmap());
27 | revealDrawable = new RevealDrawable(selectedDrawable, unSelectedDrawable);
28 | imageView.setImageDrawable(revealDrawable);
29 | imageView.setOnClickListener(this);
30 | setContentView(imageView);
31 | Toast.makeText(this, "Click Please!", Toast.LENGTH_SHORT).show();
32 | }
33 |
34 | @Override
35 | public void onClick(View v) {
36 | level += 250;
37 | if (level > 10000) {
38 | level %= 10000;
39 | }
40 | revealDrawable.setLevel(level);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/ShowActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | /**
9 | * Created by Pooholah on 2017/5/18.
10 | */
11 |
12 | public class ShowActivity extends AppCompatActivity {
13 | public final static String RES_ID = "res_id";
14 | public final static String SHOW_ACTIONBAR = "show_actionbar";
15 | @Override
16 | public void onCreate(@Nullable Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | Intent intent = getIntent();
19 | int resId = intent.getIntExtra(RES_ID, -1);
20 | boolean showActionbar = intent.getBooleanExtra(SHOW_ACTIONBAR, false);
21 | if (!showActionbar) {
22 | //全屏
23 | // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
24 | // WindowManager.LayoutParams.FLAG_FULLSCREEN);
25 | getSupportActionBar().hide();
26 | }
27 | if (resId == -1) {
28 | throw new RuntimeException("请传入需要展示的layout 的 id");
29 | }
30 | setContentView(resId);
31 | additionalActionsAfterSCV();
32 | }
33 |
34 | protected void additionalActionsAfterSCV() {
35 | }
36 |
37 | @Override
38 | protected void onNewIntent(Intent intent) {
39 | super.onNewIntent(intent);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/SweepGradientActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | import com.halohoop.androiddigin.R;
8 | import com.halohoop.androiddigin.widgets.SweepGradientRadarView;
9 |
10 | import java.util.Random;
11 |
12 | public class SweepGradientActivity extends AppCompatActivity implements View.OnClickListener {
13 |
14 | private SweepGradientRadarView sgrv;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_sweep_gradient);
20 | sgrv = (SweepGradientRadarView) findViewById(R.id.sgrv);
21 | findViewById(R.id.iv).setOnClickListener(this);
22 | sgrv.setOnClickListener(this);
23 | }
24 |
25 | @Override
26 | public void onClick(View v) {
27 | switch (v.getId()) {
28 | case R.id.iv:
29 | Random random = new Random();
30 | int i = random.nextInt(26) + 65;
31 | sgrv.newSpot((char) i + "");
32 | break;
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/showacts/TmpShowActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.showacts;
2 |
3 | /**
4 | * Created by Pooholah on 2017/5/19.
5 | */
6 |
7 | public class TmpShowActivity extends ShowActivity {
8 | @Override
9 | protected void additionalActionsAfterSCV() {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/BaseSurfaceWaveView.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.support.annotation.WorkerThread;
6 | import android.util.AttributeSet;
7 | import android.view.SurfaceHolder;
8 | import android.view.SurfaceView;
9 |
10 | /**
11 | * Created by Pooholah on 2017/7/7.
12 | */
13 |
14 | public abstract class BaseSurfaceWaveView extends SurfaceView implements SurfaceHolder.Callback {
15 |
16 | private final Object mSurfaceLock = new Object();
17 | // private RenderThread mRenderThread;
18 |
19 | private RenderThread mRenderThread;
20 |
21 | public BaseSurfaceWaveView(Context context) {
22 | this(context, null);
23 | }
24 |
25 | public BaseSurfaceWaveView(Context context, AttributeSet attrs) {
26 | this(context, attrs, 0);
27 | }
28 |
29 | public BaseSurfaceWaveView(Context context, AttributeSet attrs, int defStyleAttr) {
30 | super(context, attrs, defStyleAttr);
31 | getHolder().addCallback(this);
32 | }
33 |
34 | @Override
35 | public void surfaceCreated(SurfaceHolder holder) {
36 | mRenderThread = new RenderThread(holder);
37 | mRenderThread.start();//开始绘制
38 | }
39 |
40 | @Override
41 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
42 |
43 | }
44 |
45 | @Override
46 | public void surfaceDestroyed(SurfaceHolder holder) {
47 | synchronized (mSurfaceLock) {
48 | mRenderThread.setIsRun(false);
49 | }
50 | }
51 |
52 | private class RenderThread extends Thread {
53 |
54 | private static final long SLEEP_TIME = 16;
55 | private SurfaceHolder mSurfaceHolder;
56 | private boolean mIsRunning = true;
57 |
58 | public RenderThread(SurfaceHolder holder) {
59 | this.mSurfaceHolder = holder;
60 | }
61 |
62 | public void setIsRun(boolean isRun) {
63 | mIsRunning = isRun;
64 | }
65 |
66 | @Override
67 | public void run() {
68 | long startTime = System.currentTimeMillis();
69 | while (true) {
70 | if (!mIsRunning) {
71 | return;
72 | }
73 | Canvas canvas = mSurfaceHolder.lockCanvas();
74 | if (canvas!=null) {
75 | onRender(canvas, System.currentTimeMillis() - startTime);
76 | //绘制完成
77 | mSurfaceHolder.unlockCanvasAndPost(canvas);
78 | }
79 | try {
80 | Thread.sleep(SLEEP_TIME);
81 | } catch (InterruptedException e) {
82 | e.printStackTrace();
83 | }
84 | }
85 | }
86 | }
87 |
88 | @WorkerThread
89 | protected abstract void onRender(Canvas canvas, long l);
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/ColorMatrixView.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.ColorMatrix;
7 | import android.graphics.ColorMatrixColorFilter;
8 | import android.graphics.Paint;
9 | import android.graphics.drawable.BitmapDrawable;
10 | import android.support.annotation.Nullable;
11 | import android.util.AttributeSet;
12 | import android.view.View;
13 |
14 | import com.halohoop.androiddigin.R;
15 |
16 | /**
17 | * Created by Pooholah on 2017/5/4.
18 | */
19 |
20 | public class ColorMatrixView extends View {
21 |
22 | private Bitmap bitmap;
23 | private Bitmap newBitmap;
24 | private Canvas canvas;
25 |
26 | public ColorMatrixView(Context context) {
27 | this(context, null);
28 | }
29 |
30 | public ColorMatrixView(Context context, @Nullable AttributeSet attrs) {
31 | this(context, attrs, 0);
32 | }
33 |
34 | public ColorMatrixView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
35 | super(context, attrs, defStyleAttr);
36 | this.bitmap = ((BitmapDrawable) getResources().getDrawable(R.drawable.pic)).getBitmap();
37 | newBitmap = getNewBitmap(this.bitmap, null);
38 | }
39 |
40 | private Bitmap getNewBitmap(Bitmap bitmap, Paint paint) {
41 | Bitmap newBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
42 | Bitmap.Config.ARGB_8888);
43 | canvas = new Canvas(newBitmap);
44 | canvas.drawBitmap(bitmap, 0, 0, paint);
45 | return newBitmap;
46 | }
47 |
48 | public void change(float[] colors) {//4*5矩阵 length==20
49 | if (colors == null || colors.length != 20) {
50 | return;
51 | }
52 |
53 | ColorMatrix colorMatrix = new ColorMatrix(colors);
54 | Paint paint = new Paint();
55 | paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
56 | this.newBitmap = getNewBitmap(this.bitmap, paint);
57 | invalidate();
58 | }
59 |
60 |
61 | @Override
62 | protected void onDraw(Canvas canvas) {
63 | super.onDraw(canvas);
64 | canvas.drawBitmap(bitmap, 0, 0, null);
65 | canvas.translate(bitmap.getWidth() + 10, 0);
66 | canvas.drawBitmap(newBitmap, 0, 0, null);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/DragViewGroup.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.widget.ViewDragHelper;
7 | import android.util.AttributeSet;
8 | import android.util.Log;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.RelativeLayout;
13 |
14 | /**
15 | * Created by Pooholah on 2017/5/18.
16 | */
17 |
18 | public class DragViewGroup extends RelativeLayout {
19 |
20 | private View childAt0;
21 | private View childAt1;
22 | private ViewDragHelper viewDragHelper;
23 |
24 | public DragViewGroup(@NonNull Context context, @Nullable AttributeSet attrs) {
25 | super(context, attrs);
26 | viewDragHelper = ViewDragHelper.create(this, new CallBack());
27 | viewDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
28 | }
29 |
30 | private ViewGroup findContentLayout(ViewGroup parent) {
31 | if (parent == null) {
32 | return null;
33 | }
34 | if (parent.getId() != android.R.id.content) {
35 | return findContentLayout((ViewGroup) parent.getParent());
36 | } else {
37 | return parent;
38 | }
39 | }
40 |
41 | @Override
42 | public boolean onInterceptTouchEvent(MotionEvent ev) {
43 | return viewDragHelper.shouldInterceptTouchEvent(ev);
44 | }
45 |
46 | @Override
47 | public boolean onTouchEvent(MotionEvent event) {
48 | viewDragHelper.processTouchEvent(event);
49 | return true;
50 | }
51 |
52 | @Override
53 | protected void onFinishInflate() {
54 | super.onFinishInflate();
55 | childAt0 = getChildAt(0);
56 | childAt1 = getChildAt(1);
57 | }
58 |
59 | class CallBack extends ViewDragHelper.Callback {
60 |
61 | @Override
62 | public boolean tryCaptureView(View child, int pointerId) {
63 | return child == childAt0/* || childAt1 == child*/;
64 | }
65 |
66 | @Override
67 | public int clampViewPositionHorizontal(View child, int left, int dx) {
68 | return left;
69 | }
70 |
71 | @Override
72 | public int clampViewPositionVertical(View child, int top, int dy) {
73 | return top;
74 | }
75 |
76 | @Override
77 | public void onEdgeDragStarted(int edgeFlags, int pointerId) {
78 | super.onEdgeDragStarted(edgeFlags, pointerId);
79 | Log.i(TAG, "onEdgeDragStarted: " + edgeFlags);
80 | viewDragHelper.captureChildView(childAt1, pointerId);
81 | }
82 |
83 | @Override
84 | public void onEdgeTouched(int edgeFlags, int pointerId) {
85 | super.onEdgeTouched(edgeFlags, pointerId);
86 | Log.i(TAG, "onEdgeTouched: " + edgeFlags);
87 | }
88 |
89 | @Override
90 | public boolean onEdgeLock(int edgeFlags) {
91 | Log.i(TAG, "onEdgeLock: " + edgeFlags);
92 | return (edgeFlags&ViewDragHelper.EDGE_LEFT)==ViewDragHelper.EDGE_LEFT;
93 | }
94 | }
95 |
96 | private static final String TAG = "DragViewGroup";
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/EraserView_SRCOUT.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.graphics.PorterDuff;
10 | import android.graphics.PorterDuffXfermode;
11 | import android.util.AttributeSet;
12 | import android.view.MotionEvent;
13 | import android.view.View;
14 |
15 | /**
16 | * Created by Pooholah on 2017/5/15.
17 | */
18 |
19 | public class EraserView_SRCOUT extends View {
20 | private Paint mBitPaint;
21 | private Bitmap BmpDST,BmpSRC;
22 | private Path mPath;
23 | private float mPreX,mPreY;
24 | public EraserView_SRCOUT(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 |
27 | setLayerType(View.LAYER_TYPE_SOFTWARE, null);
28 | mBitPaint = new Paint();
29 | mBitPaint.setColor(Color.RED);
30 | mBitPaint.setStyle(Paint.Style.STROKE);
31 | mBitPaint.setStrokeWidth(45);
32 |
33 | mPath = new Path();
34 | }
35 |
36 | private Bitmap createBgBitmap(int w, int h, String text) {
37 | Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
38 | Canvas canvas = new Canvas(bitmap);
39 | canvas.drawColor(Color.WHITE);
40 | Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
41 | float textSize = 70;
42 | paint.setTextSize(textSize);
43 | int cx = w / 2;
44 | int cy = h / 2;
45 | float measureText = paint.measureText(text);
46 | //将文字画在中间
47 | canvas.drawText(text, cx - measureText / 2, cy + textSize / 2, paint);
48 | canvas = null;
49 | paint = null;
50 | return bitmap;
51 | }
52 |
53 | @Override
54 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
55 | super.onSizeChanged(w, h, oldw, oldh);
56 | BmpSRC = createBgBitmap(w, h, "You Won!");
57 | BmpDST = Bitmap.createBitmap(BmpSRC.getWidth(), BmpSRC.getHeight(), Bitmap.Config.ARGB_8888);
58 | }
59 |
60 | @Override
61 | protected void onDraw(Canvas canvas) {
62 | super.onDraw(canvas);
63 |
64 | int layerId = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG);
65 |
66 | //先把手指轨迹画到目标Bitmap上
67 | Canvas c = new Canvas(BmpDST);
68 | c.drawPath(mPath,mBitPaint);
69 |
70 | //然后把目标图像画到画布上
71 | canvas.drawBitmap(BmpDST,0,0,mBitPaint);
72 |
73 | //计算源图像区域
74 | mBitPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
75 | canvas.drawBitmap(BmpSRC,0,0,mBitPaint);
76 |
77 | mBitPaint.setXfermode(null);
78 | canvas.restoreToCount(layerId);
79 | }
80 |
81 |
82 | @Override
83 | public boolean onTouchEvent(MotionEvent event) {
84 | switch (event.getAction()){
85 | case MotionEvent.ACTION_DOWN:
86 | mPath.moveTo(event.getX(),event.getY());
87 | mPreX = event.getX();
88 | mPreY = event.getY();
89 | return true;
90 | case MotionEvent.ACTION_MOVE:
91 | float endX = (mPreX+event.getX())/2;
92 | float endY = (mPreY+event.getY())/2;
93 | mPath.quadTo(mPreX,mPreY,endX,endY);
94 | mPreX = event.getX();
95 | mPreY =event.getY();
96 | break;
97 | case MotionEvent.ACTION_UP:
98 | break;
99 | }
100 | postInvalidate();
101 | return super.onTouchEvent(event);
102 | }
103 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/TouchDelegateViewGroup.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.Rect;
8 | import android.support.annotation.AttrRes;
9 | import android.support.annotation.ColorInt;
10 | import android.support.annotation.NonNull;
11 | import android.support.annotation.Nullable;
12 | import android.util.AttributeSet;
13 | import android.widget.FrameLayout;
14 |
15 | /**
16 | * Created by Pooholah on 2017/5/28.
17 | */
18 |
19 | public class TouchDelegateViewGroup extends FrameLayout {
20 | private int color = Color.RED;
21 | private Rect rect = null;
22 | private Paint paint = null;
23 |
24 | public TouchDelegateViewGroup(@NonNull Context context) {
25 | super(context);
26 | }
27 |
28 | public TouchDelegateViewGroup(@NonNull Context context, @Nullable AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public TouchDelegateViewGroup(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
33 | super(context, attrs, defStyleAttr);
34 | }
35 |
36 | public void setDelegateAreaColor(@ColorInt int color, Rect rect) {
37 | paint = new Paint();
38 | paint.setStyle(Paint.Style.FILL);
39 | paint.setColor(color);
40 | this.rect = rect;
41 | invalidate();
42 | }
43 |
44 | @Override
45 | protected void onDraw(Canvas canvas) {
46 | super.onDraw(canvas);
47 | if (rect != null) {
48 | canvas.drawRect(rect, paint);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/VelocityTrackerDemoView.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.Rect;
8 | import android.support.annotation.Nullable;
9 | import android.util.AttributeSet;
10 | import android.view.MotionEvent;
11 | import android.view.VelocityTracker;
12 | import android.view.View;
13 | import android.view.ViewConfiguration;
14 |
15 | /**
16 | * Created by Pooholah on 2017/6/15.
17 | */
18 |
19 | public class VelocityTrackerDemoView extends View {
20 |
21 |
22 | public VelocityTrackerDemoView(Context context) {
23 | super(context);
24 | }
25 |
26 | public VelocityTrackerDemoView(Context context, @Nullable AttributeSet attrs) {
27 | super(context, attrs);
28 | }
29 |
30 | public VelocityTrackerDemoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
31 | super(context, attrs, defStyleAttr);
32 | }
33 |
34 | private VelocityTracker mVelocityTracker;
35 | private int mMaxVelocity;
36 | private int mPointerId;
37 |
38 | @Override
39 | public boolean onTouchEvent(MotionEvent event) {
40 | if (mVelocityTracker != null) {
41 | mVelocityTracker.addMovement(event);
42 | }
43 | switch (event.getAction()) {
44 | case MotionEvent.ACTION_DOWN:
45 | mVelocityTracker = VelocityTracker.obtain();
46 | mMaxVelocity = ViewConfiguration.get(getContext()).getMaximumFlingVelocity();
47 | mPointerId = event.getPointerId(0);
48 | break;
49 | case MotionEvent.ACTION_MOVE:
50 | //求伪瞬时速度
51 | mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
52 | final float velocityX = mVelocityTracker.getXVelocity(mPointerId);
53 | final float velocityY = mVelocityTracker.getYVelocity(mPointerId);
54 | updateData(velocityX, velocityY);
55 | break;
56 | case MotionEvent.ACTION_UP:
57 | case MotionEvent.ACTION_CANCEL:
58 | releaseVelocityTracker();
59 | break;
60 | }
61 | return true;
62 | }
63 |
64 | float velocityX;
65 | float velocityY;
66 |
67 | private void updateData(float velocityX, float velocityY) {
68 | this.velocityX = velocityX;
69 | this.velocityY = velocityY;
70 | invalidate();
71 | }
72 |
73 | @Override
74 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
75 | super.onSizeChanged(w, h, oldw, oldh);
76 | mPaint.setTextSize(20);
77 | if (mRect == null) {
78 | mRect = new Rect();
79 | }
80 | mPaint.getTextBounds("VelocityX:", 0, "VelocityX:".length() - 1, mRect);
81 | }
82 |
83 | private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
84 | private Rect mRect = null;
85 |
86 | @Override
87 | protected void onDraw(Canvas canvas) {
88 | canvas.drawColor(Color.WHITE);
89 | canvas.drawText("滑动空白区域得到x/y方向速度值:", 0, mRect.bottom + 30, mPaint);
90 | canvas.drawText("VelocityX:" + velocityX, 0, 200+mRect.bottom, mPaint);
91 | canvas.drawText("VelocityY:" + velocityY, 0, 250+mRect.bottom + mRect.bottom, mPaint);
92 | }
93 |
94 | private void releaseVelocityTracker() {
95 | if (null != mVelocityTracker) {
96 | mVelocityTracker.clear();
97 | mVelocityTracker.recycle();
98 | mVelocityTracker = null;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/app/src/main/java/com/halohoop/androiddigin/widgets/VpTransformer.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin.widgets;
2 |
3 | import android.support.v4.view.ViewPager;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | /**
8 | * Created by Pooholah on 2017/6/22.
9 | */
10 |
11 | public class VpTransformer implements ViewPager.PageTransformer {
12 | @Override
13 | public void transformPage(View page, float position) {
14 | if (position <= 0 && position >= -1) {
15 | ViewGroup v = (ViewGroup) page;
16 | int childCount = v.getChildCount();
17 | for (int i = 0; i < childCount; i++) {
18 | View childView = v.getChildAt(i);
19 | childView.setTranslationX(v.getWidth() * (-position));
20 | }
21 | } else if (position <= 1 && position >= 0) {
22 | ViewGroup v = (ViewGroup) page;
23 | int childCount = v.getChildCount();
24 | for (int i = 0; i < childCount; i++) {
25 | View childView = v.getChildAt(i);
26 | childView.setPivotX(childView.getWidth() >> 1);
27 | childView.setPivotY(childView.getHeight() >> 1);
28 | float fraction = 0;
29 | if (position <= 0) {
30 | fraction = (0 - position) / 1f;
31 | } else if (position > 0) {
32 | fraction = (1 - position) / 1f;
33 | }
34 | childView.setRotation(360 * (1 - fraction));
35 | float factor = (float) Math.random() * 3;
36 | if (childView.getTag() == null) {
37 | childView.setTag(factor);
38 | } else {
39 | factor = (float) childView.getTag();
40 | }
41 | childView.setTranslationX(factor * childView.getWidth() * (+position));
42 | }
43 | }
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/slide_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/slide_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/slide_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_ripple_with_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | -
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cyan_clo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/drawable/cyan_clo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_brightness_6_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_build.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dashboard_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/drawable/pic.jpg
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fragment_pop_stack.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
28 |
29 |
30 |
34 |
35 |
41 |
42 |
48 |
49 |
50 |
55 |
56 |
62 |
63 |
69 |
70 |
71 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_magnifier.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_md_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
16 |
17 |
21 |
22 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
46 |
55 |
56 |
57 |
58 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_md_main_with_parallax.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
22 |
23 |
32 |
33 |
41 |
42 |
43 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
61 |
70 |
71 |
72 |
73 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_menu_usage.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_nav_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_radial_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
27 |
28 |
29 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_reveal.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_scratch.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sweep_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_menu_usage.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_drag.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_pop_stack.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_recycleview.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_velocitytracker.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_vp_transformer.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_wave_texts.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
16 |
20 |
21 |
26 |
27 |
32 |
37 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
17 |
18 |
22 |
23 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
21 |
22 |
27 |
28 |
36 |
37 |
41 |
42 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_surface_wave.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_thread_exchange.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_wave.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nested_scroll_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
32 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/one_click_frag.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/touch_delegate_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/welcome1.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
27 |
28 |
36 |
37 |
42 |
43 |
51 |
52 |
53 |
54 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/welcome2.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
27 |
28 |
33 |
34 |
42 |
43 |
44 |
53 |
54 |
63 |
64 |
72 |
73 |
80 |
81 |
88 |
89 |
97 |
98 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/drawer_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/xyjy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/app/src/main/res/raw/xyjy
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4285f4
4 | #3367d6
5 | #FFC400
6 |
7 |
8 | #99FFC400
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 | 16dp
5 | 16dp
6 | 16dp
7 |
8 |
9 | 200dp
10 | 10dp
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/integers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -1080
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidDigIn
3 | HaloMaterial
4 | MenuUsageActivity
5 | NavMainActivity
6 | 交互
7 | 套路
8 | 特效
9 | username
10 | password
11 | Open
12 | Close
13 | FragmentPopStackActivity
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/demo1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/demo2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/test/java/com/halohoop/androiddigin/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.androiddigin;
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 | ext.kotlin_version = '1.3.21'
5 | ext.anko_version = '0.10.1'
6 | repositories {
7 | maven { url 'https://maven.aliyun.com/repository/google' }
8 | maven { url 'https://maven.aliyun.com/repository/jcenter' }
9 | mavenCentral()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.3.2'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
15 |
16 | // NOTE: Do not place your application dependencies here; they belong
17 | // in the individual module build.gradle files
18 | }
19 | }
20 |
21 | allprojects {
22 | repositories {
23 | maven { url 'https://maven.aliyun.com/repository/google' }
24 | maven { url 'https://maven.aliyun.com/repository/jcenter' }
25 | mavenCentral()
26 | }
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/device-2017-05-04-120156.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-04-120156.gif
--------------------------------------------------------------------------------
/device-2017-05-04-181727.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-04-181727.gif
--------------------------------------------------------------------------------
/device-2017-05-06-002903.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-06-002903.gif
--------------------------------------------------------------------------------
/device-2017-05-12-010202.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-12-010202.gif
--------------------------------------------------------------------------------
/device-2017-05-13-092925.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-13-092925.gif
--------------------------------------------------------------------------------
/device-2017-05-15-182750.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-15-182750.gif
--------------------------------------------------------------------------------
/device-2017-05-28-215217.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-05-28-215217.gif
--------------------------------------------------------------------------------
/device-2017-06-03-183409.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-06-03-183409.gif
--------------------------------------------------------------------------------
/device-2017-06-22-104132.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/device-2017-06-22-104132.gif
--------------------------------------------------------------------------------
/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 | org.gradle.caching=true
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Apr 16 02:44:51 CST 2019
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.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/halojbox2d-lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/halojbox2d-lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 |
6 | defaultConfig {
7 | minSdkVersion 14
8 | targetSdkVersion 25
9 | versionCode 1
10 | versionName "1.0"
11 |
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 |
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | implementation fileTree(dir: 'libs', include: ['*.jar'])
25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
26 | exclude group: 'com.android.support', module: 'support-annotations'
27 | })
28 | implementation 'com.android.support:appcompat-v7:25.3.1'
29 | testImplementation 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/halojbox2d-lib/libs/halo-jbox2d-2.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/halojbox2d-lib/libs/halo-jbox2d-2.3.1.jar
--------------------------------------------------------------------------------
/halojbox2d-lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-studio-ide-145.3128856-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/halojbox2d-lib/src/androidTest/java/com/halohoop/halojbox2d_lib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.halojbox2d_lib;
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 | * Instrumentation 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.halohoop.halojbox2d_lib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/halojbox2d-lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/halojbox2d-lib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | halojbox2d-lib
3 |
4 |
--------------------------------------------------------------------------------
/halojbox2d-lib/src/test/java/com/halohoop/halojbox2d_lib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.halojbox2d_lib;
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 | }
--------------------------------------------------------------------------------
/material_design.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/material_design.gif
--------------------------------------------------------------------------------
/pics/24demo0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/pics/24demo0.png
--------------------------------------------------------------------------------
/pics/device-2017-07-08-145619.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/pics/device-2017-07-08-145619.gif
--------------------------------------------------------------------------------
/pics/device-2017-07-13-004908.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/pics/device-2017-07-13-004908.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':flowerfloat', ':tableview', ':viewpagertransdemo', ':prac', ':wavefloatview-lib', ':halojbox2d-lib'
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tableview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/tableview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 |
6 | defaultConfig {
7 | applicationId "com.halohoop.tableview"
8 | minSdkVersion 11
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | implementation fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | implementation 'com.android.support:appcompat-v7:25.3.1'
30 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
31 | androidTestImplementation 'junit:junit:4.12'
32 | }
33 |
--------------------------------------------------------------------------------
/tableview/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-studio-ide-145.3128856-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/tableview/src/androidTest/java/com/halohoop/tableview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
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 | * Instrumentation 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.halohoop.tableview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tableview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tableview/src/main/java/com/halohoop/tableview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tableview/src/main/java/com/halohoop/tableview/MyRela.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.widget.RelativeLayout;
7 |
8 | /**
9 | * Created by Pooholah on 2017/6/22.
10 | */
11 |
12 | public class MyRela extends RelativeLayout {
13 | public MyRela(Context context) {
14 | super(context);
15 | }
16 |
17 | public MyRela(Context context, AttributeSet attrs) {
18 | super(context, attrs);
19 | }
20 |
21 | public MyRela(Context context, AttributeSet attrs, int defStyleAttr) {
22 | super(context, attrs, defStyleAttr);
23 | }
24 |
25 | @Override
26 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
27 | int w = MeasureSpec.getSize(widthMeasureSpec);
28 | int h = MeasureSpec.getSize(heightMeasureSpec);
29 | int wm = MeasureSpec.getMode(widthMeasureSpec);
30 | int hm = MeasureSpec.getMode(heightMeasureSpec);
31 | Log.i(TAG, "onMeasure: MyRelativeLayout:w:" + wm + "--h:" + hm);
32 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
33 | }
34 |
35 | private static final String TAG = "MyRelativeLayout";
36 | }
37 |
--------------------------------------------------------------------------------
/tableview/src/main/java/com/halohoop/tableview/TableView.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.ViewGroup;
6 |
7 | /**
8 | * Created by Pooholah on 2017/6/21.
9 | */
10 |
11 | public class TableView extends ViewGroup {
12 | public TableView(Context context) {
13 | super(context);
14 | }
15 |
16 | public TableView(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public TableView(Context context, AttributeSet attrs, int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | @Override
25 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tableview/src/main/java/com/halohoop/tableview/TestView.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | /**
11 | * Created by Pooholah on 2017/6/21.
12 | */
13 |
14 | public class TestView extends View {
15 | public TestView(Context context) {
16 | super(context);
17 | }
18 |
19 | public TestView(Context context, @Nullable AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 | public TestView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
24 | super(context, attrs, defStyleAttr);
25 | }
26 |
27 | // @Override
28 | // protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
29 | // int wSize = MeasureSpec.getSize(widthMeasureSpec);
30 | // int hSize = MeasureSpec.getSize(heightMeasureSpec);
31 | // int wMode = MeasureSpec.getMode(widthMeasureSpec);
32 | // int hMode = MeasureSpec.getMode(heightMeasureSpec);
33 | // int newWSpec = MeasureSpec.makeMeasureSpec(wSize/*大小自己改*/, MeasureSpec.EXACTLY);
34 | // int newHSpec = MeasureSpec.makeMeasureSpec(hSize/*大小自己改*/, MeasureSpec.EXACTLY);
35 | // super.onMeasure(newWSpec, newHSpec);
36 | //
37 | // }
38 |
39 |
40 | @Override
41 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
42 | int measuredWidth = getMeasuredWidth();
43 | int measuredHeight = getMeasuredHeight();
44 | int w = MeasureSpec.getSize(widthMeasureSpec);
45 | // Log.i(TAG, "onMeasure1: "+measuredWidth);
46 | // Log.i(TAG, "onMeasure1: "+measuredHeight);
47 | // Log.i(TAG, "onMeasure1: "+w);
48 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
49 | int wMode = MeasureSpec.getMode(widthMeasureSpec);
50 | int hMode = MeasureSpec.getMode(heightMeasureSpec);
51 |
52 | ViewGroup.LayoutParams layoutParams = getLayoutParams();
53 |
54 | int width = 0;
55 | int height = 0;
56 | if (wMode == MeasureSpec.AT_MOST) {
57 | width = 150;
58 | Log.i(TAG, "onMeasure: W-AtMost");
59 | } else {
60 | width = layoutParams.width;
61 | Log.i(TAG, "onMeasure: W-Exa");
62 | }
63 |
64 | if (hMode == MeasureSpec.AT_MOST) {
65 | height = 150;
66 | Log.i(TAG, "onMeasure: H-AtMost");
67 | } else {
68 | height = layoutParams.height;
69 | Log.i(TAG, "onMeasure: H-Exa");
70 | }
71 | // Log.i(TAG, "onMeasure: -------"+isLayoutRequested());
72 | Log.i(TAG, "onMeasure: --------------");
73 |
74 | setMeasuredDimension(width, height);
75 | }
76 |
77 | private static final String TAG = "TestView";
78 | }
79 |
--------------------------------------------------------------------------------
/tableview/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/tableview/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/tableview/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/tableview/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/tableview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TableView
3 |
4 |
--------------------------------------------------------------------------------
/tableview/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tableview/src/test/java/com/halohoop/tableview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.tableview;
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 | }
--------------------------------------------------------------------------------
/viewpagertransdemo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/viewpagertransdemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 |
6 | defaultConfig {
7 | applicationId "com.halohoop.viewpagertransdemo"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | implementation fileTree(dir: 'libs', include: ['*.jar'])
25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
26 | exclude group: 'com.android.support', module: 'support-annotations'
27 | })
28 | implementation 'com.android.support:appcompat-v7:25.3.1'
29 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
30 | androidTestImplementation 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/viewpagertransdemo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-studio-ide-145.3128856-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/androidTest/java/com/halohoop/viewpagertransdemo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.viewpagertransdemo;
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 | * Instrumentation 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.halohoop.viewpagertransdemo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/java/com/halohoop/viewpagertransdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.viewpagertransdemo;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v4.app.FragmentPagerAdapter;
7 | import android.support.v4.view.ViewPager;
8 | import android.support.v7.app.AppCompatActivity;
9 |
10 | public class MainActivity extends AppCompatActivity {
11 |
12 | private ViewPager vp;
13 | private int[] layouts = {
14 | R.layout.welcome1,
15 | R.layout.welcome2,
16 | R.layout.welcome3
17 | };
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_main);
23 |
24 | vp = (ViewPager)findViewById(R.id.vp);
25 |
26 | WelcomePagerAdapter adapter = new WelcomePagerAdapter(getSupportFragmentManager());
27 | vp.setAdapter(adapter);
28 |
29 | vp.setPageTransformer(true, new WelcompagerTransformer());
30 |
31 | }
32 |
33 | class WelcomePagerAdapter extends FragmentPagerAdapter {
34 |
35 | public WelcomePagerAdapter(FragmentManager fm) {
36 | super(fm);
37 | }
38 |
39 | @Override
40 | public Fragment getItem(int position) {
41 | Fragment f = new TranslateFragment();
42 | Bundle bundle = new Bundle();
43 | bundle.putInt("layoutId", layouts[position]);
44 | f.setArguments(bundle );
45 | return f;
46 | }
47 |
48 | @Override
49 | public int getCount() {
50 | // TODO Auto-generated method stub
51 | return 3;
52 | }
53 |
54 |
55 |
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/java/com/halohoop/viewpagertransdemo/TranslateFragment.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.viewpagertransdemo;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | public class TranslateFragment extends Fragment {
11 |
12 | @Override
13 | @Nullable
14 | public View onCreateView(LayoutInflater inflater,
15 | @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
16 |
17 | Bundle bundle = getArguments();
18 | int layoutId = bundle.getInt("layoutId");
19 |
20 | View view = inflater.inflate(layoutId, null);
21 | return view;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/java/com/halohoop/viewpagertransdemo/WelcompagerTransformer.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.viewpagertransdemo;
2 |
3 | import android.support.v4.view.ViewPager.PageTransformer;
4 | import android.util.Log;
5 | import android.view.View;
6 |
7 | import static android.content.ContentValues.TAG;
8 |
9 | public class WelcompagerTransformer implements PageTransformer {
10 |
11 | @Override
12 | public void transformPage(View view, float position) {
13 | Log.i(TAG, "transformPage1: "+view+"---"+position);
14 | if(position<=1&&position>=-1){
15 | // ViewGroup v = (ViewGroup) view.findViewById(R.id.rl);
16 | // int childCount = v.getChildCount();
17 | // for (int i = 0; i < childCount; i++) {
18 | // View childView = v.getChildAt(i);
19 | // float factor = (float) Math.random()*3;
20 | // if(childView.getTag()==null){
21 | // childView.setTag(factor);
22 | // }else{
23 | // factor = (float) childView.getTag();
24 | // }
25 | // /*
26 | // * position : 0 ~ -1
27 | // * translationX: 0 ~ childView.getWidth();
28 | // */
29 | // childView.setTranslationX(factor*v.getWidth()*(+position));
30 | // childView.setPivotX(childView.getWidth()>>1);
31 | // childView.setPivotY(childView.getHeight() >> 1);
32 | // float fraction = 0;
33 | // if (position <= 0) {
34 | // fraction = (0 - position) / 1f;
35 | // } else if (position > 0) {
36 | // fraction = (1 - position) / 1f;
37 | // }
38 | // childView.setRotation(720 * 3 * (1 - fraction));
39 | // Log.i(TAG, "transformPage: left:"+childView+"----"+childView.getLeft());
40 | // }
41 | // float fraction = 0;
42 | // if (position<=0) {
43 | // fraction = (0 - position) / 1f;
44 | // }else if(position>0){
45 | // fraction = (1 - position) / 1f;
46 | // }
47 | // Log.i(TAG, "transformPage: fraction:"+view+"----"+fraction);
48 | // for (int i = 0; i < childCount; i++) {
49 | // View childView = v.getChildAt(i);
50 | // /**
51 | // * position : 0 ~ -1
52 | // * translationX: 0 ~ childView.getWidth();
53 | // */
54 | // childView.setTranslationX((v.getWidth()>>1)*fraction);
55 | // }
56 |
57 | // ViewGroup v = (ViewGroup) view;
58 | // int childCount = v.getChildCount();
59 | // for (int i = 0; i < childCount; i++) {
60 | // View childView = v.getChildAt(i);
61 | // childView.setPivotX(childView.getWidth()>>1);
62 | // childView.setPivotY(childView.getHeight() >> 1);
63 | // float fraction = 0;
64 | // if (position <= 0) {
65 | // fraction = (0 - position) / 1f;
66 | // } else if (position > 0) {
67 | // fraction = (1 - position) / 1f;
68 | // }
69 | // childView.setRotation(360 * (1 - fraction));
70 | // childView.setTranslationX(v.getWidth() * (-position));
71 | // }
72 |
73 |
74 | //��1
75 | // view.setScaleX(1-Math.abs(position));
76 | // view.setScaleY(1-Math.abs(position));
77 | //��2
78 | view.setScaleX(Math.max(0.9f,1-Math.abs(position)));
79 | view.setScaleY(Math.max(0.9f,1-Math.abs(position)));
80 | //Ч��3 3D��ת
81 | // view.setPivotX(position<0f?view.getWidth():0f);//���ҳ�棺0~-1���ұߵ�ҳ�棺1~0
82 | // view.setPivotY(view.getHeight()*0.5f);
83 | // view.setRotationY(position*45f);//0~90��
84 | //Ч��4 3D�ڷ�ת
85 | // view.setPivotX(position<0f?view.getWidth():0f);//���ҳ�棺0~-1���ұߵ�ҳ�棺1~0
86 | // view.setPivotY(view.getHeight()*0.5f);
87 | // view.setRotationY(-position*45f);//0~90��
88 |
89 | view.setPivotX(view.getWidth()*0.5f);//���ҳ�棺0~-1���ұߵ�ҳ�棺1~0
90 | view.setPivotY(view.getHeight()*0.5f);
91 | view.setRotationY(-position*45f);//0~90��
92 |
93 |
94 | }
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/layout/welcome1.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
26 |
27 |
34 |
35 |
40 |
41 |
49 |
50 |
51 |
52 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halohoop/AndroidDigIn/338cc6c957a5e4c9acdae929afdc0233a3f65c71/viewpagertransdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ViewPagerTransDemo
3 |
4 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/viewpagertransdemo/src/test/java/com/halohoop/viewpagertransdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.viewpagertransdemo;
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 | }
--------------------------------------------------------------------------------
/wavefloatview-lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/wavefloatview-lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 25
7 |
8 | defaultConfig {
9 | minSdkVersion 14
10 | targetSdkVersion 25
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
28 | exclude group: 'com.android.support', module: 'support-annotations'
29 | })
30 | implementation 'com.android.support:appcompat-v7:25.3.1'
31 | androidTestImplementation 'junit:junit:4.12'
32 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
33 | }
34 |
--------------------------------------------------------------------------------
/wavefloatview-lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-studio-ide-145.3128856-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/wavefloatview-lib/src/androidTest/java/com/halohoop/wavefloatview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.wavefloatview;
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 | * Instrumentation 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.halohoop.wavefloatview.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/wavefloatview-lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/wavefloatview-lib/src/main/java/com/halohoop/wavefloatview/BaseSurfaceWaveWithTextsViewKotlin.kt:
--------------------------------------------------------------------------------
1 | package com.halohoop.wavefloatview
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.support.annotation.WorkerThread
6 | import android.util.AttributeSet
7 | import android.util.Log
8 | import android.view.SurfaceHolder
9 | import android.view.SurfaceView
10 | import java.util.concurrent.locks.Lock
11 | import java.util.concurrent.locks.ReentrantLock
12 |
13 | /**
14 | * Created by Pooholah on 2017/7/7.
15 | */
16 |
17 | abstract class BaseSurfaceWaveWithTextsViewKotlin(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : SurfaceView(context, attrs, defStyleAttr), SurfaceHolder.Callback {
18 |
19 | private var mRenderThread: RenderThread? = null
20 |
21 | init {
22 | holder.addCallback(this)
23 | }
24 |
25 | /**first constructor**/
26 | constructor(context: Context?) : this(context, null) {}
27 |
28 | /**secondary constructor**/
29 | constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0) {}
30 |
31 | override fun surfaceCreated(holder: SurfaceHolder) {
32 | startLoopDraw()
33 | }
34 |
35 | override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
36 | }
37 |
38 | override fun surfaceDestroyed(holder: SurfaceHolder) {
39 | lock(lockObj,{
40 | stopLoopDraw()
41 | })
42 | }
43 |
44 | fun startLoopDraw() {
45 | if (mRenderThread != null && mRenderThread!!.mIsRunning) {
46 | return
47 | }
48 | mRenderThread = RenderThread(holder)
49 | mRenderThread!!.start()//开始绘制
50 | }
51 |
52 | fun stopLoopDraw() {
53 | mRenderThread!!.mIsRunning = false
54 | mRenderThread = null
55 | }
56 |
57 | val lockObj = ReentrantLock()
58 |
59 | fun lock(lock: Lock, body: () -> T) {
60 | lock.lock()
61 | try {
62 | body()
63 | }
64 | finally {
65 | lock.unlock()
66 | }
67 | }
68 |
69 | private inner class RenderThread(private val mSurfaceHolder: SurfaceHolder) : Thread() {
70 | var mIsRunning = true
71 |
72 | override fun run() {
73 | val startTime = System.currentTimeMillis()
74 | while (true) {
75 | if (!mIsRunning) {
76 | // return@lock
77 | Log.i("halohoop", "Halohoop--" + "stop")
78 | break
79 | }
80 | val canvas = mSurfaceHolder.lockCanvas()
81 | if (canvas != null) {
82 | lock(lockObj, {
83 | if (mIsRunning) {
84 | onThreadRenderDraw(canvas, System.currentTimeMillis() - startTime)
85 | }
86 | })
87 | //绘制完成
88 | mSurfaceHolder.unlockCanvasAndPost(canvas)
89 | }
90 | try {
91 | Thread.sleep(SLEEP_TIME)
92 | } catch (e: InterruptedException) {
93 | e.printStackTrace()
94 | }
95 | }
96 | }
97 |
98 | }
99 |
100 | companion object {
101 | private val SLEEP_TIME: Long = 16
102 | }
103 |
104 | @WorkerThread
105 | protected abstract fun onThreadRenderDraw(canvas: Canvas, l: Long)
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/wavefloatview-lib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | WaveFloatView
3 |
4 |
--------------------------------------------------------------------------------
/wavefloatview-lib/src/test/java/com/halohoop/wavefloatview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.halohoop.wavefloatview;
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 | }
--------------------------------------------------------------------------------