diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index eba1110..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 63cb77a..5edb4ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,9 @@
*.iml
.gradle
/local.properties
-.idea
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
.DS_Store
/build
/captures
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..f73c061
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..2512be3
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..66e2f6f
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..4683d43
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/sonarlint/issuestore/0/5/05efc8b1657769a27696d478ded1e95f38737233 b/.idea/sonarlint/issuestore/0/5/05efc8b1657769a27696d478ded1e95f38737233
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/3/7/371303149c064ab6566348e9e3af6982b92265b3 b/.idea/sonarlint/issuestore/3/7/371303149c064ab6566348e9e3af6982b92265b3
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/5/6/5648f9b32f40f53e67a4b56f4b43fa837b708f5a b/.idea/sonarlint/issuestore/5/6/5648f9b32f40f53e67a4b56f4b43fa837b708f5a
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/5/d/5d356e3135d602d8198bb4b043fdfb97df7563c9 b/.idea/sonarlint/issuestore/5/d/5d356e3135d602d8198bb4b043fdfb97df7563c9
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/6/f/6f02b4fbc88b4d9f777c9703f79e1a9daea9e30e b/.idea/sonarlint/issuestore/6/f/6f02b4fbc88b4d9f777c9703f79e1a9daea9e30e
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/7/6/76b07e40f24cce093536731477540f12e7da3cb6 b/.idea/sonarlint/issuestore/7/6/76b07e40f24cce093536731477540f12e7da3cb6
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/8/a/8a448192745d14c6172c528962fd417b29a5af2e b/.idea/sonarlint/issuestore/8/a/8a448192745d14c6172c528962fd417b29a5af2e
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e b/.idea/sonarlint/issuestore/8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9 b/.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/a/b/abd323d78c21b0bdc70f1bd2d4dff5edb3a8cb53 b/.idea/sonarlint/issuestore/a/b/abd323d78c21b0bdc70f1bd2d4dff5edb3a8cb53
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/a/c/ace45f7a1227622e2e8220b143a9bf2f6ff4aefa b/.idea/sonarlint/issuestore/a/c/ace45f7a1227622e2e8220b143a9bf2f6ff4aefa
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/b/c/bc1e6337a6cee4d549ebc79c089f4196728c3aeb b/.idea/sonarlint/issuestore/b/c/bc1e6337a6cee4d549ebc79c089f4196728c3aeb
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/c/3/c3c1811dec2dbad2deeafb9aad505ca9631da740 b/.idea/sonarlint/issuestore/c/3/c3c1811dec2dbad2deeafb9aad505ca9631da740
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/d/2/d20c0c3ec31cee6c95d4141518d7f9e7d4173ee2 b/.idea/sonarlint/issuestore/d/2/d20c0c3ec31cee6c95d4141518d7f9e7d4173ee2
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/d/2/d2281fbb3027de2722081a53408dd77628bf080e b/.idea/sonarlint/issuestore/d/2/d2281fbb3027de2722081a53408dd77628bf080e
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/e/d/ed62c3d858b34bf40cb0e1b5915e71b900bb0cd0 b/.idea/sonarlint/issuestore/e/d/ed62c3d858b34bf40cb0e1b5915e71b900bb0cd0
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 b/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/f/4/f4a01d6a4fcb971362ec00a83903fd3902f52164 b/.idea/sonarlint/issuestore/f/4/f4a01d6a4fcb971362ec00a83903fd3902f52164
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/f/f/fff66739c7e1bf4c1093c222c79ca080b1a8671f b/.idea/sonarlint/issuestore/f/f/fff66739c7e1bf4c1093c222c79ca080b1a8671f
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb
new file mode 100644
index 0000000..148b0c6
--- /dev/null
+++ b/.idea/sonarlint/issuestore/index.pb
@@ -0,0 +1,39 @@
+
+k
+;app/src/main/java/com/santalu/myapplication/MainActivity.kt,5\6\5648f9b32f40f53e67a4b56f4b43fa837b708f5a
+x
+Hlibrary/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.kt,a\b\abd323d78c21b0bdc70f1bd2d4dff5edb3a8cb53
+P
+ app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e
+@
+app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
+D
+library/build.gradle,b\c\bc1e6337a6cee4d549ebc79c089f4196728c3aeb
+F
+app/proguard-rules.pro,9\e\9e08934d811afe28fbc77aaa3c0d747b94348db9
+J
+library/proguard-rules.pro,5\d\5d356e3135d602d8198bb4b043fdfb97df7563c9
+?
+settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
+_
+/app/src/main/res/layout/activity_gridlayout.xml,d\2\d20c0c3ec31cee6c95d4141518d7f9e7d4173ee2
+Y
+)app/src/main/res/layout/activity_main.xml,7\6\76b07e40f24cce093536731477540f12e7da3cb6
+<
+build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
+a
+1app/src/main/res/layout/activity_recyclerview.xml,a\c\ace45f7a1227622e2e8220b143a9bf2f6ff4aefa
+S
+#app/src/main/res/values/strings.xml,d\2\d2281fbb3027de2722081a53408dd77628bf080e
+i
+9app/src/main/java/com/santalu/myapplication/Extensions.kt,8\a\8a448192745d14c6172c528962fd417b29a5af2e
+q
+Aapp/src/main/java/com/santalu/myapplication/GridLayoutActivity.kt,3\7\371303149c064ab6566348e9e3af6982b92265b3
+Y
+)app/src/main/res/layout/item_cardview.xml,6\f\6f02b4fbc88b4d9f777c9703f79e1a9daea9e30e
+R
+"app/src/main/res/values/dimens.xml,c\3\c3c1811dec2dbad2deeafb9aad505ca9631da740
+]
+-app/src/main/res/layout/item_recyclerview.xml,e\d\ed62c3d858b34bf40cb0e1b5915e71b900bb0cd0
+s
+Capp/src/main/java/com/santalu/myapplication/RecyclerViewActivity.kt,f\f\fff66739c7e1bf4c1093c222c79ca080b1a8671f
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index ad410e1..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index ac31b17..415427f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,8 +1,9 @@
apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
- buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.santalu.myapplication"
@@ -12,36 +13,27 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
-ext {
- supportLibraryVersion = '27.1.1'
- picassoVersion = '2.5.2'
- pageIndicatorVersion = '1.0.1'
-}
-
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
- implementation "com.android.support:design:$supportLibraryVersion"
- implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
- implementation "com.android.support:cardview-v7:$supportLibraryVersion"
- implementation "com.android.support:gridlayout-v7:$supportLibraryVersion"
- implementation "com.squareup.picasso:picasso:$picassoVersion"
- implementation "com.romandanylyk:pageindicatorview:$pageIndicatorVersion"
- testImplementation 'junit:junit:4.12'
- implementation project(path: ':library')
+ implementation project(':library')
+
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "com.android.support:appcompat-v7:$supportlibrary_version"
+ implementation "com.android.support:recyclerview-v7:$supportlibrary_version"
+ implementation "com.android.support:cardview-v7:$supportlibrary_version"
+ implementation "com.android.support:gridlayout-v7:$supportlibrary_version"
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 038bf99..f1b4245 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,14 +1,10 @@
# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/santalu/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
-# Add any project specific keep options here:
-
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
diff --git a/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.java
deleted file mode 100644
index 17a731f..0000000
--- a/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Instrumentation test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.santalu.myapplication", appContext.getPackageName());
- }
-}
diff --git a/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..934edff
--- /dev/null
+++ b/app/src/androidTest/java/com/santalu/myapplication/ExampleInstrumentedTest.kt
@@ -0,0 +1,22 @@
+package com.santalu.myapplication
+
+import android.support.test.InstrumentationRegistry
+import android.support.test.runner.AndroidJUnit4
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getTargetContext()
+ assertEquals("com.santalu.myapplication", appContext.packageName)
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2c1cdf3..c01d61e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,8 +2,6 @@
-
-
-
+
@@ -23,30 +18,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/app/src/main/java/com/santalu/myapplication/CardViewSampleActivity.java b/app/src/main/java/com/santalu/myapplication/CardViewSampleActivity.java
deleted file mode 100644
index 2005bd6..0000000
--- a/app/src/main/java/com/santalu/myapplication/CardViewSampleActivity.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.RecyclerView.Adapter;
-import android.support.v7.widget.Toolbar;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-/**
- * Created by santalu on 20/07/2017.
- */
-
-public class CardViewSampleActivity extends AppCompatActivity {
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, CardViewSampleActivity.class));
- }
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_recycler_view);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
-
- RecyclerView recyclerView = findViewById(R.id.recycler_view);
- recyclerView.setLayoutManager(new LinearLayoutManager(this));
- recyclerView.setHasFixedSize(true);
- recyclerView.setAdapter(new SampleAdapter(this));
- }
-
- static class SampleAdapter extends Adapter {
- private final LayoutInflater inflater;
-
- SampleAdapter(Context context) {
- inflater = LayoutInflater.from(context);
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new ViewHolder(inflater.inflate(R.layout.item_card_view, parent, false));
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
- }
-
- @Override
- public int getItemCount() {
- return 20;
- }
-
- class ViewHolder extends RecyclerView.ViewHolder {
-
- ViewHolder(View itemView) {
- super(itemView);
- }
- }
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/CollapsingToolbarSampleActivity.java b/app/src/main/java/com/santalu/myapplication/CollapsingToolbarSampleActivity.java
deleted file mode 100644
index 844f841..0000000
--- a/app/src/main/java/com/santalu/myapplication/CollapsingToolbarSampleActivity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import com.santalu.diagonalimageview.DiagonalImageView;
-
-/**
- * Created by santalu on 20/07/2017.
- */
-
-public class CollapsingToolbarSampleActivity extends AppCompatActivity {
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, CollapsingToolbarSampleActivity.class));
- }
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_collapsing_toolbar);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- DiagonalImageView imageView = findViewById(R.id.image);
-
- imageView.setOnClickListener(v ->
- imageView.setPosition(DiagonalImageView.BOTTOM)
- .setDirection(DiagonalImageView.RIGHT)
- .setOverlap(300)
- .invalidate());
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/Extensions.kt b/app/src/main/java/com/santalu/myapplication/Extensions.kt
new file mode 100644
index 0000000..51f5915
--- /dev/null
+++ b/app/src/main/java/com/santalu/myapplication/Extensions.kt
@@ -0,0 +1,19 @@
+package com.santalu.myapplication
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+
+/**
+ * Created by fatih.santalu on 7/24/2018.
+ */
+
+fun ViewGroup.inflate(layoutRes: Int): View {
+ return LayoutInflater.from(context).inflate(layoutRes, this, false)
+}
+
+fun Context.toast(text: CharSequence) {
+ Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/santalu/myapplication/GridLayoutSampleActivity.java b/app/src/main/java/com/santalu/myapplication/GridLayoutSampleActivity.java
deleted file mode 100644
index 3994f18..0000000
--- a/app/src/main/java/com/santalu/myapplication/GridLayoutSampleActivity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-
-/**
- * Created by santalu on 7/18/17.
- */
-
-public class GridLayoutSampleActivity extends AppCompatActivity {
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, GridLayoutSampleActivity.class));
- }
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_grid_layout);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/MainActivity.java b/app/src/main/java/com/santalu/myapplication/MainActivity.java
deleted file mode 100644
index 027191d..0000000
--- a/app/src/main/java/com/santalu/myapplication/MainActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.santalu.myapplication;
-
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
-
- Button sampleGrid = findViewById(R.id.sample_grid);
- Button sampleList = findViewById(R.id.sample_list);
- Button sampleListComplex = findViewById(R.id.sample_list_complex);
- Button sampleCard = findViewById(R.id.sample_card);
- Button sampleCollapsing = findViewById(R.id.sample_collapsing);
-
- sampleGrid.setOnClickListener(v -> GridLayoutSampleActivity.start(MainActivity.this));
- sampleList.setOnClickListener(v -> RecyclerViewSampleActivity.start(MainActivity.this));
- sampleListComplex.setOnClickListener(v -> RecyclerViewComplexSampleActivity.start(MainActivity.this));
- sampleCard.setOnClickListener(v -> CardViewSampleActivity.start(MainActivity.this));
- sampleCollapsing.setOnClickListener(v -> CollapsingToolbarSampleActivity.start(MainActivity.this));
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/MainActivity.kt b/app/src/main/java/com/santalu/myapplication/MainActivity.kt
new file mode 100644
index 0000000..2e8d5eb
--- /dev/null
+++ b/app/src/main/java/com/santalu/myapplication/MainActivity.kt
@@ -0,0 +1,27 @@
+package com.santalu.myapplication
+
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import kotlinx.android.synthetic.main.activity_main.cardListSample
+import kotlinx.android.synthetic.main.activity_main.gridSample
+import kotlinx.android.synthetic.main.activity_main.listSample
+
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+
+ listSample.setOnClickListener {
+ SampleListActivity.start(this)
+ }
+
+ cardListSample.setOnClickListener {
+ SampleCardListActivity.start(this)
+ }
+
+ gridSample.setOnClickListener {
+ SampleGridActivity.start(this)
+ }
+ }
+}
diff --git a/app/src/main/java/com/santalu/myapplication/RecyclerViewComplexSampleActivity.java b/app/src/main/java/com/santalu/myapplication/RecyclerViewComplexSampleActivity.java
deleted file mode 100644
index 5f6621e..0000000
--- a/app/src/main/java/com/santalu/myapplication/RecyclerViewComplexSampleActivity.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.view.PagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-import com.santalu.diagonalimageview.DiagonalImageView;
-import com.squareup.picasso.Picasso;
-
-/**
- * Created by santalu on 14/08/2017.
- */
-
-public class RecyclerViewComplexSampleActivity extends AppCompatActivity {
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, RecyclerViewComplexSampleActivity.class));
- }
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_recycler_view);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
-
- int overlap = getResources().getDimensionPixelSize(R.dimen.overlap_size);
- RecyclerView recyclerView = findViewById(R.id.recycler_view);
- LinearLayoutManager layoutManager = new LinearLayoutManager(this);
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setHasFixedSize(true);
- recyclerView.addItemDecoration(new OverlapItemDecoration(-overlap));
- recyclerView.setAdapter(new SampleAdapter(this));
- }
-
- static class SampleAdapter extends RecyclerView.Adapter {
- private static final int TYPE_PAGER = 1;
- private static final int TYPE_REGULAR = 2;
-
- private final Context context;
- private final LayoutInflater inflater;
-
- SampleAdapter(Context context) {
- this.context = context;
- inflater = LayoutInflater.from(context);
- }
-
- @NonNull
- @Override
- public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- switch (viewType) {
- case TYPE_PAGER:
- return new SampleAdapter.PagerHolder(
- inflater.inflate(R.layout.item_view_pager, parent, false));
- case TYPE_REGULAR:
- default:
- return new SampleAdapter.ViewHolder(
- inflater.inflate(R.layout.item_recycler_view, parent, false));
- }
- }
-
- @Override
- public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
- switch (holder.getItemViewType()) {
- case TYPE_PAGER:
- PagerHolder pagerHolder = (PagerHolder) holder;
- pagerHolder.bind();
- break;
- case TYPE_REGULAR:
- default:
- ViewHolder viewHolder = (ViewHolder) holder;
- viewHolder.bind(position);
- break;
- }
- }
-
- @Override
- public int getItemCount() {
- return 20;
- }
-
- @Override
- public int getItemViewType(int position) {
- return position == 0 ? TYPE_PAGER : TYPE_REGULAR;
- }
-
- class PagerHolder extends RecyclerView.ViewHolder {
- ViewPager viewPager;
-
- PagerHolder(View itemView) {
- super(itemView);
- viewPager = itemView.findViewById(R.id.view_pager);
- }
-
- void bind() {
- viewPager.setAdapter(new SamplePagerAdapter(context));
- }
- }
-
- class ViewHolder extends RecyclerView.ViewHolder {
- DiagonalImageView image;
-
- ViewHolder(View itemView) {
- super(itemView);
- image = itemView.findViewById(R.id.image);
- image.setOnClickListener(v -> Log.v("DiagonalImageView", getAdapterPosition() + " clicked"));
- }
-
- void bind(int position) {
- Picasso.with(context)
- .load("https://media.gq" +
- ".com/photos/561e9f0ca7113fb922cd6151/master/pass/gq-guide-to" +
- "-suits-color-2015-03.jpg")
- .placeholder(R.drawable.demo)
- .error(R.drawable.demo)
- .into(image);
-
- if (position > 1) {
- image.setPosition(DiagonalImageView.TOP);
- } else {
- image.setPosition(DiagonalImageView.NONE);
- }
- }
- }
- }
-
- static class SamplePagerAdapter extends PagerAdapter {
- private final Context context;
-
- SamplePagerAdapter(Context context) {
- this.context = context;
- }
-
- @Override
- public int getCount() {
- return 3;
- }
-
- @Override
- public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
- return view == object;
- }
-
- @NonNull
- @Override
- public Object instantiateItem(@NonNull ViewGroup container, int position) {
- ImageView imageView = new ImageView(context);
- imageView.setScaleType(ScaleType.CENTER_CROP);
-
- Picasso.with(context)
- .load("https://www.thefashionisto" +
- ".com/wp-content/uploads/ama/2011/1/dknyspringcampaign1.jpg")
- .placeholder(R.drawable.demo)
- .error(R.drawable.demo)
- .into(imageView);
-
- container.addView(imageView);
- return imageView;
- }
-
- @Override
- public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
- container.removeView((View) object);
- }
- }
-
- static class OverlapItemDecoration extends RecyclerView.ItemDecoration {
- private int overlap;
-
- OverlapItemDecoration(int overlap) {
- this.overlap = overlap;
- }
-
- @Override
- public void getItemOffsets(Rect outRect,
- View view,
- RecyclerView parent,
- RecyclerView.State state) {
- super.getItemOffsets(outRect, view, parent, state);
- if (parent.getChildAdapterPosition(view) > 1) {
- outRect.top = overlap;
- }
- }
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/RecyclerViewSampleActivity.java b/app/src/main/java/com/santalu/myapplication/RecyclerViewSampleActivity.java
deleted file mode 100644
index 6abc56b..0000000
--- a/app/src/main/java/com/santalu/myapplication/RecyclerViewSampleActivity.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.santalu.myapplication;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import com.santalu.diagonalimageview.DiagonalImageView;
-
-/**
- * Created by santalu on 7/18/17.
- */
-
-public class RecyclerViewSampleActivity extends AppCompatActivity {
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, RecyclerViewSampleActivity.class));
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_recycler_view);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
-
- int overlap = getResources().getDimensionPixelSize(R.dimen.overlap_size);
- RecyclerView recyclerView = findViewById(R.id.recycler_view);
- LinearLayoutManager layoutManager = new LinearLayoutManager(this);
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setHasFixedSize(true);
- recyclerView.addItemDecoration(new OverlapItemDecoration(-overlap));
- recyclerView.setAdapter(new SampleAdapter(this));
- }
-
- static class SampleAdapter extends RecyclerView.Adapter {
- private final LayoutInflater inflater;
-
- SampleAdapter(Context context) {
- inflater = LayoutInflater.from(context);
- }
-
- @NonNull
- @Override
- public SampleAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new SampleAdapter.ViewHolder(
- inflater.inflate(R.layout.item_recycler_view, parent, false));
- }
-
- @Override
- public void onBindViewHolder(@NonNull SampleAdapter.ViewHolder holder, int position) {
- holder.bind(position);
- }
-
- @Override
- public int getItemCount() {
- return 20;
- }
-
- class ViewHolder extends RecyclerView.ViewHolder {
- DiagonalImageView image;
-
- ViewHolder(View itemView) {
- super(itemView);
- image = itemView.findViewById(R.id.image);
- image.setOnClickListener(v -> Log.v("cmd", getAdapterPosition() + " clicked"));
- }
-
- void bind(int position) {
- if (position == 0) {
- image.setPosition(DiagonalImageView.NONE);
- } else {
- image.setPosition(DiagonalImageView.TOP);
- }
- }
- }
- }
-
- static class OverlapItemDecoration extends RecyclerView.ItemDecoration {
- private int overlap;
-
- OverlapItemDecoration(int overlap) {
- this.overlap = overlap;
- }
-
- @Override
- public void getItemOffsets(Rect outRect,
- View view,
- RecyclerView parent,
- RecyclerView.State state) {
- super.getItemOffsets(outRect, view, parent, state);
- if (parent.getChildAdapterPosition(view) > 0) {
- outRect.top = overlap;
- }
- }
- }
-}
diff --git a/app/src/main/java/com/santalu/myapplication/SampleCardListActivity.kt b/app/src/main/java/com/santalu/myapplication/SampleCardListActivity.kt
new file mode 100644
index 0000000..41d7816
--- /dev/null
+++ b/app/src/main/java/com/santalu/myapplication/SampleCardListActivity.kt
@@ -0,0 +1,54 @@
+package com.santalu.myapplication
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import android.support.v7.widget.RecyclerView
+import android.view.View
+import android.view.ViewGroup
+import kotlinx.android.synthetic.main.activity_list.recyclerView
+
+/**
+ * Created by fatih.santalu on 7/24/2018.
+ */
+
+class SampleCardListActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_list)
+
+ recyclerView.setHasFixedSize(true)
+ recyclerView.adapter = SampleAdapter()
+ }
+
+ class SampleAdapter : RecyclerView.Adapter() {
+
+ override fun getItemCount(): Int {
+ return 20
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleViewHolder {
+ val view = parent.inflate(R.layout.item_card_list)
+ return SampleViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: SampleViewHolder, position: Int) {
+ holder.itemView.setOnClickListener {
+ it.context.toast("position $position clicked")
+ }
+ }
+
+ class SampleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
+ }
+
+ companion object {
+
+ fun start(activity: Activity) {
+ val intent = Intent(activity, SampleCardListActivity::class.java)
+ activity.startActivity(intent)
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/santalu/myapplication/SampleGridActivity.kt b/app/src/main/java/com/santalu/myapplication/SampleGridActivity.kt
new file mode 100644
index 0000000..5fe8812
--- /dev/null
+++ b/app/src/main/java/com/santalu/myapplication/SampleGridActivity.kt
@@ -0,0 +1,31 @@
+package com.santalu.myapplication
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import android.view.View
+
+/**
+ * Created by fatih.santalu on 7/24/2018.
+ */
+
+class SampleGridActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_grid)
+ }
+
+ fun onImageClick(view: View) {
+ toast("clicked")
+ }
+
+ companion object {
+
+ fun start(activity: Activity) {
+ val intent = Intent(activity, SampleGridActivity::class.java)
+ activity.startActivity(intent)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/santalu/myapplication/SampleListActivity.kt b/app/src/main/java/com/santalu/myapplication/SampleListActivity.kt
new file mode 100644
index 0000000..b450780
--- /dev/null
+++ b/app/src/main/java/com/santalu/myapplication/SampleListActivity.kt
@@ -0,0 +1,74 @@
+package com.santalu.myapplication
+
+import android.app.Activity
+import android.content.Intent
+import android.graphics.Rect
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import android.support.v7.widget.RecyclerView
+import android.support.v7.widget.RecyclerView.ItemDecoration
+import android.support.v7.widget.RecyclerView.State
+import android.view.View
+import android.view.ViewGroup
+import com.santalu.diagonalimageview.DiagonalImageView
+import kotlinx.android.synthetic.main.activity_list.recyclerView
+import kotlinx.android.synthetic.main.item_list.view.image
+
+/**
+ * Created by fatih.santalu on 7/24/2018.
+ */
+
+class SampleListActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_list)
+
+ val overlap = resources.getDimensionPixelSize(R.dimen.overlap_size)
+ recyclerView.addItemDecoration(OverlapItemDecoration(-overlap))
+ recyclerView.setHasFixedSize(true)
+ recyclerView.adapter = SampleAdapter()
+ }
+
+ class SampleAdapter : RecyclerView.Adapter() {
+
+ override fun getItemCount(): Int {
+ return 20
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleViewHolder {
+ val view = parent.inflate(R.layout.item_list)
+ return SampleViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: SampleViewHolder, position: Int) {
+ holder.itemView.image.position =
+ if (position == 0) DiagonalImageView.NONE else DiagonalImageView.TOP
+ holder.itemView.setOnClickListener {
+ it.context.toast("position $position clicked")
+ }
+ }
+
+ class SampleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
+ }
+
+ class OverlapItemDecoration(private val overlap: Int) : ItemDecoration() {
+
+ override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: State?) {
+ super.getItemOffsets(outRect, view, parent, state)
+ parent?.let {
+ if (it.getChildAdapterPosition(view) > 0) {
+ outRect?.top = overlap
+ }
+ }
+ }
+ }
+
+ companion object {
+
+ fun start(activity: Activity) {
+ val intent = Intent(activity, SampleListActivity::class.java)
+ activity.startActivity(intent)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..7daee77
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_favorite.xml b/app/src/main/res/drawable/ic_favorite.xml
deleted file mode 100644
index 9c829d7..0000000
--- a/app/src/main/res/drawable/ic_favorite.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..4ea54ca
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/selector.xml b/app/src/main/res/drawable/selector.xml
deleted file mode 100644
index b056d35..0000000
--- a/app/src/main/res/drawable/selector.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_collapsing_toolbar.xml b/app/src/main/res/layout/activity_collapsing_toolbar.xml
deleted file mode 100644
index 400b95d..0000000
--- a/app/src/main/res/layout/activity_collapsing_toolbar.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_grid.xml b/app/src/main/res/layout/activity_grid.xml
new file mode 100644
index 0000000..273e7cf
--- /dev/null
+++ b/app/src/main/res/layout/activity_grid.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_grid_layout.xml b/app/src/main/res/layout/activity_grid_layout.xml
deleted file mode 100644
index 62cf3c8..0000000
--- a/app/src/main/res/layout/activity_grid_layout.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_list.xml b/app/src/main/res/layout/activity_list.xml
new file mode 100644
index 0000000..62cbbf9
--- /dev/null
+++ b/app/src/main/res/layout/activity_list.xml
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 601e8f1..ed02e10 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,49 +1,27 @@
-
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="24dp">
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:text="@string/sample_list"/>
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_recycler_view.xml b/app/src/main/res/layout/activity_recycler_view.xml
deleted file mode 100644
index 6249914..0000000
--- a/app/src/main/res/layout/activity_recycler_view.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/item_card_list.xml b/app/src/main/res/layout/item_card_list.xml
new file mode 100644
index 0000000..454555f
--- /dev/null
+++ b/app/src/main/res/layout/item_card_list.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_card_view.xml b/app/src/main/res/layout/item_card_view.xml
deleted file mode 100644
index 2b5bb0b..0000000
--- a/app/src/main/res/layout/item_card_view.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_recycler_view.xml b/app/src/main/res/layout/item_list.xml
similarity index 65%
rename from app/src/main/res/layout/item_recycler_view.xml
rename to app/src/main/res/layout/item_list.xml
index 06ee1e7..b5430fd 100644
--- a/app/src/main/res/layout/item_recycler_view.xml
+++ b/app/src/main/res/layout/item_list.xml
@@ -4,11 +4,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/image"
android:layout_width="match_parent"
- android:layout_height="@dimen/image_height"
- android:foreground="@drawable/selector"
+ android:layout_height="@dimen/list_item_height"
+ android:foreground="?selectableItemBackground"
android:scaleType="centerCrop"
android:src="@drawable/demo"
- app:di_borderColor="@color/deep_orange"
+ app:di_borderColor="@color/colorAccent"
app:di_borderEnabled="true"
- app:di_borderSize="@dimen/line_size"
+ app:di_borderSize="@dimen/border_size"
+ app:di_direction="right"
app:di_overlap="@dimen/overlap_size"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_view_pager.xml b/app/src/main/res/layout/item_view_pager.xml
deleted file mode 100644
index f031a72..0000000
--- a/app/src/main/res/layout/item_view_pager.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml
deleted file mode 100644
index 159190b..0000000
--- a/app/src/main/res/layout/toolbar.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6d5e5d0
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..6d5e5d0
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index cde69bc..a2f5908 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
index 9a078e3..1b52399 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index c133a0c..ff10afd 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
index efc028a..115a4c7 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index bfa42f0..dcd3cd8 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index 3af2608..459ca60 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 324e72c..8ca12fe 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index 9bec2e6..8e19b41 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index aee44e1..b824ebd 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index 34947cd..4c19a13 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 4fd79c5..5a077b3 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,11 +1,6 @@
-
#3F51B5
#303F9F
#FF4081
-
- #FF5722
- #66FF00FF
-
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 6e5e2e9..e7034ca 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -1,16 +1,11 @@
- 182dp
- 240dp
- 120dp
+ 182dp
+ 120dp
4dp
56dp
- 96dp
- 8dp
- 8dp
+ 8dp
4dp
- 72dp
- 200dp
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ff4d9d1..e23e5bf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,11 +1,8 @@
- Diagonal Image View
+ Diagonal ImageView
GridLayout Sample
RecyclerView Sample
- Complex RecyclerView Sample
- CardView Sample
- CollapsingToolbar Sample
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nisl enim, gravida vel enim et, eleifend pretium lectus. Cras ullamcorper a quam eu ultricies. Fusce facilisis mattis libero a blandit. Donec et pellentesque ligula. Nulla quis velit a dui mattis tempus sit amet commodo quam. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse tempor, massa sed vestibulum auctor, massa mi aliquam lacus, ac sollicitudin mi arcu eu elit. Sed condimentum ex at nisl porta egestas.
+ CardView Sample
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index b325b59..43e6019 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,24 +1,12 @@
-
-
-
-
-
-
-
diff --git a/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.java b/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.java
deleted file mode 100644
index eb38c1c..0000000
--- a/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.santalu.myapplication;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.kt b/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.kt
new file mode 100644
index 0000000..7aaa8a4
--- /dev/null
+++ b/app/src/test/java/com/santalu/myapplication/ExampleUnitTest.kt
@@ -0,0 +1,16 @@
+package com.santalu.myapplication
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/build.gradle b/build.gradle
index 44bac8f..452e22f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,25 +1,35 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- repositories {
- jcenter()
- google()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.1.2'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
+ ext {
+ gradle_version = '3.1.3'
+ kotlin_version = '1.2.51'
+ supportlibrary_version = '27.1.1'
+ constraintlayout_version = '1.1.2'
+ }
+
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath "com.android.tools.build:gradle:$gradle_version"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
}
allprojects {
- repositories {
- jcenter()
- google()
- }
+ repositories {
+ google()
+ jcenter()
+ }
}
task clean(type: Delete) {
- delete rootProject.buildDir
+ delete rootProject.buildDir
}
diff --git a/gradle.properties b/gradle.properties
index 8c4cc43..743d692 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,35 +1,13 @@
# Project-wide Gradle settings.
-
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
-
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
-
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
-
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
-
-VERSION_NAME=1.0
-VERSION_CODE=1
-GROUP=com.github.santalu.diagonalimageview
-
-POM_NAME=Diagonal ImageView
-POM_ARTIFACT_ID=diagonal-imageview
-POM_PACKAGING=aar
-POM_DESCRIPTION=A simple imageview which allows you to create diagonal cut views easily
-POM_URL=https://github.com/santalu/diagonal-imageview
-POM_SCM_URL=https://github.com/santalu/diagonal-imageview
-POM_SCM_CONNECTION=scm:git@github.com:santalu/diagonal-imageview.git
-POM_SCM_DEV_CONNECTION=scm:git@github.com:santalu/diagonal-imageview.git
-POM_LICENCE_NAME=The MIT License (MIT)
-POM_LICENCE_URL=https://opensource.org/licenses/MIT
-POM_LICENCE_DIST=repo
-POM_DEVELOPER_ID=santalu
-POM_DEVELOPER_NAME=Fatih Santalu
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 13372ae..7a3265e 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a84d675..ae20ffd 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Wed May 09 09:23:27 EET 2018
+#Tue Jul 24 11:24:18 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index 9d82f78..cccdd3d 100644
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
##############################################################################
##
@@ -6,20 +6,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 8a0b282..f955316 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/library/build.gradle b/library/build.gradle
index 2d2349d..cf4ff68 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
- buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
- versionCode 7
- versionName "1.0.5"
+ versionCode 8
+ versionName "1.0.6"
}
buildTypes {
@@ -17,16 +17,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
-ext {
- supportLibraryVersion = '27.1.1'
-}
-
dependencies {
- implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
-}
\ No newline at end of file
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "com.android.support:appcompat-v7:$supportlibrary_version"
+}
diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro
index 038bf99..f1b4245 100644
--- a/library/proguard-rules.pro
+++ b/library/proguard-rules.pro
@@ -1,14 +1,10 @@
# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/santalu/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
-# Add any project specific keep options here:
-
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 4dff637..06e8288 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,5 +1,2 @@
-
-
-
-
-
+
diff --git a/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.java b/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.java
deleted file mode 100644
index 1bbb65d..0000000
--- a/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package com.santalu.diagonalimageview;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.graphics.Path;
-import android.graphics.Point;
-import android.graphics.RectF;
-import android.graphics.Region;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
-import android.support.annotation.IntDef;
-import android.support.v7.widget.AppCompatImageView;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Created by santalu on 7/4/17.
- *
- * Note: if position set NONE mask won't be applied
- *
- * POSITION DIRECTION
- *
- * TOP LEFT | RIGHT
- * BOTTOM LEFT | RIGHT
- * LEFT TOP | BOTTOM
- * RIGHT TOP | BOTTOM
- */
-
-public class DiagonalImageView extends AppCompatImageView {
-
- public static final int NONE = 0;
- public static final int TOP = 1;
- public static final int RIGHT = 2;
- public static final int BOTTOM = 4;
- public static final int LEFT = 8;
-
- private final Path clipPath = new Path();
- private final Path borderPath = new Path();
- private final Paint borderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- private Region clickRegion = new Region();
- private RectF clickRect = new RectF();
-
- private int position;
- private int direction;
- private int overlap;
- private int borderColor;
- private int borderSize;
- private boolean borderEnabled;
-
- public DiagonalImageView(Context context) {
- super(context);
- init(context, null);
- }
-
- public DiagonalImageView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs);
- }
-
- private void init(Context context, AttributeSet attrs) {
- if (attrs == null) {
- return;
- }
-
- // refer to this https://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported
- if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR2) {
- setLayerType(LAYER_TYPE_HARDWARE, null);
- } else {
- setLayerType(LAYER_TYPE_SOFTWARE, null);
- }
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiagonalImageView);
- try {
- position = a.getInteger(R.styleable.DiagonalImageView_di_position, NONE);
- direction = a.getInteger(R.styleable.DiagonalImageView_di_direction, RIGHT);
- overlap = a.getDimensionPixelSize(R.styleable.DiagonalImageView_di_overlap, 0);
- borderSize = a.getDimensionPixelSize(R.styleable.DiagonalImageView_di_borderSize, 0);
- borderColor = a.getColor(R.styleable.DiagonalImageView_di_borderColor, Color.BLACK);
- borderEnabled = a.getBoolean(R.styleable.DiagonalImageView_di_borderEnabled, false);
-
- borderPaint.setColor(borderColor);
- borderPaint.setStyle(Style.STROKE);
- borderPaint.setStrokeWidth(borderSize);
- } finally {
- a.recycle();
- }
- }
-
- @Position
- public int getPosition() {
- return position;
- }
-
- public DiagonalImageView setPosition(@Position int position) {
- this.position = position;
- return this;
- }
-
- @Direction
- public int getDirection() {
- return direction;
- }
-
- public DiagonalImageView setDirection(@Direction int direction) {
- this.direction = direction;
- return this;
- }
-
- public int getOverlap() {
- return overlap;
- }
-
- public DiagonalImageView setOverlap(int overlap) {
- this.overlap = overlap;
- return this;
- }
-
- public boolean isBorderEnabled() {
- return borderEnabled;
- }
-
- public DiagonalImageView setBorderEnabled(boolean enabled) {
- borderEnabled = enabled;
- return this;
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- if (clipPath.isEmpty()) {
- super.onDraw(canvas);
- return;
- }
-
- int saveCount = canvas.save();
- canvas.clipPath(clipPath);
- super.onDraw(canvas);
- if (!borderPath.isEmpty()) {
- canvas.drawPath(borderPath, borderPaint);
- }
- canvas.restoreToCount(saveCount);
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- if (!clipPath.isEmpty()) {
- canvas.clipPath(clipPath);
- }
- super.dispatchDraw(canvas);
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- if (!changed) {
- return;
- }
- measure();
- }
-
- @SuppressLint("ClickableViewAccessibility")
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (!clickRegion.isEmpty()) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- Point point = new Point();
- point.x = (int) event.getX();
- point.y = (int) event.getY();
- if (!clickRegion.contains(point.x, point.y)) {
- return false;
- }
- }
- }
- return super.onTouchEvent(event);
- }
-
- @Override
- public void invalidate() {
- super.invalidate();
- measure();
- }
-
- private void measure() {
- int width = getMeasuredWidth();
- int height = getMeasuredHeight();
-
- if (width <= 0 || height <= 0) {
- return;
- }
-
- setClipPath(width, height);
- }
-
- private void setClipPath(final int width, final int height) {
- clipPath.reset();
- borderPath.reset();
-
- switch (position) {
- case TOP:
- if (direction == LEFT) {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width, overlap);
- clipPath.lineTo(width, height);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(0, 0);
- borderPath.lineTo(width, overlap);
- }
- } else {
- clipPath.moveTo(0, overlap);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width, height);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(0, overlap);
- borderPath.lineTo(width, 0);
- }
- }
- break;
- case RIGHT:
- if (direction == TOP) {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width - overlap, height);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(width, 0);
- borderPath.lineTo(width - overlap, height);
- }
- } else {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width - overlap, 0);
- clipPath.lineTo(width, height);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(width - overlap, 0);
- borderPath.lineTo(width, height);
- }
- }
- break;
- case BOTTOM:
- if (direction == LEFT) {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width, height - overlap);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(0, height);
- borderPath.lineTo(width, height - overlap);
- }
- } else {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width, height);
- clipPath.lineTo(0, height - overlap);
-
- if (borderEnabled) {
- borderPath.moveTo(0, height - overlap);
- borderPath.lineTo(width, height);
- }
- }
- break;
- case LEFT:
- if (direction == TOP) {
- clipPath.moveTo(0, 0);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width, height);
- clipPath.lineTo(overlap, height);
-
- if (borderEnabled) {
- borderPath.moveTo(0, 0);
- borderPath.lineTo(overlap, height);
- }
- } else {
- clipPath.moveTo(overlap, 0);
- clipPath.lineTo(width, 0);
- clipPath.lineTo(width, height);
- clipPath.lineTo(0, height);
-
- if (borderEnabled) {
- borderPath.moveTo(overlap, 0);
- borderPath.lineTo(0, height);
- }
- }
- break;
- }
-
- clipPath.close();
- clipPath.computeBounds(clickRect, true);
- clickRegion.setPath(clipPath,
- new Region((int) clickRect.left,
- (int) clickRect.top,
- (int) clickRect.right,
- (int) clickRect.bottom));
- borderPath.close();
- }
-
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({ NONE, LEFT, RIGHT, TOP, BOTTOM })
- public @interface Position {
- }
-
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({ LEFT, RIGHT, TOP, BOTTOM })
- public @interface Direction {
- }
-}
\ No newline at end of file
diff --git a/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.kt b/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.kt
new file mode 100644
index 0000000..eb63959
--- /dev/null
+++ b/library/src/main/java/com/santalu/diagonalimageview/DiagonalImageView.kt
@@ -0,0 +1,254 @@
+package com.santalu.diagonalimageview
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.Paint
+import android.graphics.Paint.Style
+import android.graphics.Path
+import android.graphics.RectF
+import android.graphics.Region
+import android.os.Build.VERSION
+import android.os.Build.VERSION_CODES
+import android.support.v7.widget.AppCompatImageView
+import android.util.AttributeSet
+import android.util.Log
+import android.view.MotionEvent
+
+/**
+ * Created by fatih.santalu on 7/24/2018.
+ */
+
+class DiagonalImageView : AppCompatImageView {
+
+ private val clipPath by lazy { Path() }
+ private val borderPath by lazy { Path() }
+ private val borderPaint by lazy { Paint(Paint.ANTI_ALIAS_FLAG) }
+ private val clickRegion by lazy { Region() }
+ private val clickRect by lazy { RectF() }
+
+ var position = NONE
+ var direction = NONE
+ var overlap = 0f
+
+ var borderEnabled = false
+ var borderSize = 0f
+ var borderColor = Color.BLACK
+
+ constructor(context: Context) : super(context)
+
+ constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
+ init(context, attrs)
+ }
+
+ constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
+ super(context, attrs, defStyleAttr) {
+ init(context, attrs)
+ }
+
+ private fun init(context: Context, attrs: AttributeSet?) {
+ attrs?.let {
+ val a = context.obtainStyledAttributes(it, R.styleable.DiagonalImageView)
+ position = a.getInt(R.styleable.DiagonalImageView_di_position, NONE)
+ direction = a.getInt(R.styleable.DiagonalImageView_di_direction, NONE)
+ overlap = a.getDimensionPixelSize(R.styleable.DiagonalImageView_di_overlap, 0).toFloat()
+ borderEnabled = a.getBoolean(R.styleable.DiagonalImageView_di_borderEnabled, false)
+ borderSize = a.getDimensionPixelSize(R.styleable.DiagonalImageView_di_borderSize, 0).toFloat()
+ borderColor = a.getColor(R.styleable.DiagonalImageView_di_borderColor, Color.BLACK)
+
+ borderPaint.style = Style.STROKE
+ borderPaint.color = borderColor
+ borderPaint.strokeWidth = borderSize
+
+ // refer this https://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported
+ setLayerType(
+ if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR2) LAYER_TYPE_HARDWARE else LAYER_TYPE_SOFTWARE,
+ null
+ )
+
+ a?.recycle()
+ }
+ }
+
+ @SuppressLint("ClickableViewAccessibility")
+ override fun onTouchEvent(event: MotionEvent?): Boolean {
+ if (!clickRegion.isEmpty) {
+ event?.let {
+ if (it.action == MotionEvent.ACTION_DOWN) {
+ if (!clickRegion.contains(it.x.toInt(), it.y.toInt())) {
+ return false
+ }
+ }
+ }
+ }
+ return super.onTouchEvent(event)
+ }
+
+ override fun dispatchDraw(canvas: Canvas?) {
+ if (!clipPath.isEmpty) {
+ canvas?.clipPath(clipPath)
+ }
+ super.dispatchDraw(canvas)
+ }
+
+ override fun onDraw(canvas: Canvas?) {
+ if (clipPath.isEmpty) {
+ super.onDraw(canvas)
+ return
+ }
+ canvas?.let {
+ val saveCount = it.save()
+ it.clipPath(clipPath)
+ super.onDraw(it)
+ if (!borderPath.isEmpty) {
+ it.drawPath(borderPath, borderPaint)
+ }
+ it.restoreToCount(saveCount)
+ }
+ }
+
+ override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
+ super.onLayout(changed, left, top, right, bottom)
+ if (changed) {
+ setClipPath()
+ }
+ }
+
+ override fun invalidate() {
+ super.invalidate()
+ setClipPath()
+ }
+
+ private fun setClipPath() {
+ val width = measuredWidth.toFloat()
+ val height = measuredHeight.toFloat()
+
+ if (width <= 0 || height <= 0) {
+ return
+ }
+
+ clipPath.reset()
+ borderPath.reset()
+ when (position) {
+ TOP -> {
+ if (direction == LEFT) {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width, overlap)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(0f, 0f)
+ borderPath.lineTo(width, overlap)
+ }
+ } else {
+ clipPath.moveTo(0f, overlap)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(0f, overlap)
+ borderPath.lineTo(width, 0f)
+ }
+ }
+ }
+ BOTTOM -> {
+ if (direction == LEFT) {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width, height - overlap)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(0f, height)
+ borderPath.lineTo(width, height - overlap)
+ }
+ } else {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(0f, height - overlap)
+
+ if (borderEnabled) {
+ borderPath.moveTo(0f, height - overlap)
+ borderPath.lineTo(width, height)
+ }
+ }
+ }
+ LEFT -> {
+ if (direction == TOP) {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(overlap, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(0f, 0f)
+ borderPath.lineTo(overlap, height)
+ }
+ } else {
+ clipPath.moveTo(overlap, 0f)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(overlap, 0f)
+ borderPath.lineTo(0f, height)
+ }
+ }
+ }
+ RIGHT -> {
+ if (direction == TOP) {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width, 0f)
+ clipPath.lineTo(width - overlap, height)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(width, 0f)
+ borderPath.lineTo(width - overlap, height)
+ }
+ } else {
+ clipPath.moveTo(0f, 0f)
+ clipPath.lineTo(width - overlap, 0f)
+ clipPath.lineTo(width, height)
+ clipPath.lineTo(0f, height)
+
+ if (borderEnabled) {
+ borderPath.moveTo(width - overlap, 0f)
+ borderPath.lineTo(width, height)
+ }
+ }
+ }
+ else -> return
+ }
+ clipPath.close()
+ borderPath.close()
+ setClickRegion()
+ }
+
+ private fun setClickRegion() {
+ clipPath.computeBounds(clickRect, true)
+ clickRegion.setPath(
+ clipPath,
+ Region(
+ clickRect.left.toInt(),
+ clickRect.top.toInt(),
+ clickRect.right.toInt(),
+ clickRect.bottom.toInt()
+ )
+ )
+ }
+
+ companion object {
+
+ const val NONE = 0
+ const val TOP = 1
+ const val BOTTOM = 2
+ const val LEFT = 3
+ const val RIGHT = 4
+ }
+}
\ No newline at end of file
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
index d8c9496..db6a0eb 100644
--- a/library/src/main/res/values/attrs.xml
+++ b/library/src/main/res/values/attrs.xml
@@ -4,15 +4,15 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -20,4 +20,5 @@
+
\ No newline at end of file
diff --git a/screens/cv.png b/media/cv.png
similarity index 100%
rename from screens/cv.png
rename to media/cv.png
diff --git a/screens/gl.png b/media/gl.png
similarity index 100%
rename from screens/gl.png
rename to media/gl.png
diff --git a/screens/rv.png b/media/rv.png
similarity index 100%
rename from screens/rv.png
rename to media/rv.png
diff --git a/screens/ct.png b/screens/ct.png
deleted file mode 100644
index 839b46e..0000000
Binary files a/screens/ct.png and /dev/null differ