Skip to content

Commit

Permalink
Migrate to Android X.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3z committed Jul 29, 2019
1 parent 5b258bb commit f0fce0c
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.novoda:bintray-release:0.9'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.novoda:bintray-release:0.9.1'
}
}

Expand Down
9 changes: 4 additions & 5 deletions flowlayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}
buildTypes {
Expand All @@ -30,9 +30,8 @@ publish {
}

dependencies {
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'

implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ org.gradle.jvmargs=-Xmx1536m
# 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
android.useAndroidX=true
android.enableJetifier=true

PUBLISH_VERSION=0.1.0
PUBLISH_VERSION=1.3.0
USER_ORG=nex3z
GROUP_ID=com.nex3z
ARTIFACT_ID=flow-layout
ARTIFACT_ID=flow-layout
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 29 21:42:50 CST 2018
#Sat May 25 22:18:04 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
14 changes: 7 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -20,12 +20,12 @@ android {
}

dependencies {
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'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':flowlayout')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.nex3z.flowlayout.flowlayout;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.util.TypedValue;
import android.view.View;
import android.widget.Button;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.nex3z.flowlayout.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class RecyclerViewActivity extends AppCompatActivity {

Expand All @@ -16,7 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initRecyclerView() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_list);
RecyclerView recyclerView = findViewById(R.id.rv_list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
// recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
SimpleAdapter adapter = new SimpleAdapter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.nex3z.flowlayout.sample;

import android.content.Context;
import android.support.v7.widget.RecyclerView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -11,8 +13,9 @@ public class SimpleAdapter extends RecyclerView.Adapter<SimpleAdapter.ViewHolder

private int mCount = 0;

@NonNull
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context);

Expand All @@ -22,7 +25,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.mTvCount.setText(String.valueOf(position));
}

Expand All @@ -40,7 +43,7 @@ public class ViewHolder extends RecyclerView.ViewHolder {
TextView mTvCount;
public ViewHolder(final View itemView) {
super(itemView);
mTvCount = (TextView) itemView.findViewById(R.id.tv_count);
mTvCount = itemView.findViewById(R.id.tv_count);
}
}
}
4 changes: 2 additions & 2 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.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView 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"
android:layout_width="match_parent"
Expand Down Expand Up @@ -297,4 +297,4 @@
android:text="@string/with_recyclerview" />

</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
2 changes: 1 addition & 1 deletion sample/src/main/res/layout/activity_recycler_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:context="com.nex3z.flowlayout.sample.RecyclerViewActivity">

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Expand Down

0 comments on commit f0fce0c

Please sign in to comment.