Skip to content

Commit 2b7630f

Browse files
committed
Merge branch 'develop'
2 parents ae263a2 + 27af5e5 commit 2b7630f

File tree

25 files changed

+453
-496
lines changed

25 files changed

+453
-496
lines changed

.travis.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
language: android
2-
3-
jdk:
4-
- oraclejdk8
2+
sudo: required
3+
jdk: oraclejdk8
4+
dist: trusty
55

66
android:
77
components:
88
- tools
99
- platform-tools
10-
- build-tools-28.0.3
11-
- android-28
10+
- build-tools-29.0.2
11+
- android-29
1212
- extra-android-m2repository
1313
licenses:
1414
- 'android-sdk-preview-license-.+'
@@ -17,7 +17,10 @@ android:
1717

1818
before_install:
1919
- yes | sdkmanager "platforms;android-28"
20+
- yes | sdkmanager "platforms;android-29"
21+
22+
before_script:
2023
- chmod +x gradlew
2124

2225
script:
23-
- ./gradlew clean build
26+
- ./gradlew clean build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ allprojects {
2626
```
2727
```
2828
dependencies {
29-
implementation 'com.github.santalu:diagonal-imageview:1.1.0'
29+
implementation 'com.github.santalu:diagonal-imageview:1.1.1'
3030
}
3131
```
3232

app/build.gradle

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion rootProject.compileSdkVersion
6+
compileSdkVersion versions.compileSdk
77

88
defaultConfig {
99
applicationId "com.santalu.sample"
10-
minSdkVersion rootProject.minSdkVersion
11-
targetSdkVersion rootProject.targetSdkVersion
10+
minSdkVersion versions.minSdk
11+
targetSdkVersion versions.targetSdk
1212
versionCode 1
1313
versionName "1.0"
1414
}
@@ -23,10 +23,11 @@ android {
2323

2424
dependencies {
2525
implementation fileTree(include: ['*.jar'], dir: 'libs')
26-
implementation project(':diagonalimageview')
27-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion"
28-
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
29-
implementation "com.google.android.material:material:$rootProject.materialVersion"
30-
implementation "androidx.recyclerview:recyclerview:$rootProject.recyclerViewVersion"
31-
implementation "androidx.gridlayout:gridlayout:$rootProject.gridLayoutVersion"
26+
implementation project(':library')
27+
28+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
29+
implementation "androidx.appcompat:appcompat:$versions.appcompat"
30+
implementation "com.google.android.material:material:$versions.material"
31+
implementation "androidx.recyclerview:recyclerview:$versions.recyclerview"
32+
implementation "androidx.gridlayout:gridlayout:$versions.gridlayout"
3233
}

app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.santalu.myapplication">
45

56
<application
@@ -8,7 +9,8 @@
89
android:label="@string/app_name"
910
android:roundIcon="@mipmap/ic_launcher_round"
1011
android:supportsRtl="true"
11-
android:theme="@style/AppTheme">
12+
android:theme="@style/AppTheme"
13+
tools:ignore="GoogleAppIndexingWarning">
1214

1315
<activity android:name=".MainActivity">
1416
<intent-filter>
@@ -18,11 +20,17 @@
1820
</intent-filter>
1921
</activity>
2022

21-
<activity android:name=".SampleListActivity"/>
23+
<activity
24+
android:name=".SampleListActivity"
25+
android:parentActivityName=".MainActivity"/>
2226

23-
<activity android:name=".SampleCardListActivity"/>
27+
<activity
28+
android:name=".SampleCardListActivity"
29+
android:parentActivityName=".MainActivity"/>
2430

25-
<activity android:name=".SampleGridActivity"/>
31+
<activity
32+
android:name=".SampleGridActivity"
33+
android:parentActivityName=".MainActivity"/>
2634

2735
</application>
2836

app/src/main/java/com/santalu/myapplication/Extensions.kt

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
package com.santalu.myapplication
22

3+
import android.content.Context
4+
import android.content.Intent
35
import android.os.Bundle
6+
import android.view.LayoutInflater
7+
import android.view.View
8+
import android.view.ViewGroup
9+
import android.widget.Toast
410
import androidx.appcompat.app.AppCompatActivity
511
import kotlinx.android.synthetic.main.activity_main.cardListSample
612
import kotlinx.android.synthetic.main.activity_main.gridSample
713
import kotlinx.android.synthetic.main.activity_main.listSample
814

9-
class MainActivity : AppCompatActivity() {
15+
class MainActivity: AppCompatActivity() {
1016

1117
override fun onCreate(savedInstanceState: Bundle?) {
1218
super.onCreate(savedInstanceState)
1319
setContentView(R.layout.activity_main)
1420

15-
listSample.setOnClickListener { SampleListActivity.start(this) }
16-
cardListSample.setOnClickListener { SampleCardListActivity.start(this) }
17-
gridSample.setOnClickListener { SampleGridActivity.start(this) }
21+
listSample.setOnClickListener {
22+
startActivity(Intent(this, SampleListActivity::class.java))
23+
}
24+
cardListSample.setOnClickListener {
25+
startActivity(Intent(this, SampleCardListActivity::class.java))
26+
}
27+
gridSample.setOnClickListener {
28+
startActivity(Intent(this, SampleGridActivity::class.java))
29+
}
1830
}
1931
}
32+
33+
internal fun ViewGroup.inflate(layoutRes: Int): View =
34+
LayoutInflater.from(context).inflate(layoutRes, this, false)
35+
36+
internal fun Context.toast(text: CharSequence) =
37+
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.santalu.myapplication
22

3-
import android.app.Activity
4-
import android.content.Intent
53
import android.os.Bundle
64
import android.view.View
75
import android.view.ViewGroup
@@ -15,23 +13,22 @@ import kotlinx.android.synthetic.main.activity_list.recyclerView
1513
* Created by fatih.santalu on 7/24/2018.
1614
*/
1715

18-
class SampleCardListActivity : AppCompatActivity() {
16+
class SampleCardListActivity: AppCompatActivity() {
1917

2018
override fun onCreate(savedInstanceState: Bundle?) {
2119
super.onCreate(savedInstanceState)
2220
setContentView(R.layout.activity_list)
21+
supportActionBar?.setDisplayHomeAsUpEnabled(true)
2322

2423
recyclerView.apply {
2524
setHasFixedSize(true)
2625
adapter = SampleAdapter()
2726
}
2827
}
2928

30-
class SampleAdapter : Adapter<SampleViewHolder>() {
29+
class SampleAdapter: Adapter<SampleViewHolder>() {
3130

32-
override fun getItemCount(): Int {
33-
return 20
34-
}
31+
override fun getItemCount(): Int = 20
3532

3633
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleViewHolder {
3734
val view = parent.inflate(R.layout.item_card_list)
@@ -44,17 +41,6 @@ class SampleCardListActivity : AppCompatActivity() {
4441
}
4542
}
4643

47-
class SampleViewHolder(itemView: View) : ViewHolder(itemView)
44+
class SampleViewHolder(itemView: View): ViewHolder(itemView)
4845
}
49-
50-
companion object {
51-
52-
fun start(activity: Activity) {
53-
with(activity) {
54-
intent = Intent(this, SampleCardListActivity::class.java)
55-
startActivity(intent)
56-
}
57-
}
58-
}
59-
6046
}
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.santalu.myapplication
22

3-
import android.app.Activity
4-
import android.content.Intent
53
import android.os.Bundle
64
import android.view.View
75
import androidx.appcompat.app.AppCompatActivity
@@ -11,26 +9,17 @@ import com.santalu.diagonalimageview.DiagonalImageView
119
* Created by fatih.santalu on 7/24/2018.
1210
*/
1311

14-
class SampleGridActivity : AppCompatActivity() {
12+
class SampleGridActivity: AppCompatActivity() {
1513

1614
override fun onCreate(savedInstanceState: Bundle?) {
1715
super.onCreate(savedInstanceState)
1816
setContentView(R.layout.activity_grid)
17+
supportActionBar?.setDisplayHomeAsUpEnabled(true)
1918
}
2019

2120
fun onImageClick(view: View) {
2221
if (view is DiagonalImageView) {
2322
toast("start ${view.start} end ${view.end} clicked")
2423
}
2524
}
26-
27-
companion object {
28-
29-
fun start(activity: Activity) {
30-
with(activity) {
31-
intent = Intent(this, SampleGridActivity::class.java)
32-
startActivity(intent)
33-
}
34-
}
35-
}
3625
}
Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.santalu.myapplication
22

3-
import android.app.Activity
4-
import android.content.Intent
53
import android.graphics.Rect
64
import android.os.Bundle
75
import android.view.View
@@ -12,7 +10,8 @@ import androidx.recyclerview.widget.RecyclerView.Adapter
1210
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
1311
import androidx.recyclerview.widget.RecyclerView.State
1412
import androidx.recyclerview.widget.RecyclerView.ViewHolder
15-
import com.santalu.diagonalimageview.DiagonalImageView
13+
import com.santalu.diagonalimageview.Direction.NONE
14+
import com.santalu.diagonalimageview.Direction.TOP
1615
import com.santalu.myapplication.SampleListActivity.SampleAdapter.SampleViewHolder
1716
import kotlinx.android.synthetic.main.activity_list.recyclerView
1817
import kotlinx.android.synthetic.main.item_list.view.image
@@ -21,11 +20,12 @@ import kotlinx.android.synthetic.main.item_list.view.image
2120
* Created by fatih.santalu on 7/24/2018.
2221
*/
2322

24-
class SampleListActivity : AppCompatActivity() {
23+
class SampleListActivity: AppCompatActivity() {
2524

2625
override fun onCreate(savedInstanceState: Bundle?) {
2726
super.onCreate(savedInstanceState)
2827
setContentView(R.layout.activity_list)
28+
supportActionBar?.setDisplayHomeAsUpEnabled(true)
2929

3030
recyclerView.apply {
3131
val overlap = resources.getDimensionPixelSize(R.dimen.overlap_size)
@@ -35,11 +35,9 @@ class SampleListActivity : AppCompatActivity() {
3535
}
3636
}
3737

38-
class SampleAdapter : Adapter<SampleViewHolder>() {
38+
class SampleAdapter: Adapter<SampleViewHolder>() {
3939

40-
override fun getItemCount(): Int {
41-
return 20
42-
}
40+
override fun getItemCount(): Int = 20
4341

4442
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleViewHolder {
4543
val view = parent.inflate(R.layout.item_list)
@@ -48,15 +46,15 @@ class SampleListActivity : AppCompatActivity() {
4846

4947
override fun onBindViewHolder(holder: SampleViewHolder, position: Int) {
5048
with(holder.itemView) {
51-
image.start = if (position == 0) DiagonalImageView.NONE else DiagonalImageView.TOP
49+
image.start = if (position == 0) NONE else TOP
5250
setOnClickListener { context.toast("position $position clicked") }
5351
}
5452
}
5553

56-
class SampleViewHolder(itemView: View) : ViewHolder(itemView)
54+
class SampleViewHolder(itemView: View): ViewHolder(itemView)
5755
}
5856

59-
class OverlapItemDecoration(private val overlap: Int) : ItemDecoration() {
57+
class OverlapItemDecoration(private val overlap: Int): ItemDecoration() {
6058

6159
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: State) {
6260
super.getItemOffsets(outRect, view, parent, state)
@@ -65,14 +63,4 @@ class SampleListActivity : AppCompatActivity() {
6563
}
6664
}
6765
}
68-
69-
companion object {
70-
71-
fun start(activity: Activity) {
72-
with(activity) {
73-
intent = Intent(this, SampleListActivity::class.java)
74-
startActivity(intent)
75-
}
76-
}
77-
}
7866
}

app/src/main/res/drawable-v24/ic_launcher_foreground.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
22
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
34
android:height="108dp"
4-
android:viewportHeight="108"
55
android:viewportWidth="108"
6-
android:width="108dp">
6+
android:viewportHeight="108">
77
<path
88
android:fillType="evenOdd"
99
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10-
android:strokeColor="#00000000"
11-
android:strokeWidth="1">
10+
android:strokeWidth="1"
11+
android:strokeColor="#00000000">
1212
<aapt:attr name="android:fillColor">
1313
<gradient
1414
android:endX="78.5885"
@@ -29,6 +29,6 @@
2929
android:fillColor="#FFFFFF"
3030
android:fillType="nonZero"
3131
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32-
android:strokeColor="#00000000"
33-
android:strokeWidth="1"/>
32+
android:strokeWidth="1"
33+
android:strokeColor="#00000000"/>
3434
</vector>

0 commit comments

Comments
 (0)