From c707d42b311f96cbabc1971f98598c8b8922ba16 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 5 Aug 2017 14:49:47 -0700 Subject: Swipe (#24) * Test emulator * Update readme * Update fastadapter and about listing * Make faq parser asynchronous * Modularize about panels * Add basis for faq * Test and finalize the faq panel * Update readme * Update changelog * Remove emulator for now * Update sample * Change back to manual versioning to avoid suggestion errors * Add awesome-kt banner * Fix faq background color * Fix merge conflicts 2 * Add waffle badge * Update readme * Fix lint * Create FileUtils and NotificationUtils * Remove frost hardcode * Fix simple date * Update swipe to use weak references * Initializing test dependencies * Update to gradle 4.1 * Fix lint warnings * Drop back down and fix errors * Finalize swipe with example * Finalize weak reference and ordering * Update test code * Make loggers inline --- sample/build.gradle | 51 +++++++++------ sample/src/main/AndroidManifest.xml | 3 + .../kotlin/ca/allanwang/kau/sample/MainActivity.kt | 5 +- .../ca/allanwang/kau/sample/SwipeActivity.kt | 75 ++++++++++++++++++++++ sample/src/main/res/layout/activity_swipe.xml | 74 +++++++++++++++++++++ sample/src/main/res/values/strings.xml | 1 + sample/src/main/res/values/styles.xml | 5 ++ sample/src/main/res/xml/kau_changelog.xml | 12 +++- 8 files changed, 202 insertions(+), 24 deletions(-) create mode 100644 sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt create mode 100644 sample/src/main/res/layout/activity_swipe.xml (limited to 'sample') diff --git a/sample/build.gradle b/sample/build.gradle index d20a972..ac6ee20 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,17 +1,7 @@ -plugins { - id 'com.gladed.androidgitversion' version '0.3.4' -} apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'com.github.triplet.play' -repositories { - jcenter() - mavenCentral() - maven { url "https://jitpack.io" } - maven { url "https://maven.google.com" } -} - play { jsonFile = file('../files/gplay-keys.json') track = 'beta' @@ -24,16 +14,12 @@ android { compileSdkVersion Integer.parseInt(project.TARGET_SDK) buildToolsVersion project.BUILD_TOOLS - androidGitVersion { - codeFormat = 'MMNNPPBB' - } - defaultConfig { applicationId "ca.allanwang.kau.sample" minSdkVersion Integer.parseInt(project.MIN_SDK) targetSdkVersion Integer.parseInt(project.TARGET_SDK) - versionCode androidGitVersion.code() - versionName androidGitVersion.name() + versionName project.VERSION_NAME + versionCode project.VERSION_CODE multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -69,9 +55,28 @@ android { checkReleaseBuilds false } + packagingOptions { + pickFirst 'META-INF/core_release.kotlin_module' + pickFirst 'META-INF/library_release.kotlin_module' + } + sourceSets { main.java.srcDirs += 'src/main/kotlin' test.java.srcDirs += 'src/test/kotlin' + androidTest.java.srcDirs += 'src/androidTest/kotlin' + main.res.srcDirs += 'src/main/res-public' + } + + testOptions.unitTests { + // Don't throw runtime exceptions for android calls that are not mocked + returnDefaultValues = true + + // Always show the result of every unit test, even if it passes. + all { + testLogging { + events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + } + } } } @@ -85,10 +90,16 @@ dependencies { compile project(':kpref-activity') compile project(':searchview') compile project(':mediapicker') - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - testCompile 'junit:junit:4.12' compile "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original@aar" compile "org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN}" + + androidTestCompile("com.android.support.test.espresso:espresso-core:${ESPRESSO}") { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestCompile("com.android.support.test:runner:${TEST_RUNNER}") { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestCompile "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}" + testCompile "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}" + testCompile "junit:junit:${JUNIT}" } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index a3bbf45..ee6cc86 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -25,6 +25,9 @@ + diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 62ca8a3..51b8530 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -14,6 +14,7 @@ import ca.allanwang.kau.mediapicker.kauOnMediaPickerResult import ca.allanwang.kau.searchview.SearchItem import ca.allanwang.kau.searchview.SearchView import ca.allanwang.kau.searchview.bindSearchView +import ca.allanwang.kau.swipe.SWIPE_EDGE_LEFT import ca.allanwang.kau.ui.views.RippleCanvas import ca.allanwang.kau.utils.materialDialog import ca.allanwang.kau.utils.navigationBarColor @@ -164,8 +165,8 @@ class MainActivity : KPrefActivity() { descRes = R.string.sub_item_desc } - plainText(R.string.image_showcase) { - onClick = { _, _, _ -> kauLaunchMediaPicker(ImagePickerActivity::class.java, REQUEST_MEDIA); false } + plainText(R.string.swipe_showcase) { + onClick = { _, _, _ -> startActivityWithEdge(SWIPE_EDGE_LEFT); false } } plainText(R.string.video_overlay_showcase) { diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt new file mode 100644 index 0000000..cba9ccd --- /dev/null +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt @@ -0,0 +1,75 @@ +package ca.allanwang.kau.sample + +import android.app.Activity +import android.os.Bundle +import android.support.v7.widget.Toolbar +import android.view.ViewGroup +import android.widget.Button +import ca.allanwang.kau.internal.KauBaseActivity +import ca.allanwang.kau.swipe.* +import ca.allanwang.kau.utils.* + +/** + * Created by Allan Wang on 2017-08-05. + */ +private const val SWIPE_EDGE = "swipe_edge" + +fun Activity.startActivityWithEdge(flag: Int) { + startActivity(SwipeActivity::class.java) { + putExtra(SWIPE_EDGE, flag) + } +} + +class SwipeActivity : KauBaseActivity() { + + val toolbar: Toolbar by bindView(R.id.swipe_toolbar) + val container: ViewGroup by bindView(R.id.swipe_container) + val directions: List