Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
santalu committed Feb 7, 2020
1 parent ae328ef commit c7a68bf
Show file tree
Hide file tree
Showing 23 changed files with 443 additions and 489 deletions.
19 changes: 10 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion rootProject.compileSdkVersion
compileSdkVersion versions.compileSdk

defaultConfig {
applicationId "com.santalu.sample"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 1
versionName "1.0"
}
Expand All @@ -23,10 +23,11 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':diagonalimageview')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion"
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
implementation "com.google.android.material:material:$rootProject.materialVersion"
implementation "androidx.recyclerview:recyclerview:$rootProject.recyclerViewVersion"
implementation "androidx.gridlayout:gridlayout:$rootProject.gridLayoutVersion"
implementation project(':library')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
implementation "androidx.appcompat:appcompat:$versions.appcompat"
implementation "com.google.android.material:material:$versions.material"
implementation "androidx.recyclerview:recyclerview:$versions.recyclerview"
implementation "androidx.gridlayout:gridlayout:$versions.gridlayout"
}
16 changes: 12 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.santalu.myapplication">

<application
Expand All @@ -8,7 +9,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity android:name=".MainActivity">
<intent-filter>
Expand All @@ -18,11 +20,17 @@
</intent-filter>
</activity>

<activity android:name=".SampleListActivity"/>
<activity
android:name=".SampleListActivity"
android:parentActivityName=".MainActivity"/>

<activity android:name=".SampleCardListActivity"/>
<activity
android:name=".SampleCardListActivity"
android:parentActivityName=".MainActivity"/>

<activity android:name=".SampleGridActivity"/>
<activity
android:name=".SampleGridActivity"
android:parentActivityName=".MainActivity"/>

</application>

Expand Down
19 changes: 0 additions & 19 deletions app/src/main/java/com/santalu/myapplication/Extensions.kt

This file was deleted.

26 changes: 22 additions & 4 deletions app/src/main/java/com/santalu/myapplication/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
package com.santalu.myapplication

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.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() {
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) }
listSample.setOnClickListener {
startActivity(Intent(this, SampleListActivity::class.java))
}
cardListSample.setOnClickListener {
startActivity(Intent(this, SampleCardListActivity::class.java))
}
gridSample.setOnClickListener {
startActivity(Intent(this, SampleGridActivity::class.java))
}
}
}

internal fun ViewGroup.inflate(layoutRes: Int): View =
LayoutInflater.from(context).inflate(layoutRes, this, false)

internal fun Context.toast(text: CharSequence) =
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.santalu.myapplication

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
Expand All @@ -15,23 +13,22 @@ import kotlinx.android.synthetic.main.activity_list.recyclerView
* Created by fatih.santalu on 7/24/2018.
*/

class SampleCardListActivity : AppCompatActivity() {
class SampleCardListActivity: AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_list)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

recyclerView.apply {
setHasFixedSize(true)
adapter = SampleAdapter()
}
}

class SampleAdapter : Adapter<SampleViewHolder>() {
class SampleAdapter: Adapter<SampleViewHolder>() {

override fun getItemCount(): Int {
return 20
}
override fun getItemCount(): Int = 20

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

class SampleViewHolder(itemView: View) : ViewHolder(itemView)
class SampleViewHolder(itemView: View): ViewHolder(itemView)
}

companion object {

fun start(activity: Activity) {
with(activity) {
intent = Intent(this, SampleCardListActivity::class.java)
startActivity(intent)
}
}
}

}
15 changes: 2 additions & 13 deletions app/src/main/java/com/santalu/myapplication/SampleGridActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.santalu.myapplication

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -11,26 +9,17 @@ import com.santalu.diagonalimageview.DiagonalImageView
* Created by fatih.santalu on 7/24/2018.
*/

class SampleGridActivity : AppCompatActivity() {
class SampleGridActivity: AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_grid)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

fun onImageClick(view: View) {
if (view is DiagonalImageView) {
toast("start ${view.start} end ${view.end} clicked")
}
}

companion object {

fun start(activity: Activity) {
with(activity) {
intent = Intent(this, SampleGridActivity::class.java)
startActivity(intent)
}
}
}
}
30 changes: 9 additions & 21 deletions app/src/main/java/com/santalu/myapplication/SampleListActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.santalu.myapplication

import android.app.Activity
import android.content.Intent
import android.graphics.Rect
import android.os.Bundle
import android.view.View
Expand All @@ -12,7 +10,8 @@ import androidx.recyclerview.widget.RecyclerView.Adapter
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
import androidx.recyclerview.widget.RecyclerView.State
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.santalu.diagonalimageview.DiagonalImageView
import com.santalu.diagonalimageview.Direction.NONE
import com.santalu.diagonalimageview.Direction.TOP
import com.santalu.myapplication.SampleListActivity.SampleAdapter.SampleViewHolder
import kotlinx.android.synthetic.main.activity_list.recyclerView
import kotlinx.android.synthetic.main.item_list.view.image
Expand All @@ -21,11 +20,12 @@ import kotlinx.android.synthetic.main.item_list.view.image
* Created by fatih.santalu on 7/24/2018.
*/

class SampleListActivity : AppCompatActivity() {
class SampleListActivity: AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_list)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

recyclerView.apply {
val overlap = resources.getDimensionPixelSize(R.dimen.overlap_size)
Expand All @@ -35,11 +35,9 @@ class SampleListActivity : AppCompatActivity() {
}
}

class SampleAdapter : Adapter<SampleViewHolder>() {
class SampleAdapter: Adapter<SampleViewHolder>() {

override fun getItemCount(): Int {
return 20
}
override fun getItemCount(): Int = 20

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

override fun onBindViewHolder(holder: SampleViewHolder, position: Int) {
with(holder.itemView) {
image.start = if (position == 0) DiagonalImageView.NONE else DiagonalImageView.TOP
image.start = if (position == 0) NONE else TOP
setOnClickListener { context.toast("position $position clicked") }
}
}

class SampleViewHolder(itemView: View) : ViewHolder(itemView)
class SampleViewHolder(itemView: View): ViewHolder(itemView)
}

class OverlapItemDecoration(private val overlap: Int) : ItemDecoration() {
class OverlapItemDecoration(private val overlap: Int): ItemDecoration() {

override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: State) {
super.getItemOffsets(outRect, view, parent, state)
Expand All @@ -65,14 +63,4 @@ class SampleListActivity : AppCompatActivity() {
}
}
}

companion object {

fun start(activity: Activity) {
with(activity) {
intent = Intent(this, SampleListActivity::class.java)
startActivity(intent)
}
}
}
}
12 changes: 6 additions & 6 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
android:width="108dp">
android:viewportHeight="108">
<path
android:fillType="evenOdd"
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"
android:strokeColor="#00000000"
android:strokeWidth="1">
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
Expand All @@ -29,6 +29,6 @@
android:fillColor="#FFFFFF"
android:fillType="nonZero"
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"
android:strokeColor="#00000000"
android:strokeWidth="1"/>
android:strokeWidth="1"
android:strokeColor="#00000000"/>
</vector>
Loading

0 comments on commit c7a68bf

Please sign in to comment.