├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── dictionaries
│ └── miraclewong.xml
├── vcs.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
├── modules.xml
└── misc.xml
├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── dimens.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miraclewong
│ │ │ └── androidheros
│ │ │ └── MainActivity.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── androidheros
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── android2048
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── rushapp
│ │ │ └── android2048
│ │ │ ├── Card.java
│ │ │ └── MainActivity.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── rushapp
│ │ └── android2048
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── game2048
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── dimens.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miraclewong
│ │ │ └── game2048
│ │ │ └── MainActivity.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── game2048
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── imageshape
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ ├── drawable
│ │ │ │ ├── layer.xml
│ │ │ │ ├── button.xml
│ │ │ │ └── button_selector.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miraclewong
│ │ │ └── imageshape
│ │ │ ├── MainActivity.java
│ │ │ └── Clock.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── imageshape
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── mylistview
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── in_icon.png
│ │ │ │ ├── chatitem_in_bg.9.png
│ │ │ │ └── chatitem_out_bg.9.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── focus.xml
│ │ │ │ ├── flexible.xml
│ │ │ │ ├── chat_item_main.xml
│ │ │ │ ├── notify_item.xml
│ │ │ │ ├── scroll_hide.xml
│ │ │ │ ├── chat_item_itemin.xml
│ │ │ │ ├── chat_item_itemout.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── notify.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── miraclewong
│ │ │ │ └── mylistview
│ │ │ │ ├── ChatItemListViewBean.java
│ │ │ │ ├── FlexibleListViewTest.java
│ │ │ │ ├── FocusListViewTest.java
│ │ │ │ ├── FlexibleListView.java
│ │ │ │ ├── NotifyTest.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── NotifyAdapter.java
│ │ │ │ ├── ChatItemListViewTest.java
│ │ │ │ ├── FocusListViewAdapter.java
│ │ │ │ ├── ChatItemListViewAdapter.java
│ │ │ │ └── ScrollHideListView.java
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── mylistview
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── notificationdemo
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── robot.png
│ │ │ │ ├── ic_public.png
│ │ │ │ ├── ic_secret.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_private.png
│ │ │ │ └── robot_expanded.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── notification.xml
│ │ │ │ ├── notification_expanded.xml
│ │ │ │ └── activity_main.xml
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── notificationdemo
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── recyclerviewtest
├── .gitignore
├── .idea
│ ├── .name
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── vcs.xml
│ ├── libraries
│ │ ├── support_annotations_22_2_1.xml
│ │ ├── palette_v7_22_2_1.xml
│ │ ├── cardview_v7_22_2_1.xml
│ │ ├── recyclerview_v7_22_2_1.xml
│ │ ├── appcompat_v7_22_2_1.xml
│ │ ├── support_v13_22_2_1.xml
│ │ └── support_v4_22_2_1.xml
│ ├── runConfigurations.xml
│ ├── compiler.xml
│ ├── gradle.xml
│ ├── modules.xml
│ └── misc.xml
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── strings.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── layout
│ │ │ │ ├── rc_item.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── cardview.xml
│ │ │ │ └── recycler.xml
│ │ │ └── values-w820dp
│ │ │ │ └── dimens.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miraclewong
│ │ │ └── recyclerviewtest
│ │ │ ├── RecyclerTest2.java
│ │ │ ├── MainActivity.java
│ │ │ ├── RecyclerTest3.java
│ │ │ ├── RecyView.java
│ │ │ ├── RecyclerAdapter.java
│ │ │ └── RecyclerTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── recyclerviewtest
│ │ └── ApplicationTest.java
├── local.properties
├── proguard-rules.pro
├── build.gradle
└── gradlew.bat
├── systemwidget
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── test1.png
│ │ │ │ ├── test2.png
│ │ │ │ ├── test3.png
│ │ │ │ └── test4.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── attrs.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ ├── layout
│ │ │ │ ├── volume.xml
│ │ │ │ ├── circle_progress.xml
│ │ │ │ ├── shine_textview.xml
│ │ │ │ ├── my_textview.xml
│ │ │ │ ├── teaching.xml
│ │ │ │ ├── topbar.xml
│ │ │ │ ├── topbar_test.xml
│ │ │ │ ├── activity_event.xml
│ │ │ │ ├── my_scrollview.xml
│ │ │ │ └── activity_main.xml
│ │ │ └── drawable
│ │ │ │ └── blue_button.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── miraclewong
│ │ │ │ └── systemwidget
│ │ │ │ ├── EventActivity.java
│ │ │ │ ├── view
│ │ │ │ ├── MyView.java
│ │ │ │ ├── MyViewGroupB.java
│ │ │ │ └── MyViewGroupA.java
│ │ │ │ ├── MyViewTest.java
│ │ │ │ ├── TopBarTest.java
│ │ │ │ ├── MyTextView.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── ShineTextView.java
│ │ │ │ ├── VolumeView.java
│ │ │ │ ├── TeachingView.java
│ │ │ │ ├── CircleProgressView.java
│ │ │ │ └── MyScrollView.java
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── systemwidget
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── viewanimationdemo
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── dimens.xml
│ │ │ ├── animator
│ │ │ │ └── scalex.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miraclewong
│ │ │ └── viewanimationdemo
│ │ │ └── MainActivity.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── miraclewong
│ │ └── viewanimationdemo
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── settings.gradle
├── README.md
├── .gitignore
├── gradle.properties
├── AndroidHeros.iml
├── LICENSE
└── gradlew.bat
/.idea/.name:
--------------------------------------------------------------------------------
1 | AndroidHeros
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android2048/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/game2048/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/imageshape/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/mylistview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/notificationdemo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/recyclerviewtest/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/systemwidget/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/viewanimationdemo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/.name:
--------------------------------------------------------------------------------
1 | recyclerviewtest
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/dictionaries/miraclewong.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/drawable/in_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/drawable/in_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/game2048/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/game2048/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/game2048/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/game2048/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/drawable-hdpi/test1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/drawable-hdpi/test1.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/drawable-hdpi/test2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/drawable-hdpi/test2.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/drawable-hdpi/test3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/drawable-hdpi/test3.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/drawable-hdpi/test4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/drawable-hdpi/test4.png
--------------------------------------------------------------------------------
/game2048/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/game2048/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/game2048/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/game2048/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imageshape/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/imageshape/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imageshape/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/imageshape/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/recyclerviewtest/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android2048/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/android2048/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android2048/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/android2048/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android2048/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/android2048/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android2048/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/android2048/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imageshape/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/imageshape/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imageshape/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/imageshape/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/drawable/chatitem_in_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/drawable/chatitem_in_bg.9.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/drawable/chatitem_out_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/drawable/chatitem_out_bg.9.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mylistview/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/mylistview/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/robot.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/ic_public.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/ic_public.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/ic_secret.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/ic_secret.png
--------------------------------------------------------------------------------
/systemwidget/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/systemwidget/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/ic_private.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/ic_private.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/recyclerviewtest/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/recyclerviewtest/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/recyclerviewtest/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/recyclerviewtest/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':mylistview', ':recyclerviewtest', ':game2048', ':systemwidget', ':android2048', ':imageshape', ':notificationdemo', ':viewanimationdemo'
2 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/viewanimationdemo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/viewanimationdemo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/viewanimationdemo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/mipmap-xhdpi/robot_expanded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/notificationdemo/src/main/res/mipmap-xhdpi/robot_expanded.png
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiracleWong/AndroidHeros/HEAD/viewanimationdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #48bafe
4 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/game2048/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidHeros
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/game2048/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Game2048
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ImageShape
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MyListView
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SystemWidget
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NotificationDemo
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ViewAnimationDemo
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/game2048/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/game2048/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidHeros
2 | [@xuyisheng](https://github.com/xuyisheng) 的新书《Android群侠传》的代码。通过敲写代码的方式进行学习。可能会和官方提供的代码不一样。
3 | 官方的源代码的地址:[《Android 群英传》源代码](https://github.com/xuyisheng/AndroidHeroes)
4 |
5 | 今天才发现,Repository的名称居然写错了,应该是Android Heroes,请大家不要在乎这些。
6 |
7 |
8 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Android2048
3 |
4 | Hello world!
5 | Settings
6 | Score
7 |
8 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 19 10:12:27 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/recyclerviewtest/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 26 14:06:40 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 10dp
6 |
7 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values-v21/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Android2048
4 |
5 | Hello world!
6 | Settings
7 | Score
8 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 | =======
9 | # Built application files
10 | *.apk
11 | *.ap_
12 |
13 | # Files for the Dalvik VM
14 | *.dex
15 | /*/build/
16 |
17 | # Proguard folder generated by Eclipse
18 | proguard/
19 |
20 | # Log Files
21 | *.log
22 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/android2048/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/game2048/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/animator/scalex.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/game2048/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/android2048/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RecyclerViewTest
3 |
4 | Hello world!
5 | Settings
6 |
7 |
8 | - LinearLayoutManager
9 | - GridLayoutManager
10 |
11 |
12 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/drawable/layer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/volume.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/layout/rc_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 | 10dp
7 |
8 |
--------------------------------------------------------------------------------
/android2048/src/androidTest/java/com/rushapp/android2048/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.rushapp.android2048;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/game2048/src/androidTest/java/com/miraclewong/game2048/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.game2048;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/focus.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/miraclewong/androidheros/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.androidheros;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/imageshape/src/androidTest/java/com/miraclewong/imageshape/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.imageshape;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/mylistview/src/androidTest/java/com/miraclewong/mylistview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/systemwidget/src/androidTest/java/com/miraclewong/systemwidget/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/imageshape/src/main/res/drawable/button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 | -->
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/notificationdemo/src/androidTest/java/com/miraclewong/notificationdemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.notificationdemo;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/recyclerviewtest/src/androidTest/java/com/miraclewong/recyclerviewtest/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/EventActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | /**
7 | * Created by miraclewong on 16/1/23.
8 | */
9 | public class EventActivity extends Activity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_event);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/androidTest/java/com/miraclewong/viewanimationdemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.viewanimationdemo;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/flexible.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/circle_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/recyclerviewtest/local.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by Android Studio.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 | #
7 | # Location of the SDK. This is only used by Gradle.
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | #Mon Oct 26 14:06:41 CST 2015
11 | sdk.dir=/Users/miraclewong/Android/sdk
12 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/shine_textview.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/my_textview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/teaching.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/support_annotations_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/chat_item_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.androidheros"
9 | minSdkVersion 22
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/game2048/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.game2048"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/palette_v7_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android2048/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.rushapp.android2048"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/imageshape/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.imageshape"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/cardview_v7_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/drawable/blue_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/systemwidget/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.systemwidget"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/notificationdemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.notificationdemo"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/viewanimationdemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.viewanimationdemo"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | }
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/recyclerview_v7_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/game2048/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/topbar.xml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/android2048/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/game2048/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/imageshape/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/mylistview/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/systemwidget/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/notificationdemo/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/recyclerviewtest/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/viewanimationdemo/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 /Users/miraclewong/Android/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 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/layout/notification.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/notify_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/recyclerviewtest/.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 |
--------------------------------------------------------------------------------
/game2048/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/android2048/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/imageshape/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/scroll_hide.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/mylistview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.mylistview"
9 | minSdkVersion 22
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:support-v4:22.2.1'
25 | compile 'com.android.support:support-v13:22.2.1'
26 | compile 'com.android.support:appcompat-v7:22.2.1'
27 | }
28 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/appcompat_v7_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/support_v13_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/ChatItemListViewBean.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | public class ChatItemListViewBean {
6 |
7 | private int type;
8 | private String text;
9 | private Bitmap icon;
10 |
11 | public ChatItemListViewBean() {
12 | }
13 |
14 | public int getType() {
15 | return type;
16 | }
17 |
18 | public void setType(int type) {
19 | this.type = type;
20 | }
21 |
22 | public String getText() {
23 | return text;
24 | }
25 |
26 | public void setText(String text) {
27 | this.text = text;
28 | }
29 |
30 | public Bitmap getIcon() {
31 | return icon;
32 | }
33 |
34 | public void setIcon(Bitmap icon) {
35 | this.icon = icon;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/recyclerviewtest/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.miraclewong.recyclerviewtest"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:cardview-v7:22.2.1'
25 | compile 'com.android.support:palette-v7:22.2.1'
26 | compile 'com.android.support:recyclerview-v7:22.2.1'
27 | compile 'com.android.support:appcompat-v7:22.2.1'
28 | }
29 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/chat_item_itemin.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/chat_item_itemout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
17 |
18 |
23 |
24 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/FlexibleListViewTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.widget.ArrayAdapter;
6 |
7 | public class FlexibleListViewTest extends Activity {
8 |
9 | private FlexibleListView mFlexibleListView;
10 | private String[] data = new String[30];
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.flexible);
16 | for (int i = 0; i < 30; i++) {
17 | data[i] = "" + i;
18 | }
19 | mFlexibleListView = (FlexibleListView) findViewById(R.id.flexible_listview);
20 | mFlexibleListView.setAdapter(new ArrayAdapter(this,
21 | android.R.layout.simple_list_item_1,
22 | data));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/libraries/support_v4_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/systemwidget/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AndroidHeros.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/layout/cardview.xml:
--------------------------------------------------------------------------------
1 |
13 |
22 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/RecyclerTest2.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class RecyclerTest2 extends Activity {
10 |
11 | private RecyView mRcList;
12 | private List mData = new ArrayList();
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | mData.add("Recycler");
18 | mData.add("Recycler");
19 | mData.add("Recycler");
20 | mRcList = new RecyView(RecyclerTest2.this);
21 | mRcList.setmData(mData);
22 | // FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
23 | // mRcList.setLayoutParams(params);
24 | mRcList.init(getBaseContext());
25 |
26 | setContentView(mRcList);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/topbar_test.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
24 |
25 |
--------------------------------------------------------------------------------
/recyclerviewtest/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/view/MyView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 |
9 | public class MyView extends View {
10 |
11 | public MyView(Context context) {
12 | super(context);
13 | }
14 |
15 | public MyView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public MyView(Context context, AttributeSet attrs,
20 | int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | @Override
25 | public boolean onTouchEvent(MotionEvent event) {
26 | Log.d("wr", "View onTouchEvent" + event.getAction());
27 | return super.onTouchEvent(event);
28 | }
29 |
30 | @Override
31 | public boolean dispatchTouchEvent(MotionEvent event) {
32 | Log.d("wr", "View dispatchTouchEvent" + event.getAction());
33 | return super.dispatchTouchEvent(event);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 MiracleWong
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/mylistview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/activity_event.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/android2048/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
8 |
12 |
16 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.idea/gradle.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 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
17 |
18 |
24 |
25 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/miraclewong/androidheros/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.androidheros;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 |
8 | public class MainActivity extends Activity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 | }
15 |
16 | @Override
17 | public boolean onCreateOptionsMenu(Menu menu) {
18 | // Inflate the menu; this adds items to the action bar if it is present.
19 | getMenuInflater().inflate(R.menu.menu_main, menu);
20 | return true;
21 | }
22 |
23 | @Override
24 | public boolean onOptionsItemSelected(MenuItem item) {
25 | // Handle action bar item clicks here. The action bar will
26 | // automatically handle clicks on the Home/Up button, so long
27 | // as you specify a parent activity in AndroidManifest.xml.
28 | int id = item.getItemId();
29 |
30 | //noinspection SimplifiableIfStatement
31 | if (id == R.id.action_settings) {
32 | return true;
33 | }
34 |
35 | return super.onOptionsItemSelected(item);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/game2048/src/main/java/com/miraclewong/game2048/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.game2048;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 |
8 | public class MainActivity extends Activity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 | }
15 |
16 | @Override
17 | public boolean onCreateOptionsMenu(Menu menu) {
18 | // Inflate the menu; this adds items to the action bar if it is present.
19 | getMenuInflater().inflate(R.menu.menu_main, menu);
20 | return true;
21 | }
22 |
23 | @Override
24 | public boolean onOptionsItemSelected(MenuItem item) {
25 | // Handle action bar item clicks here. The action bar will
26 | // automatically handle clicks on the Home/Up button, so long
27 | // as you specify a parent activity in AndroidManifest.xml.
28 | int id = item.getItemId();
29 |
30 | //noinspection SimplifiableIfStatement
31 | if (id == R.id.action_settings) {
32 | return true;
33 | }
34 |
35 | return super.onOptionsItemSelected(item);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/android2048/src/main/java/com/rushapp/android2048/Card.java:
--------------------------------------------------------------------------------
1 | package com.rushapp.android2048;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.widget.FrameLayout;
6 | import android.widget.TextView;
7 |
8 | /**
9 | * Created by miraclewong on 15/10/15.
10 | */
11 | public class Card extends FrameLayout {
12 | public Card(Context context) {
13 | super(context);
14 |
15 | label = new TextView(getContext());
16 | label.setTextSize(32);
17 | label.setBackgroundColor(0x33ffffff);
18 | label.setGravity(Gravity.CENTER);
19 | LayoutParams lp = new LayoutParams(-1, -1);
20 | lp.setMargins(10, 10, 0, 0);
21 | addView(label, lp);
22 | setNum(0);
23 | }
24 |
25 | private int num = 0;
26 | private TextView label;
27 |
28 | public int getNum() {
29 | return num;
30 | }
31 |
32 | public void setNum(int num) {
33 | this.num = num;
34 | // setText的类型是int,代表的是资源ID
35 | if (num == 0)
36 | {
37 | label.setText("");
38 | }else {
39 | label.setText(num + "");
40 | }
41 | }
42 |
43 | // 判断card上的数字是否相同来判断
44 | public boolean equals(Card o) {
45 | return getNum() == o.getNum();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/imageshape/src/main/java/com/miraclewong/imageshape/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.imageshape;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 |
8 | public class MainActivity extends Activity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(new Clock(this));
14 |
15 | }
16 |
17 | @Override
18 | public boolean onCreateOptionsMenu(Menu menu) {
19 | // Inflate the menu; this adds items to the action bar if it is present.
20 | getMenuInflater().inflate(R.menu.menu_main, menu);
21 | return true;
22 | }
23 |
24 | @Override
25 | public boolean onOptionsItemSelected(MenuItem item) {
26 | // Handle action bar item clicks here. The action bar will
27 | // automatically handle clicks on the Home/Up button, so long
28 | // as you specify a parent activity in AndroidManifest.xml.
29 | int id = item.getItemId();
30 |
31 | //noinspection SimplifiableIfStatement
32 | if (id == R.id.action_settings) {
33 | return true;
34 | }
35 |
36 | return super.onOptionsItemSelected(item);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/MyViewTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | public class MyViewTest extends Activity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | int flag = getIntent().getIntExtra("flag", -1);
12 | switch (flag) {
13 | case 0:
14 | setContentView(R.layout.teaching);
15 | break;
16 | case 1:
17 | setContentView(R.layout.my_textview);
18 | break;
19 | case 2:
20 | setContentView(R.layout.shine_textview);
21 | break;
22 | case 3:
23 | setContentView(R.layout.circle_progress);
24 | CircleProgressView circle = (CircleProgressView) findViewById(R.id.circle);
25 | // circle.setSweepValue(30);
26 | break;
27 | case 4:
28 | setContentView(R.layout.volume);
29 | break;
30 | case 5:
31 | setContentView(R.layout.my_scrollview);
32 | break;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 |
8 | public class MainActivity extends Activity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.cardview);
14 | }
15 |
16 | @Override
17 | public boolean onCreateOptionsMenu(Menu menu) {
18 | // Inflate the menu; this adds items to the action bar if it is present.
19 | getMenuInflater().inflate(R.menu.menu_main, menu);
20 | return true;
21 | }
22 |
23 | @Override
24 | public boolean onOptionsItemSelected(MenuItem item) {
25 | // Handle action bar item clicks here. The action bar will
26 | // automatically handle clicks on the Home/Up button, so long
27 | // as you specify a parent activity in AndroidManifest.xml.
28 | int id = item.getItemId();
29 |
30 | //noinspection SimplifiableIfStatement
31 | if (id == R.id.action_settings) {
32 | return true;
33 | }
34 |
35 | return super.onOptionsItemSelected(item);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/view/MyViewGroupB.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.MotionEvent;
7 | import android.widget.LinearLayout;
8 |
9 | public class MyViewGroupB extends LinearLayout {
10 |
11 | public MyViewGroupB(Context context) {
12 | super(context);
13 | }
14 |
15 | public MyViewGroupB(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public MyViewGroupB(Context context, AttributeSet attrs,
20 | int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | @Override
25 | public boolean dispatchTouchEvent(MotionEvent ev) {
26 | Log.d("wr", "ViewGroupB dispatchTouchEvent" + ev.getAction());
27 | return super.dispatchTouchEvent(ev);
28 | }
29 |
30 | @Override
31 | public boolean onInterceptTouchEvent(MotionEvent ev) {
32 | Log.d("wr", "ViewGroupB onInterceptTouchEvent" + ev.getAction());
33 | return super.onInterceptTouchEvent(ev);
34 | }
35 |
36 | @Override
37 | public boolean onTouchEvent(MotionEvent event) {
38 | Log.d("wr", "ViewGroupB onTouchEvent" + event.getAction());
39 | return super.onTouchEvent(event);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/my_scrollview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
14 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/layout/notification_expanded.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
13 |
14 |
25 |
26 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/FocusListViewTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.AdapterView;
7 | import android.widget.ListView;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class FocusListViewTest extends Activity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.focus);
18 | ListView listView = (ListView) findViewById(R.id.focus_listView);
19 | List data = new ArrayList();
20 | data.add("I am item 1");
21 | data.add("I am item 2");
22 | data.add("I am item 3");
23 | data.add("I am item 4");
24 | data.add("I am item 5");
25 | final FocusListViewAdapter adapter = new FocusListViewAdapter(this, data);
26 | listView.setAdapter(adapter);
27 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
28 | @Override
29 | public void onItemClick(AdapterView> parent, View view,
30 | int position, long id) {
31 | adapter.setCurrentItem(position);
32 | adapter.notifyDataSetChanged();
33 | }
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/view/MyViewGroupA.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 | import android.widget.LinearLayout;
9 |
10 | /**
11 | * Created by miraclewong on 16/1/23.
12 | */
13 | public class MyViewGroupA extends LinearLayout {
14 | public MyViewGroupA(Context context) {
15 | super(context);
16 | }
17 |
18 | public MyViewGroupA(Context context, AttributeSet attrs) {
19 | super(context, attrs);
20 | }
21 |
22 | public MyViewGroupA(Context context, AttributeSet attrs, int defStyleAttr) {
23 | super(context, attrs, defStyleAttr);
24 | }
25 |
26 | @Override
27 | public boolean dispatchTouchEvent(MotionEvent ev) {
28 | Log.d("wr", "ViewGroupA dispatchTouchEvent" + ev.getAction());
29 | return super.dispatchTouchEvent(ev);
30 | }
31 |
32 |
33 | @Override
34 | public boolean onInterceptTouchEvent(MotionEvent ev) {
35 | Log.d("wr", "ViewGroupA onInterceptTouchEvent" + ev.getAction());
36 | return super.onInterceptTouchEvent(ev);
37 | }
38 |
39 | @Override
40 | public boolean onTouchEvent(MotionEvent event) {
41 | Log.d("wr", "ViewGroupA onTouchEvent" + event.getAction());
42 | return super.onTouchEvent(event);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/TopBarTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.widget.Toast;
6 |
7 | public class TopBarTest extends Activity {
8 |
9 | private TopBar mTopbar;
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.topbar_test);
15 | // 获得我们创建的topbar
16 | mTopbar = (TopBar) findViewById(R.id.topBar);
17 | // 为topbar注册监听事件,传入定义的接口
18 | // 并以匿名类的方式实现接口内的方法
19 | mTopbar.setOnTopbarClickListener(
20 | new TopBar.topbarClickListener() {
21 |
22 | @Override
23 | public void rightClick() {
24 | Toast.makeText(TopBarTest.this,
25 | "right", Toast.LENGTH_SHORT)
26 | .show();
27 | }
28 |
29 | @Override
30 | public void leftClick() {
31 | Toast.makeText(TopBarTest.this,
32 | "left", Toast.LENGTH_SHORT)
33 | .show();
34 | }
35 | });
36 | // 控制topbar上组件的状态
37 | mTopbar.setButtonVisable(0, true);
38 | mTopbar.setButtonVisable(1, true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/RecyclerTest3.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.DefaultItemAnimator;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.widget.FrameLayout;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class RecyclerTest3 extends Activity {
14 |
15 | private RecyclerView mRcList;
16 | private RecyclerAdapter mAdapter;
17 | private RecyclerView.LayoutManager mLayoutManager;
18 |
19 | private List mData = new ArrayList();
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | FrameLayout frameLayout = new FrameLayout(RecyclerTest3.this);
26 |
27 | mRcList = new RecyclerView(RecyclerTest3.this);
28 | mLayoutManager = new LinearLayoutManager(this);
29 | mRcList.setLayoutManager(mLayoutManager);
30 | mRcList.setHasFixedSize(true);
31 | // 设置显示动画
32 | mRcList.setItemAnimator(new DefaultItemAnimator());
33 | // 增加测试数据
34 | mData.add("Recycler");
35 | mData.add("Recycler");
36 | mData.add("Recycler");
37 | mAdapter = new RecyclerAdapter(mData);
38 | mRcList.setAdapter(mAdapter);
39 |
40 | frameLayout.addView(mRcList);
41 | setContentView(frameLayout);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/mylistview/src/main/res/layout/notify.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
20 |
25 |
26 |
36 |
37 |
--------------------------------------------------------------------------------
/imageshape/src/main/res/drawable/button_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/res/layout/recycler.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
16 |
17 |
21 |
22 |
28 |
29 |
35 |
36 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/RecyView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.DefaultItemAnimator;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.AttributeSet;
8 | import android.widget.FrameLayout;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by miraclewong on 15/11/5.
15 | */
16 | public class RecyView extends FrameLayout {
17 |
18 | private RecyclerView mRcList;
19 | private RecyclerAdapter mAdapter;
20 | private RecyclerView.LayoutManager mLayoutManager;
21 | private List mData = new ArrayList();
22 |
23 | public void setmData(List mData) {
24 | this.mData = mData;
25 | }
26 |
27 | public RecyView(Context context) {
28 |
29 | super(context);
30 | }
31 |
32 | public RecyView(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | }
35 |
36 | public RecyView(Context context, AttributeSet attrs, int defStyleAttr) {
37 | super(context, attrs, defStyleAttr);
38 | }
39 |
40 | public void init(Context context) {
41 |
42 | mRcList = new RecyclerView(context);
43 | mLayoutManager = new LinearLayoutManager(context);
44 | mRcList.setLayoutManager(mLayoutManager);
45 | mRcList.setHasFixedSize(true);
46 | // 设置显示动画
47 | mRcList.setItemAnimator(new DefaultItemAnimator());
48 | // 增加测试数据
49 | mAdapter = new RecyclerAdapter(mData);
50 | mRcList.setAdapter(mAdapter);
51 | this.addView(mRcList);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/MyTextView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.util.AttributeSet;
8 | import android.view.View;
9 |
10 | /**
11 | * Created by miraclewong on 15/10/3.
12 | */
13 | public class MyTextView extends View {
14 |
15 | private Paint mPaint1, mPaint2;
16 |
17 | public MyTextView(Context context) {
18 | super(context);
19 | initView();
20 | }
21 |
22 | public MyTextView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | initView();
25 | }
26 |
27 | public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) {
28 | super(context, attrs, defStyleAttr);
29 | initView();
30 | }
31 |
32 | private void initView() {
33 | mPaint1 = new Paint();
34 | mPaint2 = new Paint();
35 |
36 | mPaint1.setColor(getResources().getColor(android.R.color.holo_blue_bright));
37 | mPaint1.setStyle(Paint.Style.FILL);
38 |
39 | mPaint2.setColor(Color.YELLOW);
40 | mPaint2.setStyle(Paint.Style.FILL);
41 | }
42 |
43 |
44 | @Override
45 | protected void onDraw(Canvas canvas) {
46 |
47 |
48 | // 绘制外层矩形
49 | canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), mPaint1);
50 | // 绘制内层矩形
51 | canvas.drawRect(10, 10, getMeasuredWidth() - 10, getMeasuredHeight() - 10, mPaint2);
52 | canvas.save();
53 | canvas.translate(10, 0);
54 |
55 | // 这是父类的方法,绘制文本
56 | super.onDraw(canvas);
57 | canvas.restore();
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/FlexibleListView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.DisplayMetrics;
6 | import android.widget.ListView;
7 |
8 | public class FlexibleListView extends ListView {
9 |
10 | private static int mMaxOverDistance = 50;
11 | private Context mContext;
12 |
13 | public FlexibleListView(Context context, AttributeSet attrs,
14 | int defStyleAttr) {
15 | super(context, attrs, defStyleAttr);
16 | this.mContext = context;
17 | initView();
18 | }
19 |
20 | public FlexibleListView(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | this.mContext = context;
23 | initView();
24 | }
25 |
26 | public FlexibleListView(Context context) {
27 | super(context);
28 | this.mContext = context;
29 | initView();
30 | }
31 |
32 | private void initView() {
33 | DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
34 | float density = metrics.density;
35 | mMaxOverDistance = (int) (density * mMaxOverDistance);
36 | }
37 |
38 | @Override
39 | protected boolean overScrollBy(int deltaX, int deltaY,
40 | int scrollX, int scrollY,
41 | int scrollRangeX, int scrollRangeY,
42 | int maxOverScrollX, int maxOverScrollY,
43 | boolean isTouchEvent) {
44 | return super.overScrollBy(deltaX, deltaY,
45 | scrollX, scrollY,
46 | scrollRangeX, scrollRangeY,
47 | maxOverScrollX, mMaxOverDistance,
48 | isTouchEvent);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/NotifyTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.AdapterView;
7 | import android.widget.ListView;
8 | import android.widget.Toast;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class NotifyTest extends Activity {
14 |
15 | private List mData;
16 | private ListView mListView;
17 | private NotifyAdapter mAdapter;
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.notify);
23 | mData = new ArrayList();
24 | for (int i = 0; i < 20; i++) {
25 | mData.add("" + i);
26 | }
27 | mListView = (ListView) findViewById(R.id.listView);
28 | mListView.setEmptyView(findViewById(R.id.empty_view));
29 | mAdapter = new NotifyAdapter(this, mData);
30 |
31 | mListView.setAdapter(mAdapter); //设置Adapter
32 | // 遍历ListView中所有的item
33 | for (int i = 0; i < mListView.getChildCount(); i++) {
34 | View view = mListView.getChildAt(i);
35 | }
36 | // mListView.setSelection(13);
37 | mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
38 | @Override
39 | public void onItemClick(AdapterView> adapterView, View view, int position, long id) {
40 |
41 | Toast.makeText(NotifyTest.this, mData.get(position), Toast.LENGTH_SHORT).show();
42 | }
43 | });
44 | }
45 |
46 | public void btnAdd(View view) {
47 | mData.add("new");
48 | mAdapter.notifyDataSetChanged();
49 | mListView.setSelection(mData.size() - 1);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Button;
8 |
9 | public class MainActivity extends Activity {
10 |
11 | private Intent mIntent;
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_main);
17 | Button btnEvent = (Button) findViewById(R.id.btn_event);
18 | btnEvent.setOnClickListener(new View.OnClickListener() {
19 | @Override
20 | public void onClick(View v) {
21 | startActivity(new Intent(MainActivity.this,EventActivity.class));
22 | }
23 | });
24 | mIntent = new Intent(this, MyViewTest.class);
25 | }
26 |
27 | public void btnTeaching(View view) {
28 | mIntent.putExtra("flag", 0);
29 | startActivity(mIntent);
30 | }
31 |
32 | public void btnMyTextView(View view) {
33 | mIntent.putExtra("flag", 1);
34 | startActivity(mIntent);
35 | }
36 |
37 | public void btnShineTextView(View view) {
38 | mIntent.putExtra("flag", 2);
39 | startActivity(mIntent);
40 | }
41 |
42 | public void btnCircleProgress(View view) {
43 | mIntent.putExtra("flag", 3);
44 | startActivity(mIntent);
45 | }
46 |
47 | public void btnVolumeView(View view) {
48 | mIntent.putExtra("flag", 4);
49 | startActivity(mIntent);
50 | }
51 |
52 | public void btnMyScrollView(View view) {
53 | mIntent.putExtra("flag", 5);
54 | startActivity(mIntent);
55 | }
56 |
57 | public void btnTopBar(View view) {
58 | startActivity(new Intent(this, TopBarTest.class));
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/android2048/src/main/java/com/rushapp/android2048/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.rushapp.android2048;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 | import android.widget.TextView;
8 |
9 | public class MainActivity extends Activity {
10 | public static MainActivity mainActivity = null;
11 | private TextView tvScore;
12 | private int score = 0;
13 | public static MainActivity getMainActivity() {
14 | return mainActivity;
15 | }
16 |
17 | public void showScore(){
18 | tvScore.setText(score+"");
19 | }
20 |
21 | public void addScore(int s){
22 | score += s;
23 | showScore();
24 | }
25 |
26 | public void clearScore(){
27 | score = 0;
28 | }
29 |
30 | public MainActivity() {
31 | mainActivity = this;
32 | }
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_main);
38 |
39 | tvScore = (TextView) findViewById(R.id.tv_score);
40 | }
41 |
42 | @Override
43 | public boolean onCreateOptionsMenu(Menu menu) {
44 | // Inflate the menu; this adds items to the action bar if it is present.
45 | getMenuInflater().inflate(R.menu.menu_main, menu);
46 | return true;
47 | }
48 |
49 | @Override
50 | public boolean onOptionsItemSelected(MenuItem item) {
51 | // Handle action bar item clicks here. The action bar will
52 | // automatically handle clicks on the Home/Up button, so long
53 | // as you specify a parent activity in AndroidManifest.xml.
54 | int id = item.getItemId();
55 |
56 | //noinspection SimplifiableIfStatement
57 | if (id == R.id.action_settings) {
58 | return true;
59 | }
60 |
61 | return super.onOptionsItemSelected(item);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.Menu;
7 | import android.view.MenuItem;
8 | import android.view.View;
9 |
10 | public class MainActivity extends Activity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_main);
16 | }
17 |
18 | public void btnViewHolder(View view) {
19 | startActivity(new Intent(this, NotifyTest.class));
20 | }
21 |
22 | public void btnChatItem(View view) {
23 | startActivity(new Intent(this, ChatItemListViewTest.class));
24 | }
25 |
26 | public void btnScrollHideListView(View view) {
27 | startActivity(new Intent(this, ScrollHideListView.class));
28 | }
29 |
30 | public void btnFlexible(View view) {
31 | startActivity(new Intent(this, FlexibleListViewTest.class));
32 | }
33 |
34 | public void btnFocus(View view) {
35 | startActivity(new Intent(this, FocusListViewTest.class));
36 | }
37 |
38 | @Override
39 | public boolean onCreateOptionsMenu(Menu menu) {
40 | // Inflate the menu; this adds items to the action bar if it is present.
41 | getMenuInflater().inflate(R.menu.menu_main, menu);
42 | return true;
43 | }
44 |
45 | @Override
46 | public boolean onOptionsItemSelected(MenuItem item) {
47 | // Handle action bar item clicks here. The action bar will
48 | // automatically handle clicks on the Home/Up button, so long
49 | // as you specify a parent activity in AndroidManifest.xml.
50 | int id = item.getItemId();
51 |
52 | //noinspection SimplifiableIfStatement
53 | if (id == R.id.action_settings) {
54 | return true;
55 | }
56 |
57 | return super.onOptionsItemSelected(item);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/NotifyAdapter.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import java.util.List;
12 |
13 | public class NotifyAdapter extends BaseAdapter {
14 |
15 | private List mData;
16 | private LayoutInflater mInflater;
17 |
18 | public NotifyAdapter(Context context, List data) {
19 | this.mData = data;
20 | mInflater = LayoutInflater.from(context);
21 | }
22 |
23 | @Override
24 | public int getCount() {
25 | return mData.size();
26 | }
27 |
28 | @Override
29 | public Object getItem(int position) {
30 | return mData.get(position);
31 | }
32 |
33 | @Override
34 | public long getItemId(int position) {
35 | return position;
36 | }
37 |
38 | @Override
39 | public View getView(int position, View convertView, ViewGroup parent) {
40 | ViewHolder holder = null;
41 | // 判断是否缓存
42 | if (convertView == null) {
43 | holder = new ViewHolder();
44 | // 通过LayoutInflater实例化布局
45 | convertView = mInflater.inflate(R.layout.notify_item, null);
46 | holder.img = (ImageView) convertView.findViewById(R.id.imageView);
47 | holder.title = (TextView) convertView.findViewById(R.id.textView);
48 | convertView.setTag(holder);
49 | } else {
50 | // 通过tag找到缓存的布局
51 | holder = (ViewHolder) convertView.getTag();
52 | }
53 | // 设置布局中控件要显示的视图
54 | holder.img.setBackgroundResource(R.mipmap.ic_launcher);
55 | holder.title.setText(mData.get(position));
56 | return convertView;
57 | }
58 |
59 |
60 | // 创建ViewHolder
61 | public final class ViewHolder {
62 | public ImageView img;
63 | public TextView title;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/RecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by miraclewong on 15/9/20.
13 | */
14 | public class RecyclerAdapter extends RecyclerView.Adapter {
15 |
16 | private List mData;
17 |
18 | public RecyclerAdapter(List data) {
19 | mData = data;
20 | }
21 |
22 | public OnItemClickListener onItemClickListener;
23 |
24 |
25 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
26 | this.onItemClickListener = onItemClickListener;
27 | }
28 |
29 | public interface OnItemClickListener{
30 | void onItemClick(View view, int position);
31 | }
32 | // 将布局转化为View并传递给RecyclerView封装好的ViewHolder
33 | @Override
34 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
35 | View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rc_item,viewGroup,false);
36 | return new ViewHolder(v);
37 | }
38 |
39 | // 建立起ViewHolder中的视图与数据的关联
40 | @Override
41 | public void onBindViewHolder(ViewHolder viewHolder, int i) {
42 | viewHolder.textView.setText(mData.get(i) + i);
43 | }
44 |
45 | @Override
46 | public int getItemCount() {
47 | return mData.size();
48 | }
49 |
50 | public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
51 | public TextView textView;
52 |
53 | public ViewHolder(View itemView) {
54 | super(itemView);
55 | textView = (TextView)itemView;
56 | textView.setOnClickListener(this);
57 | }
58 |
59 | @Override
60 | public void onClick(View view) {
61 | if (onItemClickListener != null){
62 | onItemClickListener.onItemClick(view, getPosition());
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/systemwidget/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
16 |
22 |
23 |
29 |
30 |
36 |
37 |
43 |
44 |
50 |
51 |
57 |
63 |
64 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/ShineTextView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.LinearGradient;
7 | import android.graphics.Matrix;
8 | import android.graphics.Paint;
9 | import android.graphics.Shader;
10 | import android.util.AttributeSet;
11 | import android.widget.TextView;
12 |
13 | /**
14 | * Created by miraclewong on 15/10/7.
15 | */
16 | public class ShineTextView extends TextView {
17 |
18 | private LinearGradient mLinearGradient;
19 | private Matrix mGradientMatrix;
20 | private Paint mPaint;
21 | private int mViewWidth = 0;
22 | private int mTranslate = 0;
23 |
24 |
25 | public ShineTextView(Context context, AttributeSet attrs) {
26 | super(context, attrs);
27 | }
28 |
29 | @Override
30 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
31 | super.onSizeChanged(w, h, oldw, oldh);
32 | if (mViewWidth == 0){
33 | mViewWidth = getMeasuredWidth();
34 | if (mViewWidth > 0){
35 | mPaint = getPaint();
36 | mLinearGradient = new LinearGradient(
37 | 0,
38 | 0,
39 | mViewWidth,
40 | 0,
41 | new int[]{
42 | Color.BLUE,
43 | 0xffffffff,
44 | Color.BLUE
45 | },
46 | null,
47 | Shader.TileMode.CLAMP
48 | );
49 | mPaint.setShader(mLinearGradient);
50 | mGradientMatrix = new Matrix();
51 | }
52 | }
53 | }
54 |
55 | @Override
56 | protected void onDraw(Canvas canvas) {
57 | super.onDraw(canvas);
58 | if (mGradientMatrix != null){
59 | mTranslate += mViewWidth /5;
60 | if (mTranslate > 2 * mViewWidth){
61 | mTranslate = -mViewWidth;
62 | }
63 | mGradientMatrix.setTranslate(mTranslate,0);
64 | mLinearGradient.setLocalMatrix(mGradientMatrix);
65 | postInvalidateDelayed(100);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/ChatItemListViewTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.app.Activity;
4 | import android.graphics.BitmapFactory;
5 | import android.os.Bundle;
6 | import android.widget.ListView;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | public class ChatItemListViewTest extends Activity {
12 |
13 | private ListView mListView;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.chat_item_main);
19 |
20 | mListView = (ListView) findViewById(R.id.listView_chat);
21 | ChatItemListViewBean bean1 = new ChatItemListViewBean();
22 | bean1.setType(0);
23 | bean1.setIcon(BitmapFactory.decodeResource(getResources(),
24 | R.drawable.in_icon));
25 | bean1.setText("Hello how are you?");
26 |
27 | ChatItemListViewBean bean2 = new ChatItemListViewBean();
28 | bean2.setType(1);
29 | bean2.setIcon(BitmapFactory.decodeResource(getResources(),
30 | R.mipmap.ic_launcher));
31 | bean2.setText("Fine thank you, and you?");
32 |
33 | ChatItemListViewBean bean3 = new ChatItemListViewBean();
34 | bean3.setType(0);
35 | bean3.setIcon(BitmapFactory.decodeResource(getResources(),
36 | R.drawable.in_icon));
37 | bean3.setText("I am fine too");
38 |
39 | ChatItemListViewBean bean4 = new ChatItemListViewBean();
40 | bean4.setType(1);
41 | bean4.setIcon(BitmapFactory.decodeResource(getResources(),
42 | R.mipmap.ic_launcher));
43 | bean4.setText("Bye bye");
44 |
45 | ChatItemListViewBean bean5 = new ChatItemListViewBean();
46 | bean5.setType(0);
47 | bean5.setIcon(BitmapFactory.decodeResource(getResources(),
48 | R.drawable.in_icon));
49 | bean5.setText("See you");
50 |
51 | List data = new ArrayList();
52 | data.add(bean1);
53 | data.add(bean2);
54 | data.add(bean3);
55 | data.add(bean4);
56 | data.add(bean5);
57 | mListView.setAdapter(new ChatItemListViewAdapter(this, data));
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/notificationdemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
17 |
18 |
23 |
24 |
29 |
30 |
37 |
38 |
44 |
45 |
51 |
52 |
58 |
59 |
60 |
61 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/FocusListViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.LinearLayout;
10 | import android.widget.TextView;
11 |
12 | import java.util.List;
13 |
14 | public class FocusListViewAdapter extends BaseAdapter {
15 |
16 | private List mData;
17 | private Context mContext;
18 | private int mCurrentItem = 0;
19 |
20 | public FocusListViewAdapter(Context context, List data) {
21 | this.mContext = context;
22 | this.mData = data;
23 | }
24 |
25 | public int getCount() {
26 | return mData.size();
27 | }
28 |
29 | public Object getItem(int position) {
30 | return mData.get(position);
31 | }
32 |
33 | public long getItemId(int position) {
34 | return position;
35 | }
36 |
37 | public View getView(int position, View convertView, ViewGroup parent) {
38 | LinearLayout layout = new LinearLayout(mContext);
39 | layout.setOrientation(LinearLayout.VERTICAL);
40 | if (mCurrentItem == position) {
41 | layout.addView(addFocusView(position));
42 | } else {
43 | layout.addView(addNormalView(position));
44 | }
45 | return layout;
46 | }
47 |
48 | public void setCurrentItem(int currentItem) {
49 | this.mCurrentItem = currentItem;
50 | }
51 |
52 | private View addFocusView(int i) {
53 | ImageView iv = new ImageView(mContext);
54 | iv.setImageResource(R.mipmap.ic_launcher);
55 | return iv;
56 | }
57 |
58 | private View addNormalView(int i) {
59 | LinearLayout layout = new LinearLayout(mContext);
60 | layout.setOrientation(LinearLayout.HORIZONTAL);
61 | ImageView iv = new ImageView(mContext);
62 | iv.setImageResource(R.drawable.in_icon);
63 | layout.addView(iv, new LinearLayout.LayoutParams(
64 | LinearLayout.LayoutParams.WRAP_CONTENT,
65 | LinearLayout.LayoutParams.WRAP_CONTENT));
66 | TextView tv = new TextView(mContext);
67 | tv.setText(mData.get(i));
68 | layout.addView(tv, new LinearLayout.LayoutParams(
69 | LinearLayout.LayoutParams.WRAP_CONTENT,
70 | LinearLayout.LayoutParams.WRAP_CONTENT));
71 | layout.setGravity(Gravity.CENTER);
72 | return layout;
73 | }
74 | }
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
18 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
47 |
52 |
57 |
62 |
67 |
68 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/VolumeView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.LinearGradient;
7 | import android.graphics.Paint;
8 | import android.graphics.Shader;
9 | import android.util.AttributeSet;
10 | import android.view.View;
11 |
12 | /**
13 | * Created by miraclewong on 15/10/11.
14 | */
15 | public class VolumeView extends View {
16 | private int mWidth;
17 | private int mRectWidth;
18 | private int mRectHeight;
19 | private Paint mPaint;
20 | private int mRectCount;
21 | private int offset = 5;
22 | private double mRandom;
23 | private LinearGradient mLinearGradient;
24 |
25 | public VolumeView(Context context) {
26 | super(context);
27 | initView();
28 | }
29 |
30 | public VolumeView(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | initView();
33 | }
34 |
35 | public VolumeView(Context context, AttributeSet attrs, int defStyleAttr) {
36 | super(context, attrs, defStyleAttr);
37 | initView();
38 | }
39 |
40 |
41 | public void initView(){
42 | mPaint = new Paint();
43 | mPaint.setColor(Color.BLUE);
44 | mPaint.setStyle(Paint.Style.FILL);
45 | mRectCount = 12;
46 | }
47 | @Override
48 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
49 | super.onSizeChanged(w, h, oldw, oldh);
50 | mWidth = getWidth();
51 | mRectHeight = getHeight();
52 | mRectWidth = (int) (mWidth * 0.6 / mRectCount);
53 | // 添加LinearGradient的渐变效果
54 | mLinearGradient = new LinearGradient(
55 | 0,
56 | 0,
57 | mRectWidth,
58 | mRectHeight,
59 | Color.YELLOW,
60 | Color.BLUE,
61 | Shader.TileMode.CLAMP);
62 | mPaint.setShader(mLinearGradient);
63 | }
64 | @Override
65 | protected void onDraw(Canvas canvas) {
66 | super.onDraw(canvas);
67 | for (int i = 0; i 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 |
--------------------------------------------------------------------------------
/recyclerviewtest/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 |
--------------------------------------------------------------------------------
/.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 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/imageshape/src/main/java/com/miraclewong/imageshape/Clock.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.imageshape;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 |
9 | /**
10 | * Created by miraclewong on 15/11/21.
11 | */
12 | public class Clock extends View{
13 |
14 | private int mWidth, mHeight;
15 |
16 | public Clock(Context context) {
17 | super(context);
18 | }
19 |
20 | public Clock(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | public Clock(Context context, AttributeSet attrs, int defStyleAttr) {
25 | super(context, attrs, defStyleAttr);
26 | }
27 |
28 | @Override
29 | protected void onDraw(Canvas canvas) {
30 | // 获取宽高参数
31 | mWidth = getMeasuredWidth();
32 | mHeight = getMeasuredHeight();
33 | // 画外面的圆
34 | Paint paintCircle = new Paint();
35 | paintCircle.setStyle(Paint.Style.STROKE);
36 | paintCircle.setAntiAlias(true); // 加上抗锯齿标志
37 | paintCircle.setStrokeWidth(3); // 边缘宽度
38 | canvas.drawCircle(mWidth/2, mHeight/2, mWidth/2, paintCircle);
39 |
40 |
41 | // 画刻度
42 | Paint paintDegree = new Paint();
43 | paintCircle.setStrokeWidth(3);
44 | for (int i = 0; i < 24; i++) {
45 | // 区分整点
46 | if (i==0 || i==6 || i==12 || i ==18){
47 | paintDegree.setStrokeWidth(5);
48 | paintDegree.setTextSize(30);
49 | canvas.drawLine(mWidth / 2, mHeight / 2 - mWidth / 2, mWidth / 2, mHeight / 2 - mWidth / 2 + 60, paintDegree);
50 | String degree = String.valueOf(i);
51 | canvas.drawText(degree,mWidth/2-paintDegree.measureText(degree)/2, mHeight/2-mWidth/2 + 90,paintDegree);
52 | }else {
53 | paintDegree.setStrokeWidth(3);
54 | paintDegree.setTextSize(15);
55 | canvas.drawLine(mWidth / 2, mHeight / 2 - mWidth / 2, mWidth / 2, mHeight / 2 - mWidth / 2 + 30, paintDegree);
56 | String degree = String.valueOf(i);
57 | canvas.drawText(degree,mWidth/2-paintDegree.measureText(degree)/2, mHeight/2-mWidth/2 + 60,paintDegree);
58 | }
59 | canvas.rotate(15, mWidth/2, mHeight/2);
60 | }
61 |
62 | // 画指针
63 | Paint paintHour = new Paint();
64 | paintHour.setStrokeWidth(20);
65 | Paint paintMinute = new Paint();
66 | paintMinute.setStrokeWidth(10);
67 | canvas.save();
68 | canvas.translate(mWidth/2, mHeight/2);
69 | canvas.drawLine(0,0,100,100,paintHour);
70 | canvas.drawLine(0,0,100,200,paintMinute);
71 | canvas.restore();
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/ChatItemListViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import java.util.List;
12 |
13 | public class ChatItemListViewAdapter extends BaseAdapter {
14 |
15 | private List mData;
16 | private LayoutInflater mInflater;
17 |
18 | public ChatItemListViewAdapter(Context context,
19 | List data) {
20 | this.mData = data;
21 | mInflater = LayoutInflater.from(context);
22 | }
23 |
24 | @Override
25 | public int getCount() {
26 | return mData.size();
27 | }
28 |
29 | @Override
30 | public Object getItem(int position) {
31 | return mData.get(position);
32 | }
33 |
34 | @Override
35 | public long getItemId(int position) {
36 | return position;
37 | }
38 |
39 | @Override
40 | public int getItemViewType(int position) {
41 | ChatItemListViewBean bean = mData.get(position);
42 | return bean.getType();
43 | }
44 |
45 | @Override
46 | public int getViewTypeCount() {
47 | return 2;
48 | }
49 |
50 | @Override
51 | public View getView(int position, View convertView, ViewGroup parent) {
52 | ViewHolder holder;
53 | if (convertView == null) {
54 | if (getItemViewType(position) == 0) {
55 | holder = new ViewHolder();
56 | convertView = mInflater.inflate(
57 | R.layout.chat_item_itemin, null);
58 | holder.icon = (ImageView) convertView.findViewById(
59 | R.id.icon_in);
60 | holder.text = (TextView) convertView.findViewById(
61 | R.id.text_in);
62 | } else {
63 | holder = new ViewHolder();
64 | convertView = mInflater.inflate(
65 | R.layout.chat_item_itemout, null);
66 | holder.icon = (ImageView) convertView.findViewById(
67 | R.id.icon_out);
68 | holder.text = (TextView) convertView.findViewById(
69 | R.id.text_out);
70 | }
71 | convertView.setTag(holder);
72 | } else {
73 | holder = (ViewHolder) convertView.getTag();
74 | }
75 | holder.icon.setImageBitmap(mData.get(position).getIcon());
76 | holder.text.setText(mData.get(position).getText());
77 | return convertView;
78 | }
79 |
80 | public final class ViewHolder {
81 | public ImageView icon;
82 | public TextView text;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/TeachingView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.util.AttributeSet;
7 | import android.util.Log;
8 | import android.view.MotionEvent;
9 | import android.widget.TextView;
10 |
11 | /**
12 | * 自定的View
13 | * Created by miraclewong on 15/10/3.
14 | */
15 | public class TeachingView extends TextView {
16 |
17 | public TeachingView(Context context) {
18 | super(context);
19 | }
20 |
21 | public TeachingView(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public TeachingView(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @Override
30 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
31 | super.onLayout(changed, left, top, right, bottom);
32 | }
33 |
34 | @Override
35 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
36 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
37 | }
38 |
39 | // @Override
40 | // protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
41 | // setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
42 | // }
43 |
44 | private int measureHeight(int measureSpec) {
45 | int result = 0;
46 | int specMode = MeasureSpec.getMode(measureSpec);
47 | int specSize = MeasureSpec.getSize(measureSpec);
48 |
49 | if (specMode == MeasureSpec.EXACTLY){
50 | result = specSize;
51 | }else {
52 | result = 200;
53 | if (specMode == MeasureSpec.AT_MOST){
54 | result = Math.min(result, specSize);
55 | }
56 | }
57 | return result;
58 | }
59 |
60 | private int measureWidth(int measureSpec) {
61 | int result = 0;
62 | int specMode = MeasureSpec.getMode(measureSpec);
63 | int specSize = MeasureSpec.getSize(measureSpec);
64 |
65 | if (specMode == MeasureSpec.EXACTLY){
66 | result = specSize;
67 | }else {
68 | result = 200;
69 | if (specMode == MeasureSpec.AT_MOST){
70 | result = Math.min(result, specSize);
71 | }
72 | }
73 | return result;
74 | }
75 |
76 | @Override
77 | protected void onDraw(Canvas canvas) {
78 | super.onDraw(canvas);
79 | canvas.drawColor(Color.WHITE);
80 | int width = getWidth();
81 | int height = getHeight();
82 | Log.d("xys", "width : " + width + " height : " + height);
83 | }
84 |
85 |
86 | @Override
87 | public boolean onTouchEvent(MotionEvent event) {
88 | return super.onTouchEvent(event);
89 | }
90 |
91 | @Override
92 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
93 | super.onSizeChanged(w, h, oldw, oldh);
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/recyclerviewtest/.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 | 1.7
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/mylistview/src/main/java/com/miraclewong/mylistview/ScrollHideListView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.mylistview;
2 |
3 | import android.animation.ObjectAnimator;
4 | import android.app.Activity;
5 | import android.os.Bundle;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.MotionEvent;
8 | import android.view.View;
9 | import android.view.ViewConfiguration;
10 | import android.widget.AbsListView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.ListView;
13 |
14 |
15 | public class ScrollHideListView extends Activity {
16 |
17 | private Toolbar mToolbar;
18 | private ListView mListView;
19 | private String[] mStr = new String[20];
20 | private int mTouchSlop;
21 | private float mFirstY;
22 | private float mCurrentY;
23 | private int direction;
24 | private ObjectAnimator mAnimator;
25 | private boolean mShow = true;
26 |
27 | View.OnTouchListener myTouchListener = new View.OnTouchListener() {
28 | @Override
29 | public boolean onTouch(View v, MotionEvent event) {
30 | switch (event.getAction()) {
31 | case MotionEvent.ACTION_DOWN:
32 | mFirstY = event.getY();
33 | break;
34 | case MotionEvent.ACTION_MOVE:
35 | mCurrentY = event.getY();
36 | if (mCurrentY - mFirstY > mTouchSlop) {
37 | direction = 0;// down
38 | } else if (mFirstY - mCurrentY > mTouchSlop) {
39 | direction = 1;// up
40 | }
41 | if (direction == 1) {
42 | if (mShow) {
43 | toolbarAnim(1);//show
44 | mShow = !mShow;
45 | }
46 | } else if (direction == 0) {
47 | if (!mShow) {
48 | toolbarAnim(0);//hide
49 | mShow = !mShow;
50 | }
51 | }
52 | break;
53 | case MotionEvent.ACTION_UP:
54 | break;
55 | }
56 | return false;
57 | }
58 | };
59 |
60 | @Override
61 | protected void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | setContentView(R.layout.scroll_hide);
64 | mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();
65 | mToolbar = (Toolbar) findViewById(R.id.toolbar);
66 | mListView = (ListView) findViewById(R.id.listview);
67 | for (int i = 0; i < mStr.length; i++) {
68 | mStr[i] = "Item " + i;
69 | }
70 | View header = new View(this);
71 | // abc_action_bar_default_height_material 获取系统ActionBar的高度
72 | header.setLayoutParams(new AbsListView.LayoutParams(
73 | AbsListView.LayoutParams.MATCH_PARENT,
74 | (int) getResources().getDimension(
75 | R.dimen.abc_action_bar_default_height_material)));
76 | mListView.addHeaderView(header);
77 | mListView.setAdapter(new ArrayAdapter(
78 | ScrollHideListView.this,
79 | android.R.layout.simple_expandable_list_item_1,
80 | mStr));
81 | mListView.setOnTouchListener(myTouchListener);
82 | }
83 |
84 | private void toolbarAnim(int flag) {
85 | if (mAnimator != null && mAnimator.isRunning()) {
86 | mAnimator.cancel();
87 | }
88 | if (flag == 0) {
89 | mAnimator = ObjectAnimator.ofFloat(mToolbar,
90 | "translationY", mToolbar.getTranslationY(), 0);
91 | } else {
92 | mAnimator = ObjectAnimator.ofFloat(mToolbar,
93 | "translationY", mToolbar.getTranslationY(),
94 | -mToolbar.getHeight());
95 | }
96 | mAnimator.start();
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/CircleProgressView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.Paint.Style;
7 | import android.graphics.RectF;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 |
11 | /**
12 | * Created by miraclewong on 15/10/11.
13 | */
14 | public class CircleProgressView extends View {
15 |
16 | private int mMeasureHeight;
17 | private int mMeasureWidth;
18 |
19 | private Paint mCirclePaint;
20 | private float mCircleXY;
21 | private float mRadius;
22 |
23 | private Paint mArcPaint;
24 | private RectF mArcRectF;
25 | private float mSweepAngle;
26 | private float mSweepValue = 66;
27 |
28 | private Paint mTextPaint;
29 | private String mShowText;
30 | private float mShowTextSize;
31 |
32 | public CircleProgressView(Context context) {
33 | super(context);
34 | }
35 |
36 | public CircleProgressView(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public CircleProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
46 | mMeasureHeight = MeasureSpec.getSize(heightMeasureSpec);
47 | mMeasureWidth = MeasureSpec.getSize(widthMeasureSpec);
48 | setMeasuredDimension(mMeasureWidth, mMeasureHeight);
49 | initView();
50 | }
51 |
52 | @Override
53 | protected void onDraw(Canvas canvas) {
54 | super.onDraw(canvas);
55 |
56 | // 绘制圆
57 | canvas.drawCircle(mCircleXY, mCircleXY, mRadius, mCirclePaint);
58 | // 绘制弧线
59 | canvas.drawArc(mArcRectF, 270, mSweepAngle, false,mArcPaint);
60 | // 绘制文字
61 | canvas.drawText(mShowText, 0, mShowText.length(),mCircleXY, mCircleXY + (mShowTextSize / 4),mTextPaint);
62 | }
63 |
64 | private void initView() {
65 | float length = 0;
66 | if (mMeasureHeight >= mMeasureWidth){
67 | length = mMeasureWidth;
68 | }else {
69 | length = mMeasureHeight;
70 | }
71 |
72 | mCircleXY = length / 2;
73 | mRadius = (float) (length * 0.5 / 2);
74 | mCirclePaint = new Paint();
75 | mCirclePaint.setAntiAlias(true);
76 | mCirclePaint.setColor(getResources().getColor(android.R.color.holo_blue_bright));
77 | mArcRectF = new RectF(
78 | (float) (length * 0.1),
79 | (float) (length * 0.1),
80 | (float) (length * 0.9),
81 | (float) (length * 0.9));
82 | mSweepAngle = (mSweepValue / 100f) * 360f;
83 | mArcPaint = new Paint();
84 | mArcPaint.setAntiAlias(true);
85 | mArcPaint.setColor(getResources().getColor(
86 | android.R.color.holo_blue_bright));
87 | mArcPaint.setStrokeWidth((float) (length * 0.1));
88 | mArcPaint.setStyle(Style.STROKE);
89 |
90 | mShowText= setShowText();
91 | mShowTextSize = setShowTextSize();
92 | mTextPaint = new Paint();
93 | mTextPaint.setTextSize(mShowTextSize);
94 | mTextPaint.setTextAlign(Paint.Align.CENTER);
95 | }
96 | public void setSweepValue(float sweepValue) {
97 | if (sweepValue != 0) {
98 | mSweepValue = sweepValue;
99 | } else {
100 | mSweepValue = 25;
101 | }
102 | this.invalidate();
103 | }
104 |
105 | public String setShowText(){
106 | this.invalidate();
107 | return "Android Skill";
108 | }
109 |
110 | public float setShowTextSize(){
111 | this.invalidate();
112 | return 50;
113 | }
114 |
115 | public void forceInvalidate(){
116 | this.invalidate();
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/recyclerviewtest/src/main/java/com/miraclewong/recyclerviewtest/RecyclerTest.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.recyclerviewtest;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.app.Activity;
6 | import android.os.Bundle;
7 | import android.support.v7.widget.DefaultItemAnimator;
8 | import android.support.v7.widget.GridLayoutManager;
9 | import android.support.v7.widget.LinearLayoutManager;
10 | import android.support.v7.widget.RecyclerView;
11 | import android.support.v7.widget.StaggeredGridLayoutManager;
12 | import android.view.View;
13 | import android.widget.AdapterView;
14 | import android.widget.Spinner;
15 | import android.widget.Toast;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | public class RecyclerTest extends Activity {
21 |
22 | private RecyclerView mRcList;
23 | private RecyclerAdapter mAdapter;
24 | private RecyclerView.LayoutManager mLayoutManager;
25 |
26 | private Spinner mSpinner;
27 |
28 | private List mData = new ArrayList();
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.recycler);
34 |
35 | mRcList = (RecyclerView) findViewById(R.id.rc_list);
36 | mLayoutManager = new LinearLayoutManager(this);
37 | mRcList.setLayoutManager(mLayoutManager);
38 | mRcList.setHasFixedSize(true);
39 | // 设置显示动画
40 | mRcList.setItemAnimator(new DefaultItemAnimator());
41 |
42 | mSpinner = (Spinner) findViewById(R.id.spinner);
43 | mSpinner.setOnItemSelectedListener(
44 | new AdapterView.OnItemSelectedListener() {
45 | @Override
46 | public void onItemSelected(AdapterView> parent,
47 | View view,
48 | int position,
49 | long id) {
50 | if (position == 0) {
51 | mRcList.setLayoutManager(
52 | // 设置为线性布局
53 | new LinearLayoutManager(
54 | RecyclerTest.this));
55 | } else if (position == 1) {
56 | mRcList.setLayoutManager(
57 | // 设置为表格布局
58 | new GridLayoutManager(
59 | RecyclerTest.this, 3));
60 | } else if (position == 2) {
61 | mRcList.setLayoutManager(new StaggeredGridLayoutManager(3, 3));
62 | }
63 | }
64 |
65 | @Override
66 | public void onNothingSelected(AdapterView> parent) {
67 | }
68 | });
69 | // 增加测试数据
70 | mData.add("Recycler");
71 | mData.add("Recycler");
72 | mData.add("Recycler");
73 | mAdapter = new RecyclerAdapter(mData);
74 | mRcList.setAdapter(mAdapter);
75 | mAdapter.setOnItemClickListener(
76 | new RecyclerAdapter.OnItemClickListener() {
77 | @Override
78 | public void onItemClick(final View view, int position) {
79 | // 设置点击动画
80 | view.animate()
81 | .translationZ(15F).setDuration(300)
82 | .setListener(new AnimatorListenerAdapter() {
83 | @Override
84 | public void onAnimationEnd(Animator animation) {
85 | super.onAnimationEnd(animation);
86 | view.animate()
87 | .translationZ(1f)
88 | .setDuration(500).start();
89 | }
90 | }).start();
91 | Toast.makeText(RecyclerTest.this, "第" + (position + 1) + "个",Toast.LENGTH_SHORT).show();
92 | }
93 | });
94 | }
95 |
96 | public void addRecycler(View view) {
97 | mData.add("Recycler");
98 | int position = mData.size();
99 | if (position > 0) {
100 | mAdapter.notifyDataSetChanged();
101 | }
102 | }
103 |
104 | public void delRecycler(View view) {
105 | int position = mData.size();
106 | if (position > 0) {
107 | mData.remove(position - 1);
108 | mAdapter.notifyDataSetChanged();
109 | }else {
110 | Toast.makeText(RecyclerTest.this,"不要删除了",Toast.LENGTH_SHORT).show();
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/viewanimationdemo/src/main/java/com/miraclewong/viewanimationdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.viewanimationdemo;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorInflater;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.animation.PropertyValuesHolder;
8 | import android.animation.ValueAnimator;
9 | import android.app.Activity;
10 | import android.os.Bundle;
11 | import android.view.View;
12 | import android.view.animation.AlphaAnimation;
13 | import android.view.animation.Animation;
14 | import android.view.animation.AnimationSet;
15 | import android.view.animation.RotateAnimation;
16 | import android.view.animation.ScaleAnimation;
17 | import android.view.animation.TranslateAnimation;
18 | import android.widget.Toast;
19 |
20 | public class MainActivity extends Activity {
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_main);
26 | }
27 |
28 |
29 | public void btnAlpha(final View view) {
30 | AlphaAnimation aa = new AlphaAnimation(0, 1);
31 | aa.setDuration(1000);
32 | view.startAnimation(aa);
33 | }
34 |
35 | public void btnRotate(final View view) {
36 | RotateAnimation ra = new RotateAnimation(0, 360, 100, 100);
37 | ra.setDuration(1000);
38 | view.startAnimation(ra);
39 | }
40 |
41 | public void btnRotateSelf(View view) {
42 | RotateAnimation ra = new RotateAnimation(0, 360,
43 | RotateAnimation.RELATIVE_TO_SELF, 0.5F,
44 | RotateAnimation.RELATIVE_TO_SELF, 0.5F);
45 | ra.setDuration(1000);
46 | view.startAnimation(ra);
47 |
48 | }
49 |
50 | public void btnTranslate(final View view) {
51 | TranslateAnimation ta = new TranslateAnimation(0, -100, 0, -200);
52 | ta.setDuration(1000);
53 | view.startAnimation(ta);
54 | }
55 |
56 | public void btnScale(View view) {
57 | ScaleAnimation sa = new ScaleAnimation(0, 2, 0, 2);
58 | sa.setDuration(1000);
59 | view.startAnimation(sa);
60 | }
61 |
62 | public void btnScaleSelf(View view) {
63 | ScaleAnimation sa = new ScaleAnimation(0, 1, 0, 1,
64 | Animation.RELATIVE_TO_SELF, 0.5F,
65 | Animation.RELATIVE_TO_SELF, 0.5F);
66 | sa.setDuration(1000);
67 | view.startAnimation(sa);
68 | }
69 |
70 | public void btnSet(View view) {
71 | AnimationSet as = new AnimationSet(true);
72 | as.setDuration(1000);
73 |
74 | AlphaAnimation aa = new AlphaAnimation(0, 1);
75 | aa.setDuration(1000);
76 | as.addAnimation(aa);
77 |
78 | TranslateAnimation ta = new TranslateAnimation(0, 100, 0, 200);
79 | ta.setDuration(1000);
80 | as.addAnimation(ta);
81 |
82 | view.startAnimation(as);
83 | }
84 |
85 | public void btnProHolder(final View view){
86 | PropertyValuesHolder propertyValuesHolder1 = PropertyValuesHolder.ofFloat("translationX", 300f);
87 | PropertyValuesHolder propertyValuesHolder2 = PropertyValuesHolder.ofFloat("scaleX", 1f,0,1f);
88 | PropertyValuesHolder propertyValuesHolder3 = PropertyValuesHolder.ofFloat("scaleY", 1f,0,1f);
89 | ObjectAnimator.ofPropertyValuesHolder(view, propertyValuesHolder1, propertyValuesHolder2, propertyValuesHolder3).setDuration(3000).start();
90 | }
91 | public void btnValueAnimaotr(final View view){
92 | ValueAnimator animator = ValueAnimator.ofFloat(0, 100);
93 | animator.setTarget(view);
94 | animator.setDuration(2000).start();
95 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
96 | @Override
97 | public void onAnimationUpdate(ValueAnimator animation) {
98 | Float value = (Float) animation.getAnimatedValue();
99 | Toast.makeText(MainActivity.this, value + "", Toast.LENGTH_SHORT).show();
100 | }
101 | });
102 | }
103 |
104 | public void btnAnimatorSet(final View view){
105 | ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", 300f);
106 | ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "scaleX", 1f, 0f, 1f);
107 | ObjectAnimator animator3 = ObjectAnimator.ofFloat(view, "scaleY", 1f, 0f, 1f);
108 | AnimatorSet set = new AnimatorSet();
109 | set.setDuration(1000);
110 | set.playTogether(animator1, animator2, animator3);
111 | set.start();
112 | }
113 | public void btnXML(final View view){
114 | Animator animator = AnimatorInflater.loadAnimator(this, R.animator.scalex);
115 | animator.setTarget(view);
116 | animator.start();
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/systemwidget/src/main/java/com/miraclewong/systemwidget/MyScrollView.java:
--------------------------------------------------------------------------------
1 | package com.miraclewong.systemwidget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.DisplayMetrics;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.view.WindowManager;
10 | import android.widget.Scroller;
11 |
12 | /**
13 | * Created by miraclewong on 16/1/23.
14 | */
15 | public class MyScrollView extends ViewGroup {
16 | private int mScreenHeight;
17 | private Scroller mScroller;
18 | private int mLastY;
19 | private int mStart;
20 | private int mEnd;
21 |
22 | public MyScrollView(Context context) {
23 | super(context);
24 | }
25 |
26 | public MyScrollView(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 | initView(context);
29 | }
30 |
31 | public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
32 | super(context, attrs, defStyleAttr);
33 | initView(context);
34 | }
35 |
36 | private void initView(Context context) {
37 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
38 | DisplayMetrics dm = new DisplayMetrics();
39 | wm.getDefaultDisplay().getMetrics(dm);
40 | mScreenHeight = dm.heightPixels;
41 | mScroller = new Scroller(context);
42 | }
43 |
44 | @Override
45 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
46 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
47 | // 在ViewGroup能够滚动之前,需要先放置好它的子View。使用遍历的方式来通知自身进行测量
48 | int count = getChildCount();
49 | for (int i = 0; i < count; i++) {
50 | View childView = getChildAt(i);
51 | measureChild(childView, widthMeasureSpec,heightMeasureSpec);
52 | }
53 | }
54 |
55 | @Override
56 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
57 | int childCount = getChildCount();
58 | // 设置ViewGroup的高度
59 | MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
60 | mlp.height = mScreenHeight * childCount;
61 | for (int i = 0; i < childCount; i++) {
62 | View child = getChildAt(i);
63 | // 修改View 的 top和bottom属性,使得能够依次排列开来
64 | if (child.getVisibility() != View.GONE) {
65 | child.layout(l, i * mScreenHeight, r, (i+1)*mScreenHeight);
66 | }
67 | }
68 | }
69 |
70 |
71 | @Override
72 | public boolean onTouchEvent(MotionEvent event) {
73 | int y = (int) event.getY();
74 | switch (event.getAction()) {
75 | case MotionEvent.ACTION_DOWN:
76 | mLastY = y;
77 | // 记录触摸起点
78 | mStart = getScrollY();
79 | break;
80 | case MotionEvent.ACTION_MOVE:
81 | if (!mScroller.isFinished()) {
82 | mScroller.abortAnimation();
83 | }
84 | int dy = mLastY - y;
85 | if (getScrollY() < 0) {
86 | dy = 0;
87 | }
88 | if (getScrollY() > getHeight() - mScreenHeight) {
89 | dy = 0;
90 | }
91 | scrollBy(0, dy);
92 | mLastY = y;
93 | break;
94 | case MotionEvent.ACTION_UP:
95 | // 记录触摸终点
96 | int dScrollY = checkAlignment();
97 | if (dScrollY > 0) {
98 | if (dScrollY < mScreenHeight / 3) {
99 | mScroller.startScroll(
100 | 0, getScrollY(),
101 | 0, -dScrollY);
102 | } else {
103 | mScroller.startScroll(
104 | 0, getScrollY(),
105 | 0, mScreenHeight - dScrollY);
106 | }
107 | } else {
108 | if (-dScrollY < mScreenHeight / 3) {
109 | mScroller.startScroll(
110 | 0, getScrollY(),
111 | 0, -dScrollY);
112 | } else {
113 | mScroller.startScroll(
114 | 0, getScrollY(),
115 | 0, -mScreenHeight - dScrollY);
116 | }
117 | }
118 | break;
119 | }
120 | postInvalidate();
121 | return true;
122 | }
123 | private int checkAlignment() {
124 | int mEnd = getScrollY();
125 | boolean isUp = ((mEnd - mStart) > 0) ? true : false;
126 | int lastPrev = mEnd % mScreenHeight;
127 | int lastNext = mScreenHeight - lastPrev;
128 | if (isUp) {
129 | //向上的
130 | return lastPrev;
131 | } else {
132 | return -lastNext;
133 | }
134 | }
135 |
136 | @Override
137 | public void computeScroll() {
138 | super.computeScroll();
139 | if (mScroller.computeScrollOffset()){
140 | scrollTo(0, mScroller.getCurrY());
141 | postInvalidate();
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------