├── .gitignore ├── GlFancyCoverFlow ├── .classpath ├── .project ├── AndroidManifest.xml ├── ic_launcher-web.png ├── libs │ ├── android-support-v4.jar │ └── universal-image-loader-1.8.6-with-sources.jar ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ ├── go.png │ │ ├── ic_error.png │ │ ├── ic_launcher.png │ │ ├── logo.png │ │ ├── toggle_bg_off.png │ │ └── toggle_bg_on.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── drawable │ │ └── toggle_selector.xml │ ├── layout │ │ └── activity_main.xml │ ├── menu │ │ └── main.xml │ ├── raw │ │ └── ScreenShots │ │ │ ├── device-2014-10-15-141029.png │ │ │ ├── device-2014-10-15-141041.png │ │ │ └── device-2014-10-15-141056.png │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ ├── values-w820dp │ │ └── dimens.xml │ └── values │ │ ├── attr.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ ├── at │ └── technikum │ │ └── mti │ │ └── fancycoverflow │ │ ├── FancyCoverFlow.java │ │ ├── FancyCoverFlowAdapter.java │ │ ├── FancyCoverFlowItemWrapper.java │ │ └── ViewUtil.java │ └── com │ └── gl │ └── glfancycoverflow │ ├── FilmInfoTest.java │ ├── ImageAdapter.java │ ├── MainActivity.java │ ├── UILApplication.java │ └── model │ └── FilmInfo.java └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | target/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | .gitattributes 18 | 19 | # Eclipse project files 20 | .classpath 21 | .project 22 | 23 | /GlFancyCoverFlow/bin/jarlist.cache 24 | /GlFancyCoverFlow/bin/classes 25 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GlFancyCoverFlow 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/ic_launcher-web.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/libs/android-support-v4.jar -------------------------------------------------------------------------------- /GlFancyCoverFlow/libs/universal-image-loader-1.8.6-with-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/libs/universal-image-loader-1.8.6-with-sources.jar -------------------------------------------------------------------------------- /GlFancyCoverFlow/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-18 15 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/go.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/ic_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/ic_error.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/toggle_bg_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/toggle_bg_off.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-hdpi/toggle_bg_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-hdpi/toggle_bg_on.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/drawable/toggle_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 17 | 18 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141029.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141041.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141041.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141056.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141056.png -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GlFancyCoverFlow 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/at/technikum/mti/fancycoverflow/FancyCoverFlow.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/src/at/technikum/mti/fancycoverflow/FancyCoverFlow.java -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/at/technikum/mti/fancycoverflow/FancyCoverFlowAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 David Schreiber 3 | * 2013 John Paul Nalog 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package at.technikum.mti.fancycoverflow; 19 | 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import android.widget.BaseAdapter; 23 | 24 | 25 | public abstract class FancyCoverFlowAdapter extends BaseAdapter { 26 | 27 | // ============================================================================= 28 | // Supertype overrides 29 | // ============================================================================= 30 | 31 | @Override 32 | public final View getView(int i, View reusableView, ViewGroup viewGroup) { 33 | FancyCoverFlow coverFlow = (FancyCoverFlow) viewGroup; 34 | 35 | View wrappedView = null; 36 | FancyCoverFlowItemWrapper coverFlowItem; 37 | 38 | if (reusableView != null) { 39 | coverFlowItem = (FancyCoverFlowItemWrapper) reusableView; 40 | wrappedView = coverFlowItem.getChildAt(0); 41 | coverFlowItem.removeAllViews(); 42 | } else { 43 | coverFlowItem = new FancyCoverFlowItemWrapper(viewGroup.getContext()); 44 | } 45 | 46 | wrappedView = this.getCoverFlowItem(i, wrappedView, viewGroup); 47 | 48 | if (wrappedView == null) { 49 | throw new NullPointerException("getCoverFlowItem() was expected to return a view, but null was returned."); 50 | } 51 | 52 | final boolean isReflectionEnabled = coverFlow.isReflectionEnabled(); 53 | coverFlowItem.setReflectionEnabled(isReflectionEnabled); 54 | 55 | if(isReflectionEnabled) { 56 | coverFlowItem.setReflectionGap(coverFlow.getReflectionGap()); 57 | coverFlowItem.setReflectionRatio(coverFlow.getReflectionRatio()); 58 | } 59 | 60 | 61 | coverFlowItem.addView(wrappedView); 62 | coverFlowItem.setLayoutParams(wrappedView.getLayoutParams()); 63 | 64 | return coverFlowItem; 65 | } 66 | 67 | // ============================================================================= 68 | // Abstract methods 69 | // ============================================================================= 70 | 71 | public abstract View getCoverFlowItem(int position, View reusableView, ViewGroup parent); 72 | } 73 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/at/technikum/mti/fancycoverflow/FancyCoverFlowItemWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 David Schreiber 3 | * 2013 John Paul Nalog 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package at.technikum.mti.fancycoverflow; 19 | 20 | import android.*; 21 | import android.R; 22 | import android.annotation.SuppressLint; 23 | import android.annotation.TargetApi; 24 | import android.content.Context; 25 | import android.graphics.*; 26 | import android.os.Build; 27 | import android.util.AttributeSet; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | 31 | /** 32 | * This class has only internal use (package scope). 33 | *

