Skip to content

Upgraded to AndroidX, Added some annotations, Upgraded Gradle, Upgraded to SDK 32 with minimum SDK 14. #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@

buildscript {
repositories {
jcenter()
google()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}

allprojects {
repositories {
jcenter()
google()
maven {
url "https://jitpack.io"
}
}
}
}
20 changes: 11 additions & 9 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdk 32

defaultConfig {
applicationId "com.poliveira.apps.parallaxrecycleradapter"
minSdkVersion 7
targetSdkVersion 22
versionCode 1
minSdkVersion 14
targetSdkVersion 32
versionCode 2
versionName "1.0"
}
buildTypes {
Expand All @@ -20,7 +21,8 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project (':library')
compile 'com.android.support:cardview-v7:22.2.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':library')
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.cardview:cardview:1.0.0"
}
2 changes: 1 addition & 1 deletion example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.poliveira.parallaxrecyclerview.HeaderLayoutManagerFixed;
import com.poliveira.parallaxrecyclerview.ParallaxRecyclerAdapter;

Expand All @@ -22,12 +24,11 @@ public class MainActivity extends Activity {
private boolean isNormalAdapter = false;
private RecyclerView mRecyclerView;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerX);
createAdapter(mRecyclerView);
}

Expand Down Expand Up @@ -56,7 +57,7 @@ private void createCardAdapter(RecyclerView recyclerView) {

final ParallaxRecyclerAdapter<String> adapter = new ParallaxRecyclerAdapter<String>(content) {
@Override
public void onBindViewHolderImpl(RecyclerView.ViewHolder viewHolder, ParallaxRecyclerAdapter<String> adapter, int i) {
public void onBindViewHolderImpl(RecyclerView.ViewHolder viewHolder, @NonNull ParallaxRecyclerAdapter<String> adapter, int i) {
((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i));
}

Expand All @@ -71,12 +72,8 @@ public int getItemCountImpl(ParallaxRecyclerAdapter<String> adapter) {
}
};

adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {
@Override
public void onClick(View v, int position) {
Toast.makeText(MainActivity.this, "You clicked '" + position + "'", Toast.LENGTH_SHORT).show();
}
});
adapter.setOnClickEvent((v, position) ->
Toast.makeText(MainActivity.this, "You clicked '" + position + "'", Toast.LENGTH_SHORT).show());

HeaderLayoutManagerFixed layoutManagerFixed = new HeaderLayoutManagerFixed(this);
recyclerView.setLayoutManager(layoutManagerFixed);
Expand All @@ -96,7 +93,7 @@ private void createAdapter(RecyclerView recyclerView) {

final ParallaxRecyclerAdapter<String> adapter = new ParallaxRecyclerAdapter<String>(content) {
@Override
public void onBindViewHolderImpl(RecyclerView.ViewHolder viewHolder, ParallaxRecyclerAdapter<String> adapter, int i) {
public void onBindViewHolderImpl(RecyclerView.ViewHolder viewHolder, @NonNull ParallaxRecyclerAdapter<String> adapter, int i) {
((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i));
}

Expand All @@ -111,12 +108,8 @@ public int getItemCountImpl(ParallaxRecyclerAdapter<String> adapter) {
}
};

adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {
@Override
public void onClick(View v, int position) {
Toast.makeText(MainActivity.this, "You clicked '" + position + "'", Toast.LENGTH_SHORT).show();
}
});
adapter.setOnClickEvent((v, position) ->
Toast.makeText(MainActivity.this, "You clicked '" + position + "'", Toast.LENGTH_SHORT).show());

recyclerView.setLayoutManager(new LinearLayoutManager(this));
View header = getLayoutInflater().inflate(R.layout.header, recyclerView, false);
Expand All @@ -125,7 +118,6 @@ public void onClick(View v, int position) {
recyclerView.setAdapter(adapter);
}


static class ViewHolder extends RecyclerView.ViewHolder {
public TextView textView;

Expand All @@ -134,4 +126,4 @@ public ViewHolder(View itemView) {
textView = (TextView) itemView.findViewById(R.id.textView);
}
}
}
}
11 changes: 6 additions & 5 deletions example/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<view
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
class="android.support.v7.widget.RecyclerView"
android:id="@+id/recycler"
android:layout_gravity="left|top"/>
android:id="@+id/recyclerX"
android:layout_gravity="left|top"
tools:ignore="RtlHardcoded" />
</FrameLayout>
5 changes: 2 additions & 3 deletions example/src/main/res/layout/row_recyclerview_cards.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="250dp">

<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -18,7 +18,6 @@
android:id="@+id/textView"
android:layout_gravity="center"
android:gravity="center"/>
</android.support.v7.widget.CardView>

</androidx.cardview.widget.CardView>

</FrameLayout>
17 changes: 10 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# 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.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# 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
# org.gradle.parallel=true
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Sat Jun 04 12:44:44 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
Loading