Skip to content
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
25 changes: 5 additions & 20 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

}

}

allprojects {
Expand Down
13 changes: 7 additions & 6 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
compileSdkVersion 28
buildToolsVersion "26.0.2"

defaultConfig {
applicationId "com.example.rushd.galleryproject"
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -22,8 +22,9 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.0'
implementation project(':scrollingImageView')
implementation 'com.facebook.fresco:fresco:1.11.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.fresco:fresco:1.11.0'
api project(':scrollingImageView')
}
1 change: 1 addition & 0 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.example.rushd.galleryproject">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.yel.image.ScrollingImageView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
Expand Down Expand Up @@ -45,23 +43,26 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

RecyclerView recyclerView = (RecyclerView)findViewById(R.id.imagegallery);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.imagegallery);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.addOnScrollListener(new ScrollingImageView.ScrollListener(layoutManager, R.id.img, 5));
// recyclerView.addOnScrollListener(new ScrollingImageView.ScrollListener(layoutManager, R.id.parentLayout, 5));

ArrayList<CreateList> createLists = prepareData();
MyAdapter adapter = new MyAdapter(getApplicationContext(), createLists);
recyclerView.setAdapter(adapter);

}
private ArrayList<CreateList> prepareData(){

private ArrayList<CreateList> prepareData() {
ArrayList<CreateList> images = new ArrayList<>();
for(int i = 0; i< image_titles.length; i++){
CreateList createList = new CreateList();
createList.setImage_title(image_titles[i]);
createList.setImage_ID(image_ids[i]);
images.add(createList);
for (int j = 0; j < 5; j++) {
for (int i = 0; i < image_titles.length; i++) {
CreateList createList = new CreateList();
createList.setImage_title(image_titles[i]);
createList.setImage_ID(image_ids[i]);
images.add(createList);
}
}
return images;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.widget.ImageView;
import android.widget.Toast;

import com.facebook.drawee.view.SimpleDraweeView;

import java.util.ArrayList;

public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
Expand All @@ -24,10 +26,10 @@ public MyAdapter(Context context, ArrayList<CreateList> galleryList) {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
switch (viewType) {
case 0 :
case 0:
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cell_layout, viewGroup, false);
return new ViewHolder(view);
case 1 :
case 1:
View view2 = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.scroll_img, viewGroup, false);
return new ViewHolder2(view2);
}
Expand All @@ -37,7 +39,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewT
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (getItemViewType(position) == 1) {
((ViewHolder2) holder).img.setImageResource((galleryList.get(position).getImage_ID()));
((ViewHolder2) holder).img.setActualImageResource((galleryList.get(position).getImage_ID()));
} else {
((ViewHolder) holder).img.setScaleType(ImageView.ScaleType.CENTER_CROP);
((ViewHolder) holder).img.setImageResource((galleryList.get(position).getImage_ID()));
Expand All @@ -55,7 +57,7 @@ public void onClick(View v) {
public int getItemViewType(int position) {
// Just as an example, return 0 or 2 depending on position
// Note that unlike in ListView adapters, types don't have to be contiguous
return position == 5 ? 1 : 0;
return position % 5 == 0 ? 1 : 0;
}


Expand All @@ -64,16 +66,18 @@ public int getItemCount() {
return galleryList.size();
}

public class ViewHolder extends RecyclerView.ViewHolder{
public class ViewHolder extends RecyclerView.ViewHolder {
private ImageView img;

public ViewHolder(View view) {
super(view);
img = view.findViewById(R.id.img);
}
}

public class ViewHolder2 extends RecyclerView.ViewHolder{
private ImageView img;
public class ViewHolder2 extends RecyclerView.ViewHolder {
private SimpleDraweeView img;

public ViewHolder2(View view) {
super(view);
img = view.findViewById(R.id.img);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.rushd.galleryproject;

import android.app.Application;

import com.facebook.drawee.backends.pipeline.Fresco;

public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Fresco.initialize(this);
}
}
18 changes: 9 additions & 9 deletions example/src/main/res/layout/scroll_img.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.yel.image.ScrollingImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="#FFFFFF"
android:id="@+id/parentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yel.image.ScrollingImageView
android:layout_height="200dp"
custom:scrollType="whole">

<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="200dp"
custom:scrollType="middle"
/>
</LinearLayout>
android:layout_height="600dp"
custom:actualImageResource="@mipmap/img6" />
</com.yel.image.ScrollingImageView>
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
13 changes: 6 additions & 7 deletions scrollingImageView/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"

Expand All @@ -24,11 +24,10 @@ android {

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

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply from: './bintray.gradle'
Loading