34 | * It is responsible for applying additional effects to each coverflow item, 35 | * that can only be applied at view level (e.g. color saturation). 36 | *

37 | * This is a ViewGroup by intention to enable child views in layouts to stay 38 | * interactive (like buttons) though transformed. 39 | *

40 | * Since this class is only used within the FancyCoverFlowAdapter it doesn't 41 | * need to check if there are multiple children or not (there can only be one at 42 | * all times). 43 | */ 44 | @SuppressWarnings("ConstantConditions") 45 | class FancyCoverFlowItemWrapper extends ViewGroup { 46 | 47 | // ============================================================================= 48 | // Private members 49 | // ============================================================================= 50 | 51 | private float saturation; 52 | 53 | private boolean isReflectionEnabled = false; 54 | 55 | private float imageReflectionRatio; 56 | 57 | private int reflectionGap; 58 | 59 | private float originalScaledownFactor; 60 | 61 | /** 62 | * This is a matrix to apply color filters (like saturation) to the wrapped 63 | * view. 64 | */ 65 | private ColorMatrix colorMatrix; 66 | 67 | /** 68 | * This paint is used to draw the wrapped view including any filters. 69 | */ 70 | private Paint paint; 71 | 72 | /** 73 | * This is a cache holding the wrapped view's visual representation. 74 | */ 75 | private Bitmap wrappedViewBitmap; 76 | 77 | /** 78 | * This canvas is used to let the wrapped view draw it's content. 79 | */ 80 | private Canvas wrappedViewDrawingCanvas; 81 | 82 | // ============================================================================= 83 | // Constructor 84 | // ============================================================================= 85 | 86 | public FancyCoverFlowItemWrapper(Context context) { 87 | super(context); 88 | this.init(); 89 | } 90 | 91 | public FancyCoverFlowItemWrapper(Context context, AttributeSet attrs) { 92 | super(context, attrs); 93 | this.init(); 94 | } 95 | 96 | public FancyCoverFlowItemWrapper(Context context, AttributeSet attrs, 97 | int defStyle) { 98 | super(context, attrs, defStyle); 99 | this.init(); 100 | } 101 | 102 | private void init() { 103 | this.paint = new Paint(); 104 | this.colorMatrix = new ColorMatrix(); 105 | // TODO: Define a default value for saturation inside an XML. 106 | this.setSaturation(1); 107 | } 108 | 109 | // ============================================================================= 110 | // Getters / Setters 111 | // ============================================================================= 112 | 113 | void setReflectionEnabled(boolean hasReflection) { 114 | if (hasReflection != this.isReflectionEnabled) { 115 | this.isReflectionEnabled = hasReflection; 116 | 117 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 118 | // Turn off hardware acceleration if necessary (reflections 119 | // won't support it). 120 | this.setLayerType(hasReflection ? View.LAYER_TYPE_SOFTWARE 121 | : View.LAYER_TYPE_HARDWARE, null); 122 | } 123 | 124 | this.remeasureChildren(); 125 | } 126 | } 127 | 128 | void setReflectionRatio(float imageReflectionRatio) { 129 | if (imageReflectionRatio != this.imageReflectionRatio) { 130 | this.imageReflectionRatio = imageReflectionRatio; 131 | this.remeasureChildren(); 132 | } 133 | } 134 | 135 | void setReflectionGap(int reflectionGap) { 136 | if (reflectionGap != this.reflectionGap) { 137 | this.reflectionGap = reflectionGap; 138 | this.remeasureChildren(); 139 | } 140 | } 141 | 142 | public void setSaturation(float saturation) { 143 | if (saturation != this.saturation) { 144 | this.saturation = saturation; 145 | this.colorMatrix.setSaturation(saturation); 146 | this.paint.setColorFilter(new ColorMatrixColorFilter( 147 | this.colorMatrix)); 148 | } 149 | } 150 | 151 | // ============================================================================= 152 | // Supertype overrides 153 | // ============================================================================= 154 | 155 | @Override 156 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 157 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 158 | this.remeasureChildren(); 159 | 160 | // If we have reflection enabled, the original image is scaled down and 161 | // a reflection is added beneath. Thus, 162 | // while maintaining the same height the width decreases and we need to 163 | // adjust measured width. 164 | // WARNING: This is a hack because we do not obey the EXACTLY 165 | // MeasureSpec mode that we will get mostly. 166 | if (this.isReflectionEnabled) { 167 | this.setMeasuredDimension( 168 | (int) (this.getMeasuredWidth() * this.originalScaledownFactor), 169 | this.getMeasuredHeight()); 170 | } 171 | } 172 | 173 | @SuppressLint("DrawAllocation") 174 | @Override 175 | protected void onLayout(boolean changed, int l, int t, int r, int b) { 176 | if (changed) { 177 | int measuredWidth = this.getMeasuredWidth(); 178 | int measuredHeight = this.getMeasuredHeight(); 179 | 180 | if (this.wrappedViewBitmap == null 181 | || this.wrappedViewBitmap.getWidth() != measuredWidth 182 | || this.wrappedViewBitmap.getHeight() != measuredHeight) { 183 | this.wrappedViewBitmap = Bitmap.createBitmap(measuredWidth, 184 | measuredHeight, Bitmap.Config.ARGB_8888); 185 | this.wrappedViewDrawingCanvas = new Canvas( 186 | this.wrappedViewBitmap); 187 | } 188 | 189 | View child = getChildAt(0); 190 | int childWidth = child.getMeasuredWidth(); 191 | int childHeight = child.getMeasuredHeight(); 192 | int childLeft = (measuredWidth - childWidth) / 2; 193 | int childRight = measuredWidth - childLeft; 194 | child.layout(childLeft, 0, childRight, childHeight); 195 | } 196 | } 197 | 198 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 199 | @Override 200 | protected void dispatchDraw(Canvas canvas) { 201 | View childView = getChildAt(0); 202 | 203 | if (childView != null) { 204 | // If on honeycomb or newer, cache the view. 205 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 206 | if (childView.isDirty()) { 207 | childView.draw(this.wrappedViewDrawingCanvas); 208 | 209 | if (this.isReflectionEnabled) { 210 | this.createReflectedImages(); 211 | } 212 | } 213 | } else { 214 | childView.draw(this.wrappedViewDrawingCanvas); 215 | } 216 | } 217 | 218 | canvas.drawBitmap(this.wrappedViewBitmap, 219 | (this.getWidth() - childView.getWidth()) / 2, 0, paint); 220 | } 221 | 222 | // ============================================================================= 223 | // Methods 224 | // ============================================================================= 225 | 226 | private void remeasureChildren() { 227 | View child = this.getChildAt(0); 228 | 229 | if (child != null) { 230 | // When reflection is enabled calculate proportional scale down 231 | // factor. 232 | final int originalChildHeight = this.getMeasuredHeight(); 233 | this.originalScaledownFactor = this.isReflectionEnabled ? (originalChildHeight 234 | * (1 - this.imageReflectionRatio) - reflectionGap) 235 | / originalChildHeight 236 | : 1.0f; 237 | final int childHeight = (int) (this.originalScaledownFactor * originalChildHeight); 238 | final int childWidth = (int) (this.originalScaledownFactor * getMeasuredWidth()); 239 | 240 | int heightSpec = MeasureSpec.makeMeasureSpec(childHeight, 241 | MeasureSpec.AT_MOST); 242 | int widthSpec = MeasureSpec.makeMeasureSpec(childWidth, 243 | MeasureSpec.AT_MOST); 244 | this.getChildAt(0).measure(widthSpec, heightSpec); 245 | } 246 | } 247 | 248 | /** 249 | * Creates the reflected images. 250 | * 251 | * @return true, if successful 252 | */ 253 | private void createReflectedImages() { 254 | 255 | final int width = this.wrappedViewBitmap.getWidth(); 256 | final int height = this.wrappedViewBitmap.getHeight(); 257 | 258 | final Matrix matrix = new Matrix(); 259 | matrix.postScale(1, -1); 260 | 261 | final int scaledDownHeight = (int) (height * originalScaledownFactor); 262 | final int invertedHeight = height - scaledDownHeight - reflectionGap; 263 | final int invertedBitmapSourceTop = scaledDownHeight - invertedHeight; 264 | final Bitmap invertedBitmap = Bitmap.createBitmap( 265 | this.wrappedViewBitmap, 0, invertedBitmapSourceTop, width, 266 | invertedHeight, matrix, true); 267 | 268 | this.wrappedViewDrawingCanvas.drawBitmap(invertedBitmap, 0, 269 | scaledDownHeight + reflectionGap, null); 270 | 271 | final Paint paint = new Paint(); 272 | final LinearGradient shader = new LinearGradient(0, height 273 | * imageReflectionRatio + reflectionGap, 0, height, 0x70ffffff, 274 | 0x00ffffff, Shader.TileMode.CLAMP); 275 | paint.setShader(shader); 276 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); 277 | this.wrappedViewDrawingCanvas.drawRect(0, height 278 | * (1 - imageReflectionRatio), width, height, paint); 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/at/technikum/mti/fancycoverflow/ViewUtil.java: -------------------------------------------------------------------------------- 1 | package at.technikum.mti.fancycoverflow; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * @author dfs212 7 | * 8 | */ 9 | public class ViewUtil { 10 | 11 | /** 12 | * dpתpx 13 | * 14 | * @param context 15 | * @param dp 16 | * @return 17 | */ 18 | public static int Dp2Px(Context context, float dp) { 19 | final float scale = context.getResources().getDisplayMetrics().density; 20 | return (int) (dp * scale + 0.5f); 21 | } 22 | 23 | /** 24 | * pxתdp 25 | * @param context 26 | * @param px 27 | * @return 28 | */ 29 | public static int Px2Dp(Context context, float px) { 30 | final float scale = context.getResources().getDisplayMetrics().density; 31 | return (int) (px / scale + 0.5f); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/com/gl/glfancycoverflow/FilmInfoTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/src/com/gl/glfancycoverflow/FilmInfoTest.java -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/com/gl/glfancycoverflow/ImageAdapter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/src/com/gl/glfancycoverflow/ImageAdapter.java -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/com/gl/glfancycoverflow/MainActivity.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/src/com/gl/glfancycoverflow/MainActivity.java -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/com/gl/glfancycoverflow/UILApplication.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LittleLiByte/GlFancyCoverFlow/ec20f2a7087f7b3f56da97873ec630f7e4109004/GlFancyCoverFlow/src/com/gl/glfancycoverflow/UILApplication.java -------------------------------------------------------------------------------- /GlFancyCoverFlow/src/com/gl/glfancycoverflow/model/FilmInfo.java: -------------------------------------------------------------------------------- 1 | package com.gl.glfancycoverflow.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author LittleLiByte 7 | * 8 | */ 9 | public class FilmInfo implements Serializable { 10 | 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 1L; 15 | private String filmName; 16 | private String filmImageLink; 17 | private String fileDetailUrl; 18 | 19 | public FilmInfo(String filmName, String filmImageLink, String fileDetailUrl) { 20 | super(); 21 | this.filmName = filmName; 22 | this.filmImageLink = filmImageLink; 23 | this.fileDetailUrl = fileDetailUrl; 24 | } 25 | 26 | public String getFilmName() { 27 | return filmName; 28 | } 29 | 30 | public void setFilmName(String filmName) { 31 | this.filmName = filmName; 32 | } 33 | 34 | public String getFilmImageLink() { 35 | return filmImageLink; 36 | } 37 | 38 | public void setFilmImageLink(String filmImageLink) { 39 | this.filmImageLink = filmImageLink; 40 | } 41 | 42 | public String getFileDetailUrl() { 43 | return fileDetailUrl; 44 | } 45 | 46 | public void setFileDetailUrl(String fileDetailUrl) { 47 | this.fileDetailUrl = fileDetailUrl; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "FilmInfo [filmName=" + filmName + ", filmImageLink=" 53 | + filmImageLink + ", fileDetail=" + fileDetailUrl + "]"; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 更新版本,可以控制图片大小,去掉倒影效果 2 | 3 | GlFancyCoverFlow 4 | ================ 5 | 6 | 由FancyCoverFlow改版 7 | 现在网上有很多3D gallery了,但是基本都是都要旋转角度的,如果想要平铺即旋转角为0在屏幕上展示多个图片,会发现图片会有间隙, 8 | 并且没有层次感,而调整为无缝隙比较麻烦,再此要特别感谢eoe论坛的dkmeteor仓鼠君给予的指点,无缝隙的gallery就是他改造 9 | FancyCoverFlow而成。本demo多应用于影院海报展示,使用UiversalImageLoader从网络获取图片,可以无限轮播,可以选择自动轮播或者 10 | 手动滑动。 11 | 12 | ![](https://github.com/LittleLiByte/GlFancyCoverFlow/blob/master/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141029.png) 13 | 14 | ![](https://github.com/LittleLiByte/GlFancyCoverFlow/blob/master/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141041.png) 15 | 16 | ![](https://github.com/LittleLiByte/GlFancyCoverFlow/blob/master/GlFancyCoverFlow/res/raw/ScreenShots/device-2014-10-15-141056.png) 17 | 18 | --------------------------------------------------------------------------------