├── .buildscript └── deploy_snapshot.sh ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── adapters ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── adapters │ ├── AnimatedAdapter.java │ └── WrapperAdapter.java ├── animators ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── animators │ ├── AnimatorProvider.java │ ├── AnimatorSetProvider.java │ ├── Anims.java │ ├── BaseItemAnimator.java │ ├── FlexiItemAnimator.java │ ├── Providers.java │ └── Sets.java ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── io │ │ └── apptik │ │ └── multiview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── apptik │ │ └── multiview │ │ ├── AnimatorsFragment.java │ │ ├── BasicFragment.java │ │ ├── BlankFragment.java │ │ ├── GalleryViewFragment.java │ │ ├── LayoutsFragment.java │ │ ├── MainActivity.java │ │ ├── NavigationDrawerFragment.java │ │ ├── SampleApp.java │ │ ├── ScalableRVFragment.java │ │ ├── ScrollersFragment.java │ │ ├── adapter │ │ ├── BasicImageRecyclerAdapter.java │ │ ├── BasicMixedRecyclerAdapter.java │ │ └── BasicRecyclerAdapter.java │ │ ├── common │ │ ├── BitmapLruCache.java │ │ ├── BitmapUtils.java │ │ ├── DecodeUtils.java │ │ ├── ExifUtils.java │ │ └── IOUtils.java │ │ ├── mock │ │ └── MockData.java │ │ └── view │ │ └── TouchImageView.java │ └── res │ ├── drawable-hdpi │ ├── drawer_shadow.9.png │ ├── ic_action_animation.png │ ├── ic_action_animation_start.png │ ├── ic_action_attachment.png │ ├── ic_action_scroll_option.png │ ├── ic_action_toggle_adapter.png │ ├── ic_action_toggle_layout.png │ └── ic_drawer.png │ ├── drawable-ldpi │ ├── ic_action_animation.png │ └── ic_action_animation_start.png │ ├── drawable-mdpi │ ├── drawer_shadow.9.png │ ├── ic_action_animation.png │ ├── ic_action_animation_start.png │ ├── ic_action_attachment.png │ ├── ic_action_scroll_option.png │ ├── ic_action_toggle_adapter.png │ ├── ic_action_toggle_layout.png │ └── ic_drawer.png │ ├── drawable-xhdpi │ ├── drawer_shadow.9.png │ ├── ic_action_animation.png │ ├── ic_action_animation_start.png │ ├── ic_action_attachment.png │ ├── ic_action_scroll_option.png │ ├── ic_action_toggle_adapter.png │ ├── ic_action_toggle_layout.png │ └── ic_drawer.png │ ├── drawable-xxhdpi │ ├── drawer_shadow.9.png │ ├── ic_action_animation.png │ ├── ic_action_animation_start.png │ ├── ic_action_attachment.png │ ├── ic_action_scroll_option.png │ ├── ic_action_toggle_adapter.png │ ├── ic_action_toggle_layout.png │ └── ic_drawer.png │ ├── drawable-xxxhdpi │ ├── ic_action_attachment.png │ ├── ic_action_toggle_adapter.png │ └── ic_action_toggle_layout.png │ ├── layout-v21 │ └── item_card.xml │ ├── layout │ ├── activity_main.xml │ ├── fragment_blank.xml │ ├── fragment_galleryview.xml │ ├── fragment_main.xml │ ├── fragment_navigation_drawer.xml │ ├── fragment_recyclerview.xml │ ├── fragment_scalablerv.xml │ ├── item_card.xml │ ├── item_fullimagecard.xml │ ├── item_image.xml │ ├── item_imagecard.xml │ ├── item_networkimage.xml │ ├── item_networkimagecard.xml │ └── toolbar.xml │ ├── menu │ ├── animators.xml │ ├── basic.xml │ ├── global.xml │ ├── layouts.xml │ ├── scalable_rv.xml │ └── scrollers.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── common ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── common │ └── Log.java ├── decorations ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── apptik │ │ └── multiview │ │ └── decorations │ │ ├── GridDividerDecoration.java │ │ ├── GridSpacingDecoration.java │ │ ├── ListDividerDecoration.java │ │ └── ListSpacingDecoration.java │ └── res │ └── values │ └── dimens.xml ├── dump ├── FilmstripView.java └── ZoomView.java ├── extras ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── apptik │ │ └── multiview │ │ └── extras │ │ ├── ClickItemTouchListener.java │ │ ├── ItemClickSupport.java │ │ ├── ItemSelectionSupport.java │ │ └── ViewUtils.java │ └── res │ └── values │ └── ids.xml ├── galleryview ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── galleryview │ ├── SimpleGalleryView.java │ ├── SquareImageView.java │ ├── SquareNetworkImageView.java │ └── scaleimage │ ├── Compat.java │ ├── DefaultOnDoubleTapListener.java │ ├── ExtendedViewPagerLayoutManager.java │ ├── ImageViewScaler.java │ ├── ScaleImageView.java │ ├── gestures │ ├── CupcakeGestureDetector.java │ ├── EclairGestureDetector.java │ ├── FroyoGestureDetector.java │ ├── GestureDetector.java │ ├── OnGestureListener.java │ └── VersionedGestureDetector.java │ └── scrollerproxy │ ├── GingerScroller.java │ ├── IcsScroller.java │ ├── PreGingerScroller.java │ └── ScrollerProxy.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── layoutmanagers ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── layoutmanagers │ ├── AbstractPagerLLM.java │ ├── AbstractSnapperLLM.java │ ├── LinearLayoutManager2.java │ ├── ScalableGridLayoutManager.java │ ├── SnapperLinearLayoutManager.java │ ├── TouchChildPagerLayoutManager.java │ └── ViewPagerLayoutManager.java ├── scalablerecyclerview ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── scalablerecyclerview │ ├── BaseGridScaler.java │ ├── DuplexAdapter.java │ ├── DuplexGridLayoutManager.java │ ├── GridScaler.java │ ├── ScalableRecyclerGridView.java │ ├── ScalableViewGroup.java │ ├── SharpGridScaler.java │ └── SmoothGridScaler.java ├── scrollers ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── apptik │ └── multiview │ └── scrollers │ ├── BaseSmoothScroller.java │ ├── FlexiSmoothScroller.java │ └── SnapperSmoothScroller.java └── settings.gradle /.buildscript/deploy_snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo. 4 | # 5 | # Adapted from https://coderwall.com/p/9b_lfq and 6 | # http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ 7 | 8 | SLUG="apptik/MultiView" 9 | JDK="oraclejdk8" 10 | BRANCH="master" 11 | 12 | set -e 13 | 14 | if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then 15 | echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'." 16 | elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then 17 | echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'." 18 | elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then 19 | echo "Skipping snapshot deployment: was pull request." 20 | elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then 21 | echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'." 22 | else 23 | echo "Deploying $MODULE snapshot..." 24 | ./gradlew ":$MODULE:uploadArchives" 25 | echo "Snapshot deployed!" 26 | fi 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | local.properties 3 | .idea 4 | .DS_Store 5 | build 6 | captures 7 | *.iml 8 | *.log 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | jdk: 4 | - oraclejdk8 5 | 6 | android: 7 | components: 8 | - tools 9 | - build-tools-25.0.2 10 | - android-25 11 | - extra-android-m2repository 12 | - sys-img-armeabi-v7a-android-23 13 | 14 | script: 15 | - ./gradlew ":$MODULE:build" 16 | 17 | after_success: 18 | - .buildscript/deploy_snapshot.sh 19 | 20 | 21 | env: 22 | matrix: 23 | - MODULE=adapters 24 | - MODULE=animators 25 | - MODULE=decorations 26 | - MODULE=extras 27 | - MODULE=galleryview 28 | - MODULE=layoutmanagers 29 | - MODULE=scalablerecyclerview 30 | - MODULE=scrollers 31 | - MODULE=common 32 | 33 | notifications: 34 | email: true 35 | 36 | sudo: false 37 | 38 | cache: 39 | directories: 40 | - $HOME/.gradle -------------------------------------------------------------------------------- /adapters/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /adapters/README.md: -------------------------------------------------------------------------------- 1 | # Adapters for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | adapters 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:adapters:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=adapters&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/adapters 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/adapters 43 | -------------------------------------------------------------------------------- /adapters/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | packagingOptions { 34 | exclude 'LICENSE.txt' 35 | exclude 'NOTICE.txt' 36 | exclude 'META-INF/LICENSE.txt' 37 | } 38 | lintOptions { 39 | abortOnError false 40 | } 41 | compileOptions { 42 | sourceCompatibility = 1.7 43 | targetCompatibility = 1.7 44 | } 45 | } 46 | 47 | dependencies { 48 | compile rootProject.ext.supportRecyclerView 49 | } 50 | 51 | 52 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /adapters/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/adapters 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/adapters 39 | 40 | 41 | POM_NAME=Adapters for RecyclerView 42 | POM_ARTIFACT_ID=adapters 43 | -------------------------------------------------------------------------------- /adapters/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /adapters/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /adapters/src/main/java/io/apptik/multiview/adapters/AnimatedAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.adapters; 18 | 19 | import android.support.v7.widget.RecyclerView; 20 | 21 | 22 | public abstract class AnimatedAdapter extends RecyclerView.Adapter { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /adapters/src/main/java/io/apptik/multiview/adapters/WrapperAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.adapters; 18 | 19 | import android.content.Context; 20 | import android.support.v7.widget.RecyclerView; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | import java.lang.reflect.InvocationTargetException; 25 | 26 | 27 | public class WrapperAdapter extends RecyclerView.Adapter { 28 | 29 | 30 | A originalAdapter; 31 | Class vgClass; 32 | 33 | 34 | public WrapperAdapter(A originalAdapter, Class vgClass) { 35 | this.originalAdapter = originalAdapter; 36 | this.vgClass = vgClass; 37 | } 38 | 39 | @Override 40 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 41 | 42 | VG viewGroup = null; 43 | try { 44 | viewGroup = vgClass.getConstructor(Context.class).newInstance(parent.getContext()); 45 | } catch (InstantiationException e) { 46 | e.printStackTrace(); 47 | } catch (IllegalAccessException e) { 48 | e.printStackTrace(); 49 | } catch (InvocationTargetException e) { 50 | e.printStackTrace(); 51 | } catch (NoSuchMethodException e) { 52 | e.printStackTrace(); 53 | } 54 | if(viewGroup==null) { 55 | throw new IllegalStateException("viewGroup container was not initialized"); 56 | } 57 | RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.MATCH_PARENT); 58 | viewGroup.setLayoutParams(lp); 59 | ViewHolder vh = new ViewHolder(originalAdapter.onCreateViewHolder(parent, viewType), viewGroup); 60 | View childView = vh.originalVH.itemView; 61 | ViewGroup.LayoutParams lpCh = childView.getLayoutParams(); 62 | lpCh.width = parent.getWidth(); 63 | lpCh.height = parent.getHeight(); 64 | viewGroup.addView(childView); 65 | return vh; 66 | } 67 | 68 | @Override 69 | public void onBindViewHolder(ViewHolder holder, int position) { 70 | originalAdapter.bindViewHolder(holder.originalVH, position); 71 | } 72 | 73 | @Override 74 | public int getItemCount() { 75 | return originalAdapter.getItemCount(); 76 | } 77 | 78 | public class ViewHolder extends RecyclerView.ViewHolder { 79 | 80 | public final VH originalVH; 81 | public final VG viewGroup; 82 | 83 | public ViewHolder(VH originViewHolder, VG viewGroup) { 84 | super(viewGroup); 85 | originalVH = originViewHolder; 86 | this.viewGroup = viewGroup; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /animators/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /animators/README.md: -------------------------------------------------------------------------------- 1 | # Animators for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | animators 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:animators:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=animators&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/animators 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/animators 43 | -------------------------------------------------------------------------------- /animators/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | 20 | android { 21 | compileSdkVersion rootProject.ext.compileSdkVersion 22 | buildToolsVersion rootProject.ext.buildToolsVersion 23 | 24 | defaultConfig { 25 | minSdkVersion rootProject.ext.minSdkVersion 26 | targetSdkVersion rootProject.ext.compileSdkVersion 27 | } 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | packagingOptions { 35 | exclude 'LICENSE.txt' 36 | exclude 'NOTICE.txt' 37 | exclude 'META-INF/LICENSE.txt' 38 | } 39 | lintOptions { 40 | abortOnError false 41 | } 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile project(':common') 50 | compile rootProject.ext.supportRecyclerView 51 | compile rootProject.ext.supportAppCompat 52 | 53 | } 54 | 55 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' 56 | -------------------------------------------------------------------------------- /animators/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/animators 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/animators 39 | 40 | 41 | POM_NAME=Animators for RecyclerView 42 | POM_ARTIFACT_ID=animators 43 | -------------------------------------------------------------------------------- /animators/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /animators/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /animators/src/main/java/io/apptik/multiview/animators/AnimatorProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.animators; 18 | 19 | 20 | import android.support.v4.view.ViewPropertyAnimatorCompat; 21 | import android.support.v7.widget.RecyclerView; 22 | 23 | public interface AnimatorProvider { 24 | 25 | ViewPropertyAnimatorCompat getAnim(final RecyclerView.ViewHolder viewHolder, Object... args); 26 | Runnable getBeforeAction(final RecyclerView.ViewHolder viewHolder, Object... args); 27 | Runnable getAfterAction(final RecyclerView.ViewHolder viewHolder, Object... args); 28 | } 29 | -------------------------------------------------------------------------------- /animators/src/main/java/io/apptik/multiview/animators/AnimatorSetProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.animators; 18 | 19 | 20 | public interface AnimatorSetProvider { 21 | 22 | 23 | AnimatorProvider getAddAnimProvider(); 24 | AnimatorProvider getRemoveAnimProvider(); 25 | AnimatorProvider getMoveAnimProvider(); 26 | AnimatorProvider getChangeOldItemAnimProvider(); 27 | AnimatorProvider getChangeNewItemAnimProvider(); 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /animators/src/main/java/io/apptik/multiview/animators/Sets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.animators; 18 | 19 | 20 | public class Sets { 21 | private Sets() { 22 | throw new IllegalStateException("no instances"); 23 | } 24 | 25 | public static AnimatorSetProvider defaultItemAnimatorSet() { 26 | return new AnimatorSetProvider() { 27 | @Override 28 | public AnimatorProvider getAddAnimProvider() { 29 | return Providers.defaultAddAnimProvider(); 30 | } 31 | 32 | @Override 33 | public AnimatorProvider getRemoveAnimProvider() { 34 | return Providers.defaultRemoveAnimProvider(); 35 | } 36 | 37 | @Override 38 | public AnimatorProvider getMoveAnimProvider() { 39 | return Providers.defaultMoveAnimProvider(); 40 | } 41 | 42 | @Override 43 | public AnimatorProvider getChangeOldItemAnimProvider() { 44 | return Providers.defaultChangeOldViewAnimProvider(); 45 | } 46 | 47 | @Override 48 | public AnimatorProvider getChangeNewItemAnimProvider() { 49 | return Providers.defaultChangeNewViewAnimProvider(); 50 | } 51 | }; 52 | } 53 | 54 | public static AnimatorSetProvider garageDoorSet() { 55 | return new AnimatorSetProvider() { 56 | @Override 57 | public AnimatorProvider getAddAnimProvider() { 58 | return Providers.garageDoorAddProvider(); 59 | } 60 | 61 | @Override 62 | public AnimatorProvider getRemoveAnimProvider() { 63 | return Providers.garageDoorRemoveProvider(); 64 | } 65 | 66 | @Override 67 | public AnimatorProvider getMoveAnimProvider() { 68 | return null; 69 | } 70 | 71 | @Override 72 | public AnimatorProvider getChangeOldItemAnimProvider() { 73 | return Providers.defaultChangeOldViewAnimProvider(); 74 | } 75 | 76 | @Override 77 | public AnimatorProvider getChangeNewItemAnimProvider() { 78 | return Providers.defaultChangeNewViewAnimProvider(); 79 | 80 | } 81 | }; 82 | } 83 | 84 | // public static AnimatorSetProvider slideToRightSet() { 85 | // 86 | // } 87 | } 88 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | applicationId "io.apptik.multiview" 25 | minSdkVersion rootProject.ext.minSdkVersion 26 | targetSdkVersion rootProject.ext.compileSdkVersion 27 | versionCode 1 28 | versionName "1.0" 29 | } 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | packagingOptions { 37 | exclude 'LICENSE.txt' 38 | exclude 'NOTICE.txt' 39 | exclude 'META-INF/LICENSE.txt' 40 | } 41 | lintOptions { 42 | abortOnError false 43 | } 44 | 45 | compileOptions { 46 | sourceCompatibility = 1.7 47 | targetCompatibility = 1.7 48 | } 49 | } 50 | 51 | dependencies { 52 | compile project(':adapters') 53 | compile project(':animators') 54 | compile project(':decorations') 55 | compile project(':layoutmanagers') 56 | compile project(':scrollers') 57 | compile project(':scalablerecyclerview') 58 | compile project(':galleryview') 59 | 60 | compile rootProject.ext.supportRecyclerView 61 | compile rootProject.ext.supportAppCompat 62 | compile rootProject.ext.supportCardView 63 | compile rootProject.ext.supportV4 64 | compile 'org.djodjo.json:json-core:1.+' 65 | compile 'org.djodjo.json:json-wrapper:1.+' 66 | compile 'com.github.bumptech.glide:glide:3.6.0' 67 | } 68 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/io/apptik/multiview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview; 18 | 19 | import android.app.Application; 20 | import android.test.ApplicationTestCase; 21 | 22 | /** 23 | * Testing Fundamentals 24 | */ 25 | public class ApplicationTest extends ApplicationTestCase { 26 | public ApplicationTest() { 27 | super(Application.class); 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 48 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/BlankFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview; 18 | 19 | 20 | import android.os.Bundle; 21 | import android.support.v4.app.Fragment; 22 | import android.view.LayoutInflater; 23 | import android.view.Menu; 24 | import android.view.MenuInflater; 25 | import android.view.View; 26 | import android.view.ViewGroup; 27 | 28 | 29 | /** 30 | * A simple {@link Fragment} subclass. 31 | */ 32 | public class BlankFragment extends Fragment { 33 | 34 | 35 | public BlankFragment() { 36 | // Required empty public constructor 37 | } 38 | 39 | public static BlankFragment newInstance() { 40 | BlankFragment fragment = new BlankFragment(); 41 | return fragment; 42 | 43 | } 44 | 45 | @Override 46 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 47 | Bundle savedInstanceState) { 48 | // Inflate the layout for this fragment 49 | return inflater.inflate(R.layout.fragment_blank, container, false); 50 | } 51 | 52 | @Override 53 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 54 | menu.clear(); 55 | } 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/GalleryViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview; 18 | 19 | 20 | import android.os.Bundle; 21 | import android.support.v4.app.Fragment; 22 | import android.support.v7.widget.GridLayoutManager; 23 | import android.support.v7.widget.RecyclerView; 24 | import android.view.LayoutInflater; 25 | import android.view.Menu; 26 | import android.view.MenuInflater; 27 | import android.view.MenuItem; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | 31 | import io.apptik.multiview.adapter.BasicMixedRecyclerAdapter; 32 | import io.apptik.multiview.adapter.BasicRecyclerAdapter; 33 | import io.apptik.multiview.mock.MockData; 34 | import io.apptik.multiview.scalablerecyclerview.SharpGridScaler; 35 | 36 | 37 | /** 38 | * A simple {@link Fragment} subclass. 39 | */ 40 | public class GalleryViewFragment extends Fragment { 41 | 42 | 43 | RecyclerView recyclerView = null; 44 | BasicRecyclerAdapter recyclerAdapter; 45 | 46 | BasicMixedRecyclerAdapter recyclerMixedAdapter; 47 | 48 | public GalleryViewFragment() { 49 | // Required empty public constructor 50 | } 51 | 52 | public static GalleryViewFragment newInstance() { 53 | GalleryViewFragment fragment = new GalleryViewFragment(); 54 | return fragment; 55 | } 56 | 57 | @Override 58 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 59 | Bundle savedInstanceState) { 60 | // Inflate the layout for this fragment 61 | this.setHasOptionsMenu(true); 62 | View v = inflater.inflate(R.layout.fragment_recyclerview, container, false); 63 | recyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); 64 | 65 | recyclerAdapter = new BasicRecyclerAdapter(MockData.getMockJsonArray(333, 500)); 66 | 67 | recyclerMixedAdapter = new BasicMixedRecyclerAdapter(MockData.getMockJsonArray(333, 500), getActivity().getApplicationContext()); 68 | 69 | GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 3); 70 | 71 | recyclerView.setAdapter(recyclerMixedAdapter); 72 | 73 | recyclerView.setLayoutManager(gridLayoutManager); 74 | 75 | SharpGridScaler sharpGridScaler = new SharpGridScaler(recyclerView); 76 | 77 | 78 | 79 | return v; 80 | } 81 | 82 | @Override 83 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 84 | menu.clear(); 85 | inflater.inflate(R.menu.scalable_rv, menu); 86 | } 87 | 88 | @Override 89 | public boolean onOptionsItemSelected(MenuItem item) { 90 | if(recyclerView==null ) return false; 91 | switch (item.getItemId()) { 92 | case R.id.action_text_only: break; 93 | case R.id.action_image_only: break; 94 | case R.id.action_Image_text: break; 95 | 96 | } 97 | return true; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/SampleApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview; 18 | 19 | import android.app.Application; 20 | 21 | import io.apptik.multiview.common.BitmapLruCache; 22 | import io.apptik.multiview.common.Log; 23 | 24 | 25 | public class SampleApp extends Application { 26 | 27 | BitmapLruCache bitmapLruCache; 28 | @Override 29 | public void onCreate() { 30 | super.onCreate(); 31 | Log.on(); 32 | 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/common/BitmapLruCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.common; 18 | 19 | 20 | import android.content.Context; 21 | import android.graphics.Bitmap; 22 | import android.net.Uri; 23 | import android.support.v4.util.LruCache; 24 | import android.util.Log; 25 | 26 | import java.io.IOException; 27 | import java.io.InputStream; 28 | 29 | 30 | public class BitmapLruCache extends LruCache { 31 | 32 | private static BitmapLruCache inst; 33 | 34 | public static BitmapLruCache get() { 35 | if(inst==null) { 36 | inst = new BitmapLruCache(); 37 | } 38 | return inst; 39 | } 40 | 41 | public BitmapLruCache(int maxSize) { 42 | super(maxSize); 43 | } 44 | 45 | 46 | public static int getDefaultLruCacheSize() { 47 | final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); 48 | final int cacheSize = maxMemory / 8; 49 | return cacheSize; 50 | } 51 | 52 | public BitmapLruCache() { 53 | this(getDefaultLruCacheSize()); 54 | } 55 | 56 | @Override 57 | protected int sizeOf(Uri key, Bitmap value) { 58 | return value.getByteCount() / 1024; 59 | } 60 | 61 | 62 | public Bitmap getBitmap(Uri uri, Context ctx, int maxW, int maxH) { 63 | Bitmap res = get(uri); 64 | if (res == null) { 65 | InputStream stream = null; 66 | try { 67 | stream = ctx.getContentResolver().openInputStream(uri); 68 | 69 | res = DecodeUtils.decode(ctx, uri, maxW, maxH); 70 | } catch (Exception e) { 71 | Log.w("BitmapLruCache", "Unable to open content: " + uri, e); 72 | } finally { 73 | if (stream != null) { 74 | try { 75 | stream.close(); 76 | } catch (IOException e) { 77 | Log.w("BitmapLruCache", "Unable to close content: " + uri, e); 78 | } 79 | } 80 | } 81 | 82 | putBitmap(uri, res); 83 | } 84 | return res; 85 | } 86 | 87 | 88 | public void putBitmap(Uri url, Bitmap bitmap) { 89 | if(url==null || bitmap==null) return; 90 | put(url, bitmap); 91 | } 92 | 93 | 94 | } 95 | 96 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/common/BitmapUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.common; 18 | 19 | import android.graphics.Bitmap; 20 | import android.graphics.Matrix; 21 | 22 | /** 23 | * Various bitmap utilities 24 | * 25 | * @author alessandro 26 | * 27 | */ 28 | public class BitmapUtils { 29 | 30 | private BitmapUtils() { 31 | } 32 | 33 | /** 34 | * Resize a bitmap 35 | * 36 | * @param input 37 | * @param destWidth 38 | * @param destHeight 39 | * @return 40 | * @throws OutOfMemoryError 41 | */ 42 | public static Bitmap resizeBitmap( final Bitmap input, int destWidth, int destHeight ) throws OutOfMemoryError { 43 | return resizeBitmap( input, destWidth, destHeight, 0 ); 44 | } 45 | 46 | /** 47 | * Resize a bitmap object to fit the passed width and height 48 | * 49 | * @param input 50 | * The bitmap to be resized 51 | * @param destWidth 52 | * Desired maximum width of the result bitmap 53 | * @param destHeight 54 | * Desired maximum height of the result bitmap 55 | * @return A new resized bitmap 56 | * @throws OutOfMemoryError 57 | * if the operation exceeds the available vm memory 58 | */ 59 | public static Bitmap resizeBitmap( final Bitmap input, int destWidth, int destHeight, int rotation ) throws OutOfMemoryError { 60 | 61 | int dstWidth = destWidth; 62 | int dstHeight = destHeight; 63 | final int srcWidth = input.getWidth(); 64 | final int srcHeight = input.getHeight(); 65 | 66 | if ( rotation == 90 || rotation == 270 ) { 67 | dstWidth = destHeight; 68 | dstHeight = destWidth; 69 | } 70 | 71 | boolean needsResize = false; 72 | float p; 73 | if ( ( srcWidth > dstWidth ) || ( srcHeight > dstHeight ) ) { 74 | needsResize = true; 75 | if ( ( srcWidth > srcHeight ) && ( srcWidth > dstWidth ) ) { 76 | p = (float) dstWidth / (float) srcWidth; 77 | dstHeight = (int) ( srcHeight * p ); 78 | } else { 79 | p = (float) dstHeight / (float) srcHeight; 80 | dstWidth = (int) ( srcWidth * p ); 81 | } 82 | } else { 83 | dstWidth = srcWidth; 84 | dstHeight = srcHeight; 85 | } 86 | 87 | if ( needsResize || rotation != 0 ) { 88 | Bitmap output; 89 | 90 | if ( rotation == 0 ) { 91 | output = Bitmap.createScaledBitmap(input, dstWidth, dstHeight, true); 92 | } else { 93 | Matrix matrix = new Matrix(); 94 | matrix.postScale( (float) dstWidth / srcWidth, (float) dstHeight / srcHeight ); 95 | matrix.postRotate( rotation ); 96 | output = Bitmap.createBitmap(input, 0, 0, srcWidth, srcHeight, matrix, true); 97 | } 98 | return output; 99 | } else 100 | return input; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/common/IOUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.common; 18 | 19 | import android.content.ContentResolver; 20 | import android.content.Context; 21 | import android.database.Cursor; 22 | import android.net.Uri; 23 | import android.os.ParcelFileDescriptor; 24 | import android.provider.MediaStore.Images.ImageColumns; 25 | 26 | import java.io.Closeable; 27 | 28 | /** 29 | * Various I/O utilities 30 | * 31 | * @author alessandro 32 | * 33 | */ 34 | public class IOUtils { 35 | 36 | private IOUtils() { 37 | } 38 | 39 | /** 40 | * Close a {@link Closeable} stream without throwing any exception 41 | * 42 | * @param c 43 | */ 44 | public static void closeSilently( final Closeable c ) { 45 | if ( c == null ) return; 46 | try { 47 | c.close(); 48 | } catch ( final Throwable t ) {} 49 | } 50 | 51 | public static void closeSilently( final ParcelFileDescriptor c ) { 52 | if ( c == null ) return; 53 | try { 54 | c.close(); 55 | } catch ( final Throwable t ) {} 56 | } 57 | 58 | public static void closeSilently( Cursor cursor ) { 59 | if ( cursor == null ) return; 60 | try { 61 | cursor.close(); 62 | } catch ( Throwable t ) {} 63 | } 64 | 65 | /** 66 | * Try to return the absolute file path from the given Uri 67 | * 68 | * @param context 69 | * @param uri 70 | * @return the file path or null 71 | */ 72 | public static String getRealFilePath( final Context context, final Uri uri ) { 73 | 74 | if ( null == uri ) return null; 75 | 76 | final String scheme = uri.getScheme(); 77 | String data = null; 78 | 79 | if ( scheme == null ) 80 | data = uri.getPath(); 81 | else if ( ContentResolver.SCHEME_FILE.equals( scheme ) ) { 82 | data = uri.getPath(); 83 | } else if ( ContentResolver.SCHEME_CONTENT.equals( scheme ) ) { 84 | Cursor cursor = context.getContentResolver().query( uri, new String[] { ImageColumns.DATA }, null, null, null ); 85 | if ( null != cursor ) { 86 | if ( cursor.moveToFirst() ) { 87 | int index = cursor.getColumnIndex( ImageColumns.DATA ); 88 | if ( index > -1 ) { 89 | data = cursor.getString( index ); 90 | } 91 | } 92 | cursor.close(); 93 | } 94 | } 95 | return data; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/io/apptik/multiview/mock/MockData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.mock; 18 | 19 | import org.djodjo.json.JsonArray; 20 | import org.djodjo.json.JsonObject; 21 | 22 | import java.util.Random; 23 | 24 | 25 | public class MockData { 26 | 27 | static Random rand = new Random(); 28 | 29 | public static JsonArray getMockJsonArray(int noElements, int picSize) { 30 | JsonArray res = new JsonArray(); 31 | for (int i = 0; i < noElements; i++) { 32 | res.add(getRandomEntry(i, picSize)); 33 | } 34 | 35 | return res; 36 | } 37 | 38 | public static JsonObject getRandomEntry(int id, int picSize) { 39 | int cc = (int) (Math.random() * 0x1000000); 40 | int cc2 = 0xFFFFFF00 ^ cc; 41 | String color = Integer.toHexString(cc); 42 | String color2 = Integer.toHexString((0xFFFFFF - cc)); 43 | // String color2 = Integer.toHexString(cc2); 44 | double lat = 50 + rand.nextInt(300) / 100d; 45 | double lon = 4 + rand.nextInt(300) / 100d; 46 | return new JsonObject() 47 | .put("pic", "http://dummyimage.com/" + picSize + "/" + color + "/" + color2) 48 | .put("title", "Item - " + id) 49 | .put("info", "info - " + color) 50 | .put("info2", "info - " + color2) 51 | .put("info3", "info - " + lat + ":" + lon) 52 | .put("loc", new JsonArray().put(lat).put(lon)) 53 | .put("id", id); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_animation.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_animation_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_animation_start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_attachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_attachment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_scroll_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_scroll_option.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_toggle_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_toggle_adapter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_toggle_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_action_toggle_layout.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_action_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-ldpi/ic_action_animation.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_action_animation_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-ldpi/ic_action_animation_start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_animation.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_animation_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_animation_start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_attachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_attachment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_scroll_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_scroll_option.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_toggle_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_toggle_adapter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_toggle_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_action_toggle_layout.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_animation.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_animation_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_animation_start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_attachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_attachment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_scroll_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_scroll_option.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_toggle_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_toggle_adapter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_toggle_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_action_toggle_layout.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_animation.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_animation_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_animation_start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_attachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_attachment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_scroll_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_scroll_option.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_toggle_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_toggle_adapter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_toggle_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_action_toggle_layout.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_attachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxxhdpi/ic_action_attachment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_toggle_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxxhdpi/ic_action_toggle_adapter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_toggle_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/drawable-xxxhdpi/ic_action_toggle_layout.png -------------------------------------------------------------------------------- /app/src/main/res/layout-v21/item_card.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | 27 | 30 | 31 | 37 | 38 | 52 | 53 | 67 | 68 | 82 | 83 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 25 | 26 | 31 | 32 | 33 | 35 | 39 | 40 | 41 | 46 | 48 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_blank.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_galleryview.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_recyclerview.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_scalablerv.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_card.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 26 | 29 | 30 | 36 | 37 | 51 | 52 | 66 | 67 | 81 | 82 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_networkimage.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/menu/basic.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | 42 | 48 | 49 | 53 | 57 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/res/menu/global.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | 42 | 48 | 49 | 53 | 57 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/res/menu/layouts.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | 42 | 48 | 49 | 53 | 57 | 61 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/menu/scalable_rv.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/menu/scrollers.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | 42 | 48 | 49 | 53 | 57 | 61 | 62 | 63 | 64 | 70 | 71 | 75 | 79 | 83 | 87 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 64dp 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 16dp 20 | 16dp 21 | 22 | 24 | 240dp 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | MultiView 19 | 20 | Basic 21 | LayoutManagers 22 | Animators 23 | Adapters 24 | Decorations 25 | Scrollers 26 | Scalable RV 27 | GalleryView 28 | 29 | Open navigation drawer 30 | Close navigation drawer 31 | 32 | Example action 33 | 34 | Settings 35 | 36 | 37 | Coming Soon 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | buildscript { 19 | repositories { 20 | mavenCentral() 21 | jcenter() 22 | } 23 | dependencies { 24 | classpath 'com.android.tools.build:gradle:2.2.2' 25 | 26 | // NOTE: Do not place your application dependencies here; they belong 27 | // in the individual module build.gradle files 28 | } 29 | } 30 | allprojects { 31 | group = GROUP 32 | version = VERSION_NAME 33 | repositories { 34 | mavenCentral() 35 | jcenter() 36 | maven { 37 | url 'http://oss.sonatype.org/content/repositories/snapshots' 38 | } 39 | } 40 | } 41 | 42 | 43 | ext { 44 | minSdkVersion = 15 45 | compileSdkVersion = 25 46 | buildToolsVersion = '25.0.2' 47 | supportDeps = "25.1.0" 48 | supportAnnotations = 'com.android.support:support-annotations:'+supportDeps 49 | supportV4 = 'com.android.support:support-v4:'+supportDeps 50 | supportRecyclerView = 'com.android.support:recyclerview-v7:'+supportDeps 51 | supportCardView = 'com.android.support:cardview-v7:'+supportDeps 52 | supportAppCompat = 'com.android.support:appcompat-v7:'+supportDeps 53 | supportDesign = 'com.android.support:design:'+supportDeps 54 | 55 | supportTestRunner = 'com.android.support.test:runner:0.5' 56 | supportTestRules = 'com.android.support.test:rules:0.5' 57 | supportTestEspresso = 'com.android.support.test.espresso:espresso-core:2.2.2' 58 | supportTestEspressoContrib = 'com.android.support.test.espresso:espresso-contrib:2.2.2' 59 | 60 | junit = 'junit:junit:4.12' 61 | 62 | } 63 | 64 | dependencies { 65 | } -------------------------------------------------------------------------------- /common/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /common/README.md: -------------------------------------------------------------------------------- 1 | # Common tools for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | common 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:common:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=common&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/common 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/common 43 | -------------------------------------------------------------------------------- /common/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | packagingOptions { 34 | exclude 'LICENSE.txt' 35 | exclude 'NOTICE.txt' 36 | exclude 'META-INF/LICENSE.txt' 37 | } 38 | lintOptions { 39 | abortOnError false 40 | } 41 | compileOptions { 42 | sourceCompatibility = 1.7 43 | targetCompatibility = 1.7 44 | } 45 | } 46 | 47 | dependencies { 48 | compile rootProject.ext.supportAppCompat 49 | } 50 | 51 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' 52 | -------------------------------------------------------------------------------- /common/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/common 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/common 39 | 40 | 41 | POM_NAME=Common utils 42 | POM_ARTIFACT_ID=common 43 | -------------------------------------------------------------------------------- /common/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /common/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /common/src/main/java/io/apptik/multiview/common/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.common; 18 | 19 | 20 | import java.util.regex.Matcher; 21 | import java.util.regex.Pattern; 22 | 23 | public class Log { 24 | 25 | private static final int CALL_STACK_INDEX = 5; 26 | private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$"); 27 | private static boolean DEBUG = false; 28 | 29 | public static void on() { 30 | DEBUG = true; 31 | } 32 | public static void off() { 33 | DEBUG = false; 34 | } 35 | public static void v(String msg) { 36 | if(DEBUG) { 37 | android.util.Log.v(getTag(), msg); 38 | } 39 | } 40 | 41 | public static void d(String msg) { 42 | if(DEBUG) { 43 | android.util.Log.d(getTag(), msg); 44 | } 45 | } 46 | 47 | public static void i(String msg) { 48 | if(DEBUG) { 49 | android.util.Log.i(getTag(), msg); 50 | } 51 | } 52 | 53 | public static void w(String msg) { 54 | if(DEBUG) { 55 | android.util.Log.w(getTag(), msg); 56 | } 57 | } 58 | 59 | public static void e(String msg) { 60 | if(DEBUG) { 61 | android.util.Log.e(getTag(), msg); 62 | } 63 | } 64 | 65 | public static void wtf(String msg) { 66 | if(DEBUG) { 67 | android.util.Log.wtf(getTag(), msg); 68 | } 69 | } 70 | 71 | private static String getTag() { 72 | StackTraceElement[] stackTrace = new Throwable().getStackTrace(); 73 | if (stackTrace.length <= CALL_STACK_INDEX) { 74 | throw new IllegalStateException( 75 | "Synthetic stacktrace didn't have enough elements: are you using proguard?"); 76 | } 77 | return createStackElementTag(stackTrace[CALL_STACK_INDEX]); 78 | } 79 | 80 | protected static String createStackElementTag(StackTraceElement element) { 81 | String tag = element.getClassName(); 82 | Matcher m = ANONYMOUS_CLASS.matcher(tag); 83 | if (m.find()) { 84 | tag = m.replaceAll(""); 85 | } 86 | return tag.substring(tag.lastIndexOf('.') + 1); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /decorations/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /decorations/README.md: -------------------------------------------------------------------------------- 1 | # Decorations for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | decorations 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:decorations:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=decorations&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/decorations 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/decorations 43 | -------------------------------------------------------------------------------- /decorations/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | packagingOptions { 34 | exclude 'LICENSE.txt' 35 | exclude 'NOTICE.txt' 36 | exclude 'META-INF/LICENSE.txt' 37 | } 38 | lintOptions { 39 | abortOnError false 40 | } 41 | compileOptions { 42 | sourceCompatibility = 1.7 43 | targetCompatibility = 1.7 44 | } 45 | } 46 | 47 | dependencies { 48 | compile rootProject.ext.supportRecyclerView 49 | } 50 | 51 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /decorations/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/decorations 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/decorations 39 | 40 | 41 | POM_NAME=Decorations for RecyclerView 42 | POM_ARTIFACT_ID=decorations 43 | -------------------------------------------------------------------------------- /decorations/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /decorations/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /decorations/src/main/java/io/apptik/multiview/decorations/GridDividerDecoration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.decorations; 18 | 19 | import android.graphics.Canvas; 20 | import android.graphics.Rect; 21 | import android.graphics.drawable.Drawable; 22 | import android.support.v7.widget.RecyclerView; 23 | import android.support.v7.widget.RecyclerView.ItemDecoration; 24 | import android.view.View; 25 | import android.view.ViewGroup.MarginLayoutParams; 26 | 27 | 28 | public class GridDividerDecoration extends ItemDecoration { 29 | 30 | 31 | private final Drawable mVerticalDivider; 32 | private final Drawable mHorizontalDivider; 33 | 34 | 35 | 36 | public GridDividerDecoration(Drawable divider) { 37 | this(divider, divider); 38 | } 39 | 40 | public GridDividerDecoration(Drawable verticalDivider, Drawable horizontalDivider) { 41 | mVerticalDivider = verticalDivider; 42 | mHorizontalDivider = horizontalDivider; 43 | 44 | } 45 | 46 | 47 | 48 | // @Override 49 | // public void onDrawOver(Canvas c, RecyclerView parent) { 50 | // final BaseLayoutManager lm = (BaseLayoutManager) parent.getLayoutManager(); 51 | // 52 | // final int rightWithPadding = parent.getWidth() - parent.getPaddingRight(); 53 | // final int bottomWithPadding = parent.getHeight() - parent.getPaddingBottom(); 54 | // 55 | // final int childCount = parent.getChildCount(); 56 | // for (int i = 0; i < childCount; i++) { 57 | // final View child = parent.getChildAt(i); 58 | // 59 | // final int childLeft = lm.getDecoratedLeft(child); 60 | // final int childTop = lm.getDecoratedTop(child); 61 | // final int childRight = lm.getDecoratedRight(child); 62 | // final int childBottom = lm.getDecoratedBottom(child); 63 | // 64 | // final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams(); 65 | // 66 | // final int bottomOffset = childBottom - child.getBottom() - lp.bottomMargin; 67 | // if (bottomOffset > 0 && childBottom < bottomWithPadding) { 68 | // final int left = childLeft; 69 | // final int top = childBottom - bottomOffset; 70 | // final int right = childRight; 71 | // final int bottom = top + mHorizontalDivider.getIntrinsicHeight(); 72 | // 73 | // mHorizontalDivider.setBounds(left, top, right, bottom); 74 | // mHorizontalDivider.draw(c); 75 | // } 76 | // 77 | // final int rightOffset = childRight - child.getRight() - lp.rightMargin; 78 | // if (rightOffset > 0 && childRight < rightWithPadding) { 79 | // final int left = childRight - rightOffset; 80 | // final int top = childTop; 81 | // final int right = left + mVerticalDivider.getIntrinsicWidth(); 82 | // final int bottom = childBottom; 83 | // 84 | // mVerticalDivider.setBounds(left, top, right, bottom); 85 | // mVerticalDivider.draw(c); 86 | // } 87 | // } 88 | // } 89 | 90 | @Override 91 | public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { 92 | //TODO 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /decorations/src/main/java/io/apptik/multiview/decorations/GridSpacingDecoration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.decorations; 18 | 19 | import android.content.Context; 20 | import android.content.res.Resources; 21 | import android.graphics.Rect; 22 | import android.support.v7.widget.RecyclerView; 23 | import android.support.v7.widget.RecyclerView.ItemDecoration; 24 | 25 | 26 | public class GridSpacingDecoration extends ItemDecoration { 27 | public static final int DEFAULT_PADDING = 8; 28 | private int mPaddingPx = 8; 29 | private int mPaddingEdgesPx = 16; 30 | 31 | public GridSpacingDecoration(Context ctx) { 32 | final Resources resources = ctx.getResources(); 33 | mPaddingPx = (int) resources.getDimension(io.apptik.multiview.decorations.R.dimen.paddingItemDecorationDefault); 34 | mPaddingEdgesPx = (int) resources.getDimension(io.apptik.multiview.decorations.R.dimen.paddingItemDecorationEdge); 35 | } 36 | public GridSpacingDecoration(int verticalSpacing, int horizontalSpacing) { 37 | mPaddingPx = verticalSpacing; 38 | } 39 | 40 | @Override 41 | public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /decorations/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 8dp 19 | 16dp 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /extras/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /extras/README.md: -------------------------------------------------------------------------------- 1 | # Extra hooks for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | extras 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:extras:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=extras&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/extras 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/extras 43 | -------------------------------------------------------------------------------- /extras/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | packagingOptions { 35 | exclude 'LICENSE.txt' 36 | exclude 'NOTICE.txt' 37 | exclude 'META-INF/LICENSE.txt' 38 | } 39 | lintOptions { 40 | abortOnError false 41 | } 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile rootProject.ext.supportAppCompat 50 | compile rootProject.ext.supportRecyclerView 51 | compile project(':common') 52 | } 53 | 54 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /extras/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/extras 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/extras 39 | 40 | 41 | POM_NAME=Extras toolkit library for RecyclerView 42 | POM_ARTIFACT_ID=extras 43 | -------------------------------------------------------------------------------- /extras/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /extras/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /extras/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /galleryview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /galleryview/README.md: -------------------------------------------------------------------------------- 1 | # Galleryview based on RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | galleryview 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:galleryview:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=galleryview&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/galleryview 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/galleryview 43 | -------------------------------------------------------------------------------- /galleryview/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | packagingOptions { 35 | exclude 'LICENSE.txt' 36 | exclude 'NOTICE.txt' 37 | exclude 'META-INF/LICENSE.txt' 38 | } 39 | lintOptions { 40 | abortOnError false 41 | } 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile project(':layoutmanagers') 50 | compile project(':scalablerecyclerview') 51 | compile rootProject.ext.supportRecyclerView 52 | compile rootProject.ext.supportAppCompat 53 | compile rootProject.ext.supportCardView 54 | compile rootProject.ext.supportV4 55 | } 56 | 57 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /galleryview/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/galleryview 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/galleryview 39 | 40 | 41 | POM_NAME=Galleryview based on RecyclerView 42 | POM_ARTIFACT_ID=galleryview 43 | -------------------------------------------------------------------------------- /galleryview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /galleryview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/SimpleGalleryView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.galleryview; 18 | 19 | 20 | import android.content.Context; 21 | import android.util.AttributeSet; 22 | 23 | import io.apptik.multiview.scalablerecyclerview.ScalableRecyclerGridView; 24 | 25 | public class SimpleGalleryView extends ScalableRecyclerGridView { 26 | public SimpleGalleryView(Context context, AttributeSet attrs) { 27 | super(context, attrs); 28 | } 29 | 30 | public SimpleGalleryView(Context context, AttributeSet attrs, int defStyle) { 31 | super(context, attrs, defStyle); 32 | } 33 | 34 | public SimpleGalleryView(Context context, int intialSpan) { 35 | super(context, intialSpan); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/SquareImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.galleryview; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.widget.ImageView; 22 | 23 | 24 | public class SquareImageView extends ImageView { 25 | public SquareImageView(Context context) { 26 | super(context); 27 | } 28 | 29 | public SquareImageView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | } 32 | 33 | public SquareImageView(Context context, AttributeSet attrs, int defStyle) { 34 | super(context, attrs, defStyle); 35 | } 36 | 37 | @Override 38 | protected void onMeasure(int width, int height) { 39 | super.onMeasure(width, height); 40 | int measuredWidth = getMeasuredWidth(); 41 | int measuredHeight = getMeasuredHeight(); 42 | if (measuredWidth > measuredHeight) { 43 | setMeasuredDimension(measuredWidth, measuredWidth); 44 | } else { 45 | setMeasuredDimension(measuredHeight, measuredHeight); 46 | 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/SquareNetworkImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.galleryview; 18 | 19 | public class SquareNetworkImageView 20 | // extends NetworkImageView 21 | { 22 | // public SquareNetworkImageView(Context context) { 23 | // super(context); 24 | // } 25 | // 26 | // public SquareNetworkImageView(Context context, AttributeSet attrs) { 27 | // super(context, attrs); 28 | // } 29 | // 30 | // public SquareNetworkImageView(Context context, AttributeSet attrs, int defStyle) { 31 | // super(context, attrs, defStyle); 32 | // } 33 | // 34 | // @Override 35 | // protected void onMeasure(int width, int height) { 36 | // super.onMeasure(width, height); 37 | // int measuredWidth = getMeasuredWidth(); 38 | // int measuredHeight = getMeasuredHeight(); 39 | // if (measuredWidth > measuredHeight) { 40 | // setMeasuredDimension(measuredWidth, measuredWidth); 41 | // } else { 42 | // setMeasuredDimension(measuredHeight, measuredHeight); 43 | // 44 | // } 45 | // } 46 | } 47 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/Compat.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage; 17 | 18 | import android.annotation.TargetApi; 19 | import android.os.Build; 20 | import android.os.Build.VERSION; 21 | import android.os.Build.VERSION_CODES; 22 | import android.view.MotionEvent; 23 | import android.view.View; 24 | 25 | public class Compat { 26 | 27 | private static final int SIXTY_FPS_INTERVAL = 1000 / 60; 28 | 29 | public static void postOnAnimation(View view, Runnable runnable) { 30 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { 31 | postOnAnimationJellyBean(view, runnable); 32 | } else { 33 | view.postDelayed(runnable, SIXTY_FPS_INTERVAL); 34 | } 35 | } 36 | 37 | @TargetApi(16) 38 | private static void postOnAnimationJellyBean(View view, Runnable runnable) { 39 | view.postOnAnimation(runnable); 40 | } 41 | 42 | public static int getPointerIndex(int action) { 43 | if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) 44 | return getPointerIndexHoneyComb(action); 45 | else 46 | return getPointerIndexEclair(action); 47 | } 48 | 49 | @SuppressWarnings("deprecation") 50 | @TargetApi(Build.VERSION_CODES.ECLAIR) 51 | private static int getPointerIndexEclair(int action) { 52 | return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; 53 | } 54 | 55 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 56 | private static int getPointerIndexHoneyComb(int action) { 57 | return (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/DefaultOnDoubleTapListener.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.galleryview.scaleimage; 2 | 3 | import android.graphics.RectF; 4 | import android.view.GestureDetector; 5 | import android.view.MotionEvent; 6 | import android.widget.ImageView; 7 | 8 | /** 9 | * Provided default implementation of GestureDetector.OnDoubleTapListener, to be overriden with custom behavior, if needed 10 | *

 

