Skip to content

Commit

Permalink
migrate androidx and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FarshidRoohi committed Sep 26, 2019
1 parent 3ef1db9 commit d02af90
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 90 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
/.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
### example:

```XML
<farshid_roohi.ir.customrecyclerview.view.view.ItemContainerView
<farshid_roohi.ir.customrecyclerview.view.ItemContainerView
android:id="@+id/item_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.2'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.0"

Expand Down
14 changes: 7 additions & 7 deletions customrecyclerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"

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

}

Expand Down Expand Up @@ -76,9 +76,9 @@ bintray {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package farshid_roohi.ir.customrecyclerview.view.view;
package farshid_roohi.ir.customrecyclerview.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -50,6 +50,9 @@ public void putItem(ItemParentView value) {
public ItemContainerAdapter getContainerAdapter() {
return this.containerAdapter;
}
public void notifyDataSetChanged(){
this.containerAdapter.notifyDataSetChanged();
}

private void initializeView() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package farshid_roohi.ir.customrecyclerview.view.view;
package farshid_roohi.ir.customrecyclerview.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.DimenRes;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.ColorInt;
import androidx.annotation.DimenRes;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
Expand All @@ -18,7 +18,7 @@
import java.util.List;

import farshid_roohi.ir.customrecyclerview.R;
import farshid_roohi.ir.customrecyclerview.view.view.ItemParentView;
import farshid_roohi.ir.customrecyclerview.view.ItemParentView;

public class ItemContainerAdapter extends RecyclerView.Adapter<ItemContainerAdapter.ViewHolder> {

Expand Down
2 changes: 1 addition & 1 deletion customrecyclerview/src/main/res/layout/item_container.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:background="@android:color/transparent">


<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<farshid_roohi.ir.customrecyclerview.view.view.ItemParentView
<farshid_roohi.ir.customrecyclerview.view.ItemParentView
android:id="@+id/item_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</RelativeLayout>


<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_parent_child"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# 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.
android.enableJetifier=true
android.useAndroidX=true
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
Expand Down
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 @@
#Tue Dec 25 16:11:19 IRST 2018
#Thu Sep 26 12:52:28 IRST 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.4.1-all.zip
21 changes: 12 additions & 9 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 29
defaultConfig {
applicationId "farshid_roohi.ir.sample.customrecyclerview"
minSdkVersion 14
targetSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -20,15 +20,18 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.0.0'

implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

implementation 'com.squareup.picasso:picasso:2.71828'

// Add lib customRecyclerView
implementation 'ir.farshid_roohi:customrecyclerview:0.1.2'
// implementation 'ir.farshid_roohi:customrecyclerview:0.1.2'
implementation project(":customrecyclerview")

testImplementation 'junit:junit:4.12'

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package farshid_roohi.ir.sample.customrecyclerview.sample;

import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -16,20 +16,20 @@
import farshid_roohi.ir.sample.customrecyclerview.R;


public class ChildAdapter extends RecyclerView.Adapter<ChildAdapter.ViewHolder> {
public class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder> {

private List<ModelSample> list;
private List<Model> list;

public ChildAdapter(List<ModelSample> list) {
public Adapter(List<Model> list) {
this.list = list;
}

public ChildAdapter() {
public Adapter() {
this.list = new ArrayList<>();
}


public void addList(List<ModelSample> list) {
public void addList(List<Model> list) {
this.list = list;
}

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

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
ModelSample item = this.list.get(position);
Model item = this.list.get(position);

holder.txtName.setText(item.getName());
Picasso.get()
Expand Down Expand Up @@ -91,6 +91,6 @@ public int getItemCount() {
}

public interface OnClickItemListener {
void onItemClickListener(ModelSample item);
void onItemClickListener(Model item);
}
}
Loading

0 comments on commit d02af90

Please sign in to comment.