├── AdaptPieSample
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ └── Project.xml
│ ├── misc.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── zjx
│ │ │ └── sample
│ │ │ └── pie
│ │ │ ├── MainActivity.java
│ │ │ ├── ReflectUtils.java
│ │ │ ├── SecondActivity.java
│ │ │ ├── ThirdActivity.java
│ │ │ └── Validate.java
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_second.xml
│ │ └── activity_third.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── BluetoothSample
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── zjxstar
│ │ │ └── happy
│ │ │ └── bluetoothsample
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── zjxstar
│ │ │ │ └── happy
│ │ │ │ └── bluetoothsample
│ │ │ │ ├── BluetoothService.kt
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── zjxstar
│ │ └── happy
│ │ └── bluetoothsample
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── ConstraintLayoutSample
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── zjx
│ │ │ └── constraint
│ │ │ └── sample
│ │ │ └── MainActivity.java
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_main_b.xml
│ │ ├── activity_main_c.xml
│ │ ├── activity_main_d.xml
│ │ ├── activity_main_e.xml
│ │ ├── activity_main_f.xml
│ │ └── activity_main_g.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── DialogSample
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ └── Project.xml
│ ├── gradle.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── zjx
│ │ │ └── dialog
│ │ │ └── sample
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── zjx
│ │ │ │ └── dialog
│ │ │ │ └── sample
│ │ │ │ ├── FragmentA.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── MyAlertDialogFragment.java
│ │ │ │ ├── MyDialogFragment.java
│ │ │ │ ├── MySimpleDialogFragment.java
│ │ │ │ └── SecondActivity.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_second.xml
│ │ │ ├── fragment_a.xml
│ │ │ ├── fragment_dialog.xml
│ │ │ └── fragment_simple_dialog.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── zjx
│ │ └── dialog
│ │ └── sample
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── GradleSample
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ ├── project_task_examples.gradle
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── zjx
│ │ │ └── happy
│ │ │ └── learning
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── zjx
│ │ │ │ └── happy
│ │ │ │ └── learning
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── zjx
│ │ └── happy
│ │ └── learning
│ │ └── ExampleUnitTest.java
├── build.gradle
├── buildSrc
│ ├── .gitignore
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ └── groovy
│ │ └── com
│ │ └── zjx
│ │ └── happy
│ │ └── plugin
│ │ └── CustomPluginB.groovy
├── customPlugin
│ ├── .gitignore
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── groovy
│ │ └── com
│ │ │ └── zjx
│ │ │ └── happy
│ │ │ └── plugin
│ │ │ └── CustomPluginC.groovy
│ │ └── resources
│ │ └── META-INF
│ │ └── gradle-plugins
│ │ └── com.happy.custompluginc.properties
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── repos
│ └── com
│ │ └── happy
│ │ └── plugin
│ │ ├── customPlugin
│ │ ├── 1.0.0
│ │ │ ├── customPlugin-1.0.0.jar
│ │ │ ├── customPlugin-1.0.0.jar.md5
│ │ │ ├── customPlugin-1.0.0.jar.sha1
│ │ │ ├── customPlugin-1.0.0.pom
│ │ │ ├── customPlugin-1.0.0.pom.md5
│ │ │ └── customPlugin-1.0.0.pom.sha1
│ │ ├── maven-metadata.xml
│ │ ├── maven-metadata.xml.md5
│ │ └── maven-metadata.xml.sha1
│ │ └── transformPlugin
│ │ ├── 1.0.0
│ │ ├── transformPlugin-1.0.0.jar
│ │ ├── transformPlugin-1.0.0.jar.md5
│ │ ├── transformPlugin-1.0.0.jar.sha1
│ │ ├── transformPlugin-1.0.0.pom
│ │ ├── transformPlugin-1.0.0.pom.md5
│ │ └── transformPlugin-1.0.0.pom.sha1
│ │ ├── maven-metadata.xml
│ │ ├── maven-metadata.xml.md5
│ │ └── maven-metadata.xml.sha1
├── settings.gradle
└── transformPlugin
│ ├── .gitignore
│ ├── build.gradle
│ └── src
│ └── main
│ ├── groovy
│ └── com
│ │ └── zjx
│ │ └── happy
│ │ └── transform
│ │ ├── InjectTransform.groovy
│ │ ├── MyInjectByJavassit.groovy
│ │ └── TransformPlugin.groovy
│ └── resources
│ └── META-INF
│ └── gradle-plugins
│ └── com.happy.customplugin.transform.properties
├── GroovySample
├── .gitignore
└── src
│ └── com
│ └── zjx
│ └── happy
│ └── closure
│ ├── section_five.groovy
│ ├── section_four.groovy
│ ├── section_one.groovy
│ ├── section_three.groovy
│ └── section_two.groovy
├── JetpackSample
├── .gitignore
├── .idea
│ ├── gradle.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── zjxstar
│ │ │ └── happy
│ │ │ └── jetpacksample
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── zjxstar
│ │ │ │ └── happy
│ │ │ │ └── jetpacksample
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── databinding
│ │ │ │ ├── DatabindingActivity.kt
│ │ │ │ ├── InverseMethodModel.kt
│ │ │ │ ├── MyHandlers.kt
│ │ │ │ ├── ObservableViewModel.kt
│ │ │ │ ├── PlainOldActivitySolution5.kt
│ │ │ │ ├── Presenter.kt
│ │ │ │ ├── SimpleViewModelSolution.kt
│ │ │ │ ├── Solution2Activity.kt
│ │ │ │ ├── SolutionActivity.kt
│ │ │ │ ├── StringUtils.java
│ │ │ │ ├── Task.kt
│ │ │ │ ├── TwoWayBindingActivity.kt
│ │ │ │ ├── User.kt
│ │ │ │ └── utils
│ │ │ │ │ ├── BindingAdapters.kt
│ │ │ │ │ ├── BindingConverters.kt
│ │ │ │ │ └── BindingMethods.kt
│ │ │ │ ├── lifecycle
│ │ │ │ ├── MyActivity.kt
│ │ │ │ ├── MyLifecycleActivity.kt
│ │ │ │ ├── MyLiveData.kt
│ │ │ │ ├── MyLocationListener.kt
│ │ │ │ ├── NameActivity.kt
│ │ │ │ └── NameViewModel.kt
│ │ │ │ └── room
│ │ │ │ ├── AppDatabase.kt
│ │ │ │ ├── Book.kt
│ │ │ │ ├── Converters.kt
│ │ │ │ ├── DBActivity.kt
│ │ │ │ ├── FeedReaderContract.kt
│ │ │ │ ├── FeedReaderDbHelper.kt
│ │ │ │ ├── MyDao.kt
│ │ │ │ ├── NameTuple.kt
│ │ │ │ ├── Playlist.kt
│ │ │ │ ├── PlaylistSongJoinDao.kt
│ │ │ │ ├── RoomActivity.kt
│ │ │ │ ├── User.kt
│ │ │ │ ├── UserDao.kt
│ │ │ │ └── UserDetail.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── ic_person_black_96dp.xml
│ │ │ └── ic_whatshot_black_96dp.xml
│ │ │ ├── layout
│ │ │ ├── activity_databinding.xml
│ │ │ ├── activity_db.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_name.xml
│ │ │ ├── activity_room.xml
│ │ │ ├── activity_solution.xml
│ │ │ ├── activity_solution2.xml
│ │ │ ├── activity_two_way_binding.xml
│ │ │ ├── include_user.xml
│ │ │ └── plain_activity_solution_5.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── zjxstar
│ │ └── happy
│ │ └── jetpacksample
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── LayoutInflaterSample
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── zjx
│ │ │ └── sample
│ │ │ └── inflater
│ │ │ ├── DensityUtil.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MyFactory.java
│ │ │ ├── SecondActivity.java
│ │ │ └── ThirdActivity.java
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_main_include.xml
│ │ ├── activity_second.xml
│ │ ├── activity_third.xml
│ │ ├── layout_second_item.xml
│ │ └── layout_second_item2.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── ProGuardSample
├── .gitignore
├── .idea
│ ├── caches
│ │ └── build_file_checksums.ser
│ ├── codeStyles
│ │ └── Project.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules-debug.pro
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── zjx
│ │ │ └── sample
│ │ │ └── proguard
│ │ │ ├── MainActivity.java
│ │ │ └── model
│ │ │ ├── Dog.java
│ │ │ └── Movie.java
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── README.md
└── SecuritySample
├── .gitignore
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zjx
│ │ └── securitysample
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── README.txt
│ ├── java
│ │ └── com
│ │ │ └── zjx
│ │ │ └── securitysample
│ │ │ ├── MainActivity.kt
│ │ │ ├── base64
│ │ │ └── Base64Activity.java
│ │ │ └── md5
│ │ │ ├── MD5.java
│ │ │ ├── MD5Activity.java
│ │ │ ├── MD5K.kt
│ │ │ └── MD5Utils.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_base64.xml
│ │ ├── activity_main.xml
│ │ └── activity_md5.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zjx
│ └── securitysample
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/AdaptPieSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /.idea
4 | /local.properties
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/AdaptPieSample/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/AdaptPieSample/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.zjx.sample.pie"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | implementation fileTree(dir: 'libs', include: ['*.jar'])
22 | implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
23 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
24 | }
25 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/java/com/zjx/sample/pie/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package com.zjx.sample.pie;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.view.WindowManager;
7 |
8 | public class SecondActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_second);
14 |
15 | // 设置全屏
16 | // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
17 |
18 | //沉浸式状态栏
19 | // getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
20 |
21 | WindowManager.LayoutParams lp = getWindow().getAttributes();
22 | // 只有当DisplayCutout完全包含在系统栏中时,才允许窗口延伸到DisplayCutout区域。 否则,窗口布局不与DisplayCutout区域重叠。
23 | lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
24 | // 该窗口决不允许与DisplayCutout区域重叠。
25 | // lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
26 | // 该窗口始终允许延伸到屏幕短边上的DisplayCutout区域。
27 | // lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
28 | getWindow().setAttributes(lp);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
24 |
25 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AdaptPieSample
3 |
4 |
--------------------------------------------------------------------------------
/AdaptPieSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AdaptPieSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/AdaptPieSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
--------------------------------------------------------------------------------
/AdaptPieSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/AdaptPieSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/AdaptPieSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/AdaptPieSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/BluetoothSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .idea
--------------------------------------------------------------------------------
/BluetoothSample/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/BluetoothSample/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BluetoothSample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BluetoothSample/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BluetoothSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/BluetoothSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 28
9 | defaultConfig {
10 | applicationId "com.zjxstar.happy.bluetoothsample"
11 | minSdkVersion 21
12 | targetSdkVersion 28
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28 | implementation 'com.android.support:appcompat-v7:28.0.0'
29 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | }
34 |
--------------------------------------------------------------------------------
/BluetoothSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/androidTest/java/com/zjxstar/happy/bluetoothsample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.bluetoothsample
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.zjxstar.happy.bluetoothsample", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BluetoothSample
3 |
4 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BluetoothSample/app/src/test/java/com/zjxstar/happy/bluetoothsample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.bluetoothsample
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/BluetoothSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.40'
5 | repositories {
6 | google()
7 | jcenter()
8 |
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.4.1'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 |
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/BluetoothSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # Kotlin code style for this project: "official" or "obsolete":
15 | kotlin.code.style=official
16 |
--------------------------------------------------------------------------------
/BluetoothSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/BluetoothSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/BluetoothSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 05 14:34:03 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/BluetoothSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 | /.idea
13 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.zjx.constraint.sample"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | implementation fileTree(dir: 'libs', include: ['*.jar'])
22 | implementation 'com.android.support:appcompat-v7:28.0.0'
23 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
24 | }
25 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/java/com/zjx/constraint/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.zjx.constraint.sample;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main_g);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/layout/activity_main_b.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
17 |
18 |
25 |
26 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/layout/activity_main_c.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
21 |
22 |
32 |
33 |
43 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/layout/activity_main_d.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/layout/activity_main_e.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
18 |
19 |
27 |
28 |
34 |
35 |
44 |
45 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/layout/activity_main_g.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
16 |
17 |
27 |
28 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ConstraintLayoutSample
3 |
4 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ConstraintLayoutSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/ConstraintLayoutSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/ConstraintLayoutSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/DialogSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 |
--------------------------------------------------------------------------------
/DialogSample/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/DialogSample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/DialogSample/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/DialogSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/DialogSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.zjx.dialog.sample"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | }
29 |
--------------------------------------------------------------------------------
/DialogSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/DialogSample/app/src/androidTest/java/com/zjx/dialog/sample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zjx.dialog.sample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zjx.dialog.sample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/java/com/zjx/dialog/sample/MySimpleDialogFragment.java:
--------------------------------------------------------------------------------
1 | package com.zjx.dialog.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.DialogFragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | public class MySimpleDialogFragment extends DialogFragment {
13 |
14 | public static MySimpleDialogFragment newInstance() {
15 | return new MySimpleDialogFragment();
16 | }
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | View view = inflater.inflate(R.layout.fragment_simple_dialog, container, false);
22 | TextView tv = view.findViewById(R.id.text);
23 | tv.setText("this is an instance of MySimpleDialogFragment");
24 | return view;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/layout/fragment_a.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/layout/fragment_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/layout/fragment_simple_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DialogSample
3 |
4 |
--------------------------------------------------------------------------------
/DialogSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/DialogSample/app/src/test/java/com/zjx/dialog/sample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zjx.dialog.sample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/DialogSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/DialogSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
--------------------------------------------------------------------------------
/DialogSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/DialogSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/DialogSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/DialogSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/GradleSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .idea/
--------------------------------------------------------------------------------
/GradleSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/GradleSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/GradleSample/app/src/androidTest/java/com/zjx/happy/learning/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.learning;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zjx.happy.learning", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/java/com/zjx/happy/learning/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.learning;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | GradleSample
3 |
4 |
--------------------------------------------------------------------------------
/GradleSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/GradleSample/app/src/test/java/com/zjx/happy/learning/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.learning;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/GradleSample/buildSrc/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
--------------------------------------------------------------------------------
/GradleSample/buildSrc/build.gradle:
--------------------------------------------------------------------------------
1 | // 依赖groovy插件
2 | plugins {
3 | id 'groovy'
4 | }
5 |
6 | dependencies {
7 | implementation gradleApi()
8 | implementation localGroovy()
9 | }
10 |
--------------------------------------------------------------------------------
/GradleSample/buildSrc/src/main/groovy/com/zjx/happy/plugin/CustomPluginB.groovy:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.plugin
2 |
3 | import org.gradle.api.Plugin
4 | import org.gradle.api.Project
5 |
6 | // 在单独的groovy文件中定义插件类
7 | class CustomPluginB implements Plugin {
8 |
9 | @Override
10 | void apply(Project project) {
11 | project.task('CustomPluginTaskB') {
12 | doFirst {
13 | println 'This is custom plugin TaskB'
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/GradleSample/customPlugin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
--------------------------------------------------------------------------------
/GradleSample/customPlugin/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'groovy'
3 | }
4 |
5 | apply plugin: 'maven'
6 |
7 | dependencies {
8 | implementation gradleApi()
9 | implementation localGroovy()
10 | }
11 |
12 | repositories {
13 | mavenCentral()
14 | }
15 |
16 | // 将该插件上传到本地Maven库
17 | group='com.happy.plugin'
18 | version='1.0.0'
19 |
20 | // 通过gradlew :customPlugin:uploadArchives命令上传
21 | uploadArchives {
22 | repositories {
23 | mavenDeployer {
24 | //本地的Maven地址设置为../repos
25 | repository(url: uri('../repos'))
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/GradleSample/customPlugin/src/main/groovy/com/zjx/happy/plugin/CustomPluginC.groovy:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.plugin
2 |
3 | import org.gradle.api.Plugin
4 | import org.gradle.api.Project
5 |
6 | class CustomPluginC implements Plugin {
7 |
8 | @Override
9 | void apply(Project project) {
10 |
11 | project.task('CustomPluginTaskC') {
12 | doFirst {
13 | println 'This is Custom Plugin TaskC'
14 | }
15 | }
16 |
17 | }
18 | }
--------------------------------------------------------------------------------
/GradleSample/customPlugin/src/main/resources/META-INF/gradle-plugins/com.happy.custompluginc.properties:
--------------------------------------------------------------------------------
1 | # 该properties文件的文件名是就是插件名:com.happy.custompluginc
2 | # 创建该目录一定要注意,一定要一级一级的创建,先创建META-INF,再创建 gradle-plugins,而不是直接创建META-INF.gradle-plugins
3 | # 插件实现类的全限定性名
4 | implementation-class=com.zjx.happy.plugin.CustomPluginC
--------------------------------------------------------------------------------
/GradleSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GradleSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/GradleSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon May 20 12:20:26 GMT+08:00 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.jar
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.jar.md5:
--------------------------------------------------------------------------------
1 | 9f2e6193917124e8e0630923556be3ce
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.jar.sha1:
--------------------------------------------------------------------------------
1 | ad4c2a2249008d51f137a4a7df640c37f6766f05
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.pom:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | com.happy.plugin
6 | customPlugin
7 | 1.0.0
8 |
9 |
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.pom.md5:
--------------------------------------------------------------------------------
1 | 52e619f3f28e05b92d9a8e4d90eb01dd
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/1.0.0/customPlugin-1.0.0.pom.sha1:
--------------------------------------------------------------------------------
1 | 785cec581a116e7806d10adbe7ed30e33546a3dc
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/maven-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.happy.plugin
4 | customPlugin
5 |
6 | 1.0.0
7 |
8 | 1.0.0
9 |
10 | 20190521120017
11 |
12 |
13 |
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/maven-metadata.xml.md5:
--------------------------------------------------------------------------------
1 | 6c83cf2997d20ea582bef7f0999a6022
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/customPlugin/maven-metadata.xml.sha1:
--------------------------------------------------------------------------------
1 | 6627b7fe2d175df9210ecdd6673f186f95321bed
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.jar
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.jar.md5:
--------------------------------------------------------------------------------
1 | 27e520f22294e9d3a5c65ae59efc5260
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.jar.sha1:
--------------------------------------------------------------------------------
1 | 0b5edf5d71b934f35b52162001646e7d0262d5d5
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.pom:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | com.happy.plugin
6 | transformPlugin
7 | 1.0.0
8 |
9 |
10 | com.android.tools.build
11 | gradle
12 | 3.3.1
13 | compile
14 |
15 |
16 | org.javassist
17 | javassist
18 | 3.22.0-GA
19 | compile
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.pom.md5:
--------------------------------------------------------------------------------
1 | 0eef0588c4e98c2cea578cf30adbb6dc
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/1.0.0/transformPlugin-1.0.0.pom.sha1:
--------------------------------------------------------------------------------
1 | 180b156877298ada22d36f65a37253b953561d30
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/maven-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.happy.plugin
4 | transformPlugin
5 |
6 | 1.0.0
7 |
8 | 1.0.0
9 |
10 | 20190522022105
11 |
12 |
13 |
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/maven-metadata.xml.md5:
--------------------------------------------------------------------------------
1 | aadfa54ddfa4e7bb0c6ee078a8ccfe7c
--------------------------------------------------------------------------------
/GradleSample/repos/com/happy/plugin/transformPlugin/maven-metadata.xml.sha1:
--------------------------------------------------------------------------------
1 | b0ca63433490ec45347835df436451fb9078bf97
--------------------------------------------------------------------------------
/GradleSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':buildSrc', ':customPlugin', ':transformPlugin'
2 |
--------------------------------------------------------------------------------
/GradleSample/transformPlugin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/GradleSample/transformPlugin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'groovy'
2 |
3 | apply plugin: 'maven'
4 |
5 | dependencies {
6 | compile gradleApi()
7 | compile localGroovy()
8 |
9 | compile 'com.android.tools.build:gradle:3.3.1'
10 | compile group: 'org.javassist', name: 'javassist', version: '3.22.0-GA'
11 | }
12 |
13 | repositories {
14 | mavenCentral()
15 | }
16 |
17 | // 将该插件上传到本地Maven库
18 | group='com.happy.plugin'
19 | version='1.0.0'
20 |
21 | // 通过gradlew :transformPlugin:uploadArchives命令上传
22 | uploadArchives {
23 | repositories {
24 | mavenDeployer {
25 | //本地的Maven地址设置为../repos
26 | repository(url: uri('../repos'))
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/GradleSample/transformPlugin/src/main/groovy/com/zjx/happy/transform/TransformPlugin.groovy:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.transform
2 |
3 | import com.android.build.gradle.AppExtension
4 | import org.gradle.api.Plugin
5 | import org.gradle.api.Project
6 |
7 | /**
8 | * 定义插件,加入Transform
9 | */
10 | class TransformPlugin implements Plugin {
11 |
12 | @Override
13 | void apply(Project project) {
14 |
15 | // 获取Android扩展
16 | def android = project.extensions.getByType(AppExtension)
17 | // 注册Transform,其实就是添加了Task
18 | android.registerTransform(new InjectTransform(project))
19 |
20 | // 这里只是随便定义一个Task而已,和Transform无关
21 | project.task('JustTask') {
22 | doLast {
23 | println('InjectTransform task')
24 | }
25 | }
26 |
27 | }
28 | }
--------------------------------------------------------------------------------
/GradleSample/transformPlugin/src/main/resources/META-INF/gradle-plugins/com.happy.customplugin.transform.properties:
--------------------------------------------------------------------------------
1 | implementation-class=com.zjx.happy.transform.TransformPlugin
--------------------------------------------------------------------------------
/GroovySample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 | release
10 | .idea
11 | out/
--------------------------------------------------------------------------------
/GroovySample/src/com/zjx/happy/closure/section_four.groovy:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.closure
2 |
3 | /**
4 | * 动态闭包
5 | * @author zjxstar
6 | */
7 |
8 | def say(closure) {
9 | if (closure) { // 判断是否传入了一个闭包
10 | closure()
11 | } else {
12 | println('say nothing')
13 | }
14 | }
15 |
16 | say()
17 | say() {
18 | println('i\'m hungry')
19 | }
20 |
21 | def compute(amount, Closure computer) {
22 | total = 0
23 | // 判断闭包的参数个数是否为2
24 | if (computer.maximumNumberOfParameters == 2) {
25 | total = computer(amount, 6)
26 | } else {
27 | total = computer(amount)
28 | }
29 |
30 | println("total is $total")
31 | }
32 |
33 | compute(100) {
34 | it * 8 // 800
35 | }
36 |
37 | compute(100) { // 600
38 | amount, weight ->
39 | amount * weight
40 | }
41 |
42 | /**
43 | * 对闭包的参数类型做要求
44 | * @param closure
45 | */
46 | def execute(Closure closure) {
47 | println("params count: ${closure.maximumNumberOfParameters}")
48 |
49 | if (closure.delegate != closure.owner) {
50 | println('I have a custom delegate')
51 | }
52 |
53 | // 遍历闭包的参数类型
54 | for (paramType in closure.parameterTypes) {
55 | if (paramType.name == 'java.util.Date') {
56 | println('Force today')
57 | } else {
58 | println(paramType.name)
59 | }
60 |
61 | }
62 | }
63 |
64 | execute {} // 一个Object类型参数
65 | execute { it } // 一个默认参数,Object类型
66 | execute { -> } // 没有参数
67 | execute { String value -> println(value) } // 一个String类型参数
68 | execute {int a, Date b -> println('Two params')} // 两个参数,int类型和Date类型
69 |
70 | class A {
71 | String name
72 | }
73 | Closure closure = { println(it) }
74 | closure.delegate = new A(name: 'Tom')
75 | execute(closure)
76 |
--------------------------------------------------------------------------------
/GroovySample/src/com/zjx/happy/closure/section_one.groovy:
--------------------------------------------------------------------------------
1 | package com.zjx.happy.closure
2 |
3 | /**
4 | * 闭包带来的好处
5 | * @author zjxstar
6 | */
7 |
8 | /**
9 | * 传统方式实现1到n的奇数和
10 | * @param n
11 | * @return
12 | */
13 | def sum(n) {
14 | total = 0
15 | for (int i = 1; i <= n; i += 2) {
16 | // 计算1到n的奇数和
17 | total += i
18 | }
19 | total
20 | }
21 |
22 | println('传统方式实现 sum = ' + sum(9))
23 |
24 | /**
25 | * 传统方式实现1到n的奇数乘积
26 | * @param n
27 | * @return
28 | */
29 | def multiply(n) {
30 | total = 1
31 | for (int i = 1; i <= n; i += 2) {
32 | // 计算1到n的奇数乘积
33 | total *= i
34 | }
35 | total
36 | }
37 |
38 | println('传统方式实现 multiply = ' + multiply(9))
39 |
40 | /**
41 | * 使用闭包实现
42 | * @param n
43 | * @param closure
44 | */
45 | def pickOdd(n, closure) { // 此处的closure可以换成别的参数名
46 | for (int i = 1; i <= n; i += 2) {
47 | // 执行逻辑都由传入的闭包决定
48 | closure(i)
49 | }
50 | }
51 |
52 | /**
53 | * 打印奇数
54 | */
55 | pickOdd(9) {
56 | println it
57 | }
58 |
59 | /**
60 | * 求和
61 | */
62 | total = 0
63 | pickOdd(9, {
64 | num -> total += num // 可以访问total变量
65 | })
66 | println("Sum of odd is: ${total}")
--------------------------------------------------------------------------------
/JetpackSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .idea
15 |
--------------------------------------------------------------------------------
/JetpackSample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/JetpackSample/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/JetpackSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/JetpackSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | apply plugin: 'kotlin-kapt'
8 |
9 | android {
10 | compileSdkVersion 28
11 | defaultConfig {
12 | applicationId "com.zjxstar.happy.jetpacksample"
13 | minSdkVersion 21
14 | targetSdkVersion 28
15 | versionCode 1
16 | versionName "1.0"
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | vectorDrawables.useSupportLibrary = true
19 | }
20 |
21 | // 支持DataBinding
22 | dataBinding {
23 | enabled true
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 | }
37 |
38 | dependencies {
39 | implementation fileTree(dir: 'libs', include: ['*.jar'])
40 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
41 | implementation 'androidx.appcompat:appcompat:1.0.2'
42 | implementation 'androidx.core:core-ktx:1.0.2'
43 |
44 | implementation "androidx.lifecycle:lifecycle-extensions:2.1.0-alpha04"
45 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
46 |
47 | implementation 'androidx.room:room-common:2.1.0'
48 | implementation 'androidx.room:room-runtime:2.1.0'
49 | implementation 'androidx.room:room-rxjava2:2.1.0'
50 |
51 | // 测试相关
52 | testImplementation 'junit:junit:4.12'
53 | androidTestImplementation 'androidx.test:runner:1.2.0'
54 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
55 | }
56 |
--------------------------------------------------------------------------------
/JetpackSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/androidTest/java/com/zjxstar/happy/jetpacksample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample
2 |
3 | import androidx.test.InstrumentationRegistry
4 | import androidx.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.zjxstar.happy.jetpacksample", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.widget.Button
7 | import android.widget.Toast
8 | import com.zjxstar.happy.jetpacksample.databinding.*
9 | import com.zjxstar.happy.jetpacksample.lifecycle.NameActivity
10 | import com.zjxstar.happy.jetpacksample.room.DBActivity
11 | import kotlinx.android.synthetic.main.activity_main.*
12 |
13 | /**
14 | * 主界面
15 | *
16 | * @author zjxstar
17 | * @date Created on 2019-07-03
18 | */
19 | class MainActivity : AppCompatActivity() {
20 |
21 | lateinit var mGoDataBindingBtn: Button
22 |
23 | override fun onCreate(savedInstanceState: Bundle?) {
24 | super.onCreate(savedInstanceState)
25 | setContentView(R.layout.activity_main)
26 |
27 | mGoDataBindingBtn = findViewById(R.id.go_databinding_btn)
28 | mGoDataBindingBtn.apply {
29 | setOnClickListener { view ->
30 | val intent = Intent(context, TwoWayBindingActivity::class.java)
31 | startActivity(intent)
32 | }
33 | }
34 |
35 | go_lifecycle_btn.setOnClickListener {
36 | val intent = Intent(this, NameActivity::class.java)
37 | startActivity(intent)
38 | }
39 |
40 | go_db_btn.setOnClickListener {
41 | val intent = Intent(this, DBActivity::class.java)
42 | startActivity(intent)
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/DatabindingActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import androidx.databinding.DataBindingUtil
6 | import androidx.databinding.ObservableArrayMap
7 | import androidx.databinding.ObservableInt
8 | import com.zjxstar.happy.jetpacksample.R
9 |
10 | /**
11 | * DataBinding学习页面
12 | *
13 | * @author zjxstar
14 | * @date Created on 2019-07-03
15 | */
16 | class DatabindingActivity : AppCompatActivity() {
17 |
18 | override fun onCreate(savedInstanceState: Bundle?) {
19 | super.onCreate(savedInstanceState)
20 | setContentView(R.layout.activity_databinding)
21 |
22 | val binding: ActivityDatabindingBinding = DataBindingUtil.setContentView(
23 | this, R.layout.activity_databinding)
24 |
25 | binding.user = User("Tom", "Jerry")
26 | binding.handlers = MyHandlers()
27 |
28 | binding.task = Task("Task A")
29 | binding.presenter = Presenter()
30 | binding.task = Task("Task B")
31 |
32 | val map = ObservableArrayMap().apply {
33 | put("firstName", "Google")
34 | put("lastName", "Inc.")
35 | put("age", 17)
36 | }
37 |
38 | binding.map = map
39 |
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/InverseMethodModel.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import android.text.TextUtils
4 | import android.util.Log
5 | import androidx.databinding.InverseMethod
6 |
7 | /**
8 | *
9 | * @author zjxstar
10 | * @date Created on 2019-07-05
11 | */
12 |
13 | object InverseMethodModel {
14 |
15 | @InverseMethod("orderTypeToString")
16 | @JvmStatic
17 | fun stringToOrderType(str: String): String {
18 | val result = when(str) {
19 | "A" -> "0001"
20 | "B" -> "0002"
21 | else -> ""
22 | }
23 | Log.d("InverseMethodModel", result)
24 | return result
25 | }
26 |
27 | @JvmStatic
28 | fun orderTypeToString(type: String): String {
29 | return when(type) {
30 | "0001" -> "A"
31 | "0002" -> "B"
32 | else -> ""
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/MyHandlers.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import android.util.Log
4 | import android.view.View
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-07-03
10 | */
11 | class MyHandlers {
12 |
13 | fun onClickFriend(view: View) {
14 | Log.d("MyHandlers", "onClickFriend")
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/ObservableViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.databinding.Observable
4 | import androidx.databinding.PropertyChangeRegistry
5 | import androidx.lifecycle.ViewModel
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-07-04
10 | */
11 | open class ObservableViewModel : ViewModel(), Observable {
12 |
13 | private val callbacks: PropertyChangeRegistry = PropertyChangeRegistry()
14 |
15 | override fun removeOnPropertyChangedCallback(callback: Observable.OnPropertyChangedCallback?) {
16 | callbacks.add(callback)
17 | }
18 |
19 | override fun addOnPropertyChangedCallback(callback: Observable.OnPropertyChangedCallback?) {
20 | callbacks.remove(callback)
21 | }
22 |
23 | fun notifyChange() {
24 | callbacks.notifyCallbacks(this, 0, null)
25 | }
26 |
27 | fun notifyPropertyChanged(fieldId: Int) {
28 | callbacks.notifyCallbacks(this, fieldId, null)
29 | }
30 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/PlainOldActivitySolution5.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.zjxstar.happy.jetpacksample.databinding
18 |
19 | import android.os.Bundle
20 | import androidx.appcompat.app.AppCompatActivity
21 | import androidx.databinding.DataBindingUtil
22 | import androidx.lifecycle.ViewModelProviders
23 | import com.zjxstar.happy.jetpacksample.R
24 |
25 | /**
26 | * Fifth version of the Activity in the codelab.
27 | */
28 | class PlainOldActivitySolution5 : AppCompatActivity() {
29 |
30 | // Obtain ViewModel from ViewModelProviders
31 | private val viewModel by lazy {
32 | ViewModelProviders.of(this).get(SimpleViewModelSolution::class.java)
33 | }
34 |
35 | override fun onCreate(savedInstanceState: Bundle?) {
36 | super.onCreate(savedInstanceState)
37 |
38 | val binding: PlainActivitySolution5Binding =
39 | DataBindingUtil.setContentView(this, R.layout.plain_activity_solution_5)
40 |
41 | binding.lifecycleOwner = this // use Fragment.viewLifecycleOwner for fragments
42 |
43 | binding.viewmodel = viewModel
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/Presenter.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import android.util.Log
4 | import android.view.View
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-07-03
10 | */
11 | class Presenter {
12 |
13 | fun onSaveClick(task: Task) {
14 | Log.d("Presenter", "onSaveClick(task)")
15 | }
16 |
17 | fun onSaveClick(view: View, task: Task) {
18 | Log.d("Presenter", "onSaveClick(view, task)")
19 | }
20 |
21 | fun onCompletedChanged(task: Task, completed: Boolean) {
22 | Log.d("Presenter", "onCompletedChanged( " + task.name + ", " + completed + " )")
23 | }
24 |
25 | fun onLongClick(view: View, task: Task): Boolean {
26 | Log.d("Presenter", "onLongClick" + task.name)
27 | return false
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/SimpleViewModelSolution.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MutableLiveData
5 | import androidx.lifecycle.Transformations
6 | import androidx.lifecycle.ViewModel
7 |
8 | /**
9 | *
10 | * @author zjxstar
11 | * @date Created on 2019-07-04
12 | */
13 | class SimpleViewModelSolution : ViewModel() {
14 |
15 | private val _name = MutableLiveData("Tom")
16 | private val _lastname = MutableLiveData("Jerry")
17 | private val _likes = MutableLiveData(0)
18 |
19 | val name: LiveData = _name
20 | val lastname: LiveData = _lastname
21 | val likes: LiveData = _likes
22 |
23 | val popularity: LiveData = Transformations.map(_likes) {
24 | when {
25 | it > 9 -> Popularity.STAR
26 | it > 4 -> Popularity.POPULAR
27 | else -> Popularity.NORMAL
28 | }
29 | }
30 |
31 | fun onLike() {
32 | _likes.value = (_likes.value ?: 0) + 1
33 | }
34 |
35 | }
36 |
37 | enum class Popularity {
38 | NORMAL,
39 | POPULAR,
40 | STAR
41 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/Solution2Activity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.databinding.DataBindingUtil
6 | import androidx.lifecycle.ViewModelProviders
7 | import com.zjxstar.happy.jetpacksample.R
8 |
9 | /**
10 | *
11 | * @author zjxstar
12 | * @date Created on 2019-07-04
13 | */
14 | class Solution2Activity : AppCompatActivity() {
15 |
16 | private val viewmodel by lazy {
17 | ViewModelProviders.of(this).get(SimpleViewModelSolution::class.java)
18 | }
19 |
20 | override fun onCreate(savedInstanceState: Bundle?) {
21 | super.onCreate(savedInstanceState)
22 |
23 | val binding: ActivitySolution2Binding = DataBindingUtil.setContentView(this, R.layout.activity_solution2)
24 | binding.lifecycleOwner = this
25 | binding.viewmodel = viewmodel
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/SolutionActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import androidx.databinding.DataBindingUtil
6 | import androidx.lifecycle.ViewModelProviders
7 | import com.zjxstar.happy.jetpacksample.R
8 |
9 | class SolutionActivity : AppCompatActivity() {
10 |
11 | private val viewModel by lazy {
12 | ViewModelProviders.of(this).get(SimpleViewModelSolution::class.java)
13 | }
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_solution)
18 | val binding: ActivitySolutionBinding = DataBindingUtil.setContentView(this, R.layout.activity_solution)
19 | // val binding: ActivitySolutionBinding = ActivitySolutionBinding.inflate(layoutInflater)
20 | binding.lifecycleOwner = this
21 | binding.viewmodel = viewModel
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding;
2 |
3 | /**
4 | * @author zjxstar
5 | * @date Created on 2019-07-03
6 | */
7 | public class StringUtils {
8 |
9 | public static String say(Task task) {
10 | return task.getName();
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/Task.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | /**
4 | *
5 | * @author zjxstar
6 | * @date Created on 2019-07-03
7 | */
8 | data class Task(val name: String)
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/TwoWayBindingActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import androidx.databinding.DataBindingUtil
6 | import com.zjxstar.happy.jetpacksample.R
7 |
8 | class TwoWayBindingActivity : AppCompatActivity() {
9 |
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | val binding: ActivityTwoWayBindingBinding = DataBindingUtil.setContentView(this, R.layout.activity_two_way_binding)
13 | binding.orderTypeCode = "0002"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/User.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.databinding
2 |
3 | import androidx.databinding.ObservableInt
4 |
5 | /**
6 | *
7 | * @author zjxstar
8 | * @date Created on 2019-07-03
9 | */
10 | data class User(val firstname: String, val lastname: String)
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/utils/BindingConverters.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example.android.databinding.basicsample.util
18 |
19 | import android.view.View
20 | import androidx.databinding.BindingConversion
21 |
22 | /**
23 | * In order to show a View only when it has more than 0 likes, we pass this expression to its
24 | * visibilty property:
25 | *
26 | * `android:visibility="@{ConverterUtil.isZero(viewmodel.likes)}"`
27 | *
28 | * This converts "likes" (an Int) into a Boolean. See [BindingConverters] for the conversion
29 | * from Boolean to a visibility integer.
30 | */
31 | object ConverterUtil {
32 | @JvmStatic
33 | fun isZero(number: Int): Boolean = number == 0
34 | }
35 |
36 | /**
37 | * The number of likes is an integer and the visibility attribute takes an integer
38 | * (VISIBLE, GONE and INVISIBLE are 0, 4 and 8 respectively), so we use this converter.
39 | *
40 | * There is no need to specify that this converter should be used. [BindingConversion]s are
41 | * applied automatically.
42 | */
43 | object BindingConverters {
44 |
45 | @BindingConversion
46 | @JvmStatic
47 | fun booleanToVisibility(isNotVisible: Boolean): Int {
48 | return if (isNotVisible) View.GONE else View.VISIBLE
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/databinding/utils/BindingMethods.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example.android.databinding.basicsample.util
18 |
19 | import android.widget.ImageView
20 | import androidx.databinding.BindingMethod
21 | import androidx.databinding.BindingMethods
22 |
23 | /**
24 | * `app:srcCompat` is an attribute used by the support library to integrate vector drawables. This
25 | * BindingMethod binds the attribute to the setImageDrawable method in the ImageView class.
26 | *
27 | * Binding methods have to be applied to any class in your project. Even an empty one.
28 | *
29 | * This is equivalent to:
30 | * ```
31 | *
32 | * @BindingAdapter("app:srcCompat")
33 | * @JvmStatic fun srcCompat(view: ImageView, @DrawableRes drawableId: Int) {
34 | * view.setImageResource(drawable)
35 | * }
36 | * ```
37 | */
38 | @BindingMethods(
39 | BindingMethod(
40 | type = ImageView::class,
41 | attribute = "app:srcCompat",
42 | method = "setImageResource"
43 | )
44 | )
45 | class MyBindingMethods
46 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/MyActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import android.app.Activity
4 | import android.os.Bundle
5 | import androidx.lifecycle.Lifecycle
6 | import androidx.lifecycle.LifecycleOwner
7 | import androidx.lifecycle.LifecycleRegistry
8 |
9 | /**
10 | *
11 | * @author zjxstar
12 | * @date Created on 2019-09-02
13 | */
14 |
15 | class MyActivity : Activity(), LifecycleOwner {
16 | private lateinit var lifecycleRegistry: LifecycleRegistry
17 |
18 | override fun onCreate(savedInstanceState: Bundle?) {
19 | super.onCreate(savedInstanceState)
20 |
21 | lifecycleRegistry = LifecycleRegistry(this)
22 | lifecycleRegistry.markState(Lifecycle.State.CREATED)
23 | }
24 |
25 | override fun onStart() {
26 | super.onStart()
27 | lifecycleRegistry.markState(Lifecycle.State.STARTED)
28 | }
29 |
30 | override fun getLifecycle(): Lifecycle {
31 | return lifecycleRegistry
32 | }
33 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/MyLifecycleActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-09-02
10 | */
11 | class MyLifecycleActivity : AppCompatActivity() {
12 |
13 | private lateinit var myLocationListener: MyLocationListener
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | myLocationListener = MyLocationListener(this, lifecycle) {
18 | location -> // update UI
19 | }
20 |
21 |
22 | }
23 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/MyLiveData.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import androidx.annotation.MainThread
4 | import androidx.lifecycle.LiveData
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-09-02
10 | */
11 |
12 | class MyLiveData : LiveData() {
13 |
14 | override fun onActive() {
15 | super.onActive()
16 | }
17 |
18 |
19 | override fun onInactive() {
20 | super.onInactive()
21 | }
22 |
23 | override fun setValue(value: String?) {
24 | super.setValue(value)
25 | }
26 |
27 | companion object {
28 | private lateinit var sInstance: MyLiveData
29 |
30 | @MainThread
31 | fun get(): MyLiveData {
32 | sInstance = if (::sInstance.isInitialized) sInstance else MyLiveData()
33 | return sInstance
34 | }
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/MyLocationListener.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import android.content.Context
4 | import android.location.Location
5 | import androidx.lifecycle.Lifecycle
6 | import androidx.lifecycle.OnLifecycleEvent
7 |
8 | /**
9 | *
10 | * @author zjxstar
11 | * @date Created on 2019-09-02
12 | */
13 | class MyLocationListener(private val context: Context,
14 | private val lifecyle: Lifecycle,
15 | private val callback: (Location) -> Unit) {
16 | private var enabled = false;
17 |
18 | @OnLifecycleEvent(Lifecycle.Event.ON_START)
19 | fun start() {
20 | if (enabled) {
21 | // TODO connect
22 | }
23 | }
24 |
25 | fun enable() {
26 | enabled = true
27 | if (lifecyle.currentState.isAtLeast(Lifecycle.State.STARTED)) {
28 | // TODO connect if not connected
29 | }
30 | }
31 |
32 | @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
33 | fun stop() {
34 | // disconnect if connected
35 | }
36 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/NameActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.lifecycle.Observer
6 | import androidx.lifecycle.ViewModelProviders
7 | import com.zjxstar.happy.jetpacksample.R
8 | import kotlinx.android.synthetic.main.activity_name.*
9 |
10 | /**
11 | *
12 | * @author zjxstar
13 | * @date Created on 2019-09-02
14 | */
15 |
16 | class NameActivity : AppCompatActivity() {
17 |
18 | private lateinit var model: NameViewModel
19 |
20 | override fun onCreate(savedInstanceState: Bundle?) {
21 | super.onCreate(savedInstanceState)
22 | setContentView(R.layout.activity_name)
23 |
24 | model = ViewModelProviders.of(this).get(NameViewModel::class.java)
25 |
26 | val nameObserver = Observer {
27 | newName -> nameTextView.text = newName
28 | }
29 |
30 | model.currentName.observe(this, nameObserver)
31 |
32 | updateBtn.setOnClickListener {
33 | val anotherName = "Tom"
34 | model.currentName.value = anotherName
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/lifecycle/NameViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.lifecycle
2 |
3 | import androidx.lifecycle.MutableLiveData
4 | import androidx.lifecycle.ViewModel
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-09-02
10 | */
11 |
12 | class NameViewModel : ViewModel() {
13 | val currentName: MutableLiveData by lazy {
14 | MutableLiveData()
15 | }
16 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/AppDatabase.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.Database
4 | import androidx.room.RoomDatabase
5 | import androidx.room.TypeConverters
6 |
7 | /**
8 | *
9 | * @author zjxstar
10 | * @date Created on 2019-09-11
11 | */
12 |
13 | @Database(entities = arrayOf(User::class),
14 | views = arrayOf(UserDetail::class),
15 | version = 1)
16 | @TypeConverters(Converters::class)
17 | abstract class AppDatabase : RoomDatabase() {
18 | abstract fun userDao(): UserDao
19 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/Book.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.ColumnInfo
4 | import androidx.room.Entity
5 | import androidx.room.ForeignKey
6 | import androidx.room.PrimaryKey
7 |
8 | /**
9 | *
10 | * @author zjxstar
11 | * @date Created on 2019-09-11
12 | */
13 | @Entity(
14 | foreignKeys = arrayOf(ForeignKey(entity = User::class,
15 | parentColumns = arrayOf("uid"),
16 | childColumns = arrayOf("user_id"))
17 | )
18 | )
19 | data class Book(
20 | @PrimaryKey val bookId: Int,
21 | val title: String?,
22 | @ColumnInfo(name = "user_id") val userId: Int
23 | )
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/Converters.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.TypeConverter
4 | import java.util.*
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-09-12
10 | */
11 |
12 | class Converters {
13 |
14 | @TypeConverter
15 | fun fromTimestamp(value: Long?): Date? {
16 | return value?.let { Date(it) }
17 | }
18 |
19 | @TypeConverter
20 | fun dateToTimestamp(date: Date?): Long? {
21 | return date?.time?.toLong()
22 | }
23 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/FeedReaderContract.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import android.provider.BaseColumns
4 |
5 | /**
6 | *
7 | * @author zjxstar
8 | * @date Created on 2019-09-03
9 | */
10 | class FeedReaderContract {
11 |
12 | object FeedEntry : BaseColumns {
13 | const val TABLE_NAME = "entry"
14 | const val COLUMN_NAME_TITLE = "title"
15 | const val COLUMN_NAME_SUBTITLE = "subtitle"
16 | }
17 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/FeedReaderDbHelper.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import android.content.Context
4 | import android.database.sqlite.SQLiteDatabase
5 | import android.database.sqlite.SQLiteOpenHelper
6 | import android.provider.BaseColumns
7 |
8 | /**
9 | *
10 | * @author zjxstar
11 | * @date Created on 2019-09-03
12 | */
13 |
14 | private const val SQL_CREATE_ENTRIES =
15 | "CREATE TABLE ${FeedReaderContract.FeedEntry.TABLE_NAME} (" +
16 | "${BaseColumns._ID} INTEGER PRIMARY KEY," +
17 | "${FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE} TEXT," +
18 | "${FeedReaderContract.FeedEntry.COLUMN_NAME_SUBTITLE} TEXT)"
19 |
20 | private const val SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS ${FeedReaderContract.FeedEntry.TABLE_NAME}"
21 |
22 | class FeedReaderDbHelper(context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
23 |
24 | override fun onCreate(db: SQLiteDatabase) {
25 | db.execSQL(SQL_CREATE_ENTRIES)
26 | }
27 |
28 |
29 | override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
30 | db.execSQL(SQL_DELETE_ENTRIES)
31 | onCreate(db)
32 | }
33 |
34 | override fun onDowngrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
35 | onUpgrade(db, oldVersion, newVersion)
36 | }
37 |
38 | companion object {
39 | const val DATABASE_VERSION = 1
40 | const val DATABASE_NAME = "FeedREader.db"
41 | }
42 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/NameTuple.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.ColumnInfo
4 |
5 | /**
6 | *
7 | * @author zjxstar
8 | * @date Created on 2019-09-11
9 | */
10 | data class NameTuple(
11 | @ColumnInfo(name = "first_name") val firstName: String?,
12 |
13 | @ColumnInfo(name = "last_name") val lastName: String?
14 | )
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/Playlist.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.Entity
4 | import androidx.room.ForeignKey
5 | import androidx.room.PrimaryKey
6 |
7 | /**
8 | *
9 | * @author zjxstar
10 | * @date Created on 2019-09-11
11 | */
12 |
13 | @Entity
14 | data class Playlist(
15 | @PrimaryKey var id: Int,
16 | val name: String?,
17 | val description: String?
18 | )
19 |
20 | @Entity
21 | data class Song(
22 | @PrimaryKey var id: Int,
23 | val songName: String?,
24 | val artistName: String?
25 | )
26 |
27 | @Entity(
28 | tableName = "playlist_song_join",
29 | primaryKeys = arrayOf("playlistId", "songId"),
30 | foreignKeys = arrayOf(
31 | ForeignKey(
32 | entity = Playlist::class,
33 | parentColumns = arrayOf("id"),
34 | childColumns = arrayOf("playlistId")
35 | ),
36 | ForeignKey(
37 | entity = Song::class,
38 | parentColumns = arrayOf("id"),
39 | childColumns = arrayOf("songId")
40 | )
41 | )
42 | )
43 | data class PlaylistSongJoin(
44 | val playlistId: Int,
45 | val songId: Int
46 | )
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/PlaylistSongJoinDao.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.Dao
4 | import androidx.room.Insert
5 | import androidx.room.Query
6 |
7 | /**
8 | *
9 | * @author zjxstar
10 | * @date Created on 2019-09-11
11 | */
12 | @Dao
13 | interface PlaylistSongJoinDao {
14 |
15 | @Insert
16 | fun insert(playlistSongJoin: PlaylistSongJoin)
17 |
18 | @Query("""
19 | SELECT * FROM playlist
20 | INNER JOIN playlist_song_join
21 | ON playlist.id=playlist_song_join.playlistId
22 | WHERE playlist_song_join.songId=:songId
23 | """)
24 | fun getPlaylistsForSong(songId: Int): Array
25 |
26 | @Query("""
27 | SELECT * FROM song
28 | INNER JOIN playlist_song_join
29 | ON song.id=playlist_song_join.songId
30 | WHERE playlist_song_join.playlistId=:playlistId
31 | """
32 | )
33 | fun getSongsForPlaylist(playlistId: Int): Array
34 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/RoomActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.room.Room
6 | import androidx.room.migration.Migration
7 | import androidx.sqlite.db.SupportSQLiteDatabase
8 | import com.zjxstar.happy.jetpacksample.R
9 |
10 | /**
11 | *
12 | * @author zjxstar
13 | * @date Created on 2019-09-11
14 | */
15 |
16 | val MIGRATION_1_2 = object : Migration(1, 2) {
17 | override fun migrate(database: SupportSQLiteDatabase) {
18 | database.execSQL("CREATE TABLE `Fruit` (`id` INTEGER, `name` TEXT, " + "PRIMARY KEY(`id`))")
19 | }
20 | }
21 |
22 | val MIGRATION_2_3 = object : Migration(2, 3) {
23 | override fun migrate(database: SupportSQLiteDatabase) {
24 | database.execSQL("ALTER TABLE Book ADD COLUMN pub_year INTEGER")
25 | }
26 | }
27 |
28 |
29 | class RoomActivity : AppCompatActivity() {
30 |
31 | override fun onCreate(savedInstanceState: Bundle?) {
32 | super.onCreate(savedInstanceState)
33 | setContentView(R.layout.activity_room)
34 | }
35 |
36 |
37 | private fun createDB() {
38 | val db = Room.databaseBuilder(
39 | applicationContext,
40 | AppDatabase::class.java,
41 | "user-db"
42 | ).build()
43 | }
44 |
45 | private fun migration() {
46 | Room.databaseBuilder(applicationContext, AppDatabase::class.java, "database-name")
47 | .addMigrations(MIGRATION_1_2, MIGRATION_2_3).build()
48 | }
49 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/User.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import android.graphics.Bitmap
4 | import androidx.room.*
5 |
6 | /**
7 | *
8 | * @author zjxstar
9 | * @date Created on 2019-09-11
10 | */
11 |
12 | //@Fts4
13 | @Entity(indices = arrayOf(Index(value = ["last_name"])))
14 | data class User (
15 | @PrimaryKey val uid: Int,
16 | @ColumnInfo(name = "first_name") val firstName: String?,
17 | @ColumnInfo(name = "last_name") val lastName: String?,
18 | val age: Int,
19 | @Embedded val address: Address?
20 | )
21 |
22 | data class Address(
23 | val street: String?,
24 | val state: String?,
25 | val city: String?,
26 | val region: String?,
27 | @ColumnInfo(name = "post_code") val postCode: Int
28 | )
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/UserDao.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.Dao
4 | import androidx.room.Delete
5 | import androidx.room.Insert
6 | import androidx.room.Query
7 |
8 | /**
9 | *
10 | * @author zjxstar
11 | * @date Created on 2019-09-11
12 | */
13 | @Dao
14 | interface UserDao {
15 |
16 | @Query("SELECT * FROM user")
17 | fun getAll(): List
18 |
19 | @Query("SELECT * FROM user WHERE uid IN (:userIds)")
20 | fun loadAllByIds(userIds: IntArray): List
21 |
22 | @Query("SELECT * FROM user WHERE first_name LIKE :first AND " +
23 | "last_name LIKE :last LIMIT 1")
24 | fun findByName(first: String, last: String): User
25 |
26 | @Insert
27 | fun insertAll(vararg users: User)
28 |
29 | @Delete
30 | fun delete(user: User)
31 | }
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/java/com/zjxstar/happy/jetpacksample/room/UserDetail.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample.room
2 |
3 | import androidx.room.DatabaseView
4 |
5 | /**
6 | *
7 | * @author zjxstar
8 | * @date Created on 2019-09-11
9 | */
10 | @DatabaseView("SELECT user.id, user.departmentId," +
11 | "department.name AS departmentName FROM user " +
12 | "INNER JOIN department ON user.departmentId=department.id")
13 | data class UserDetail(
14 | val id: Long,
15 | val name: String?,
16 | val departmentId: Long,
17 | val departmentName: String?
18 | )
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/drawable/ic_person_black_96dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/drawable/ic_whatshot_black_96dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/activity_db.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
22 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
27 |
28 |
36 |
37 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/activity_name.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/activity_room.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/activity_two_way_binding.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/layout/include_user.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #ff76a5
7 | #ff0057
8 |
9 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | JetpackSample
3 |
4 | Likes
5 | TextView
6 | NAME
7 | LAST NAME
8 | Last name
9 | Name
10 | Profile\'s avatar
11 | Like
12 |
13 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/JetpackSample/app/src/test/java/com/zjxstar/happy/jetpacksample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjxstar.happy.jetpacksample
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/JetpackSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.31'
5 | repositories {
6 | google()
7 | jcenter()
8 |
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.4.1'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 |
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/JetpackSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 | #android.databinding.enableV2=true
23 |
--------------------------------------------------------------------------------
/JetpackSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/JetpackSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/JetpackSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jul 03 16:17:08 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/JetpackSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 | .idea
13 | /.idea
14 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.zjx.sample.inflater"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | implementation fileTree(dir: 'libs', include: ['*.jar'])
22 | implementation 'com.android.support:appcompat-v7:28.0.0'
23 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
24 | }
25 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/java/com/zjx/sample/inflater/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package com.zjx.sample.inflater;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * dip 转 px, px 转 dip 的工具类
7 | */
8 | public class DensityUtil {
9 |
10 | /**
11 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
12 | */
13 | public static int dip2px(Context context, float dpValue) {
14 | final float scale = context.getResources().getDisplayMetrics().density;
15 | return (int) (dpValue * scale + 0.5f);
16 | }
17 |
18 | /**
19 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
20 | */
21 | public static int px2dip(Context context, float pxValue) {
22 | final float scale = context.getResources().getDisplayMetrics().density;
23 | return (int) (pxValue / scale + 0.5f);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/java/com/zjx/sample/inflater/ThirdActivity.java:
--------------------------------------------------------------------------------
1 | package com.zjx.sample.inflater;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 |
7 | public class ThirdActivity extends Activity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 |
13 | // 自定义Factory,必须在setContentView之前
14 | LayoutInflater inflater = LayoutInflater.from(this);
15 | inflater.setFactory2(new MyFactory(inflater.getFactory()));
16 |
17 | setContentView(R.layout.activity_third);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
18 |
19 |
20 |
21 |
26 |
27 |
32 |
33 |
35 |
36 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/activity_main_include.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
15 |
16 |
22 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/activity_third.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
33 |
34 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/layout_second_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/layout/layout_second_item2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 | #ffbccc
8 |
9 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LayoutInflaterSample
3 |
4 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/LayoutInflaterSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/LayoutInflaterSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/LayoutInflaterSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ProGuardSample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/ProGuardSample/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/ProGuardSample/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ProGuardSample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ProGuardSample/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProGuardSample/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ProGuardSample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ProGuardSample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.zjx.sample.proguard"
7 | minSdkVersion 21
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 | buildTypes {
13 | debug {
14 | minifyEnabled true
15 | proguardFiles 'proguard-rules-debug.pro'
16 | }
17 | release {
18 | minifyEnabled true
19 | shrinkResources true
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation 'com.android.support:appcompat-v7:26.1.0'
28 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
29 | implementation 'com.google.code.gson:gson:2.8.5'
30 | }
31 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/java/com/zjx/sample/proguard/model/Dog.java:
--------------------------------------------------------------------------------
1 | package com.zjx.sample.proguard.model;
2 |
3 | public class Dog {
4 |
5 | public String name;
6 |
7 | private int age;
8 |
9 | private String breed = "keji";
10 |
11 | public int getAge() {
12 | return age;
13 | }
14 |
15 | public void setAge(int age) {
16 | this.age = age;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/java/com/zjx/sample/proguard/model/Movie.java:
--------------------------------------------------------------------------------
1 | package com.zjx.sample.proguard.model;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | public class Movie {
6 |
7 | public String name;
8 |
9 | public int time;
10 |
11 | @SerializedName("money")
12 | public double price;
13 |
14 | public String poster;
15 |
16 | public Movie(String name, int time, double price, String poster) {
17 | this.name = name;
18 | this.time = time;
19 | this.price = price;
20 | this.poster = poster;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ProGuardSample
3 |
4 |
--------------------------------------------------------------------------------
/ProGuardSample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ProGuardSample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/ProGuardSample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/ProGuardSample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/ProGuardSample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/ProGuardSample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 15 10:48:58 GMT+08:00 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/ProGuardSample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidSamples
2 | 技术文章中涉及到的代码示例都放在这里....
3 |
4 | # 示例说明
5 | * ProGuardSample:混淆示例
6 | * AdaptPieSample:适配Android P齐刘海的简单示例
7 | * ConstraintLayoutSample:约束布局示例
8 | * DialogSample:DialogFragment示例
9 | * GradleSample:Gradle示例
10 | * GroovySample:Groovy闭包示例
11 | * LayoutInflaterSample:LayoutInflater示例
12 | * SecuritySample:加密算法示例
13 |
--------------------------------------------------------------------------------
/SecuritySample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 | /.idea
13 | .idea
--------------------------------------------------------------------------------
/SecuritySample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/SecuritySample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 28
9 | defaultConfig {
10 | applicationId "com.zjx.securitysample"
11 | minSdkVersion 21
12 | targetSdkVersion 28
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28 | implementation 'com.android.support:appcompat-v7:28.0.0'
29 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | }
34 |
--------------------------------------------------------------------------------
/SecuritySample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/androidTest/java/com/zjx/securitysample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjx.securitysample
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.zjx.securitysample", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/assets/README.txt:
--------------------------------------------------------------------------------
1 | Hello MD5 in Java
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/java/com/zjx/securitysample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zjx.securitysample
2 |
3 | import android.content.Intent
4 | import android.support.v7.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.view.View
7 | import com.zjx.securitysample.base64.Base64Activity
8 | import com.zjx.securitysample.md5.MD5Activity
9 |
10 | class MainActivity : AppCompatActivity() {
11 |
12 | override fun onCreate(savedInstanceState: Bundle?) {
13 | super.onCreate(savedInstanceState)
14 | setContentView(R.layout.activity_main)
15 | }
16 |
17 | fun toMD5Page(view: View) {
18 | val intent = Intent(this, MD5Activity::class.java)
19 | startActivity(intent)
20 | }
21 |
22 | fun toBase64Page(view: View) {
23 | val intent = Intent(this, Base64Activity::class.java)
24 | startActivity(intent)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/java/com/zjx/securitysample/md5/MD5K.kt:
--------------------------------------------------------------------------------
1 | package com.zjx.securitysample.md5
2 |
3 | import java.io.IOException
4 | import java.io.InputStream
5 | import java.security.DigestInputStream
6 | import java.security.MessageDigest
7 |
8 | class MD5K {
9 |
10 | fun getMD5ForStr(str: String): String {
11 | val md5 = MessageDigest.getInstance(ALGORITHM_MD5)
12 | md5.update(str.toByteArray())
13 | return toHex(md5.digest())
14 | }
15 |
16 | fun getMD5ForFile(inputStream: InputStream): String {
17 | var dis: DigestInputStream? = null
18 | val buffer = ByteArray(1024)
19 | try {
20 | var md5 = MessageDigest.getInstance(ALGORITHM_MD5)
21 | dis = DigestInputStream(inputStream, md5)
22 | while (dis.read(buffer) > 0);
23 | md5 = dis.messageDigest
24 | return toHex(md5.digest())
25 | } catch (e: Exception) {
26 | e.printStackTrace()
27 | } finally {
28 | try {
29 | dis?.close()
30 | } catch (e: IOException) {
31 | e.printStackTrace()
32 | }
33 | }
34 | return ""
35 | }
36 |
37 | private fun toHex(bytes: ByteArray): String {
38 | val hexDigits = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
39 | val len = bytes.size
40 | val str = CharArray(len * 2) // 32
41 | var k = 0
42 | for (i in 0 until len) {
43 | val byteTemp = bytes[i]
44 | // Kotlin中只有int和long支持位运算
45 | str[k++] = hexDigits[byteTemp.toInt().ushr(4) and 0xf] // 前四位
46 | str[k++] = hexDigits[byteTemp.toInt() and 0xf] // 后四位
47 | }
48 | return String(str)
49 | }
50 |
51 | companion object {
52 | const val ALGORITHM_MD5: String = "MD5"
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/layout/activity_base64.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
23 |
24 |
29 |
30 |
35 |
36 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SecuritySample
3 |
4 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SecuritySample/app/src/test/java/com/zjx/securitysample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.zjx.securitysample
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SecuritySample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.61'
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/SecuritySample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
--------------------------------------------------------------------------------
/SecuritySample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjxstar/AndroidSamples/acab56cc796f63851a95a0737c6a09433c2a9b5d/SecuritySample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/SecuritySample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/SecuritySample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------