Skip to content

Commit

Permalink
Use android x without support
Browse files Browse the repository at this point in the history
  • Loading branch information
Semper-Viventem committed Jul 27, 2018
1 parent 36c7dc0 commit 061f879
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 82 deletions.
8 changes: 4 additions & 4 deletions backdrop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ subprojects {

android {

compileSdkVersion 27
compileSdkVersion 'android-P'

defaultConfig {
minSdkVersion 21
targetSdkVersion 27
targetSdkVersion 28
}

buildTypes {
Expand All @@ -57,14 +57,14 @@ android {
}

ext {
supportVersion = '27.1.1'
kotlin_version = '1.2.41'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "com.android.support:appcompat-v7:$supportVersion"
// Android X
implementation "androidx.appcompat:appcompat:1.0.0-beta01"

// Kotlin
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package ru.semper_viventem.backdrop
import android.content.Context
import android.os.Bundle
import android.os.Parcelable
import android.support.annotation.IdRes
import android.support.design.widget.CoordinatorLayout
import android.support.v7.widget.Toolbar
import android.util.AttributeSet
import android.view.View
import androidx.annotation.IdRes
import androidx.appcompat.widget.Toolbar
import androidx.coordinatorlayout.widget.CoordinatorLayout


class BackdropBehavior : CoordinatorLayout.Behavior<View> {
Expand Down Expand Up @@ -48,13 +48,13 @@ class BackdropBehavior : CoordinatorLayout.Behavior<View> {

constructor(context: Context, attrs: AttributeSet) : super(context, attrs)

override fun onSaveInstanceState(parent: CoordinatorLayout?, child: View?): Parcelable {
override fun onSaveInstanceState(parent: CoordinatorLayout, child: View): Parcelable {
return Bundle().apply {
putSerializable(ARG_DROP_STATE, dropState)
}
}

override fun onRestoreInstanceState(parent: CoordinatorLayout?, child: View?, state: Parcelable?) {
override fun onRestoreInstanceState(parent: CoordinatorLayout, child: View, state: Parcelable) {
super.onRestoreInstanceState(parent, child, state)

dropState = (state as? Bundle)?.getSerializable(ARG_DROP_STATE) as? DropState ?: DEFAULT_DROP_STATE
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX = true
android.enableJetifier = false
# 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
Expand Down
35 changes: 9 additions & 26 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ android {
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -28,39 +27,23 @@ android {
}
}

ext {
supportVersion = '28.0.0-alpha3'
retrofitVersion = '2.2.0'
conductorVersion = "2.1.4"
playServicesVersion = "15.0.0"
}

androidExtensions {
experimental = true
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Support
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
// Material Components
// implementation "com.google.android.material:material:1.0.0-alpha1"

// Android X
implementation "androidx.appcompat:appcompat:1.0.0-beta01"
implementation "androidx.constraintlayout:constraintlayout:1.1.2"
implementation "com.google.android.material:material:1.0.0-beta01"

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Tests
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Logging
implementation 'com.jakewharton.timber:timber:4.5.1'

// Images
implementation 'com.github.bumptech.glide:glide:4.6.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
// Lists
implementation 'com.hannesdorfmann:adapterdelegates3:3.0.1'
implementation 'com.squareup.picasso:picasso:2.71828'

implementation project(':backdrop')
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package ru.semper_viventem.backdropview

import android.content.Context
import android.support.annotation.LayoutRes
import android.support.design.widget.CoordinatorLayout
import android.support.design.widget.CoordinatorLayout.Behavior
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import androidx.annotation.LayoutRes
import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.squareup.picasso.Picasso


fun ViewGroup.inflate(@LayoutRes layoutRes: Int, attachToRoot: Boolean = false): View {
Expand All @@ -34,15 +32,9 @@ fun View.showKeyboard(show: Boolean) {
}

fun ImageView.load(
url: String?,
round: Boolean = false
url: String?
) {
Glide.with(context)
Picasso.get()
.load(url)
.apply {
if (round) {
apply(RequestOptions.circleCropTransform())
}
}
.into(this)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ru.semper_viventem.backdropview.ui

import android.os.Bundle
import android.support.annotation.IdRes
import android.support.v4.app.Fragment
import android.support.v7.app.AppCompatActivity
import androidx.annotation.IdRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.activity_main.*
import ru.semper_viventem.backdrop.BackdropBehavior
import ru.semper_viventem.backdropview.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.semper_viventem.backdropview.ui.common

import android.support.v7.util.DiffUtil
import android.support.v7.widget.RecyclerView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView

/**
* Easy to use base adapter for lists with single item type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package ru.semper_viventem.backdropview.ui.common

import android.content.Context
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment


abstract class Screen : Fragment {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ru.semper_viventem.backdropview.ui.gallery

import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.item_gallery.view.*
import ru.semper_viventem.backdropview.R
import ru.semper_viventem.backdropview.inflate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ru.semper_viventem.backdropview.ui.gallery

import android.support.v7.widget.DividerItemDecoration
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearSnapHelper
import android.view.View
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import kotlinx.android.synthetic.main.screen_gallery.view.*
import ru.semper_viventem.backdropview.R
import ru.semper_viventem.backdropview.ui.common.Screen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ru.semper_viventem.backdropview.ui.list

import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.item_list.view.*
import ru.semper_viventem.backdropview.R
import ru.semper_viventem.backdropview.inflate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.semper_viventem.backdropview.ui.list

import android.support.v7.widget.LinearLayoutManager
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.screen_list.view.*
import ru.semper_viventem.backdropview.R
import ru.semper_viventem.backdropview.ui.common.Screen
Expand Down
8 changes: 4 additions & 4 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand All @@ -9,7 +9,7 @@
android:background="@color/colorPrimary"
tools:context=".ui.MainActivity">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -23,7 +23,7 @@
android:layout_marginStart="@dimen/small_gap"
android:orientation="vertical">

<android.support.design.widget.NavigationView
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -44,4 +44,4 @@
android:paddingTop="@dimen/foreground_radius"
app:layout_behavior="ru.semper_viventem.backdrop.BackdropBehavior"/>

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 2 additions & 2 deletions sample/src/main/res/layout/item_gallery.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand All @@ -24,4 +24,4 @@
android:textStyle="bold"
android:textSize="16sp"
tools:text="Title"/>
</android.support.design.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>
8 changes: 4 additions & 4 deletions sample/src/main/res/layout/item_list.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand All @@ -9,7 +9,7 @@
android:clickable="true"
android:focusable="true">

<android.support.design.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageCard"
android:layout_width="80dp"
android:layout_height="80dp"
Expand All @@ -27,7 +27,7 @@
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:background="@color/colorAccent"/>
</android.support.design.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>

<TextView
android:id="@+id/title"
Expand Down Expand Up @@ -56,4 +56,4 @@
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintVertical_bias="0.0"
tools:text="Description"/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/screen_gallery.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -31,7 +31,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -40,4 +40,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/screen_list.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -31,7 +31,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
Expand All @@ -40,4 +40,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 061f879

Please sign in to comment.