11 | * To be used via {@link ImageViewScaler#setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener)} 12 | */ 13 | public class DefaultOnDoubleTapListener implements GestureDetector.OnDoubleTapListener { 14 | 15 | private ImageViewScaler ImageViewScaler; 16 | 17 | /** 18 | * Default constructor 19 | * 20 | * @param ImageViewScaler ImageViewScaler to bind to 21 | */ 22 | public DefaultOnDoubleTapListener(ImageViewScaler ImageViewScaler) { 23 | setImageViewScaler(ImageViewScaler); 24 | } 25 | 26 | /** 27 | * Allows to change ImageViewScaler within range of single instance 28 | * 29 | * @param newImageViewScaler ImageViewScaler to bind to 30 | */ 31 | public void setImageViewScaler(ImageViewScaler newImageViewScaler) { 32 | this.ImageViewScaler = newImageViewScaler; 33 | } 34 | 35 | @Override 36 | public boolean onSingleTapConfirmed(MotionEvent e) { 37 | if (this.ImageViewScaler == null) 38 | return false; 39 | 40 | ImageView imageView = ImageViewScaler.getImageView(); 41 | 42 | if (null != ImageViewScaler.getOnPhotoTapListener()) { 43 | final RectF displayRect = ImageViewScaler.getDisplayRect(); 44 | 45 | if (null != displayRect) { 46 | final float x = e.getX(), y = e.getY(); 47 | 48 | // Check to see if the user tapped on the photo 49 | if (displayRect.contains(x, y)) { 50 | 51 | float xResult = (x - displayRect.left) 52 | / displayRect.width(); 53 | float yResult = (y - displayRect.top) 54 | / displayRect.height(); 55 | 56 | ImageViewScaler.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult); 57 | return true; 58 | } 59 | } 60 | } 61 | if (null != ImageViewScaler.getOnViewTapListener()) { 62 | ImageViewScaler.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY()); 63 | } 64 | 65 | return false; 66 | } 67 | 68 | @Override 69 | public boolean onDoubleTap(MotionEvent ev) { 70 | if (ImageViewScaler == null) 71 | return false; 72 | 73 | try { 74 | float scale = ImageViewScaler.getScale(); 75 | float x = ev.getX(); 76 | float y = ev.getY(); 77 | 78 | if (scale < ImageViewScaler.getMediumScale()) { 79 | ImageViewScaler.setScale(ImageViewScaler.getMediumScale(), x, y, true); 80 | } else if (scale >= ImageViewScaler.getMediumScale() && scale < ImageViewScaler.getMaximumScale()) { 81 | ImageViewScaler.setScale(ImageViewScaler.getMaximumScale(), x, y, true); 82 | } else { 83 | ImageViewScaler.setScale(ImageViewScaler.getMinimumScale(), x, y, true); 84 | } 85 | } catch (ArrayIndexOutOfBoundsException e) { 86 | // Can sometimes happen when getX() and getY() is called 87 | } 88 | 89 | return true; 90 | } 91 | 92 | @Override 93 | public boolean onDoubleTapEvent(MotionEvent e) { 94 | // Wait for the confirmed onDoubleTap() instead 95 | return false; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/ExtendedViewPagerLayoutManager.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.galleryview.scaleimage; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.AttributeSet; 6 | 7 | import io.apptik.multiview.layoutmanagers.ViewPagerLayoutManager; 8 | import io.apptik.multiview.scalablerecyclerview.ScalableRecyclerGridView; 9 | 10 | 11 | public class ExtendedViewPagerLayoutManager extends ViewPagerLayoutManager { 12 | public ExtendedViewPagerLayoutManager(Context context) { 13 | super(context); 14 | } 15 | 16 | public ExtendedViewPagerLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 17 | super(context, attrs, defStyleAttr, defStyleRes); 18 | } 19 | 20 | public ExtendedViewPagerLayoutManager(Context context, int orientation, boolean reverseLayout) { 21 | super(context, orientation, reverseLayout); 22 | } 23 | 24 | @Override 25 | public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { 26 | 27 | final int layoutDirection = dx > 0 ? 1 : -1; 28 | 29 | if(recyclerView != null && recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_SETTLING && recyclerView instanceof ScalableRecyclerGridView){ 30 | if(!(recyclerView.canScrollHorizontally(layoutDirection))) { 31 | // adjust(); 32 | return 0; 33 | } 34 | } 35 | return super.scrollHorizontallyBy(dx, recycler, state); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/gestures/EclairGestureDetector.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.gestures; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.view.MotionEvent; 21 | 22 | import io.apptik.multiview.galleryview.scaleimage.Compat; 23 | 24 | 25 | @TargetApi(5) 26 | public class EclairGestureDetector extends CupcakeGestureDetector { 27 | 28 | private static final int INVALID_POINTER_ID = -1; 29 | private int mActivePointerId = INVALID_POINTER_ID; 30 | private int mActivePointerIndex = 0; 31 | 32 | public EclairGestureDetector(Context context) { 33 | super(context); 34 | } 35 | 36 | @Override 37 | float getActiveX(MotionEvent ev) { 38 | try { 39 | return ev.getX(mActivePointerIndex); 40 | } catch (Exception e) { 41 | return ev.getX(); 42 | } 43 | } 44 | 45 | @Override 46 | float getActiveY(MotionEvent ev) { 47 | try { 48 | return ev.getY(mActivePointerIndex); 49 | } catch (Exception e) { 50 | return ev.getY(); 51 | } 52 | } 53 | 54 | @Override 55 | public boolean onTouchEvent(MotionEvent ev) { 56 | final int action = ev.getAction(); 57 | switch (action & MotionEvent.ACTION_MASK) { 58 | case MotionEvent.ACTION_DOWN: 59 | mActivePointerId = ev.getPointerId(0); 60 | break; 61 | case MotionEvent.ACTION_CANCEL: 62 | case MotionEvent.ACTION_UP: 63 | mActivePointerId = INVALID_POINTER_ID; 64 | break; 65 | case MotionEvent.ACTION_POINTER_UP: 66 | // Ignore deprecation, ACTION_POINTER_ID_MASK and 67 | // ACTION_POINTER_ID_SHIFT has same value and are deprecated 68 | // You can have either deprecation or lint target api warning 69 | final int pointerIndex = Compat.getPointerIndex(ev.getAction()); 70 | final int pointerId = ev.getPointerId(pointerIndex); 71 | if (pointerId == mActivePointerId) { 72 | // This was our active pointer going up. Choose a new 73 | // active pointer and adjust accordingly. 74 | final int newPointerIndex = pointerIndex == 0 ? 1 : 0; 75 | mActivePointerId = ev.getPointerId(newPointerIndex); 76 | mLastTouchX = ev.getX(newPointerIndex); 77 | mLastTouchY = ev.getY(newPointerIndex); 78 | } 79 | break; 80 | } 81 | 82 | mActivePointerIndex = ev 83 | .findPointerIndex(mActivePointerId != INVALID_POINTER_ID ? mActivePointerId 84 | : 0); 85 | return super.onTouchEvent(ev); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/gestures/FroyoGestureDetector.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.gestures; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.view.MotionEvent; 21 | import android.view.ScaleGestureDetector; 22 | 23 | @TargetApi(8) 24 | public class FroyoGestureDetector extends EclairGestureDetector { 25 | 26 | protected final ScaleGestureDetector mDetector; 27 | 28 | public FroyoGestureDetector(Context context) { 29 | super(context); 30 | ScaleGestureDetector.OnScaleGestureListener mScaleListener = new ScaleGestureDetector.OnScaleGestureListener() { 31 | 32 | @Override 33 | public boolean onScale(ScaleGestureDetector detector) { 34 | float scaleFactor = detector.getScaleFactor(); 35 | 36 | if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) 37 | return false; 38 | 39 | mListener.onScale(scaleFactor, 40 | detector.getFocusX(), detector.getFocusY()); 41 | return true; 42 | } 43 | 44 | @Override 45 | public boolean onScaleBegin(ScaleGestureDetector detector) { 46 | return true; 47 | } 48 | 49 | @Override 50 | public void onScaleEnd(ScaleGestureDetector detector) { 51 | // NO-OP 52 | } 53 | }; 54 | mDetector = new ScaleGestureDetector(context, mScaleListener); 55 | } 56 | 57 | @Override 58 | public boolean isScaling() { 59 | return mDetector.isInProgress(); 60 | } 61 | 62 | @Override 63 | public boolean onTouchEvent(MotionEvent ev) { 64 | mDetector.onTouchEvent(ev); 65 | return super.onTouchEvent(ev); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/gestures/GestureDetector.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.gestures; 17 | 18 | import android.view.MotionEvent; 19 | 20 | public interface GestureDetector { 21 | 22 | public boolean onTouchEvent(MotionEvent ev); 23 | 24 | public boolean isScaling(); 25 | 26 | public boolean isDragging(); 27 | 28 | public void setOnGestureListener(OnGestureListener listener); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/gestures/OnGestureListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.gestures; 17 | 18 | public interface OnGestureListener { 19 | 20 | public void onDrag(float dx, float dy); 21 | 22 | public void onFling(float startX, float startY, float velocityX, 23 | float velocityY); 24 | 25 | public void onScale(float scaleFactor, float focusX, float focusY); 26 | 27 | } -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/gestures/VersionedGestureDetector.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.galleryview.scaleimage.gestures; 2 | 3 | /******************************************************************************* 4 | * Copyright 2011, 2012 Chris Banes. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | *******************************************************************************/ 18 | 19 | import android.content.Context; 20 | import android.os.Build; 21 | 22 | public final class VersionedGestureDetector { 23 | 24 | public static GestureDetector newInstance(Context context, 25 | OnGestureListener listener) { 26 | final int sdkVersion = Build.VERSION.SDK_INT; 27 | GestureDetector detector; 28 | 29 | if (sdkVersion < Build.VERSION_CODES.ECLAIR) { 30 | detector = new CupcakeGestureDetector(context); 31 | } else if (sdkVersion < Build.VERSION_CODES.FROYO) { 32 | detector = new EclairGestureDetector(context); 33 | } else { 34 | detector = new FroyoGestureDetector(context); 35 | } 36 | 37 | detector.setOnGestureListener(listener); 38 | 39 | return detector; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/scrollerproxy/GingerScroller.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.scrollerproxy; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.widget.OverScroller; 21 | 22 | @TargetApi(9) 23 | public class GingerScroller extends ScrollerProxy { 24 | 25 | protected final OverScroller mScroller; 26 | private boolean mFirstScroll = false; 27 | 28 | public GingerScroller(Context context) { 29 | mScroller = new OverScroller(context); 30 | } 31 | 32 | @Override 33 | public boolean computeScrollOffset() { 34 | // Workaround for first scroll returning 0 for the direction of the edge it hits. 35 | // Simply recompute values. 36 | if (mFirstScroll) { 37 | mScroller.computeScrollOffset(); 38 | mFirstScroll = false; 39 | } 40 | return mScroller.computeScrollOffset(); 41 | } 42 | 43 | @Override 44 | public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY, 45 | int overX, int overY) { 46 | mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY); 47 | } 48 | 49 | @Override 50 | public void forceFinished(boolean finished) { 51 | mScroller.forceFinished(finished); 52 | } 53 | 54 | @Override 55 | public boolean isFinished() { 56 | return mScroller.isFinished(); 57 | } 58 | 59 | @Override 60 | public int getCurrX() { 61 | return mScroller.getCurrX(); 62 | } 63 | 64 | @Override 65 | public int getCurrY() { 66 | return mScroller.getCurrY(); 67 | } 68 | } -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/scrollerproxy/IcsScroller.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.scrollerproxy; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | 21 | @TargetApi(14) 22 | public class IcsScroller extends GingerScroller { 23 | 24 | public IcsScroller(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | public boolean computeScrollOffset() { 30 | return mScroller.computeScrollOffset(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/scrollerproxy/PreGingerScroller.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.scrollerproxy; 17 | 18 | import android.content.Context; 19 | import android.widget.Scroller; 20 | 21 | public class PreGingerScroller extends ScrollerProxy { 22 | 23 | private final Scroller mScroller; 24 | 25 | public PreGingerScroller(Context context) { 26 | mScroller = new Scroller(context); 27 | } 28 | 29 | @Override 30 | public boolean computeScrollOffset() { 31 | return mScroller.computeScrollOffset(); 32 | } 33 | 34 | @Override 35 | public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY, 36 | int overX, int overY) { 37 | mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY); 38 | } 39 | 40 | @Override 41 | public void forceFinished(boolean finished) { 42 | mScroller.forceFinished(finished); 43 | } 44 | 45 | public boolean isFinished() { 46 | return mScroller.isFinished(); 47 | } 48 | 49 | @Override 50 | public int getCurrX() { 51 | return mScroller.getCurrX(); 52 | } 53 | 54 | @Override 55 | public int getCurrY() { 56 | return mScroller.getCurrY(); 57 | } 58 | } -------------------------------------------------------------------------------- /galleryview/src/main/java/io/apptik/multiview/galleryview/scaleimage/scrollerproxy/ScrollerProxy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package io.apptik.multiview.galleryview.scaleimage.scrollerproxy; 17 | 18 | import android.content.Context; 19 | import android.os.Build.VERSION; 20 | import android.os.Build.VERSION_CODES; 21 | 22 | public abstract class ScrollerProxy { 23 | 24 | public static ScrollerProxy getScroller(Context context) { 25 | if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { 26 | return new PreGingerScroller(context); 27 | } else if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) { 28 | return new GingerScroller(context); 29 | } else { 30 | return new IcsScroller(context); 31 | } 32 | } 33 | 34 | public abstract boolean computeScrollOffset(); 35 | 36 | public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, 37 | int maxY, int overX, int overY); 38 | 39 | public abstract void forceFinished(boolean finished); 40 | 41 | public abstract boolean isFinished(); 42 | 43 | public abstract int getCurrX(); 44 | 45 | public abstract int getCurrY(); 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | VERSION_NAME=0.0.4-SNAPSHOT 37 | VERSION_CODE=4 38 | GROUP=io.apptik.multiview 39 | 40 | POM_DESCRIPTION=Multi-purpose Android UI components based on RecyclerView 41 | 42 | POM_SCM_CONNECTION=scm:git@github.com/apptik/multiview.git 43 | POM_SCM_DEV_CONNECTION=scm:git@github.com/apptik/multiview.git 44 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 45 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 46 | 47 | POM_LICENCE_DIST=repo 48 | POM_DEVELOPER_ID=djodjo 49 | POM_DEVELOPER_NAME=Kalin Maldzhanski 50 | 51 | 52 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apptik/MultiView/aa3aae74dcf4b59d62aae066d239ab8db1a55b9e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 27 17:28:32 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /layoutmanagers/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /layoutmanagers/README.md: -------------------------------------------------------------------------------- 1 | # Layoutmanagers for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | layoutmanagers 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:layoutmanagers:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=layoutmanagers&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/layoutmanagers 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/layoutmanagers 43 | -------------------------------------------------------------------------------- /layoutmanagers/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | packagingOptions { 35 | exclude 'LICENSE.txt' 36 | exclude 'NOTICE.txt' 37 | exclude 'META-INF/LICENSE.txt' 38 | } 39 | lintOptions { 40 | abortOnError false 41 | } 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile project(':common') 50 | compile rootProject.ext.supportRecyclerView 51 | } 52 | 53 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /layoutmanagers/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/layoutmanagers 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/layoutmanagers 39 | 40 | 41 | POM_NAME=Layoutmanagers for RecyclerView 42 | POM_ARTIFACT_ID=layoutmanagers 43 | -------------------------------------------------------------------------------- /layoutmanagers/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /layoutmanagers/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /layoutmanagers/src/main/java/io/apptik/multiview/layoutmanagers/SnapperLinearLayoutManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.layoutmanagers; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | 22 | 23 | public class SnapperLinearLayoutManager extends AbstractSnapperLLM { 24 | 25 | 26 | public SnapperLinearLayoutManager(Context context) { 27 | super(context); 28 | 29 | } 30 | 31 | public SnapperLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int 32 | defStyleRes) { 33 | super(context, attrs, defStyleAttr, defStyleRes); 34 | 35 | } 36 | 37 | public SnapperLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { 38 | super(context, orientation, reverseLayout); 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /layoutmanagers/src/main/java/io/apptik/multiview/layoutmanagers/ViewPagerLayoutManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.layoutmanagers; 18 | 19 | 20 | import android.content.Context; 21 | import android.util.AttributeSet; 22 | 23 | public class ViewPagerLayoutManager extends AbstractPagerLLM { 24 | 25 | public ViewPagerLayoutManager(Context context) { 26 | super(context); 27 | } 28 | 29 | public ViewPagerLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int 30 | defStyleRes) { 31 | super(context, attrs, defStyleAttr, defStyleRes); 32 | } 33 | 34 | public ViewPagerLayoutManager(Context context, int orientation, boolean reverseLayout) { 35 | super(context, orientation, reverseLayout); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /scalablerecyclerview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /scalablerecyclerview/README.md: -------------------------------------------------------------------------------- 1 | # Scalablerecyclerview based on RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | scalablerecyclerview 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:scalablerecyclerview:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=scalablerecyclerview&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/scalablerecyclerview 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/scalablerecyclerview 43 | -------------------------------------------------------------------------------- /scalablerecyclerview/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | packagingOptions { 34 | exclude 'LICENSE.txt' 35 | exclude 'NOTICE.txt' 36 | exclude 'META-INF/LICENSE.txt' 37 | } 38 | lintOptions { 39 | abortOnError false 40 | } 41 | 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile project(':layoutmanagers') 50 | compile project(':common') 51 | compile project(':extras') 52 | compile project(':scrollers') 53 | compile rootProject.ext.supportRecyclerView 54 | compile rootProject.ext.supportAppCompat 55 | compile rootProject.ext.supportCardView 56 | compile rootProject.ext.supportV4 57 | } 58 | 59 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /scalablerecyclerview/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/scalablerecyclerview 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/scalablerecyclerview 39 | 40 | 41 | POM_NAME=Scalable RecyclerView 42 | POM_ARTIFACT_ID=scalablerecyclerview 43 | -------------------------------------------------------------------------------- /scalablerecyclerview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/DuplexAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.scalablerecyclerview; 18 | 19 | 20 | import android.support.v7.widget.RecyclerView; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | public class DuplexAdapter extends RecyclerView.Adapter{ 25 | @Override 26 | public DuplexAdapter.DuplexHolder onCreateViewHolder(ViewGroup parent, int viewType) { 27 | return null; 28 | } 29 | 30 | @Override 31 | public void onBindViewHolder(DuplexAdapter.DuplexHolder holder, int position) { 32 | 33 | } 34 | 35 | @Override 36 | public int getItemCount() { 37 | return 0; 38 | } 39 | 40 | public class DuplexHolder extends RecyclerView.ViewHolder { 41 | public DuplexHolder(View itemView) { 42 | super(itemView); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/GridScaler.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.scalablerecyclerview; 2 | 3 | 4 | import android.view.MotionEvent; 5 | 6 | public interface GridScaler { 7 | 8 | int getInitialSpan(); 9 | 10 | void scale(Float currScale, Integer currSpan, MotionEvent ev); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/ScalableViewGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.scalablerecyclerview; 18 | 19 | 20 | import android.content.Context; 21 | import android.graphics.Canvas; 22 | import android.util.AttributeSet; 23 | import android.widget.FrameLayout; 24 | 25 | 26 | public class ScalableViewGroup extends FrameLayout { 27 | 28 | 29 | private float mScaleFactor = 1.f; 30 | 31 | public ScalableViewGroup(Context context) { 32 | super(context); 33 | setWillNotDraw(false); 34 | } 35 | 36 | public ScalableViewGroup(Context context, AttributeSet attrs) { 37 | super(context, attrs); 38 | } 39 | 40 | public ScalableViewGroup(Context context, AttributeSet attrs, int defStyleAttr) { 41 | super(context, attrs, defStyleAttr); 42 | } 43 | 44 | public float getScaleFactor() { 45 | return mScaleFactor; 46 | } 47 | 48 | public void setScaleFactor(float mScaleFactor) { 49 | this.mScaleFactor = mScaleFactor; 50 | invalidate(); 51 | } 52 | 53 | @Override 54 | public void onDraw(Canvas canvas) { 55 | // /canvas.save(); 56 | canvas.scale(mScaleFactor, mScaleFactor); 57 | //canvas.restore(); 58 | super.onDraw(canvas); 59 | 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/SharpGridScaler.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.scalablerecyclerview; 2 | 3 | import android.support.v4.view.ViewCompat; 4 | import android.support.v7.widget.GridLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.MotionEvent; 7 | 8 | import io.apptik.multiview.common.Log; 9 | 10 | public class SharpGridScaler extends BaseGridScaler{ 11 | 12 | 13 | public SharpGridScaler(RecyclerView recyclerView) { 14 | super(recyclerView); 15 | } 16 | 17 | @Override 18 | public void scale(Float currScale, Integer currSpan, MotionEvent ev) { 19 | Log.d("scale: " + currScale + "/" + currSpan + " :: " + ev); 20 | GridLayoutManager lm = (GridLayoutManager)getRecyclerView().getLayoutManager(); 21 | 22 | if(lm.getSpanCount() !=currSpan) { 23 | lm.setSpanCount(currSpan); 24 | getRecyclerView().getLayoutManager().requestLayout(); 25 | } 26 | 27 | ViewCompat.setScaleX(getRecyclerView(),currScale); 28 | ViewCompat.setScaleY(getRecyclerView(),currScale); 29 | getRecyclerView().invalidate(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/SmoothGridScaler.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.scalablerecyclerview; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.MotionEvent; 5 | 6 | public class SmoothGridScaler extends BaseGridScaler{ 7 | 8 | 9 | public SmoothGridScaler(RecyclerView recyclerView) { 10 | super(recyclerView); 11 | } 12 | 13 | @Override 14 | public void scale(Float currScale, Integer currSpan, MotionEvent ev) { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /scrollers/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /scrollers/README.md: -------------------------------------------------------------------------------- 1 | # Scrollers for RecyclerView 2 | 3 | ## Download 4 | 5 | Download [the latest JAR][mvn] or grab via Maven: 6 | ```xml 7 | 8 | io.apptik.multiview 9 | scrollers 10 | 0.0.3 11 | 12 | ``` 13 | or Gradle: 14 | ```groovy 15 | compile 'io.apptik.multiview:scrollers:0.0.3' 16 | ``` 17 | 18 | Downloads of the released versions are available in [Sonatype's `releases` repository][release]. 19 | 20 | Snapshots of the development versions are available in [Sonatype's `snapshots` repository][snap]. 21 | 22 | requires at minimum Android SDK 15. 23 | 24 | ## Licence 25 | 26 | Copyright (C) 2016 AppTik Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | 40 | [mvn]: https://search.maven.org/remote_content?g=io.apptik.multiview&a=scrollers&v=LATEST 41 | [release]: https://oss.sonatype.org/content/repositories/releases/io/apptik/multiview/scrollers 42 | [snap]: https://oss.sonatype.org/content/repositories/snapshots/io/apptik/multiview/scrollers 43 | -------------------------------------------------------------------------------- /scrollers/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | minSdkVersion rootProject.ext.minSdkVersion 25 | targetSdkVersion rootProject.ext.compileSdkVersion 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | packagingOptions { 34 | exclude 'LICENSE.txt' 35 | exclude 'NOTICE.txt' 36 | exclude 'META-INF/LICENSE.txt' 37 | } 38 | lintOptions { 39 | abortOnError false 40 | } 41 | 42 | compileOptions { 43 | sourceCompatibility = 1.7 44 | targetCompatibility = 1.7 45 | } 46 | } 47 | 48 | dependencies { 49 | compile project(':common') 50 | compile rootProject.ext.supportRecyclerView 51 | } 52 | 53 | apply from: 'https://raw.githubusercontent.com/djodjoni/gradle-mvn-push/master/gradle-mvn-push-android.gradle' -------------------------------------------------------------------------------- /scrollers/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 AppTik Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true 35 | 36 | 37 | POM_URL=https://github.com/apptik/multiview/tree/master/scrollers 38 | POM_SCM_URL=https://github.com/apptik/multiview/tree/master/scrollers 39 | 40 | 41 | POM_NAME=Scrollers for RecyclerView 42 | POM_ARTIFACT_ID=scrollers 43 | -------------------------------------------------------------------------------- /scrollers/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sic/dev/adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /scrollers/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /scrollers/src/main/java/io/apptik/multiview/scrollers/FlexiSmoothScroller.java: -------------------------------------------------------------------------------- 1 | package io.apptik.multiview.scrollers; 2 | 3 | 4 | import android.content.Context; 5 | import android.graphics.PointF; 6 | import android.support.v7.widget.RecyclerView; 7 | 8 | import io.apptik.multiview.common.Log; 9 | 10 | public class FlexiSmoothScroller extends BaseSmoothScroller { 11 | 12 | private Runnable beforeScrollAction; 13 | private Runnable afterScrollAction; 14 | 15 | public FlexiSmoothScroller(Context context) { 16 | super(context); 17 | } 18 | 19 | public Runnable getAfterScrollAction() { 20 | return afterScrollAction; 21 | } 22 | 23 | public void setAfterScrollAction(Runnable afterScrollAction) { 24 | this.afterScrollAction = afterScrollAction; 25 | } 26 | 27 | public Runnable getBeforeScrollAction() { 28 | return beforeScrollAction; 29 | } 30 | 31 | public void setBeforeScrollAction(Runnable beforeScrollAction) { 32 | this.beforeScrollAction = beforeScrollAction; 33 | } 34 | 35 | @Override 36 | protected void onStop() { 37 | if(afterScrollAction!=null) { 38 | afterScrollAction.run(); 39 | } 40 | super.onStop(); 41 | } 42 | 43 | @Override 44 | protected void onStart() { 45 | if(beforeScrollAction!=null) { 46 | beforeScrollAction.run(); 47 | } 48 | super.onStart(); 49 | } 50 | 51 | @Override 52 | public PointF computeScrollVectorForPosition(int targetPosition) { 53 | Log.d("computeScrollVectorForPosition"); 54 | boolean mShouldReverseLayout = false; 55 | RecyclerView.LayoutManager lm = getLayoutManager(); 56 | Log.d("computeScrollVectorForPosition lm: " + lm + " : " + getChildCount()); 57 | if (getChildCount() == 0) { 58 | return null; 59 | } 60 | final int firstChildPos = lm.getPosition(lm.getChildAt(0)); 61 | final int direction = targetPosition < firstChildPos != mShouldReverseLayout ? -1 : 1; 62 | Log.d("computeScrollVectorForPosition firstChildPos: " + firstChildPos + ", direction: " + direction); 63 | if (lm.canScrollHorizontally()) { 64 | return new PointF(direction, 0); 65 | } else { 66 | return new PointF(0, direction); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /scrollers/src/main/java/io/apptik/multiview/scrollers/SnapperSmoothScroller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.apptik.multiview.scrollers; 18 | 19 | 20 | import android.content.Context; 21 | 22 | public class SnapperSmoothScroller extends FlexiSmoothScroller { 23 | 24 | public SnapperSmoothScroller(Context context) { 25 | super(context); 26 | setMillisecondsPerInchFoundTarget(50f); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 AppTik Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':app', 18 | ':layoutmanagers', 19 | ':adapters', 20 | ':animators', 21 | ':scrollers', 22 | ':decorations', 23 | ':galleryview', 24 | ':scalablerecyclerview', 25 | ':common', 26 | ':extras' 27 | --------------------------------------------------------------------------------