diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-04 16:08:03 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-07-04 16:08:03 -0700 |
commit | cf2a7fcd0880a8d276970124cdb5d5845d5631fe (patch) | |
tree | cc38ead7853ddb85c9c988e94a4af605e1e676f8 /imagepicker | |
parent | fe4632c34a1d671503e0242a269865b884545e13 (diff) | |
download | kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.gz kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.bz2 kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.zip |
Separate core components in its own module
Diffstat (limited to 'imagepicker')
9 files changed, 152 insertions, 0 deletions
diff --git a/imagepicker/.gitignore b/imagepicker/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/imagepicker/.gitignore @@ -0,0 +1 @@ +/build diff --git a/imagepicker/build.gradle b/imagepicker/build.gradle new file mode 100644 index 0000000..8b3acb1 --- /dev/null +++ b/imagepicker/build.gradle @@ -0,0 +1,51 @@ +plugins { + id 'com.gladed.androidgitversion' version '0.3.4' +} + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'com.github.dcendents.android-maven' + +group = project.APP_GROUP + +android { + compileSdkVersion Integer.parseInt(project.TARGET_SDK) + buildToolsVersion project.BUILD_TOOLS + + androidGitVersion { + codeFormat = 'MMNNPP' + prefix 'v' + } + + defaultConfig { + minSdkVersion Integer.parseInt(project.MIN_SDK) + targetSdkVersion Integer.parseInt(project.TARGET_SDK) + versionCode androidGitVersion.code() + versionName androidGitVersion.name() + consumerProguardFiles 'progress-proguard.txt' + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + checkReleaseBuilds false + } + resourcePrefix "kau_" + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + test.java.srcDirs += 'src/test/kotlin' + } +} + +dependencies { + compile project(':core') + compile "com.github.bumptech.glide:glide:${GLIDE}" + kapt "com.github.bumptech.glide:compiler:${GLIDE}" +} + +apply from: '../artifacts.gradle' diff --git a/imagepicker/progress-proguard.txt b/imagepicker/progress-proguard.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/imagepicker/progress-proguard.txt @@ -0,0 +1 @@ + diff --git a/imagepicker/src/main/AndroidManifest.xml b/imagepicker/src/main/AndroidManifest.xml new file mode 100644 index 0000000..89dccc2 --- /dev/null +++ b/imagepicker/src/main/AndroidManifest.xml @@ -0,0 +1 @@ +<manifest package="ca.allanwang.kau.imagepicker" /> diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageHelper.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageHelper.kt new file mode 100644 index 0000000..9b45679 --- /dev/null +++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageHelper.kt @@ -0,0 +1,10 @@ +package ca.allanwang.kau.imagepicker + +import com.bumptech.glide.annotation.GlideModule +import com.bumptech.glide.module.LibraryGlideModule + +/** + * Created by Allan Wang on 2017-07-04. + */ +@GlideModule +class KauGlide : LibraryGlideModule()
\ No newline at end of file diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt new file mode 100644 index 0000000..7b55c58 --- /dev/null +++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt @@ -0,0 +1,20 @@ +package ca.allanwang.kau.imagepicker + +import android.support.v7.widget.RecyclerView +import android.view.View +import android.widget.ImageView +import ca.allanwang.kau.iitems.KauIItem +import ca.allanwang.kau.utils.bindView + +/** + * Created by Allan Wang on 2017-07-04. + */ +class ImageItem(data:String) + : KauIItem<ImageItem, ImageItem.ViewHolder>(R.layout.kau_iitem_card, R.layout.kau_iitem_card, { ViewHolder(it) }) { + + + + class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { + val image: ImageView by bindView(R.id.kau_image) + } +}
\ No newline at end of file diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt new file mode 100644 index 0000000..216939f --- /dev/null +++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt @@ -0,0 +1,39 @@ +package ca.allanwang.kau.imagepicker + +import android.graphics.drawable.Drawable +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import android.support.v7.widget.RecyclerView +import android.support.v7.widget.Toolbar +import android.transition.TransitionInflater +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import ca.allanwang.kau.R +import ca.allanwang.kau.adapters.FastItemThemedAdapter +import ca.allanwang.kau.adapters.ThemableIItemColors +import ca.allanwang.kau.adapters.ThemableIItemColorsDelegate +import ca.allanwang.kau.iitems.LibraryIItem +import ca.allanwang.kau.utils.bindView +import ca.allanwang.kau.utils.string +import ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter +import java.security.InvalidParameterException + +/** + * Created by Allan Wang on 2017-07-04. + * + */ +abstract class ImagePickerActivityBase : AppCompatActivity() { + + val toolbar:Toolbar by bindView(R.id.kau_toolbar) + val recycler:RecyclerView by bindView(R.id.kau_recycler) + val adapter = FastItemAdapter<ImageItem>() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.kau_activity_image_picker) + } +}
\ No newline at end of file diff --git a/imagepicker/src/main/res/layout/kau_activity_image_picker.xml b/imagepicker/src/main/res/layout/kau_activity_image_picker.xml new file mode 100644 index 0000000..d3739dd --- /dev/null +++ b/imagepicker/src/main/res/layout/kau_activity_image_picker.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="@dimen/kau_drag_dismiss_distance"> + + <android.support.v7.widget.Toolbar + android:id="@+id/kau_toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" /> + + <android.support.v7.widget.RecyclerView + android:id="@+id/kau_recycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="?attr/actionBarSize" /> + +</ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout>
\ No newline at end of file diff --git a/imagepicker/src/main/res/layout/kau_iitem_image.xml b/imagepicker/src/main/res/layout/kau_iitem_image.xml new file mode 100644 index 0000000..824ae7b --- /dev/null +++ b/imagepicker/src/main/res/layout/kau_iitem_image.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="80dp" + android:layout_height="80dp"> + + <ImageView + android:id="@+id/kau_image" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + +</FrameLayout>
\ No newline at end of file |