diff --git a/eclipse-compile/fab/.classpath b/eclipse-compile/fab/.classpath deleted file mode 100644 index c6e9dc9f1d..0000000000 --- a/eclipse-compile/fab/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/fab/.gitignore b/eclipse-compile/fab/.gitignore deleted file mode 100644 index e614fbbef9..0000000000 --- a/eclipse-compile/fab/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -gen diff --git a/eclipse-compile/fab/.project b/eclipse-compile/fab/.project deleted file mode 100644 index b53f0578e5..0000000000 --- a/eclipse-compile/fab/.project +++ /dev/null @@ -1,39 +0,0 @@ - - - ShellFab - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - org.eclipse.xtext.ui.shared.xtextNature - - diff --git a/eclipse-compile/fab/AndroidManifest.xml b/eclipse-compile/fab/AndroidManifest.xml deleted file mode 100644 index 7e0d38def5..0000000000 --- a/eclipse-compile/fab/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/eclipse-compile/fab/java/com/software/shell/fab/ActionButton.java b/eclipse-compile/fab/java/com/software/shell/fab/ActionButton.java deleted file mode 100644 index 0da0da5d0c..0000000000 --- a/eclipse-compile/fab/java/com/software/shell/fab/ActionButton.java +++ /dev/null @@ -1,1432 +0,0 @@ -/* - * Copyright 2015 Shell Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * File created: 2015-01-17 10:39:13 - */ - -package com.software.shell.fab; - -import android.annotation.SuppressLint; -import android.annotation.TargetApi; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.*; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.util.AttributeSet; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewOutlineProvider; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; - -/** - * This class represents a Action Button, which is used in - * Material Design - * - * @author Vladislav - * @version 1.0.3 - * @since 1.0.0 - */ -public class ActionButton extends View { - - /** - * Logging tag - */ - private static final String LOG_TAG = "FAB"; - - /** - * Action Button type - */ - private Type type = Type.DEFAULT; - - /** - * Action Button state - */ - private State state = State.NORMAL; - - /** - * Action Button color in {@link State#NORMAL} state - */ - private int buttonColor = Color.LTGRAY; - - /** - * Action Button color in {@link State#PRESSED} state - */ - private int buttonColorPressed = Color.DKGRAY; - - /** - * Shadow radius expressed in actual pixels - */ - private float shadowRadius = MetricsConverter.dpToPx(getContext(), 2.0f); - - /** - * Shadow X-axis offset expressed in actual pixels - */ - private float shadowXOffset = MetricsConverter.dpToPx(getContext(), 1.0f); - - /** - * Shadow Y-axis offset expressed in actual pixels - */ - private float shadowYOffset = MetricsConverter.dpToPx(getContext(), 1.5f); - - /** - * Shadow color - */ - private int shadowColor = Color.parseColor("#757575"); - - /** - * Stroke width - */ - private float strokeWidth = 0.0f; - - /** - * Stroke color - */ - private int strokeColor = Color.BLACK; - - /** - * Action Button image drawable centered inside the view - */ - private Drawable image; - - /** - * Size of the Action Button image inside the view - */ - private float imageSize = MetricsConverter.dpToPx(getContext(), 24.0f); - - /** - * Animation, which is used while showing Action Button - */ - private Animation showAnimation; - - /** - * Animation, which is used while hiding or dismissing Action Button - */ - private Animation hideAnimation; - - /** - * {@link android.graphics.Paint}, which is used for drawing the elements of - * Action Button - */ - protected final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - - /** - * Creates an instance of the Action Button - *

- * Used when instantiating Action Button programmatically - * - * @param context context the view is running in - */ - public ActionButton(Context context) { - super(context); - initActionButton(); - } - - /** - * Creates an instance of the Action Button - *

- * Used when inflating the declared Action Button - * within XML resource - * - * @param context context the view is running in - * @param attrs attributes of the XML tag that is inflating the view - */ - public ActionButton(Context context, AttributeSet attrs) { - super(context, attrs); - initActionButton(context, attrs, 0, 0); - } - - /** - * Creates an instance of the Action Button - *

- * Used when inflating the declared Action Button - * within XML resource - * - * @param context context the view is running in - * @param attrs attributes of the XML tag that is inflating the view - * @param defStyleAttr attribute in the current theme that contains a - * reference to a style resource that supplies default values for - * the view. Can be 0 to not look for defaults - */ - public ActionButton(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initActionButton(context, attrs, defStyleAttr, 0); - } - - /** - * Creates an instance of the Action Button - *

- * Used when inflating the declared Action Button - * within XML resource - *

- * Might be called if target API is LOLLIPOP (21) and higher - * - * @param context context the view is running in - * @param attrs attributes of the XML tag that is inflating the view - * @param defStyleAttr attribute in the current theme that contains a - * reference to a style resource that supplies default values for - * the view. Can be 0 to not look for defaults - * @param defStyleRes resource identifier of a style resource that - * supplies default values for the view, used only if - * defStyleAttr is 0 or can not be found in the theme. Can be 0 - * to not look for defaults - */ - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public ActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - initActionButton(context, attrs, defStyleAttr, defStyleRes); - } - - /** - * Initializes the Action Button, which is created programmatically - */ - private void initActionButton() { - initLayerType(); - Log.v(LOG_TAG, "Action Button initialized"); - } - - /** - * Initializes the Action Button, which is declared within XML resource - *

- * Makes calls to different initialization methods for parameters initialization. - * For those parameters, which are not declared in the XML resource, - * the default value will be used - * - * @param context context the view is running in - * @param attrs attributes of the XML tag that is inflating the view - * @param defStyleAttr attribute in the current theme that contains a - * reference to a style resource that supplies default values for - * the view. Can be 0 to not look for defaults - * @param defStyleRes resource identifier of a style resource that - * supplies default values for the view, used only if - * defStyleAttr is 0 or can not be found in the theme. Can be 0 - * to not look for defaults - */ - private void initActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - initLayerType(); - TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton, - defStyleAttr, defStyleRes); - try { - initType(attributes); - initButtonColor(attributes); - initButtonColorPressed(attributes); - initShadowRadius(attributes); - initShadowXOffset(attributes); - initShadowYOffset(attributes); - initShadowColor(attributes); - initStrokeWidth(attributes); - initStrokeColor(attributes); - initImage(attributes); - initImageSize(attributes); - initShowAnimation(attributes); - initHideAnimation(attributes); - } catch (Exception e) { - Log.e(LOG_TAG, "Unable to read attr", e); - } finally { - attributes.recycle(); - } - Log.v(LOG_TAG, "Action Button initialized"); - } - - /** - * Initializes the layer type needed for shadows drawing - *

- * Might be called if target API is HONEYCOMB (11) and higher - */ - @TargetApi(Build.VERSION_CODES.HONEYCOMB) - private void initLayerType() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - setLayerType(LAYER_TYPE_SOFTWARE, paint); - Log.v(LOG_TAG, "Layer type initialized"); - } - } - - /** - * Initializes the {@link Type} of Action Button - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initType(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_type)) { - final int id = attrs.getInteger(R.styleable.ActionButton_type, type.getId()); - type = Type.forId(id); - Log.v(LOG_TAG, "Initialized type: " + getType()); - } - } - - /** - * Initializes the Action Button color for - * {@link #state} set to {@link State#NORMAL} - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initButtonColor(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_button_color)) { - buttonColor = attrs.getColor(R.styleable.ActionButton_button_color, buttonColor); - Log.v(LOG_TAG, "Initialized button color: " + getButtonColor()); - } - } - - /** - * Initializes the Action Button color for - * {@link #state} set to {@link State#PRESSED} - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initButtonColorPressed(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_button_colorPressed)) { - buttonColorPressed = attrs.getColor(R.styleable.ActionButton_button_colorPressed, - buttonColorPressed); - Log.v(LOG_TAG, "Initialized button color pressed: " + getButtonColorPressed()); - } - } - - /** - * Initializes the shadow radius - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initShadowRadius(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_shadow_radius)) { - shadowRadius = attrs.getDimension(R.styleable.ActionButton_shadow_radius, shadowRadius); - Log.v(LOG_TAG, "Initialized shadow radius: " + getShadowRadius()); - } - } - - /** - * Initializes the shadow X-axis offset - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initShadowXOffset(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_shadow_xOffset)) { - shadowXOffset = attrs.getDimension(R.styleable.ActionButton_shadow_xOffset, shadowXOffset); - Log.v(LOG_TAG, "Initialized shadow X-axis offset: " + getShadowXOffset()); - } - } - - /** - * Initializes the shadow Y-axis offset - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initShadowYOffset(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_shadow_yOffset)) { - shadowYOffset = attrs.getDimension(R.styleable.ActionButton_shadow_yOffset, shadowYOffset); - Log.v(LOG_TAG, "Initialized shadow Y-axis offset: " + getShadowYOffset()); - } - } - - /** - * Initializes the shadow color - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initShadowColor(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_shadow_color)) { - shadowColor = attrs.getColor(R.styleable.ActionButton_shadow_color, shadowColor); - Log.v(LOG_TAG, "Initialized shadow color: " + getShadowColor()); - } - } - - /** - * Initializes the stroke width - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initStrokeWidth(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_stroke_width)) { - strokeWidth = attrs.getDimension(R.styleable.ActionButton_stroke_width, strokeWidth); - Log.v(LOG_TAG, "Initialized stroke width: " + getStrokeWidth()); - } - } - - /** - * Initializes the stroke color - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initStrokeColor(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_stroke_color)) { - strokeColor = attrs.getColor(R.styleable.ActionButton_stroke_color, strokeColor); - Log.v(LOG_TAG, "Initialized stroke color: " + getStrokeColor()); - } - } - - /** - * Initializes the animation, which is used while showing - * Action Button - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initShowAnimation(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_show_animation)) { - final int animResId = attrs.getResourceId(R.styleable.ActionButton_show_animation, - Animations.NONE.animResId); - showAnimation = Animations.load(getContext(), animResId); - Log.v(LOG_TAG, "Initialized animation on show"); - } - } - - /** - * Initializes the animation, which is used while hiding or dismissing - * Action Button - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initHideAnimation(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_hide_animation)) { - final int animResId = attrs.getResourceId(R.styleable.ActionButton_hide_animation, - Animations.NONE.animResId); - hideAnimation = Animations.load(getContext(), animResId); - Log.v(LOG_TAG, "Initialized animation on hide"); - } - } - - /** - * Initializes the image inside Action Button - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initImage(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_image)) { - image = attrs.getDrawable(R.styleable.ActionButton_image); - Log.v(LOG_TAG, "Initialized image"); - } - } - - /** - * Initializes the image size inside Action Button - *

- * Changing the default size of the image breaks the rules of - * Material Design - * - * @param attrs attributes of the XML tag that is inflating the view - */ - private void initImageSize(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_image_size)) { - imageSize = attrs.getDimension(R.styleable.ActionButton_image_size, imageSize); - Log.v(LOG_TAG, "Initialized image size: " + getImageSize()); - } - } - - /** - * Plays the {@link #showAnimation} if set - */ - public void playShowAnimation() { - startAnimation(getShowAnimation()); - } - - /** - * Plays the {@link #hideAnimation} if set - */ - public void playHideAnimation() { - startAnimation(getHideAnimation()); - } - - /** - * Makes the Action Button to appear and - * sets its visibility to {@link #VISIBLE} - *

- * {@link #showAnimation} is played if set - */ - public void show() { - if (isHidden()) { - playShowAnimation(); - setVisibility(VISIBLE); - Log.v(LOG_TAG, "Action Button shown"); - } - } - - /** - * Makes the Action Button to disappear and - * sets its visibility to {@link #INVISIBLE} - *

- * {@link #hideAnimation} is played if set - */ - public void hide() { - if (!isHidden() && !isDismissed()) { - playHideAnimation(); - setVisibility(INVISIBLE); - Log.v(LOG_TAG, "Action Button hidden"); - } - } - - /** - * Completely dismisses the Action Button, - * sets its visibility to {@link #GONE} and removes it from the parent view - *

- * After calling this method any calls to {@link #show()} won't result in showing - * the Action Button so far as it is removed from the parent View - *

- * {@link #hideAnimation} is played if set - */ - public void dismiss() { - if (!isDismissed()) { - if (!isHidden()) { - playHideAnimation(); - } - setVisibility(GONE); - ViewGroup parent = (ViewGroup) getParent(); - parent.removeView(this); - Log.v(LOG_TAG, "Action Button dismissed"); - } - } - - /** - * Checks whether Action Button is hidden - * - * @return true if Action Button is hidden, otherwise false - */ - public boolean isHidden() { - return getVisibility() == INVISIBLE; - } - - /** - * Checks whether Action Button is dismissed - * - * @return true if Action Button is dismissed, otherwise false - */ - public boolean isDismissed() { - ViewGroup parent = (ViewGroup) getParent(); - return parent == null; - } - - /** - * Returns the size of the Action Button in actual pixels (px). - * Size of the Action Button is the diameter of the main circle - * - * @return size of the Action Button in actual pixels (px) - */ - public int getButtonSize() { - final int buttonSize = (int) type.getSize(getContext()); - Log.v(LOG_TAG, "Button size is: " + buttonSize); - return buttonSize; - } - - /** - * Returns the type of the Action Button - * - * @return type of the Action Button - */ - public Type getType() { - return type; - } - - /** - * Sets the type of the Action Button and - * invalidates the layout of the view - * - * @param type type of the Action Button - */ - public void setType(Type type) { - this.type = type; - requestLayout(); - Log.v(LOG_TAG, "Type changed to: " + getType()); - } - - /** - * Returns the current state of the Action Button - * - * @return current state of the Action Button - */ - public State getState() { - return state; - } - - /** - * Sets the current state of the Action Button and - * invalidates the view - * - * @param state new state of the Action Button - */ - public void setState(State state) { - this.state = state; - invalidate(); - Log.v(LOG_TAG, "State changed to: " + getState()); - } - - /** - * Returns the Action Button color when in - * {@link State#NORMAL} state - * - * @return Action Button color when in - * {@link State#NORMAL} state - */ - public int getButtonColor() { - return buttonColor; - } - - /** - * Sets the Action Button color when in - * {@link State#NORMAL} state and invalidates the view - * - * @param buttonColor Action Button color - * when in {@link State#NORMAL} state - */ - public void setButtonColor(int buttonColor) { - this.buttonColor = buttonColor; - invalidate(); - Log.v(LOG_TAG, "Color changed to: " + getButtonColor()); - } - - /** - * Sets the Action Button color when in - * {@link State#PRESSED} state - * - * @return Action Button color when in - * {@link State#PRESSED} state - */ - public int getButtonColorPressed() { - return buttonColorPressed; - } - - /** - * Sets the Action Button color when in - * {@link State#PRESSED} state and invalidates the view - * - * @param buttonColorPressed Action Button color - * when in {@link State#PRESSED} state - */ - public void setButtonColorPressed(int buttonColorPressed) { - this.buttonColorPressed = buttonColorPressed; - invalidate(); - Log.v(LOG_TAG, "Pressed color changed to: " + getButtonColorPressed()); - } - - /** - * Checks whether Action Button has shadow by determining shadow radius - *

- * Shadow is disabled if elevation is set API level is {@code 21 Lollipop} and higher - * - * @return true if Action Button has radius, otherwise false - */ - public boolean hasShadow() { - return !hasElevation() && getShadowRadius() > 0.0f; - } - - /** - * Returns the Action Button shadow radius in actual - * pixels (px) - * - * @return Action Button shadow radius in actual pixels (px) - */ - public float getShadowRadius() { - return shadowRadius; - } - - /** - * Sets the Action Button shadow radius and - * invalidates the layout of the view - *

- * Must be specified in density-independent (dp) pixels, which are - * then converted into actual pixels (px). If shadow radius is set to 0, - * shadow is removed - * - * @param shadowRadius shadow radius specified in density-independent - * (dp) pixels - */ - public void setShadowRadius(float shadowRadius) { - this.shadowRadius = MetricsConverter.dpToPx(getContext(), shadowRadius); - requestLayout(); - Log.v(LOG_TAG, "Shadow radius changed to:" + getShadowRadius()); - } - - /** - * Removes the Action Button shadow by setting its radius to 0 - */ - public void removeShadow() { - if (hasShadow()) { - setShadowRadius(0.0f); - } - } - - /** - * Returns the Action Button shadow X-axis offset - * in actual pixels (px) - *

- * If X-axis offset is greater than 0 shadow is shifted right. - * If X-axis offset is lesser than 0 shadow is shifted left. - * 0 X-axis offset means that shadow is not X-axis shifted at all - * - * @return Action Button shadow X-axis offset - * in actual pixels (px) - */ - public float getShadowXOffset() { - return shadowXOffset; - } - - /** - * Sets the Action Button shadow X-axis offset and - * invalidates the layout of the view - *

- * If X-axis offset is greater than 0 shadow is shifted right. - * If X-axis offset is lesser than 0 shadow is shifted left. - * 0 X-axis offset means that shadow is not shifted at all - *

- * Must be specified in density-independent (dp) pixels, which are - * then converted into actual pixels (px) - * - * @param shadowXOffset shadow X-axis offset specified in density-independent - * (dp) pixels - */ - public void setShadowXOffset(float shadowXOffset) { - this.shadowXOffset = MetricsConverter.dpToPx(getContext(), shadowXOffset); - requestLayout(); - Log.v(LOG_TAG, "Shadow X offset changed to: " + getShadowXOffset()); - } - - /** - * Returns the Action Button shadow Y-axis offset - * in actual pixels (px) - *

- * If Y-axis offset is greater than 0 shadow is shifted down. - * If Y-axis offset is lesser than 0 shadow is shifted up. - * 0 Y-axis offset means that shadow is not Y-axis shifted at all - * - * @return Action Button shadow Y-axis offset - * in actual pixels (px) - */ - public float getShadowYOffset() { - return shadowYOffset; - } - - /** - * Sets the Action Button shadow Y-axis offset and - * invalidates the layout of the view - *

- * If Y-axis offset is greater than 0 shadow is shifted down. - * If Y-axis offset is lesser than 0 shadow is shifted up. - * 0 Y-axis offset means that shadow is not Y-axis shifted at all - *

- * Must be specified in density-independent (dp) pixels, which are - * then converted into actual pixels (px) - * - * @param shadowYOffset shadow Y-axis offset specified in density-independent - * (dp) pixels - */ - public void setShadowYOffset(float shadowYOffset) { - this.shadowYOffset = MetricsConverter.dpToPx(getContext(), shadowYOffset); - requestLayout(); - Log.v(LOG_TAG, "Shadow Y offset changed to:" + getShadowYOffset()); - } - - /** - * Returns Action Button shadow color - * - * @return Action Button shadow color - */ - public int getShadowColor() { - return shadowColor; - } - - /** - * Sets the Action Button shadow color and - * invalidates the view - * - * @param shadowColor Action Button color - */ - public void setShadowColor(int shadowColor) { - this.shadowColor = shadowColor; - invalidate(); - Log.v(LOG_TAG, "Shadow color changed to: " + getShadowColor()); - } - - /** - * Returns the Action Button stroke width in actual - * pixels (px) - * - * @return Action Button stroke width in actual - * pixels (px) - */ - public float getStrokeWidth() { - return strokeWidth; - } - - /** - * Checks whether Action Button has stroke by checking - * stroke width - * - * @return true if Action Button has stroke, otherwise false - */ - public boolean hasStroke() { - return getStrokeWidth() > 0.0f; - } - - /** - * Sets the Action Button stroke width and - * invalidates the layout of the view - *

- * Stroke width value must be greater than 0. If stroke width is - * set to 0 stroke is removed - *

- * Must be specified in density-independent (dp) pixels, which are - * then converted into actual pixels (px) - * - * @param strokeWidth stroke width specified in density-independent - * (dp) pixels - */ - public void setStrokeWidth(float strokeWidth) { - this.strokeWidth = MetricsConverter.dpToPx(getContext(), strokeWidth); - requestLayout(); - Log.v(LOG_TAG, "Stroke width changed to: " + getStrokeWidth()); - } - - /** - * Removes the Action Button stroke by setting its width to 0 - */ - public void removeStroke() { - if (hasStroke()) { - setStrokeWidth(0.0f); - } - } - - /** - * Returns the Action Button stroke color - * - * @return Action Button stroke color - */ - public int getStrokeColor() { - return strokeColor; - } - - /** - * Sets the Action Button stroke color and - * invalidates the view - * - * @param strokeColor Action Button stroke color - */ - public void setStrokeColor(int strokeColor) { - this.strokeColor = strokeColor; - invalidate(); - Log.v(LOG_TAG, "Stroke color changed to: " + getStrokeColor()); - } - - /** - * Returns the Action Button image drawable centered - * inside the view - * - * @return Action Button image drawable centered - * inside the view - */ - public Drawable getImage() { - return image; - } - - /** - * Checks whether Action Button has an image centered - * inside the view - * - * @return true if Action Button has an image centered - * inside the view, otherwise false - */ - public boolean hasImage() { - return getImage() != null; - } - - /** - * Places the image drawable centered inside the view and - * invalidates the view - *

- * Size of the image while drawing is fit to {@link #imageSize} - * - * @param image image drawable, which will be placed centered - * inside the view - */ - public void setImageDrawable(Drawable image) { - this.image = image; - invalidate(); - Log.v(LOG_TAG, "Image drawable set"); - } - - /** - * Resolves the drawable resource id and places the resolved image drawable - * centered inside the view - * - * @param resId drawable resource id, which is to be resolved to - * image drawable and used as parameter when calling - * {@link #setImageDrawable(android.graphics.drawable.Drawable)} - */ - public void setImageResource(int resId) { - setImageDrawable(getResources().getDrawable(resId)); - } - - /** - * Creates the {@link android.graphics.drawable.BitmapDrawable} from the given - * {@link android.graphics.Bitmap} and places it centered inside the view - * - * @param bitmap bitmap, from which {@link android.graphics.drawable.BitmapDrawable} - * is created and used as parameter when calling - * {@link #setImageDrawable(android.graphics.drawable.Drawable)} - */ - public void setImageBitmap(Bitmap bitmap) { - setImageDrawable(new BitmapDrawable(getResources(), bitmap)); - } - - /** - * Removes the Action Button image by setting its value to null - */ - public void removeImage() { - if (hasImage()) { - setImageDrawable(null); - } - } - - /** - * Returns the Action Button image size in actual pixels (px). - * If Action Button image is not set returns 0 - * - * @return Action Button image size in actual pixels (px), - * 0 if image is not set - */ - public float getImageSize() { - return getImage() != null ? imageSize : 0.0f; - } - - /** - * Sets the size of the Action Button image - *

- * Changing the default size of the image breaks the rules of - * Material Design - *

- * Must be specified in density-independent (dp) pixels, which are - * then converted into actual pixels (px) - * - * @param size size of the Action Button image - * specified in density-independent (dp) pixels - */ - public void setImageSize(float size) { - this.imageSize = MetricsConverter.dpToPx(getContext(), size); - Log.v(LOG_TAG, "Image size changed to: " + getImageSize()); - } - - /** - * Returns an animation, which is used while showing Action Button - * - * @return animation, which is used while showing Action Button - */ - public Animation getShowAnimation() { - return showAnimation; - } - - /** - * Sets the animation, which is used while showing Action Button - * - * @param animation animation, which is to be used while showing - * Action Button - */ - public void setShowAnimation(Animation animation) { - this.showAnimation = animation; - Log.v(LOG_TAG, "Show animation set"); - } - - /** - * Sets one of the {@link Animations} as animation, which is used while showing - * Action Button - * - * @param animation one of the {@link Animations}, which is to be used while - * showing Action Button - */ - public void setShowAnimation(Animations animation) { - setShowAnimation(Animations.load(getContext(), animation.animResId)); - } - - /** - * Removes the animation, which is used while showing Action Button - */ - public void removeShowAnimation() { - setShowAnimation(Animations.NONE); - Log.v(LOG_TAG, "Show animation removed"); - } - - /** - * Returns an animation, which is used while hiding Action Button - * - * @return animation, which is used while hiding Action Button - */ - public Animation getHideAnimation() { - return hideAnimation; - } - - /** - * Sets the animation, which is used while hiding Action Button - * - * @param animation animation, which is to be used while hiding - * Action Button - */ - public void setHideAnimation(Animation animation) { - this.hideAnimation = animation; - Log.v(LOG_TAG, "Hide animation set"); - } - - /** - * Sets one of the {@link Animations} as animation, which is used while hiding - * Action Button - * - * @param animation one of the {@link Animations}, which is to be used while - * hiding Action Button - */ - public void setHideAnimation(Animations animation) { - setHideAnimation(Animations.load(getContext(), animation.animResId)); - } - - public void removeHideAnimation() { - setHideAnimation(Animations.NONE); - Log.v(LOG_TAG, "Hide animation removed"); - } - - /** - * Adds additional actions on motion events: - * 1. Changes the Action Button {@link #state} to {@link State#PRESSED} - * on {@link android.view.MotionEvent#ACTION_DOWN} - * 2. Changes the Action Button {@link #state} to {@link State#NORMAL} - * on {@link android.view.MotionEvent#ACTION_UP} - * - * @param event motion event - * @return true if event was handled, otherwise false - */ - @SuppressWarnings("all") - @SuppressLint("ClickableViewAccessibility") - @Override - public boolean onTouchEvent(MotionEvent event) { - super.onTouchEvent(event); - final int action = event.getAction(); - switch (action) { - case MotionEvent.ACTION_DOWN: - Log.v(LOG_TAG, "Motion event action down detected"); - setState(State.PRESSED); - return true; - case MotionEvent.ACTION_UP: - Log.v(LOG_TAG, "Motion event action up detected"); - setState(State.NORMAL); - return true; - default: - Log.v(LOG_TAG, "Unrecognized motion event detected"); - return false; - } - } - - /** - * Adds additional checking whether animation is null before starting to play it - * - * @param animation animation to play - */ - @SuppressWarnings("all") - @Override - public void startAnimation(Animation animation) { - if (animation != null) { - super.startAnimation(animation); - } - } - - /** - * Resets the paint to its default values and sets initial flags to it - *

- * Use this method before drawing the new element of the view - */ - protected final void resetPaint() { - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - Log.v(LOG_TAG, "Paint reset"); - } - - /** - * Draws the elements of the Action Button - * - * @param canvas canvas, on which the drawing is to be performed - */ - @SuppressWarnings("all") - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - Log.v(LOG_TAG, "Action Button onDraw called"); - drawCircle(canvas); - if (hasElevation()) { - drawElevation(); - } - if (hasStroke()) { - drawStroke(canvas); - } - if (hasImage()) { - drawImage(canvas); - } - } - - /** - * Draws the main circle of the Action Button and calls - * {@link #drawShadow()} to draw the shadow if present - * - * @param canvas canvas, on which circle is to be drawn - */ - protected void drawCircle(Canvas canvas) { - resetPaint(); - if (hasShadow()) { - drawShadow(); - } - paint.setStyle(Paint.Style.FILL); - paint.setColor(getState() == State.PRESSED ? getButtonColorPressed() : getButtonColor()); - canvas.drawCircle(calculateCenterX(), calculateCenterY(), calculateCircleRadius(), paint); - Log.v(LOG_TAG, "Circle drawn"); - } - - /** - * Calculates the X-axis center coordinate of the entire view - * - * @return X-axis center coordinate of the entire view - */ - protected float calculateCenterX() { - final float centerX = getMeasuredWidth() / 2; - Log.v(LOG_TAG, "Calculated center X = " + centerX); - return centerX; - } - - /** - * Calculates the Y-axis center coordinate of the entire view - * - * @return Y-axis center coordinate of the entire view - */ - protected float calculateCenterY() { - final float centerY = getMeasuredHeight() / 2; - Log.v(LOG_TAG, "Calculated center Y = " + centerY); - return centerY; - } - - /** - * Calculates the radius of the main circle - * - * @return radius of the main circle - */ - protected final float calculateCircleRadius() { - final float circleRadius = getButtonSize() / 2; - Log.v(LOG_TAG, "Calculated circle circleRadius = " + circleRadius); - return circleRadius; - } - - /** - * Draws the shadow if view elevation is not enabled - */ - protected void drawShadow() { - paint.setShadowLayer(getShadowRadius(), getShadowXOffset(), getShadowYOffset(), getShadowColor()); - Log.v(LOG_TAG, "Shadow drawn"); - } - - /** - * Draws the elevation around the main circle - *

- * Uses the stroke corrective, which helps to avoid the elevation overlapping issue - */ - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - protected void drawElevation() { - final int strokeWeightCorrective = (int) (getStrokeWidth() / 1.5f); - final int width = getWidth() - strokeWeightCorrective; - final int height = getHeight() - strokeWeightCorrective; - final ViewOutlineProvider outlineProvider = new ActionButtonOutlineProvider(width, height); - setOutlineProvider(outlineProvider); - Log.v(LOG_TAG, "Elevation drawn"); - } - - /** - * Checks whether view elevation is enabled - * - * @return true if view elevation enabled, otherwise false - */ - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - private boolean hasElevation() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && getElevation() > 0.0f; - } - - /** - * Draws stroke around the main circle - * - * @param canvas canvas, on which circle is to be drawn - */ - protected void drawStroke(Canvas canvas) { - resetPaint(); - paint.setStyle(Paint.Style.STROKE); - paint.setStrokeWidth(getStrokeWidth()); - paint.setColor(getStrokeColor()); - canvas.drawCircle(calculateCenterX(), calculateCenterY(), calculateCircleRadius(), paint); - Log.v(LOG_TAG, "Stroke drawn"); - } - - /** - * Draws the image centered inside the view - * - * @param canvas canvas, on which circle is to be drawn - */ - protected void drawImage(Canvas canvas) { - final int startPointX = (int) (calculateCenterX() - getImageSize() / 2); - final int startPointY = (int) (calculateCenterY() - getImageSize() / 2); - final int endPointX = (int) (startPointX + getImageSize()); - final int endPointY = (int) (startPointY + getImageSize()); - getImage().setBounds(startPointX, startPointY, endPointX, endPointY); - getImage().draw(canvas); - Log.v(LOG_TAG, String.format("Image drawn on canvas with coordinates: startPointX = %s, startPointY = %s, " + - "endPointX = %s, endPointY = %s", startPointX, startPointY, endPointX, endPointY)); - } - - /** - * Sets the measured dimension for the entire view - * - * @param widthMeasureSpec horizontal space requirements as imposed by the parent. - * The requirements are encoded with - * {@link android.view.View.MeasureSpec} - * @param heightMeasureSpec vertical space requirements as imposed by the parent. - * The requirements are encoded with - * {@link android.view.View.MeasureSpec} - */ - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - Log.v(LOG_TAG, "Action Button onMeasure called"); - setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight()); - Log.v(LOG_TAG, String.format("View size measured with: height = %s, width = %s", getHeight(), getWidth())); - } - - /** - * Calculates the measured width in actual pixels for the entire view - * - * @return measured width in actual pixels for the entire view - */ - private int calculateMeasuredWidth() { - final int measuredWidth = getButtonSize() + calculateShadowWidth() + calculateStrokeWeight(); - Log.v(LOG_TAG, "Calculated measured width = " + measuredWidth); - return measuredWidth; - } - - /** - * Calculates the measured height in actual pixels for the entire view - * - * @return measured width in actual pixels for the entire view - */ - private int calculateMeasuredHeight() { - final int measuredHeight = getButtonSize() + calculateShadowHeight() + calculateStrokeWeight(); - Log.v(LOG_TAG, "Calculated measured height = " + measuredHeight); - return measuredHeight; - } - - /** - * Calculates shadow width in actual pixels - * - * @return shadow width in actual pixels - */ - private int calculateShadowWidth() { - final int shadowWidth = hasShadow() ? (int) ((getShadowRadius() + Math.abs(getShadowXOffset())) * 2) : 0; - Log.v(LOG_TAG, "Calculated shadow width = " + shadowWidth); - return shadowWidth; - } - - /** - * Calculates shadow height in actual pixels - * - * @return shadow height in actual pixels - */ - private int calculateShadowHeight() { - final int shadowHeight = hasShadow() ? (int) ((getShadowRadius() + Math.abs(getShadowYOffset())) * 2) : 0; - Log.v(LOG_TAG, "Calculated shadow height = " + shadowHeight); - return shadowHeight; - } - - /** - * Calculates the stroke weight in actual pixels - * * - * @return stroke weight in actual pixels - */ - private int calculateStrokeWeight() { - final int strokeWeight = (int) (getStrokeWidth() * 2.0f); - Log.v(LOG_TAG, "Calculated stroke weight is: " + strokeWeight); - return strokeWeight; - } - - /** - * Determines the Action Button types - */ - public enum Type { - - /** - * Action Button default (56dp) type - */ - DEFAULT { - @Override - int getId() { - return 0; - } - - @Override - float getSize(Context context) { - return MetricsConverter.dpToPx(context, 56.0f); - } - }, - - /** - * Action Button mini (40dp) type - */ - MINI { - @Override - int getId() { - return 1; - } - - @Override - float getSize(Context context) { - return MetricsConverter.dpToPx(context, 40.0f); - } - }; - - /** - * Returns an {@code id} for specific Action Button - * type, which is defined in attributes - * - * @return {@code id} for particular Action Button type, - * which is defined in attributes - */ - abstract int getId(); - - /** - * Returns the size of the specific type of the Action Button - * - * @param context context the view is running in - * @return size of the particular type of the Action Button - */ - abstract float getSize(Context context); - - /** - * Returns the Action Button type for a specific {@code id} - * - * @param id an {@code id}, for which Action Button type required - * @return Action Button type - */ - static Type forId(int id) { - for (Type type : values()) { - if (type.getId() == id) { - return type; - } - } - return DEFAULT; - } - - } - - /** - * Determines the Action Button states - */ - public enum State { - - /** - * Action Button normal state - */ - NORMAL, - - /** - * Action Button pressed state - */ - PRESSED - - } - - public enum Animations { - - /** - * None. Animation absent - */ - NONE (0), - - /** - * Fade in animation - */ - FADE_IN (R.anim.fab_fade_in), - - /** - * Fade out animation - */ - FADE_OUT (R.anim.fab_fade_out), - - /** - * Scale up animation - */ - SCALE_UP (R.anim.fab_scale_up), - - /** - * Scale down animation - */ - SCALE_DOWN (R.anim.fab_scale_down), - - /** - * Roll from down animation - */ - ROLL_FROM_DOWN (R.anim.fab_roll_from_down), - - /** - * Roll to down animation - */ - ROLL_TO_DOWN (R.anim.fab_roll_to_down), - - /** - * Roll from right animation - */ - ROLL_FROM_RIGHT (R.anim.fab_roll_from_right), - - /** - * Roll to right animation - */ - ROLL_TO_RIGHT (R.anim.fab_roll_to_right), - - /** - * Jump from down animation - */ - JUMP_FROM_DOWN (R.anim.fab_jump_from_down), - - /** - * Jump to down animation - */ - JUMP_TO_DOWN (R.anim.fab_jump_to_down), - - /** - * Jump from right animation - */ - JUMP_FROM_RIGHT (R.anim.fab_jump_from_right), - - /** - * Jump to right animation - */ - JUMP_TO_RIGHT (R.anim.fab_jump_to_right); - - /** - * Correspondent animation resource id - */ - final int animResId; - - private Animations(int animResId) { - this.animResId = animResId; - } - - /** - * Loads an animation from animation resource id - * - * @param context context the view is running in - * @param animResId resource id of the animation, which is to be loaded - * @return loaded animation - */ - protected static Animation load(Context context, int animResId) { - return animResId == NONE.animResId ? null : AnimationUtils.loadAnimation(context, animResId); - } - - } - -} diff --git a/eclipse-compile/fab/java/com/software/shell/fab/ActionButtonOutlineProvider.java b/eclipse-compile/fab/java/com/software/shell/fab/ActionButtonOutlineProvider.java deleted file mode 100644 index d154c3998f..0000000000 --- a/eclipse-compile/fab/java/com/software/shell/fab/ActionButtonOutlineProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2015 Shell Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * File created: 2015-02-25 19:54:28 - */ - -package com.software.shell.fab; - -import android.annotation.TargetApi; -import android.graphics.Outline; -import android.os.Build; -import android.view.View; -import android.view.ViewOutlineProvider; - -/** - * An implementation of the {@link android.view.ViewOutlineProvider} - * for Action Button - * - * Used for drawing the elevation shadow for {@code API 21 Lollipop} and higher - * - * @author Vladislav - * @version 1.0.0 - * @since 1.0.0 - */ -@TargetApi(Build.VERSION_CODES.LOLLIPOP) -class ActionButtonOutlineProvider extends ViewOutlineProvider { - - /** - * Outline provider width - */ - private int width; - - /** - * Outline provider height - */ - private int height; - - /** - * Creates an instance of the {@link com.software.shell.fab.ActionButtonOutlineProvider} - * - * @param width initial outline provider width - * @param height initial outline provider height - */ - ActionButtonOutlineProvider(int width, int height) { - this.width = width; - this.height = height; - } - - /** - * Called to get the provider to populate the Outline. This method will be called by a View - * when its owned Drawables are invalidated, when the View's size changes, or if invalidateOutline() - * is called explicitly. The input outline is empty and has an alpha of 1.0f - * - * @param view a view, which builds the outline - * @param outline an empty outline, which is to be populated - */ - @Override - public void getOutline(View view, Outline outline) { - outline.setOval(0, 0, width, height); - } - -} diff --git a/eclipse-compile/fab/java/com/software/shell/fab/FloatingActionButton.java b/eclipse-compile/fab/java/com/software/shell/fab/FloatingActionButton.java deleted file mode 100644 index 196c8e7ad5..0000000000 --- a/eclipse-compile/fab/java/com/software/shell/fab/FloatingActionButton.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright 2015 Shell Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * File created: 2015-02-16 10:56:57 - */ - -package com.software.shell.fab; - -import android.content.Context; -import android.content.res.TypedArray; -import android.util.AttributeSet; -import android.util.Log; -import android.view.animation.Animation; - -/** - * Deprecated since version 1.0.2. Use {@link com.software.shell.fab.ActionButton} - * class instead. - * The reason is the rename of base class name from FloatingActionButton to - * ActionButton and some of the methods, which are present in this class. - *

- * Will be removed in version 2.0.0. Please use {@link com.software.shell.fab.ActionButton} and - * methods declared there instead - * - * @author Vladislav - * @version 1.0.0 - * @since 1.0.0 - */ -@Deprecated -public class FloatingActionButton extends ActionButton{ - - private static final String LOG_TAG = "FAB"; - - public FloatingActionButton(Context context) { - super(context); - } - - public FloatingActionButton(Context context, AttributeSet attrs) { - super(context, attrs); - initActionButton(context, attrs, 0, 0); - } - - public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initActionButton(context, attrs, defStyleAttr, 0); - } - - public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - initActionButton(context, attrs, defStyleAttr, defStyleRes); - } - - /** - * Returns an animation, which is used while showing Floating Action Button - * @deprecated since version 1.0.2. Please use {@link #getShowAnimation()} instead - * - * @return animation, which is used while showing Floating Action Button - */ - @Deprecated - public Animation getAnimationOnShow() { - return getShowAnimation(); - } - - /** - * Sets the animation, which is used while showing Floating Action Button - * @deprecated since version 1.0.2. Please use - * {@link #setShowAnimation(android.view.animation.Animation)} instead - * - * @param animation animation, which is to be used while showing - * Floating Action Button - */ - @Deprecated - public void setAnimationOnShow(Animation animation) { - setShowAnimation(animation); - } - - /** - * Sets one of the {@link Animations} as animation, which is used while showing - * Floating Action Button - * @deprecated since version 1.0.2. Please use - * {@link #setShowAnimation(com.software.shell.fab.ActionButton.Animations)} instead - * - * @param animation one of the {@link Animations}, which is to be used while - * showing Floating Action Button - */ - @Deprecated - public void setAnimationOnShow(Animations animation) { - setShowAnimation(animation); - } - - /** - * Returns an animation, which is used while hiding Floating Action Button - * @deprecated since version 1.0.2. Please use {@link #getHideAnimation()} - * instead - * - * @return animation, which is used while hiding Floating Action Button - */ - @Deprecated - public Animation getAnimationOnHide() { - return getHideAnimation(); - } - - /** - * Sets the animation, which is used while hiding Floating Action Button - * @deprecated since version 1.0.2. Please use - * {@link #setHideAnimation(android.view.animation.Animation)} instead - * - * @param animation animation, which is to be used while hiding - * Floating Action Button - */ - @Deprecated - public void setAnimationOnHide(Animation animation) { - setHideAnimation(animation); - } - - /** - * Sets one of the {@link Animations} as animation, which is used while hiding - * Floating Action Button - * @deprecated since version 1.0.2. Please use - * {@link #setHideAnimation(com.software.shell.fab.ActionButton.Animations)} )} instead - * - * @param animation one of the {@link Animations}, which is to be used while - * hiding Floating Action Button - */ - @Deprecated - public void setAnimationOnHide(Animations animation) { - setHideAnimation(animation); - } - - private void initActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton, - defStyleAttr, defStyleRes); - try { - initType(attributes); - initShowAnimation(attributes); - initHideAnimation(attributes); - } catch (Exception e) { - Log.e(LOG_TAG, "Unable to read attr", e); - } finally { - attributes.recycle(); - } - Log.v(LOG_TAG, "Floating Action Button initialized"); - } - - private void initType(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_type)) { - final int id = attrs.getInteger(R.styleable.ActionButton_type, 0); - setType(Type.forId(id)); - Log.v(LOG_TAG, "Initialized type: " + getType()); - } - } - - /** - * Initializes the animation, which is used while showing - * Action Button - * @deprecated since 1.0.2 and will be removed in version 2.0.0. - * Use show_animation and hide_animation in XML instead - * - * @param attrs attributes of the XML tag that is inflating the view - */ - @Deprecated - private void initShowAnimation(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_animation_onShow)) { - final int animResId = attrs.getResourceId(R.styleable.ActionButton_animation_onShow, - Animations.NONE.animResId); - setShowAnimation(Animations.load(getContext(), animResId)); - } - } - - /** - * Initializes the animation, which is used while hiding or dismissing - * Action Button - * @deprecated since 1.0.2 and will be removed in version 2.0.0 - * Use show_animation and hide_animation in XML instead - * - * @param attrs attributes of the XML tag that is inflating the view - */ - @Deprecated - private void initHideAnimation(TypedArray attrs) { - if (attrs.hasValue(R.styleable.ActionButton_animation_onHide)) { - final int animResId = attrs.getResourceId(R.styleable.ActionButton_animation_onHide, - Animations.NONE.animResId); - setHideAnimation(Animations.load(getContext(), animResId)); - } - } - -} diff --git a/eclipse-compile/fab/java/com/software/shell/fab/MetricsConverter.java b/eclipse-compile/fab/java/com/software/shell/fab/MetricsConverter.java deleted file mode 100644 index c4770449c4..0000000000 --- a/eclipse-compile/fab/java/com/software/shell/fab/MetricsConverter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2015 Shell Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * File created: 2015-01-30 22:55:44 - */ - -package com.software.shell.fab; - -import android.content.Context; - -/** - * Contains utility methods for metrics conversion - * - * @author Vladislav - * @version 1.0.0 - * @since 1.0.0 - */ -public final class MetricsConverter { - - /** - * Prevents from creating {@link com.software.shell.fab.MetricsConverter} instances - */ - private MetricsConverter() { - } - - /** - * Converts the density-independent value into real pixel value based on display metrics - * - * @param context application context - * @param dp density-independent value - * @return converted real pixel value - */ - public static float dpToPx(Context context, float dp) { - final float scale = context.getResources().getDisplayMetrics().density; - return dp * scale; - } - -} diff --git a/eclipse-compile/fab/project.properties b/eclipse-compile/fab/project.properties deleted file mode 100644 index 17b8e6b92f..0000000000 --- a/eclipse-compile/fab/project.properties +++ /dev/null @@ -1,15 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Indicates whether an apk should be generated for each density. -split.density=false -# Project target. -target=android-21 -dex.force.jumbo=true -android.library=true diff --git a/eclipse-compile/fab/res/anim-v11/fab_jump_from_down.xml b/eclipse-compile/fab/res/anim-v11/fab_jump_from_down.xml deleted file mode 100644 index 87095c9bc7..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_jump_from_down.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_jump_from_right.xml b/eclipse-compile/fab/res/anim-v11/fab_jump_from_right.xml deleted file mode 100644 index 9db4bf984f..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_jump_from_right.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_jump_to_down.xml b/eclipse-compile/fab/res/anim-v11/fab_jump_to_down.xml deleted file mode 100644 index ca59b72de1..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_jump_to_down.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_jump_to_right.xml b/eclipse-compile/fab/res/anim-v11/fab_jump_to_right.xml deleted file mode 100644 index d4287e6264..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_jump_to_right.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_roll_from_down.xml b/eclipse-compile/fab/res/anim-v11/fab_roll_from_down.xml deleted file mode 100644 index 438160f361..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_roll_from_down.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_roll_from_right.xml b/eclipse-compile/fab/res/anim-v11/fab_roll_from_right.xml deleted file mode 100644 index 0ef84e389b..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_roll_from_right.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_roll_to_down.xml b/eclipse-compile/fab/res/anim-v11/fab_roll_to_down.xml deleted file mode 100644 index 8e8140cf93..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_roll_to_down.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_roll_to_right.xml b/eclipse-compile/fab/res/anim-v11/fab_roll_to_right.xml deleted file mode 100644 index 22915225a9..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_roll_to_right.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_scale_down.xml b/eclipse-compile/fab/res/anim-v11/fab_scale_down.xml deleted file mode 100644 index ce63f0fd5f..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_scale_down.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - diff --git a/eclipse-compile/fab/res/anim-v11/fab_scale_up.xml b/eclipse-compile/fab/res/anim-v11/fab_scale_up.xml deleted file mode 100644 index 1d18f40544..0000000000 --- a/eclipse-compile/fab/res/anim-v11/fab_scale_up.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/eclipse-compile/fab/res/anim/fab_fade_in.xml b/eclipse-compile/fab/res/anim/fab_fade_in.xml deleted file mode 100644 index 2b0ebedb7f..0000000000 --- a/eclipse-compile/fab/res/anim/fab_fade_in.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/eclipse-compile/fab/res/anim/fab_fade_out.xml b/eclipse-compile/fab/res/anim/fab_fade_out.xml deleted file mode 100644 index 064ff9e45b..0000000000 --- a/eclipse-compile/fab/res/anim/fab_fade_out.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/eclipse-compile/fab/res/anim/fab_jump_from_down.xml b/eclipse-compile/fab/res/anim/fab_jump_from_down.xml deleted file mode 100644 index f41e38317f..0000000000 --- a/eclipse-compile/fab/res/anim/fab_jump_from_down.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_jump_from_right.xml b/eclipse-compile/fab/res/anim/fab_jump_from_right.xml deleted file mode 100644 index c9bdc0da7a..0000000000 --- a/eclipse-compile/fab/res/anim/fab_jump_from_right.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_jump_to_down.xml b/eclipse-compile/fab/res/anim/fab_jump_to_down.xml deleted file mode 100644 index 0649c71a04..0000000000 --- a/eclipse-compile/fab/res/anim/fab_jump_to_down.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_jump_to_right.xml b/eclipse-compile/fab/res/anim/fab_jump_to_right.xml deleted file mode 100644 index 8ea8b69a3a..0000000000 --- a/eclipse-compile/fab/res/anim/fab_jump_to_right.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_roll_from_down.xml b/eclipse-compile/fab/res/anim/fab_roll_from_down.xml deleted file mode 100644 index 66a284f25d..0000000000 --- a/eclipse-compile/fab/res/anim/fab_roll_from_down.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_roll_from_right.xml b/eclipse-compile/fab/res/anim/fab_roll_from_right.xml deleted file mode 100644 index 3c38343fcd..0000000000 --- a/eclipse-compile/fab/res/anim/fab_roll_from_right.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_roll_to_down.xml b/eclipse-compile/fab/res/anim/fab_roll_to_down.xml deleted file mode 100644 index 16a6946ea9..0000000000 --- a/eclipse-compile/fab/res/anim/fab_roll_to_down.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_roll_to_right.xml b/eclipse-compile/fab/res/anim/fab_roll_to_right.xml deleted file mode 100644 index 420734f2b8..0000000000 --- a/eclipse-compile/fab/res/anim/fab_roll_to_right.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_scale_down.xml b/eclipse-compile/fab/res/anim/fab_scale_down.xml deleted file mode 100644 index e0dd6bea64..0000000000 --- a/eclipse-compile/fab/res/anim/fab_scale_down.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - diff --git a/eclipse-compile/fab/res/anim/fab_scale_up.xml b/eclipse-compile/fab/res/anim/fab_scale_up.xml deleted file mode 100644 index 956f6ed79d..0000000000 --- a/eclipse-compile/fab/res/anim/fab_scale_up.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/eclipse-compile/fab/res/drawable-hdpi/fab_plus_icon.png b/eclipse-compile/fab/res/drawable-hdpi/fab_plus_icon.png deleted file mode 100644 index b4358ce201..0000000000 Binary files a/eclipse-compile/fab/res/drawable-hdpi/fab_plus_icon.png and /dev/null differ diff --git a/eclipse-compile/fab/res/drawable-mdpi/fab_plus_icon.png b/eclipse-compile/fab/res/drawable-mdpi/fab_plus_icon.png deleted file mode 100644 index 6a32089858..0000000000 Binary files a/eclipse-compile/fab/res/drawable-mdpi/fab_plus_icon.png and /dev/null differ diff --git a/eclipse-compile/fab/res/drawable-xhdpi/fab_plus_icon.png b/eclipse-compile/fab/res/drawable-xhdpi/fab_plus_icon.png deleted file mode 100644 index a92d0a8f34..0000000000 Binary files a/eclipse-compile/fab/res/drawable-xhdpi/fab_plus_icon.png and /dev/null differ diff --git a/eclipse-compile/fab/res/drawable-xxhdpi/fab_plus_icon.png b/eclipse-compile/fab/res/drawable-xxhdpi/fab_plus_icon.png deleted file mode 100644 index 569b089f47..0000000000 Binary files a/eclipse-compile/fab/res/drawable-xxhdpi/fab_plus_icon.png and /dev/null differ diff --git a/eclipse-compile/fab/res/drawable-xxxhdpi/fab_plus_icon.png b/eclipse-compile/fab/res/drawable-xxxhdpi/fab_plus_icon.png deleted file mode 100644 index 90a1d16dcf..0000000000 Binary files a/eclipse-compile/fab/res/drawable-xxxhdpi/fab_plus_icon.png and /dev/null differ diff --git a/eclipse-compile/fab/res/values-sw600dp/dimens.xml b/eclipse-compile/fab/res/values-sw600dp/dimens.xml deleted file mode 100644 index 3ca9bdfce2..0000000000 --- a/eclipse-compile/fab/res/values-sw600dp/dimens.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - 24dp - diff --git a/eclipse-compile/fab/res/values/attrs.xml b/eclipse-compile/fab/res/values/attrs.xml deleted file mode 100644 index bdd08225a7..0000000000 --- a/eclipse-compile/fab/res/values/attrs.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/fab/res/values/colors.xml b/eclipse-compile/fab/res/values/colors.xml deleted file mode 100644 index 60ca1a0bbb..0000000000 --- a/eclipse-compile/fab/res/values/colors.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - #f44336 - #b71c1c - - #e91e63 - #880e4f - - #9c27b0 - #4a148c - - #673ab7 - #311b92 - - #3f51b5 - #1a237e - - #2196f3 - #0d47a1 - - #03a9f4 - #01579b - - #00bcd4 - #006064 - - #009688 - #004d40 - - #4caf50 - #1b5e20 - - #8bc34a - #33691e - - #cddc39 - #827717 - - #ffeb3b - #f57f17 - - #ffc107 - #ff6f00 - - #ff9800 - #e65100 - - #ff5722 - #bf360c - - #795548 - #3e2723 - - #9e9e9e - #212121 - - #607d8b - #263238 - - #000000 - - #ffffff - diff --git a/eclipse-compile/fab/res/values/dimens.xml b/eclipse-compile/fab/res/values/dimens.xml deleted file mode 100644 index 06d5dccfcd..0000000000 --- a/eclipse-compile/fab/res/values/dimens.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - 16dp - - diff --git a/eclipse-compile/observable/.classpath b/eclipse-compile/observable/.classpath deleted file mode 100644 index c6e9dc9f1d..0000000000 --- a/eclipse-compile/observable/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/eclipse-compile/observable/.gitignore b/eclipse-compile/observable/.gitignore deleted file mode 100755 index 15f46acd99..0000000000 --- a/eclipse-compile/observable/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/build -/bin -/gen - diff --git a/eclipse-compile/observable/.project b/eclipse-compile/observable/.project deleted file mode 100644 index 8258814f66..0000000000 --- a/eclipse-compile/observable/.project +++ /dev/null @@ -1,39 +0,0 @@ - - - ListObservable - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - org.eclipse.xtext.ui.shared.xtextNature - - diff --git a/eclipse-compile/observable/AndroidManifest.xml b/eclipse-compile/observable/AndroidManifest.xml deleted file mode 100755 index 2dc5b76674..0000000000 --- a/eclipse-compile/observable/AndroidManifest.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/eclipse-compile/observable/build.gradle b/eclipse-compile/observable/build.gradle deleted file mode 100755 index 20f59fb26a..0000000000 --- a/eclipse-compile/observable/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0' - classpath 'com.android.tools.build:gradle:1.0.0' - } -} - -apply plugin: 'com.android.library' - -repositories { - mavenCentral() -} - -dependencies { - compile 'com.android.support:recyclerview-v7:21.0.0' - androidTestCompile ('com.android.support:appcompat-v7:21.0.2') { - exclude module: 'support-v4' - } - androidTestCompile ('com.nineoldandroids:library:2.4.0') { - exclude module: 'support-v4' - } -} - -android { - compileSdkVersion 21 - buildToolsVersion "21.1.1" - - defaultConfig { - minSdkVersion 9 - } - - jacoco { - version = '0.7.2.201409121644' - } - - buildTypes { - debug { - testCoverageEnabled = true - } - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - res.srcDirs = ['res'] - } - } - - lintOptions { - abortOnError false - } -} - -apply plugin: 'com.github.kt3k.coveralls' - -coveralls.jacocoReportPath = 'build/outputs/reports/coverage/debug/report.xml' - -// This is from 'https://github.com/chrisbanes/gradle-mvn-push' -apply from: 'gradle-mvn-push.gradle' diff --git a/eclipse-compile/observable/gradle-mvn-push.gradle b/eclipse-compile/observable/gradle-mvn-push.gradle deleted file mode 100755 index f5f4129c96..0000000000 --- a/eclipse-compile/observable/gradle-mvn-push.gradle +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2013 Chris Banes - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'maven' -apply plugin: 'signing' - -def isReleaseBuild() { - return VERSION_NAME.contains("SNAPSHOT") == false -} - -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} - -def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - } - - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.sourceFiles - } - - artifacts { - archives androidSourcesJar - archives androidJavadocsJar - } -} diff --git a/eclipse-compile/observable/gradle.properties b/eclipse-compile/observable/gradle.properties deleted file mode 100755 index a5035de4fa..0000000000 --- a/eclipse-compile/observable/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -POM_NAME=Android-ObservableScrollView -POM_ARTIFACT_ID=android-observablescrollview -POM_PACKAGING=aar diff --git a/eclipse-compile/observable/java2/androidTest/AndroidManifest.xml b/eclipse-compile/observable/java2/androidTest/AndroidManifest.xml deleted file mode 100755 index 0bbcb89165..0000000000 --- a/eclipse-compile/observable/java2/androidTest/AndroidManifest.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/assets/lipsum.html b/eclipse-compile/observable/java2/androidTest/assets/lipsum.html deleted file mode 100755 index 7d71889e3b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/assets/lipsum.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - -

-

Lorem ipsum dolor sit amet, ut duis lorem provident sed felis blandit, condimentum donec lectus ipsum et mauris, morbi porttitor interdum feugiat nulla donec sodales, vestibulum nisl primis a molestie vestibulum quam, sapien mauris metus risus suspendisse magnis. Augue viverra nulla faucibus egestas eu, a etiam id congue rutrum ante, arcu tincidunt donec quam felis at ornare, iaculis ligula sodales venenatis commodo volutpat neque, suspendisse elit praesent tellus felis mi amet. Inceptos amet tempor lectus lorem est non, ac donec ac libero neque mauris, tellus ante metus eget leo consequat. Scelerisque dolor curabitur pretium blandit ut feugiat, amet lacus pulvinar justo convallis ut, sed natoque ipsum urna posuere nibh eu. Sed at sed vulputate sit orci, facilisis a aliquam tellus quam aliquam, eu aliquam donec at molestie ante, pellentesque mauris lorem ultrices libero faucibus porta, imperdiet adipiscing sit hac diam ut nulla. Lacus enim elit pulvinar donec vehicula dapibus, accumsan purus officia cursus dolor sapien, eu amet dis mauris mi nulla ut. Non accusamus etiam pede non urna tempus, vestibulum aliquam tortor eget pharetra sodales, in vestibulum ut justo orci nulla, lobortis purus sem semper consectetuer magni purus. Dolor a leo vestibulum amet ut sit, arcu ut eaque urna fusce aliquet turpis, sed fermentum sed vestibulum nisl pede, tristique enim lorem posuere in laborum ut. Vestibulum id id justo leo nulla, magna lobortis ullamcorper et dignissim pellentesque, duis suspendisse quis id lorem ante. Vivamus a nullam ante adipiscing amet, mi vel consectetuer nunc aenean pede quisque, eget rhoncus dis porttitor habitant nunc vivamus, duis cubilia blandit non donec justo dictumst, praesent vitae nulla nam pulvinar urna. Adipiscing adipiscing justo urna pulvinar imperdiet nullam, vitae fusce rhoncus proin nonummy suscipit, ullamcorper amet et non potenti platea ultrices, mauris nullam sapien nunc justo vel, eu semper pellentesque arcu fusce augue. Malesuada mauris nibh sit a a scelerisque, velit sem lectus tellus convallis consectetuer, ultricies auctor a ante eros amet sed.

-

Risus lacus duis leo platea wisi, felis maecenas rutrum in id in donec, non id a potenti libero eget, posuere elit ea sed pellentesque quis. Sunt lacus urna lorem elit duis, nibh donec purus quisque consectetuer dolor, neque vestibulum proin ornare eros nonummy phasellus. Iaculis cras eu at egestas dolor montes, viverra quisque malesuada consectetuer semper maecenas, a sed vitae donec tempor aliqua metus, ornare mollis suscipit et erat fusce, sit orci aut auctor elementum fames aliquam. Platea dui integer magnis non metus, minus dignissimos ante massa nostra et, rutrum sapien egestas quis sapien donec donec. Erat sit a eros aenean natoque, quam libero id lorem enim proin, lorem ipsum fermentum mattis metus et. Aliquam aliquet suscipit purus conubia at neque, platea vivamus vestibulum nulla quibusdam senectus, et morbi lectus malesuada gravida donec, elementum sit convallis pellentesque velit amet. Et eveniet viverra vehicula consectetuer justo, provident sed commodo non lacinia velit, tempor phasellus vel leo nisl cras, vivamus et arcu interdum dui eu amet. Volutpat wisi rhoncus vel turpis diam quibusdam, dapibus elit est quisque cubilia mauris, nulla elit magna tempor accumsan bibendum, lorem varius sed interdum eget mattis, scelerisque egestas feugiat donec dui molestie. Leo facilisis nisl sit montes ligula sed, enim commodo consectetuer nunc est et, ut sed vehicula dolor luctus elit. Fermentum cras donec eget nibh est vel, sed justo risus et pharetra diam, eu vivamus egestas ligula risus diam, sed justo eget hac ut mauris. Vestibulum diam nec vitae mi eget suspendisse, aenean arcu purus facilisis purus class in, id aliquam sit id scelerisque sapien etiam. Ut nullam sit sed at mauris lobortis, consequat dolor autem ipsum euismod nulla, elit quis proin eget conubia varius, erat arcu massa mus in mauris, scelerisque ut eu sollicitudin libero leo urna.

-

Consectetuer luctus tempor elit ut dolor ligula, quis dui per dui hendrerit ante sagittis, in quisque pretium in eleifend enim. Condimentum iaculis vitae feugiat dis tellus vel, lectus dolor nec dui nulla nascetur, et pellentesque curabitur lorem leo velit eget. Id nascetur arcu lobortis suspendisse imperdiet urna, natoque nascetur ante in porta a, interdum hendrerit mi bibendum platea tellus, urna in enim ornare vestibulum faucibus enim. Leo fusce egestas ante nec volutpat, in tempor vel facilisis potenti ut, pede at non lorem a commodo, nulla dolor orci interdum vestibulum nulla. Dui nulla vestibulum quisque a pharetra porta, integer nec ipsum nec sed dui pharetra, magna et dignissim ipsum sed dictum, litora eros vivamus scelerisque libero ipsum. Sed ac ac lorem molestie adipiscing morbi, pellentesque imperdiet nunc quis morbi amet ante, libero dui ligula nec risus neque et, velit nonummy phasellus et facilisi amet, ligula in elementum non sapien pulvinar faucibus. Eu leo ut posuere sed aliquet, tincidunt vel urna volutpat tempus sem, sit felis aliquet vestibulum condimentum sit, amet nibh vel tellus purus ullamcorper libero, nulla vestibulum pede ut vestibulum pretium. Eu nulla vestibulum a neque in metus, quisquam nam sed cursus eget luctus, pede ultrices nec sed dignissim pellentesque, sit class cursus metus nulla placerat mauris, consequat mollis neque vivamus amet pede. Mauris dolor nulla diam eros bibendum, quam ante vestibulum morbi non ligula vel, molestie curabitur rhoncus nulla euismod interdum non. Nulla fringilla lorem mollis ad massa, sit molestie nibh lorem arcu volutpat, accumsan commodo lectus eu et donec, sit tempor tempus rutrum in curabitur amet. Nec urna euismod a tincidunt commodo, eu pede turpis libero vitae viverra, ante vestibulum nam non habitasse potenti, mauris imperdiet in in nunc convallis. Et nostra wisi in est accumsan vehicula, quisque vitae felis mauris sed vulputate nec, ante imperdiet sollicitudin massa iaculis massa sit.

-

Quam libero nulla netus eu porta curae, ut nulla bibendum facilisis et urna sed, quis congue vestibulum aliquam interdum etiam. Nulla vel lobortis ullamcorper vitae excepturi, neque urna feugiat lectus vel lacinia, massa pretium orci eu metus neque vulputate. Imperdiet ac velit rhoncus nulla malesuada nullam, nec pulvinar justo gravida lorem rutrum magna, habitasse repudiandae mi eros vestibulum ante, nec euismod dui iaculis in turpis pretium, ac id metus egestas proin lacus lectus. Laoreet lorem nec vitae risus erat arcu, vitae quam ut in ante tristique, porta dolor pede quam et odio nam, arcu lacus sem congue ante cursus massa. Et mattis sagittis erat accumsan fusce quam, vehicula ligula beatae natoque fusce sodales conubia, habitasse metus cum magnis viverra nam cursus, egestas urna wisi primis blandit eu magna, eget libero elit lacus lorem dis aliquam. Ut mauris ante natoque lacus massa, justo a lectus sodales enim adipiscing id, accumsan ut ipsum vestibulum sed enim auctor, vitae congue tincidunt id phasellus lacinia scelerisque, tincidunt sapien nulla euismod volutpat iaculis. Platea sociis nec aliquet nec molestie, in mi et augue sapien in vivamus, integer fames proin vitae in ullamcorper et. Fringilla etiam sapiente rhoncus suspendisse nec id, lobortis cras eget egestas dui ac nec, justo lacus ut lorem bibendum quia eros, eget a gravida id donec nunc suscipit, porta sed in sodales non rutrum. Lectus vel dui elementum pellentesque magna aliquam, vitae non sit pede et fusce nibh, id id deserunt ornare dui sit condimentum, in adipiscing imperdiet turpis nam aliquet, facilisis metus magna lacus wisi facilisis tortor. Vulputate elit accumsan quam amet ligula, suspendisse lacus mi nonummy integer urna, libero nulla nunc varius in odio, laoreet nulla amet placerat amet nec. Consectetuer vel massa hendrerit vitae iaculis id, sed ut ut laudantium odio in, elit vestibulum duis ante maecenas interdum in, neque vehicula ultrices varius in quam, pede tellus pellentesque sed nullam quis.

-
- - \ No newline at end of file diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/SavedStateTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/SavedStateTest.java deleted file mode 100755 index c98d0fa50b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/SavedStateTest.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview; - -import android.os.Parcel; -import android.test.InstrumentationTestCase; -import android.util.SparseIntArray; -import android.view.AbsSavedState; - -public class SavedStateTest extends InstrumentationTestCase { - - public void testGridViewSavedState() throws Throwable { - Parcel parcel = Parcel.obtain(); - ObservableGridView.SavedState state1 = new ObservableGridView.SavedState(AbsSavedState.EMPTY_STATE); - state1.prevFirstVisiblePosition = 1; - state1.prevFirstVisibleChildHeight = 2; - state1.prevScrolledChildrenHeight = 3; - state1.prevScrollY = 4; - state1.scrollY = 5; - state1.childrenHeights = new SparseIntArray(); - state1.childrenHeights.put(0, 10); - state1.childrenHeights.put(1, 20); - state1.childrenHeights.put(2, 30); - state1.writeToParcel(parcel, 0); - - parcel.setDataPosition(0); - - ObservableGridView.SavedState state2 = ObservableGridView.SavedState.CREATOR.createFromParcel(parcel); - assertNotNull(state2); - assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition); - assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight); - assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight); - assertEquals(state1.prevScrollY, state2.prevScrollY); - assertEquals(state1.scrollY, state2.scrollY); - assertNotNull(state1.childrenHeights); - assertEquals(3, state1.childrenHeights.size()); - assertEquals(10, state1.childrenHeights.get(0)); - assertEquals(20, state1.childrenHeights.get(1)); - assertEquals(30, state1.childrenHeights.get(2)); - } - - public void testListViewSavedState() throws Throwable { - Parcel parcel = Parcel.obtain(); - ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE); - state1.prevFirstVisiblePosition = 1; - state1.prevFirstVisibleChildHeight = 2; - state1.prevScrolledChildrenHeight = 3; - state1.prevScrollY = 4; - state1.scrollY = 5; - state1.childrenHeights = new SparseIntArray(); - state1.childrenHeights.put(0, 10); - state1.childrenHeights.put(1, 20); - state1.childrenHeights.put(2, 30); - state1.writeToParcel(parcel, 0); - - parcel.setDataPosition(0); - - ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel); - assertNotNull(state2); - assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition); - assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight); - assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight); - assertEquals(state1.prevScrollY, state2.prevScrollY); - assertEquals(state1.scrollY, state2.scrollY); - assertNotNull(state1.childrenHeights); - assertEquals(3, state1.childrenHeights.size()); - assertEquals(10, state1.childrenHeights.get(0)); - assertEquals(20, state1.childrenHeights.get(1)); - assertEquals(30, state1.childrenHeights.get(2)); - } - - public void testRecyclerViewSavedState() throws Throwable { - Parcel parcel = Parcel.obtain(); - ObservableRecyclerView.SavedState state1 = new ObservableRecyclerView.SavedState(AbsSavedState.EMPTY_STATE); - state1.prevFirstVisiblePosition = 1; - state1.prevFirstVisibleChildHeight = 2; - state1.prevScrolledChildrenHeight = 3; - state1.prevScrollY = 4; - state1.scrollY = 5; - state1.childrenHeights = new SparseIntArray(); - state1.childrenHeights.put(0, 10); - state1.childrenHeights.put(1, 20); - state1.childrenHeights.put(2, 30); - state1.writeToParcel(parcel, 0); - - parcel.setDataPosition(0); - - ObservableRecyclerView.SavedState state2 = ObservableRecyclerView.SavedState.CREATOR.createFromParcel(parcel); - assertNotNull(state2); - assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition); - assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight); - assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight); - assertEquals(state1.prevScrollY, state2.prevScrollY); - assertEquals(state1.scrollY, state2.scrollY); - assertNotNull(state1.childrenHeights); - assertEquals(3, state1.childrenHeights.size()); - assertEquals(10, state1.childrenHeights.get(0)); - assertEquals(20, state1.childrenHeights.get(1)); - assertEquals(30, state1.childrenHeights.get(2)); - } - - public void testScrollViewSavedState() throws Throwable { - Parcel parcel = Parcel.obtain(); - ObservableScrollView.SavedState state1 = new ObservableScrollView.SavedState(AbsSavedState.EMPTY_STATE); - state1.prevScrollY = 1; - state1.scrollY = 2; - state1.writeToParcel(parcel, 0); - - parcel.setDataPosition(0); - - ObservableScrollView.SavedState state2 = ObservableScrollView.SavedState.CREATOR.createFromParcel(parcel); - assertNotNull(state2); - assertEquals(state1.prevScrollY, state2.prevScrollY); - assertEquals(state1.scrollY, state2.scrollY); - } - - public void testWebViewSavedState() throws Throwable { - Parcel parcel = Parcel.obtain(); - ObservableWebView.SavedState state1 = new ObservableWebView.SavedState(AbsSavedState.EMPTY_STATE); - state1.prevScrollY = 1; - state1.scrollY = 2; - state1.writeToParcel(parcel, 0); - - parcel.setDataPosition(0); - - ObservableWebView.SavedState state2 = ObservableWebView.SavedState.CREATOR.createFromParcel(parcel); - assertNotNull(state2); - assertEquals(state1.prevScrollY, state2.prevScrollY); - assertEquals(state1.scrollY, state2.scrollY); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivity.java deleted file mode 100755 index 111b616fda..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.AbsListView; - -import com.github.ksoichiro.android.observablescrollview.ObservableGridView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; - -public class GridViewActivity extends Activity implements ObservableScrollViewCallbacks { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_gridview); - ObservableGridView scrollable = (ObservableGridView) findViewById(R.id.scrollable); - scrollable.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, scrollable); - scrollable.setOnScrollListener(new AbsListView.OnScrollListener() { - @Override - public void onScrollStateChanged(AbsListView view, int scrollState) { - } - - @Override - public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - } - }); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivityTest.java deleted file mode 100755 index 7a08f3502b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/GridViewActivityTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.util.DisplayMetrics; -import android.util.TypedValue; - -import com.github.ksoichiro.android.observablescrollview.ObservableGridView; - -public class GridViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableGridView scrollable; - - public GridViewActivityTest() { - super(GridViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableGridView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } - - public void testScrollVerticallyTo() throws Throwable { - final DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, metrics)); - } - }); - getInstrumentation().waitForIdleSync(); - - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo(0); - } - }); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivity.java deleted file mode 100755 index 5d6dc79611..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.AbsListView; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; - -public class ListViewActivity extends Activity implements ObservableScrollViewCallbacks { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_listview); - ObservableListView scrollable = (ObservableListView) findViewById(R.id.scrollable); - scrollable.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, scrollable); - scrollable.setOnScrollListener(new AbsListView.OnScrollListener() { - @Override - public void onScrollStateChanged(AbsListView view, int scrollState) { - } - - @Override - public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - } - }); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivityTest.java deleted file mode 100755 index 188fbc4fbc..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewActivityTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.util.DisplayMetrics; -import android.util.TypedValue; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; - -public class ListViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableListView scrollable; - - public ListViewActivityTest() { - super(ListViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableListView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } - - public void testScrollVerticallyTo() throws Throwable { - final DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, metrics)); - } - }); - getInstrumentation().waitForIdleSync(); - - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo(0); - } - }); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivity.java deleted file mode 100755 index 6a3509b2aa..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivity.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.os.Bundle; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -public class ListViewScrollFromBottomActivity extends ListViewActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - final ObservableListView scrollable = (ObservableListView) findViewById(R.id.scrollable); - ScrollUtils.addOnGlobalLayoutListener(scrollable, new Runnable() { - @Override - public void run() { - int count = scrollable.getAdapter().getCount() - 1; - int position = count == 0 ? 1 : count > 0 ? count : 0; - scrollable.smoothScrollToPosition(position); - scrollable.setSelection(position); - } - }); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivityTest.java deleted file mode 100755 index db8b465bba..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ListViewScrollFromBottomActivityTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; - -public class ListViewScrollFromBottomActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableListView scrollable; - - public ListViewScrollFromBottomActivityTest() { - super(ListViewScrollFromBottomActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableListView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivity.java deleted file mode 100755 index 0175397494..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivity.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; - -public class RecyclerViewActivity extends Activity implements ObservableScrollViewCallbacks { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_recyclerview); - - ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scrollable); - recyclerView.setLayoutManager(new LinearLayoutManager(this)); - recyclerView.setHasFixedSize(true); - recyclerView.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, recyclerView); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivityTest.java deleted file mode 100755 index 33335ed057..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewActivityTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.util.DisplayMetrics; -import android.util.TypedValue; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; - -public class RecyclerViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableRecyclerView scrollable; - - public RecyclerViewActivityTest() { - super(RecyclerViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableRecyclerView) activity.findViewById(R.id.scrollable); - getInstrumentation().waitForIdleSync(); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } - - public void testScrollVerticallyTo() throws Throwable { - final DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, metrics)); - } - }); - getInstrumentation().waitForIdleSync(); - - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo(0); - } - }); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivity.java deleted file mode 100755 index 5bf39218a1..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivity.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.os.Bundle; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -public class RecyclerViewScrollFromBottomActivity extends RecyclerViewActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - final ObservableRecyclerView scrollable = (ObservableRecyclerView) findViewById(R.id.scrollable); - ScrollUtils.addOnGlobalLayoutListener(scrollable, new Runnable() { - @Override - public void run() { - int count = scrollable.getAdapter().getItemCount() - 1; - int position = count == 0 ? 1 : count > 0 ? count : 0; - scrollable.scrollToPosition(position); - } - }); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivityTest.java deleted file mode 100755 index 37eaf4d582..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/RecyclerViewScrollFromBottomActivityTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; - -public class RecyclerViewScrollFromBottomActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableRecyclerView scrollable; - - public RecyclerViewScrollFromBottomActivityTest() { - super(RecyclerViewScrollFromBottomActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableRecyclerView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollUtilsTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollUtilsTest.java deleted file mode 100755 index 6b2aecdf44..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollUtilsTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.graphics.Color; -import android.test.InstrumentationTestCase; - -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -import junit.framework.Assert; - -public class ScrollUtilsTest extends InstrumentationTestCase { - - public void testGetFloat() { - Assert.assertEquals(1.0f, ScrollUtils.getFloat(1, 0, 2)); - assertEquals(0.0f, ScrollUtils.getFloat(-1, 0, 2)); - assertEquals(2.0f, ScrollUtils.getFloat(3, 0, 2)); - } - - public void testGetColorWithAlpha() { - assertEquals(Color.parseColor("#00123456"), ScrollUtils.getColorWithAlpha(0, Color.parseColor("#FF123456"))); - assertEquals(Color.parseColor("#FF123456"), ScrollUtils.getColorWithAlpha(1, Color.parseColor("#FF123456"))); - } - - public void testMixColors() { - assertEquals(Color.parseColor("#000000"), ScrollUtils.mixColors(Color.parseColor("#000000"), Color.parseColor("#FFFFFF"), 0)); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivity.java deleted file mode 100755 index d98a9727f0..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivity.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; - -public class ScrollViewActivity extends Activity implements ObservableScrollViewCallbacks { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_scrollview); - ((Scrollable) findViewById(R.id.scrollable)).setScrollViewCallbacks(this); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivityTest.java deleted file mode 100755 index c7bcf06a33..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ScrollViewActivityTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; - -public class ScrollViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableScrollView scrollable; - - public ScrollViewActivityTest() { - super(ScrollViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableScrollView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleHeaderRecyclerAdapter.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleHeaderRecyclerAdapter.java deleted file mode 100755 index 18a3887f17..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleHeaderRecyclerAdapter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.content.Context; -import android.support.v7.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import java.util.ArrayList; - -public class SimpleHeaderRecyclerAdapter extends RecyclerView.Adapter { - private static final int VIEW_TYPE_HEADER = 0; - private static final int VIEW_TYPE_ITEM = 1; - - private LayoutInflater mInflater; - private ArrayList mItems; - private View mHeaderView; - - public SimpleHeaderRecyclerAdapter(Context context, ArrayList items, View headerView) { - mInflater = LayoutInflater.from(context); - mItems = items; - mHeaderView = headerView; - } - - @Override - public int getItemCount() { - if (mHeaderView == null) { - return mItems.size(); - } else { - return mItems.size() + 1; - } - } - - @Override - public int getItemViewType(int position) { - return (position == 0) ? VIEW_TYPE_HEADER : VIEW_TYPE_ITEM; - } - - @Override - public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - if (viewType == VIEW_TYPE_HEADER) { - return new HeaderViewHolder(mHeaderView); - } else { - return new ItemViewHolder(mInflater.inflate(android.R.layout.simple_list_item_1, parent, false)); - } - } - - @Override - public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { - if (viewHolder instanceof ItemViewHolder) { - ((ItemViewHolder) viewHolder).textView.setText(mItems.get(position - 1)); - } - } - - static class HeaderViewHolder extends RecyclerView.ViewHolder { - public HeaderViewHolder(View view) { - super(view); - } - } - - static class ItemViewHolder extends RecyclerView.ViewHolder { - TextView textView; - - public ItemViewHolder(View view) { - super(view); - textView = (TextView) view.findViewById(android.R.id.text1); - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleRecyclerAdapter.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleRecyclerAdapter.java deleted file mode 100755 index daf2b5dfa4..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/SimpleRecyclerAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.content.Context; -import android.support.v7.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import java.util.ArrayList; - -public class SimpleRecyclerAdapter extends RecyclerView.Adapter { - private LayoutInflater mInflater; - private ArrayList mItems; - - public SimpleRecyclerAdapter(Context context, ArrayList items) { - mInflater = LayoutInflater.from(context); - mItems = items; - } - - @Override - public int getItemCount() { - return mItems.size(); - } - - @Override - public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new ViewHolder(mInflater.inflate(android.R.layout.simple_list_item_1, parent, false)); - } - - @Override - public void onBindViewHolder(ViewHolder viewHolder, int position) { - viewHolder.textView.setText(mItems.get(position)); - } - - static class ViewHolder extends RecyclerView.ViewHolder { - TextView textView; - - public ViewHolder(View view) { - super(view); - textView = (TextView) view.findViewById(android.R.id.text1); - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivity.java deleted file mode 100755 index 5a0891c828..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivity.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.view.MotionEvent; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.github.ksoichiro.android.observablescrollview.ObservableGridView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.nineoldandroids.view.ViewHelper; - -public class TouchInterceptionGridViewActivity extends Activity implements ObservableScrollViewCallbacks { - - private TouchInterceptionFrameLayout mInterceptionLayout; - private Scrollable mScrollable; - - private int mIntersectionHeight; - private int mHeaderBarHeight; - - private float mScrollYOnDownMotion; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_touchinterception_gridview); - ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName()); - mScrollable = (Scrollable) findViewById(R.id.scrollable); - mScrollable.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, (ObservableGridView) mScrollable); - - mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height); - mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height); - - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - final int minInterceptionLayoutY = -mIntersectionHeight; - return minInterceptionLayoutY < (int) ViewHelper.getY(mInterceptionLayout) - || (moving && mScrollable.getCurrentScrollY() - diffY < 0); - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - mScrollYOnDownMotion = mScrollable.getCurrentScrollY(); - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; - if (translationY < -mIntersectionHeight) { - translationY = -mIntersectionHeight; - } else if (getScreenHeight() - mHeaderBarHeight < translationY) { - translationY = getScreenHeight() - mHeaderBarHeight; - } - - slideTo(translationY, true); - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - } - }; - - private void slideTo(float translationY, final boolean animated) { - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) -translationY + getScreenHeight(); - mInterceptionLayout.requestLayout(); - } - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivityTest.java deleted file mode 100755 index 381f247921..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionGridViewActivityTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.test.TouchUtils; - -import com.github.ksoichiro.android.observablescrollview.ObservableGridView; - -public class TouchInterceptionGridViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableGridView scrollable; - - public TouchInterceptionGridViewActivityTest() { - super(TouchInterceptionGridViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableGridView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - TouchUtils.touchAndCancelView(this, scrollable); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivity.java deleted file mode 100755 index 3b8007489b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivity.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.view.MotionEvent; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.nineoldandroids.view.ViewHelper; - -public class TouchInterceptionListViewActivity extends Activity implements ObservableScrollViewCallbacks { - - private TouchInterceptionFrameLayout mInterceptionLayout; - private Scrollable mScrollable; - - private int mIntersectionHeight; - private int mHeaderBarHeight; - - private float mScrollYOnDownMotion; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_touchinterception_listview); - ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName()); - mScrollable = (Scrollable) findViewById(R.id.scrollable); - mScrollable.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, (ObservableListView) mScrollable); - - mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height); - mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height); - - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - final int minInterceptionLayoutY = -mIntersectionHeight; - return minInterceptionLayoutY < (int) ViewHelper.getY(mInterceptionLayout) - || (moving && mScrollable.getCurrentScrollY() - diffY < 0); - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - mScrollYOnDownMotion = mScrollable.getCurrentScrollY(); - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; - if (translationY < -mIntersectionHeight) { - translationY = -mIntersectionHeight; - } else if (getScreenHeight() - mHeaderBarHeight < translationY) { - translationY = getScreenHeight() - mHeaderBarHeight; - } - - slideTo(translationY, true); - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - } - }; - - private void slideTo(float translationY, final boolean animated) { - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) -translationY + getScreenHeight(); - mInterceptionLayout.requestLayout(); - } - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivityTest.java deleted file mode 100755 index 430b775905..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionListViewActivityTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.test.TouchUtils; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; - -public class TouchInterceptionListViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableListView scrollable; - - public TouchInterceptionListViewActivityTest() { - super(TouchInterceptionListViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableListView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - TouchUtils.touchAndCancelView(this, scrollable); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivity.java deleted file mode 100755 index a7b80620b9..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivity.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.view.MotionEvent; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.nineoldandroids.view.ViewHelper; - -public class TouchInterceptionRecyclerViewActivity extends Activity implements ObservableScrollViewCallbacks { - - private TouchInterceptionFrameLayout mInterceptionLayout; - private Scrollable mScrollable; - - private int mIntersectionHeight; - private int mHeaderBarHeight; - - private float mScrollYOnDownMotion; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_touchinterception_recyclerview); - ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName()); - mScrollable = (Scrollable) findViewById(R.id.scrollable); - mScrollable.setScrollViewCallbacks(this); - ObservableRecyclerView recyclerView = (ObservableRecyclerView) mScrollable; - recyclerView.setLayoutManager(new LinearLayoutManager(this)); - recyclerView.setHasFixedSize(true); - recyclerView.setScrollViewCallbacks(this); - UiTestUtils.setDummyData(this, recyclerView); - - mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height); - mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height); - - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - final int minInterceptionLayoutY = -mIntersectionHeight; - return minInterceptionLayoutY < (int) ViewHelper.getY(mInterceptionLayout) - || (moving && mScrollable.getCurrentScrollY() - diffY < 0); - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - mScrollYOnDownMotion = mScrollable.getCurrentScrollY(); - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; - if (translationY < -mIntersectionHeight) { - translationY = -mIntersectionHeight; - } else if (getScreenHeight() - mHeaderBarHeight < translationY) { - translationY = getScreenHeight() - mHeaderBarHeight; - } - - slideTo(translationY, true); - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - } - }; - - private void slideTo(float translationY, final boolean animated) { - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) -translationY + getScreenHeight(); - mInterceptionLayout.requestLayout(); - } - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivityTest.java deleted file mode 100755 index caf54346f9..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionRecyclerViewActivityTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.test.TouchUtils; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; - -public class TouchInterceptionRecyclerViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableRecyclerView scrollable; - - public TouchInterceptionRecyclerViewActivityTest() { - super(TouchInterceptionRecyclerViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableRecyclerView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - TouchUtils.touchAndCancelView(this, scrollable); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivity.java deleted file mode 100755 index f2b9c5cb46..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivity.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.view.MotionEvent; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.nineoldandroids.view.ViewHelper; - -public class TouchInterceptionScrollViewActivity extends Activity implements ObservableScrollViewCallbacks { - - private TouchInterceptionFrameLayout mInterceptionLayout; - private Scrollable mScrollable; - - private int mIntersectionHeight; - private int mHeaderBarHeight; - - private float mScrollYOnDownMotion; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_touchinterception_scrollview); - ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName()); - mScrollable = (Scrollable) findViewById(R.id.scrollable); - mScrollable.setScrollViewCallbacks(this); - - mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height); - mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height); - - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - final int minInterceptionLayoutY = -mIntersectionHeight; - return minInterceptionLayoutY < (int) ViewHelper.getY(mInterceptionLayout) - || (moving && mScrollable.getCurrentScrollY() - diffY < 0); - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - mScrollYOnDownMotion = mScrollable.getCurrentScrollY(); - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; - if (translationY < -mIntersectionHeight) { - translationY = -mIntersectionHeight; - } else if (getScreenHeight() - mHeaderBarHeight < translationY) { - translationY = getScreenHeight() - mHeaderBarHeight; - } - - slideTo(translationY, true); - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - } - }; - - private void slideTo(float translationY, final boolean animated) { - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) -translationY + getScreenHeight(); - mInterceptionLayout.requestLayout(); - } - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivityTest.java deleted file mode 100755 index 1c56fd405f..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionScrollViewActivityTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.test.TouchUtils; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; - -public class TouchInterceptionScrollViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableScrollView scrollable; - - public TouchInterceptionScrollViewActivityTest() { - super(TouchInterceptionScrollViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableScrollView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - TouchUtils.touchAndCancelView(this, scrollable); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivity.java deleted file mode 100755 index 023905b1ea..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivity.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.view.MotionEvent; -import android.webkit.WebView; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.nineoldandroids.view.ViewHelper; - -public class TouchInterceptionWebViewActivity extends Activity implements ObservableScrollViewCallbacks { - - private TouchInterceptionFrameLayout mInterceptionLayout; - private Scrollable mScrollable; - - private int mIntersectionHeight; - private int mHeaderBarHeight; - - private float mScrollYOnDownMotion; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_touchinterception_webview); - ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName()); - mScrollable = (Scrollable) findViewById(R.id.scrollable); - mScrollable.setScrollViewCallbacks(this); - ((WebView) mScrollable).loadUrl("file:///android_asset/lipsum.html"); - - mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height); - mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height); - - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - final int minInterceptionLayoutY = -mIntersectionHeight; - return minInterceptionLayoutY < (int) ViewHelper.getY(mInterceptionLayout) - || (moving && mScrollable.getCurrentScrollY() - diffY < 0); - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - mScrollYOnDownMotion = mScrollable.getCurrentScrollY(); - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ViewHelper.getTranslationY(mInterceptionLayout) - mScrollYOnDownMotion + diffY; - if (translationY < -mIntersectionHeight) { - translationY = -mIntersectionHeight; - } else if (getScreenHeight() - mHeaderBarHeight < translationY) { - translationY = getScreenHeight() - mHeaderBarHeight; - } - - slideTo(translationY, true); - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - } - }; - - private void slideTo(float translationY, final boolean animated) { - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) -translationY + getScreenHeight(); - mInterceptionLayout.requestLayout(); - } - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivityTest.java deleted file mode 100755 index d1f24e4fa1..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/TouchInterceptionWebViewActivityTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.test.TouchUtils; - -import com.github.ksoichiro.android.observablescrollview.ObservableWebView; - -public class TouchInterceptionWebViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableWebView scrollable; - - public TouchInterceptionWebViewActivityTest() { - super(TouchInterceptionWebViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableWebView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - TouchUtils.touchAndCancelView(this, scrollable); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/UiTestUtils.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/UiTestUtils.java deleted file mode 100755 index 43ebbf8440..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/UiTestUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.support.v7.widget.RecyclerView; -import android.test.InstrumentationTestCase; -import android.test.TouchUtils; -import android.util.TypedValue; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.GridView; -import android.widget.ListView; - -import java.util.ArrayList; - -public class UiTestUtils { - - private static final int NUM_OF_ITEMS = 100; - private static final int NUM_OF_ITEMS_FEW = 3; - private static final int DRAG_STEP_COUNT = 50; - - public enum Direction { - LEFT, RIGHT, UP, DOWN - } - - private UiTestUtils() { - } - - public static void saveAndRestoreInstanceState(final InstrumentationTestCase test, final Activity activity) throws Throwable { - test.runTestOnUiThread(new Runnable() { - @Override - public void run() { - Bundle outState = new Bundle(); - test.getInstrumentation().callActivityOnSaveInstanceState(activity, outState); - test.getInstrumentation().callActivityOnPause(activity); - test.getInstrumentation().callActivityOnResume(activity); - test.getInstrumentation().callActivityOnRestoreInstanceState(activity, outState); - } - }); - test.getInstrumentation().waitForIdleSync(); - } - - public static void swipeHorizontally(InstrumentationTestCase test, View v, Direction direction) { - int[] xy = new int[2]; - v.getLocationOnScreen(xy); - - final int viewWidth = v.getWidth(); - final int viewHeight = v.getHeight(); - - float distanceFromEdge = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, - v.getResources().getDisplayMetrics()); - float xStart = xy[0] + ((direction == Direction.LEFT) ? (viewWidth - distanceFromEdge) : distanceFromEdge); - float xEnd = xy[0] + ((direction == Direction.LEFT) ? distanceFromEdge : (viewWidth - distanceFromEdge)); - float y = xy[1] + (viewHeight / 2.0f); - - TouchUtils.drag(test, xStart, xEnd, y, y, DRAG_STEP_COUNT); - } - - public static void swipeVertically(InstrumentationTestCase test, View v, Direction direction) { - int[] xy = new int[2]; - v.getLocationOnScreen(xy); - - final int viewWidth = v.getWidth(); - final int viewHeight = v.getHeight(); - - float distanceFromEdge = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, - v.getResources().getDisplayMetrics()); - float x = xy[0] + (viewWidth / 2.0f); - float yStart = xy[1] + ((direction == Direction.UP) ? (viewHeight - distanceFromEdge) : distanceFromEdge); - float yEnd = xy[1] + ((direction == Direction.UP) ? distanceFromEdge : (viewHeight - distanceFromEdge)); - - TouchUtils.drag(test, x, x, yStart, yEnd, DRAG_STEP_COUNT); - } - - public static ArrayList getDummyData() { - return getDummyData(NUM_OF_ITEMS); - } - - public static ArrayList getDummyData(int num) { - ArrayList items = new ArrayList(); - for (int i = 1; i <= num; i++) { - items.add("Item " + i); - } - return items; - } - - public static void setDummyData(Context context, GridView gridView) { - gridView.setAdapter(new ArrayAdapter(context, android.R.layout.simple_list_item_1, getDummyData())); - } - - public static void setDummyData(Context context, ListView listView) { - setDummyData(context, listView, NUM_OF_ITEMS); - } - - public static void setDummyDataFew(Context context, ListView listView) { - setDummyData(context, listView, NUM_OF_ITEMS_FEW); - } - - public static void setDummyData(Context context, ListView listView, int num) { - listView.setAdapter(new ArrayAdapter(context, android.R.layout.simple_list_item_1, getDummyData(num))); - } - - public static void setDummyDataWithHeader(Context context, ListView listView, View headerView) { - listView.addHeaderView(headerView); - setDummyData(context, listView); - } - - public static void setDummyData(Context context, RecyclerView recyclerView) { - setDummyData(context, recyclerView, NUM_OF_ITEMS); - } - - public static void setDummyDataFew(Context context, RecyclerView recyclerView) { - setDummyData(context, recyclerView, NUM_OF_ITEMS_FEW); - } - - public static void setDummyData(Context context, RecyclerView recyclerView, int num) { - recyclerView.setAdapter(new SimpleRecyclerAdapter(context, getDummyData(num))); - } - - public static void setDummyDataWithHeader(Context context, RecyclerView recyclerView, View headerView) { - recyclerView.setAdapter(new SimpleHeaderRecyclerAdapter(context, getDummyData(), headerView)); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2Activity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2Activity.java deleted file mode 100755 index ecde277728..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2Activity.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.content.res.TypedArray; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBarActivity; -import android.support.v7.widget.Toolbar; -import android.util.TypedValue; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; -import android.widget.FrameLayout; - -import com.github.ksoichiro.android.observablescrollview.CacheFragmentStatePagerAdapter; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout; -import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; -import com.nineoldandroids.animation.ValueAnimator; -import com.nineoldandroids.view.ViewHelper; - -public class ViewPagerTab2Activity extends ActionBarActivity implements ObservableScrollViewCallbacks { - - private View mToolbarView; - private TouchInterceptionFrameLayout mInterceptionLayout; - private ViewPager mPager; - private NavigationAdapter mPagerAdapter; - private int mSlop; - private boolean mScrolled; - private ScrollState mLastScrollState; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_viewpagertab2); - - setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); - - mToolbarView = findViewById(R.id.toolbar); - mPagerAdapter = new NavigationAdapter(getSupportFragmentManager()); - mPager = (ViewPager) findViewById(R.id.pager); - mPager.setAdapter(mPagerAdapter); - // Padding for ViewPager must be set outside the ViewPager itself - // because with padding, EdgeEffect of ViewPager become strange. - final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height); - findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0); - - SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); - slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); - slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent)); - slidingTabLayout.setDistributeEvenly(true); - slidingTabLayout.setViewPager(mPager); - - ViewConfiguration vc = ViewConfiguration.get(this); - mSlop = vc.getScaledTouchSlop(); - mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container); - mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - if (!mScrolled) { - // This event can be used only when TouchInterceptionFrameLayout - // doesn't handle the consecutive events. - adjustToolbar(scrollState); - } - } - - private TouchInterceptionFrameLayout.TouchInterceptionListener mInterceptionListener = new TouchInterceptionFrameLayout.TouchInterceptionListener() { - @Override - public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) { - if (!mScrolled && mSlop < Math.abs(diffX) && Math.abs(diffY) < Math.abs(diffX)) { - // Horizontal scroll is maybe handled by ViewPager - return false; - } - - Scrollable scrollable = getCurrentScrollable(); - if (scrollable == null) { - mScrolled = false; - return false; - } - - // If interceptionLayout can move, it should intercept. - // And once it begins to move, horizontal scroll shouldn't work any longer. - int toolbarHeight = mToolbarView.getHeight(); - int translationY = (int) ViewHelper.getTranslationY(mInterceptionLayout); - boolean scrollingUp = 0 < diffY; - boolean scrollingDown = diffY < 0; - if (scrollingUp) { - if (translationY < 0) { - mScrolled = true; - mLastScrollState = ScrollState.UP; - return true; - } - } else if (scrollingDown) { - if (-toolbarHeight < translationY) { - mScrolled = true; - mLastScrollState = ScrollState.DOWN; - return true; - } - } - mScrolled = false; - return false; - } - - @Override - public void onDownMotionEvent(MotionEvent ev) { - } - - @Override - public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) { - float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -mToolbarView.getHeight(), 0); - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) (-translationY + getScreenHeight()); - mInterceptionLayout.requestLayout(); - } - } - - @Override - public void onUpOrCancelMotionEvent(MotionEvent ev) { - mScrolled = false; - adjustToolbar(mLastScrollState); - } - }; - - public Scrollable getCurrentScrollable() { - Fragment fragment = getCurrentFragment(); - if (fragment == null) { - return null; - } - View view = fragment.getView(); - if (view == null) { - return null; - } - return (Scrollable) view.findViewById(R.id.scroll); - } - - private void adjustToolbar(ScrollState scrollState) { - int toolbarHeight = mToolbarView.getHeight(); - final Scrollable scrollable = getCurrentScrollable(); - if (scrollable == null) { - return; - } - int scrollY = scrollable.getCurrentScrollY(); - if (scrollState == ScrollState.DOWN) { - showToolbar(); - } else if (scrollState == ScrollState.UP) { - if (toolbarHeight <= scrollY) { - hideToolbar(); - } else { - showToolbar(); - } - } else if (!toolbarIsShown() && !toolbarIsHidden()) { - // Toolbar is moving but doesn't know which to move: - // you can change this to hideToolbar() - showToolbar(); - } - } - - private Fragment getCurrentFragment() { - return mPagerAdapter.getItemAt(mPager.getCurrentItem()); - } - - private boolean toolbarIsShown() { - return ViewHelper.getTranslationY(mInterceptionLayout) == 0; - } - - private boolean toolbarIsHidden() { - return ViewHelper.getTranslationY(mInterceptionLayout) == -mToolbarView.getHeight(); - } - - private void showToolbar() { - animateToolbar(0); - } - - private void hideToolbar() { - animateToolbar(-mToolbarView.getHeight()); - } - - private void animateToolbar(final float toY) { - float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout); - if (layoutTranslationY != toY) { - ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200); - animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - float translationY = (float) animation.getAnimatedValue(); - ViewHelper.setTranslationY(mInterceptionLayout, translationY); - if (translationY < 0) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams(); - lp.height = (int) (-translationY + getScreenHeight()); - mInterceptionLayout.requestLayout(); - } - } - }); - animator.start(); - } - } - - private int getActionBarSize() { - TypedValue typedValue = new TypedValue(); - int[] textSizeAttr = new int[]{R.attr.actionBarSize}; - int indexOfAttrTextSize = 0; - TypedArray a = obtainStyledAttributes(typedValue.data, textSizeAttr); - int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1); - a.recycle(); - return actionBarSize; - } - - private int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } - - /** - * This adapter provides two types of fragments as an example. - * {@linkplain #createItem(int)} should be modified if you use this example for your app. - */ - private static class NavigationAdapter extends CacheFragmentStatePagerAdapter { - - private static final String[] TITLES = new String[]{"Applepie", "Butter Cookie", "Cupcake", "Donut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jelly Bean", "KitKat", "Lollipop"}; - - public NavigationAdapter(FragmentManager fm) { - super(fm); - } - - @Override - protected Fragment createItem(int position) { - Fragment f; - final int pattern = position % 5; - switch (pattern) { - case 0: - f = new ViewPagerTab2ScrollViewFragment(); - break; - case 1: - f = new ViewPagerTab2ListViewFragment(); - break; - case 2: - f = new ViewPagerTab2RecyclerViewFragment(); - break; - case 3: - f = new ViewPagerTab2GridViewFragment(); - break; - case 4: - default: - f = new ViewPagerTab2WebViewFragment(); - break; - } - return f; - } - - @Override - public int getCount() { - return TITLES.length; - } - - @Override - public CharSequence getPageTitle(int position) { - return TITLES[position]; - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ActivityTest.java deleted file mode 100755 index e1dc35a63b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ActivityTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.test.ActivityInstrumentationTestCase2; -import android.view.View; - -public class ViewPagerTab2ActivityTest extends ActivityInstrumentationTestCase2 { - - private ViewPagerTab2Activity activity; - - public ViewPagerTab2ActivityTest() { - super(ViewPagerTab2Activity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - } - - public void testScroll() throws Throwable { - for (int i = 0; i < 5; i++) { - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.LEFT); - getInstrumentation().waitForIdleSync(); - scroll(); - } - for (int i = 0; i < 5; i++) { - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.RIGHT); - getInstrumentation().waitForIdleSync(); - scroll(); - } - } - - public void scroll() throws Throwable { - View scrollable = ((View) activity.getCurrentScrollable()).findViewById(R.id.scroll); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - for (int i = 0; i < 5; i++) { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - scroll(); - - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.LEFT); - getInstrumentation().waitForIdleSync(); - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2GridViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2GridViewFragment.java deleted file mode 100755 index 401752a985..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2GridViewFragment.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableGridView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; - -public class ViewPagerTab2GridViewFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_gridview, container, false); - - Activity parentActivity = getActivity(); - final ObservableGridView gridView = (ObservableGridView) view.findViewById(R.id.scroll); - UiTestUtils.setDummyData(getActivity(), gridView); - gridView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); - - if (parentActivity instanceof ObservableScrollViewCallbacks) { - gridView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ListViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ListViewFragment.java deleted file mode 100755 index 33daf0c8e9..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ListViewFragment.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; - -public class ViewPagerTab2ListViewFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_listview, container, false); - - Activity parentActivity = getActivity(); - final ObservableListView listView = (ObservableListView) view.findViewById(R.id.scroll); - UiTestUtils.setDummyData(getActivity(), listView); - listView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); - - if (parentActivity instanceof ObservableScrollViewCallbacks) { - listView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2RecyclerViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2RecyclerViewFragment.java deleted file mode 100755 index 1e20ed93b0..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2RecyclerViewFragment.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v7.widget.LinearLayoutManager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; - -public class ViewPagerTab2RecyclerViewFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_recyclerview, container, false); - - Activity parentActivity = getActivity(); - final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll); - recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity)); - recyclerView.setHasFixedSize(false); - UiTestUtils.setDummyData(getActivity(), recyclerView); - recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); - - if (parentActivity instanceof ObservableScrollViewCallbacks) { - recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ScrollViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ScrollViewFragment.java deleted file mode 100755 index 286e96e5ae..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2ScrollViewFragment.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; - -public class ViewPagerTab2ScrollViewFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false); - - final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); - Activity parentActivity = getActivity(); - scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); - if (parentActivity instanceof ObservableScrollViewCallbacks) { - scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2WebViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2WebViewFragment.java deleted file mode 100755 index 582873f306..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTab2WebViewFragment.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ObservableWebView; - -public class ViewPagerTab2WebViewFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_webview, container, false); - - final ObservableWebView webView = (ObservableWebView) view.findViewById(R.id.scroll); - webView.loadUrl("file:///android_asset/lipsum.html"); - Activity parentActivity = getActivity(); - webView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); - if (parentActivity instanceof ObservableScrollViewCallbacks) { - webView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivity.java deleted file mode 100755 index 3915379038..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivity.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBarActivity; -import android.support.v7.widget.Toolbar; -import android.view.View; - -import com.github.ksoichiro.android.observablescrollview.CacheFragmentStatePagerAdapter; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; -import com.github.ksoichiro.android.observablescrollview.Scrollable; -import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; -import com.nineoldandroids.view.ViewHelper; -import com.nineoldandroids.view.ViewPropertyAnimator; - -public class ViewPagerTabActivity extends ActionBarActivity implements ObservableScrollViewCallbacks { - - private View mHeaderView; - private View mToolbarView; - private int mBaseTranslationY; - private ViewPager mPager; - private NavigationAdapter mPagerAdapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_viewpagertab); - - setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); - - mHeaderView = findViewById(R.id.header); - mToolbarView = findViewById(R.id.toolbar); - mPagerAdapter = new NavigationAdapter(getSupportFragmentManager()); - mPager = (ViewPager) findViewById(R.id.pager); - mPager.setAdapter(mPagerAdapter); - - SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); - slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); - slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent)); - slidingTabLayout.setDistributeEvenly(true); - slidingTabLayout.setViewPager(mPager); - - // When the page is selected, other fragments' scrollY should be adjusted - // according to the toolbar status(shown/hidden) - slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int i, float v, int i2) { - } - - @Override - public void onPageSelected(int i) { - propagateToolbarState(toolbarIsShown()); - } - - @Override - public void onPageScrollStateChanged(int i) { - } - }); - - propagateToolbarState(toolbarIsShown()); - } - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); - float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); - if (firstScroll) { - if (-toolbarHeight < currentHeaderTranslationY) { - mBaseTranslationY = scrollY; - } - } - float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0); - ViewPropertyAnimator.animate(mHeaderView).cancel(); - ViewHelper.setTranslationY(mHeaderView, headerTranslationY); - } - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - mBaseTranslationY = 0; - - Fragment fragment = getCurrentFragment(); - if (fragment == null) { - return; - } - View view = fragment.getView(); - if (view == null) { - return; - } - - // ObservableXxxViews have same API - // but currently they don't have any common interfaces. - adjustToolbar(scrollState, view); - } - - public Scrollable getCurrentScrollable() { - Fragment fragment = getCurrentFragment(); - if (fragment == null) { - return null; - } - View view = fragment.getView(); - if (view == null) { - return null; - } - return (Scrollable) view.findViewById(R.id.scroll); - } - - private void adjustToolbar(ScrollState scrollState, View view) { - int toolbarHeight = mToolbarView.getHeight(); - final Scrollable scrollView = (Scrollable) view.findViewById(R.id.scroll); - if (scrollView == null) { - return; - } - int scrollY = scrollView.getCurrentScrollY(); - if (scrollState == ScrollState.DOWN) { - showToolbar(); - } else if (scrollState == ScrollState.UP) { - if (toolbarHeight <= scrollY) { - hideToolbar(); - } else { - showToolbar(); - } - } else { - // Even if onScrollChanged occurs without scrollY changing, toolbar should be adjusted - if (toolbarIsShown() || toolbarIsHidden()) { - // Toolbar is completely moved, so just keep its state - // and propagate it to other pages - propagateToolbarState(toolbarIsShown()); - } else { - // Toolbar is moving but doesn't know which to move: - // you can change this to hideToolbar() - showToolbar(); - } - } - } - - public Fragment getCurrentFragment() { - return mPagerAdapter.getItemAt(mPager.getCurrentItem()); - } - - private void propagateToolbarState(boolean isShown) { - int toolbarHeight = mToolbarView.getHeight(); - - // Set scrollY for the fragments that are not created yet - mPagerAdapter.setScrollY(isShown ? 0 : toolbarHeight); - - // Set scrollY for the active fragments - for (int i = 0; i < mPagerAdapter.getCount(); i++) { - // Skip current item - if (i == mPager.getCurrentItem()) { - continue; - } - - // Skip destroyed or not created item - Fragment f = mPagerAdapter.getItemAt(i); - if (f == null) { - continue; - } - - View view = f.getView(); - if (view == null) { - continue; - } - propagateToolbarState(isShown, view, toolbarHeight); - } - } - - private void propagateToolbarState(boolean isShown, View view, int toolbarHeight) { - Scrollable scrollView = (Scrollable) view.findViewById(R.id.scroll); - if (scrollView == null) { - return; - } - if (isShown) { - // Scroll up - if (0 < scrollView.getCurrentScrollY()) { - scrollView.scrollVerticallyTo(0); - } - } else { - // Scroll down (to hide padding) - if (scrollView.getCurrentScrollY() < toolbarHeight) { - scrollView.scrollVerticallyTo(toolbarHeight); - } - } - } - - private boolean toolbarIsShown() { - return ViewHelper.getTranslationY(mHeaderView) == 0; - } - - private boolean toolbarIsHidden() { - return ViewHelper.getTranslationY(mHeaderView) == -mToolbarView.getHeight(); - } - - private void showToolbar() { - float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); - if (headerTranslationY != 0) { - ViewPropertyAnimator.animate(mHeaderView).cancel(); - ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); - } - propagateToolbarState(true); - } - - private void hideToolbar() { - float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); - int toolbarHeight = mToolbarView.getHeight(); - if (headerTranslationY != -toolbarHeight) { - ViewPropertyAnimator.animate(mHeaderView).cancel(); - ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); - } - propagateToolbarState(false); - } - - /** - * This adapter provides two types of fragments as an example. - * {@linkplain #createItem(int)} should be modified if you use this example for your app. - */ - private static class NavigationAdapter extends CacheFragmentStatePagerAdapter { - - private static final String[] TITLES = new String[]{"Applepie", "Butter Cookie", "Cupcake", "Donut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jelly Bean", "KitKat", "Lollipop"}; - - private int mScrollY; - - public NavigationAdapter(FragmentManager fm) { - super(fm); - } - - public void setScrollY(int scrollY) { - mScrollY = scrollY; - } - - @Override - protected Fragment createItem(int position) { - // Initialize fragments. - // Please be sure to pass scroll position to each fragments using setArguments. - Fragment f; - final int pattern = position % 3; - switch (pattern) { - case 0: { - f = new ViewPagerTabScrollViewFragment(); - if (0 <= mScrollY) { - Bundle args = new Bundle(); - args.putInt(ViewPagerTabScrollViewFragment.ARG_SCROLL_Y, mScrollY); - f.setArguments(args); - } - break; - } - case 1: { - f = new ViewPagerTabListViewFragment(); - if (0 < mScrollY) { - Bundle args = new Bundle(); - args.putInt(ViewPagerTabListViewFragment.ARG_INITIAL_POSITION, 1); - f.setArguments(args); - } - break; - } - case 2: - default: { - f = new ViewPagerTabRecyclerViewFragment(); - if (0 < mScrollY) { - Bundle args = new Bundle(); - args.putInt(ViewPagerTabRecyclerViewFragment.ARG_INITIAL_POSITION, 1); - f.setArguments(args); - } - break; - } - } - return f; - } - - @Override - public int getCount() { - return TITLES.length; - } - - @Override - public CharSequence getPageTitle(int position) { - return TITLES[position]; - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivityTest.java deleted file mode 100755 index 6125d6ff26..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabActivityTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.test.ActivityInstrumentationTestCase2; -import android.view.View; - -public class ViewPagerTabActivityTest extends ActivityInstrumentationTestCase2 { - - private ViewPagerTabActivity activity; - - public ViewPagerTabActivityTest() { - super(ViewPagerTabActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - } - - public void testScroll() throws Throwable { - for (int i = 0; i < 3; i++) { - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.LEFT); - getInstrumentation().waitForIdleSync(); - scroll(); - } - for (int i = 0; i < 3; i++) { - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.RIGHT); - getInstrumentation().waitForIdleSync(); - scroll(); - } - } - - public void scroll() throws Throwable { - View scrollable = ((View) activity.getCurrentScrollable()).findViewById(R.id.scroll); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - for (int i = 0; i < 3; i++) { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - scroll(); - - UiTestUtils.swipeHorizontally(this, activity.findViewById(R.id.pager), UiTestUtils.Direction.LEFT); - getInstrumentation().waitForIdleSync(); - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabListViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabListViewFragment.java deleted file mode 100755 index 447e54b2d4..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabListViewFragment.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -public class ViewPagerTabListViewFragment extends Fragment { - - public static final String ARG_INITIAL_POSITION = "ARG_INITIAL_POSITION"; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_listview, container, false); - - Activity parentActivity = getActivity(); - final ObservableListView listView = (ObservableListView) view.findViewById(R.id.scroll); - UiTestUtils.setDummyDataWithHeader(getActivity(), listView, inflater.inflate(R.layout.padding, null)); - - if (parentActivity instanceof ObservableScrollViewCallbacks) { - // Scroll to the specified position after layout - Bundle args = getArguments(); - if (args != null && args.containsKey(ARG_INITIAL_POSITION)) { - final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0); - ScrollUtils.addOnGlobalLayoutListener(listView, new Runnable() { - @Override - public void run() { - // scrollTo() doesn't work, should use setSelection() - listView.setSelection(initialPosition); - } - }); - } - listView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabRecyclerViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabRecyclerViewFragment.java deleted file mode 100755 index f91988e8a7..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabRecyclerViewFragment.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v7.widget.LinearLayoutManager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -public class ViewPagerTabRecyclerViewFragment extends Fragment { - - public static final String ARG_INITIAL_POSITION = "ARG_INITIAL_POSITION"; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_recyclerview, container, false); - - Activity parentActivity = getActivity(); - final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll); - recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity)); - recyclerView.setHasFixedSize(false); - View headerView = LayoutInflater.from(parentActivity).inflate(R.layout.padding, null); - UiTestUtils.setDummyDataWithHeader(getActivity(), recyclerView, headerView); - - if (parentActivity instanceof ObservableScrollViewCallbacks) { - // Scroll to the specified offset after layout - Bundle args = getArguments(); - if (args != null && args.containsKey(ARG_INITIAL_POSITION)) { - final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0); - ScrollUtils.addOnGlobalLayoutListener(recyclerView, new Runnable() { - @Override - public void run() { - recyclerView.scrollVerticallyToPosition(initialPosition); - } - }); - } - recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabScrollViewFragment.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabScrollViewFragment.java deleted file mode 100755 index 16c6265836..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/ViewPagerTabScrollViewFragment.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2014 Soichiro Kashima - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollUtils; - -public class ViewPagerTabScrollViewFragment extends Fragment { - - public static final String ARG_SCROLL_Y = "ARG_SCROLL_Y"; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_scrollview, container, false); - - final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); - Activity parentActivity = getActivity(); - if (parentActivity instanceof ObservableScrollViewCallbacks) { - // Scroll to the specified offset after layout - Bundle args = getArguments(); - if (args != null && args.containsKey(ARG_SCROLL_Y)) { - final int scrollY = args.getInt(ARG_SCROLL_Y, 0); - ScrollUtils.addOnGlobalLayoutListener(scrollView, new Runnable() { - @Override - public void run() { - scrollView.scrollTo(0, scrollY); - } - }); - } - scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); - } - return view; - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivity.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivity.java deleted file mode 100755 index dd13963a80..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivity.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.os.Bundle; - -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ObservableWebView; -import com.github.ksoichiro.android.observablescrollview.ScrollState; -import com.github.ksoichiro.android.observablescrollview.Scrollable; - -public class WebViewActivity extends Activity implements ObservableScrollViewCallbacks { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_webview); - ObservableWebView scrollable = (ObservableWebView) findViewById(R.id.scrollable); - scrollable.setScrollViewCallbacks(this); - scrollable.loadUrl("file:///android_asset/lipsum.html"); - } - - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - } - - @Override - public void onDownMotionEvent() { - } - - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivityTest.java b/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivityTest.java deleted file mode 100755 index d6cc295eba..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/WebViewActivityTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.ksoichiro.android.observablescrollview.test; - -import android.app.Activity; -import android.test.ActivityInstrumentationTestCase2; -import android.util.DisplayMetrics; -import android.util.TypedValue; - -import com.github.ksoichiro.android.observablescrollview.ObservableWebView; - -public class WebViewActivityTest extends ActivityInstrumentationTestCase2 { - - private Activity activity; - private ObservableWebView scrollable; - - public WebViewActivityTest() { - super(WebViewActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(true); - activity = getActivity(); - scrollable = (ObservableWebView) activity.findViewById(R.id.scrollable); - } - - public void testScroll() throws Throwable { - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP); - getInstrumentation().waitForIdleSync(); - - UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN); - getInstrumentation().waitForIdleSync(); - } - - public void testSaveAndRestoreInstanceState() throws Throwable { - UiTestUtils.saveAndRestoreInstanceState(this, activity); - testScroll(); - } - - public void testScrollVerticallyTo() throws Throwable { - final DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, metrics)); - } - }); - getInstrumentation().waitForIdleSync(); - - runTestOnUiThread(new Runnable() { - @Override - public void run() { - scrollable.scrollVerticallyTo(0); - } - }); - getInstrumentation().waitForIdleSync(); - } -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java b/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java deleted file mode 100755 index 06f60f7afc..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.samples.apps.iosched.ui.widget; - -import android.content.Context; -import android.graphics.Typeface; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.AttributeSet; -import android.util.SparseArray; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.HorizontalScrollView; -import android.widget.LinearLayout; -import android.widget.TextView; - -/** - * To be used with ViewPager to provide a tab indicator component which give constant feedback as to - * the user's scroll progress. - *

- * To use the component, simply add it to your view hierarchy. Then in your - * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call - * {@link #setViewPager(android.support.v4.view.ViewPager)} providing it the ViewPager this layout is being used for. - *

- * The colors can be customized in two ways. The first and simplest is to provide an array of colors - * via {@link #setSelectedIndicatorColors(int...)}. The - * alternative is via the {@link com.google.samples.apps.iosched.ui.widget.SlidingTabLayout.TabColorizer} interface which provides you complete control over - * which color is used for any individual position. - *

- * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)}, - * providing the layout ID of your custom layout. - */ -public class SlidingTabLayout extends HorizontalScrollView { - /** - * Allows complete control over the colors drawn in the tab layout. Set with - * {@link #setCustomTabColorizer(com.google.samples.apps.iosched.ui.widget.SlidingTabLayout.TabColorizer)}. - */ - public interface TabColorizer { - - /** - * @return return the color of the indicator used when {@code position} is selected. - */ - int getIndicatorColor(int position); - - } - - private static final int TITLE_OFFSET_DIPS = 24; - private static final int TAB_VIEW_PADDING_DIPS = 16; - private static final int TAB_VIEW_TEXT_SIZE_SP = 12; - - private int mTitleOffset; - - private int mTabViewLayoutId; - private int mTabViewTextViewId; - private boolean mDistributeEvenly; - - private ViewPager mViewPager; - private SparseArray mContentDescriptions = new SparseArray(); - private ViewPager.OnPageChangeListener mViewPagerPageChangeListener; - - private final SlidingTabStrip mTabStrip; - - public SlidingTabLayout(Context context) { - this(context, null); - } - - public SlidingTabLayout(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - // Disable the Scroll Bar - setHorizontalScrollBarEnabled(false); - // Make sure that the Tab Strips fills this View - setFillViewport(true); - - mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); - - mTabStrip = new SlidingTabStrip(context); - addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - } - - /** - * Set the custom {@link com.google.samples.apps.iosched.ui.widget.SlidingTabLayout.TabColorizer} to be used. - * - * If you only require simple custmisation then you can use - * {@link #setSelectedIndicatorColors(int...)} to achieve - * similar effects. - */ - public void setCustomTabColorizer(TabColorizer tabColorizer) { - mTabStrip.setCustomTabColorizer(tabColorizer); - } - - public void setDistributeEvenly(boolean distributeEvenly) { - mDistributeEvenly = distributeEvenly; - } - - /** - * Sets the colors to be used for indicating the selected tab. These colors are treated as a - * circular array. Providing one color will mean that all tabs are indicated with the same color. - */ - public void setSelectedIndicatorColors(int... colors) { - mTabStrip.setSelectedIndicatorColors(colors); - } - - /** - * Set the {@link android.support.v4.view.ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are - * required to set any {@link android.support.v4.view.ViewPager.OnPageChangeListener} through this method. This is so - * that the layout can update it's scroll position correctly. - * - * @see android.support.v4.view.ViewPager#setOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener) - */ - public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { - mViewPagerPageChangeListener = listener; - } - - /** - * Set the custom layout to be inflated for the tab views. - * - * @param layoutResId Layout id to be inflated - * @param textViewId id of the {@link android.widget.TextView} in the inflated view - */ - public void setCustomTabView(int layoutResId, int textViewId) { - mTabViewLayoutId = layoutResId; - mTabViewTextViewId = textViewId; - } - - /** - * Sets the associated view pager. Note that the assumption here is that the pager content - * (number of tabs and tab titles) does not change after this call has been made. - */ - public void setViewPager(ViewPager viewPager) { - mTabStrip.removeAllViews(); - - mViewPager = viewPager; - if (viewPager != null) { - viewPager.setOnPageChangeListener(new InternalViewPagerListener()); - populateTabStrip(); - } - } - - /** - * Create a default view to be used for tabs. This is called if a custom tab view is not set via - * {@link #setCustomTabView(int, int)}. - */ - protected TextView createDefaultTabView(Context context) { - TextView textView = new TextView(context); - textView.setGravity(Gravity.CENTER); - textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); - textView.setTypeface(Typeface.DEFAULT_BOLD); - textView.setLayoutParams(new LinearLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - - TypedValue outValue = new TypedValue(); - getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, - outValue, true); - textView.setBackgroundResource(outValue.resourceId); - textView.setAllCaps(true); - - int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); - textView.setPadding(padding, padding, padding, padding); - - return textView; - } - - private void populateTabStrip() { - final PagerAdapter adapter = mViewPager.getAdapter(); - final OnClickListener tabClickListener = new TabClickListener(); - - for (int i = 0; i < adapter.getCount(); i++) { - View tabView = null; - TextView tabTitleView = null; - - if (mTabViewLayoutId != 0) { - // If there is a custom tab view layout id set, try and inflate it - tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, - false); - tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); - } - - if (tabView == null) { - tabView = createDefaultTabView(getContext()); - } - - if (tabTitleView == null && TextView.class.isInstance(tabView)) { - tabTitleView = (TextView) tabView; - } - - if (mDistributeEvenly) { - LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); - lp.width = 0; - lp.weight = 1; - } - - tabTitleView.setText(adapter.getPageTitle(i)); - tabView.setOnClickListener(tabClickListener); - String desc = mContentDescriptions.get(i, null); - if (desc != null) { - tabView.setContentDescription(desc); - } - - mTabStrip.addView(tabView); - if (i == mViewPager.getCurrentItem()) { - tabView.setSelected(true); - } - } - } - - public void setContentDescription(int i, String desc) { - mContentDescriptions.put(i, desc); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - - if (mViewPager != null) { - scrollToTab(mViewPager.getCurrentItem(), 0); - } - } - - private void scrollToTab(int tabIndex, int positionOffset) { - final int tabStripChildCount = mTabStrip.getChildCount(); - if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { - return; - } - - View selectedChild = mTabStrip.getChildAt(tabIndex); - if (selectedChild != null) { - int targetScrollX = selectedChild.getLeft() + positionOffset; - - if (tabIndex > 0 || positionOffset > 0) { - // If we're not at the first child and are mid-scroll, make sure we obey the offset - targetScrollX -= mTitleOffset; - } - - scrollTo(targetScrollX, 0); - } - } - - private class InternalViewPagerListener implements ViewPager.OnPageChangeListener { - private int mScrollState; - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - int tabStripChildCount = mTabStrip.getChildCount(); - if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) { - return; - } - - mTabStrip.onViewPagerPageChanged(position, positionOffset); - - View selectedTitle = mTabStrip.getChildAt(position); - int extraOffset = (selectedTitle != null) - ? (int) (positionOffset * selectedTitle.getWidth()) - : 0; - scrollToTab(position, extraOffset); - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, - positionOffsetPixels); - } - } - - @Override - public void onPageScrollStateChanged(int state) { - mScrollState = state; - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrollStateChanged(state); - } - } - - @Override - public void onPageSelected(int position) { - if (mScrollState == ViewPager.SCROLL_STATE_IDLE) { - mTabStrip.onViewPagerPageChanged(position, 0f); - scrollToTab(position, 0); - } - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - mTabStrip.getChildAt(i).setSelected(position == i); - } - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageSelected(position); - } - } - - } - - private class TabClickListener implements OnClickListener { - @Override - public void onClick(View v) { - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - if (v == mTabStrip.getChildAt(i)) { - mViewPager.setCurrentItem(i); - return; - } - } - } - } - -} diff --git a/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java b/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java deleted file mode 100755 index 803c4fb41d..0000000000 --- a/eclipse-compile/observable/java2/androidTest/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.samples.apps.iosched.ui.widget; - -import android.R; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.View; -import android.widget.LinearLayout; - -class SlidingTabStrip extends LinearLayout { - - private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0; - private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; - private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 3; - private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; - - private final int mBottomBorderThickness; - private final Paint mBottomBorderPaint; - - private final int mSelectedIndicatorThickness; - private final Paint mSelectedIndicatorPaint; - - private final int mDefaultBottomBorderColor; - - private int mSelectedPosition; - private float mSelectionOffset; - - private SlidingTabLayout.TabColorizer mCustomTabColorizer; - private final SimpleTabColorizer mDefaultTabColorizer; - - SlidingTabStrip(Context context) { - this(context, null); - } - - SlidingTabStrip(Context context, AttributeSet attrs) { - super(context, attrs); - setWillNotDraw(false); - - final float density = getResources().getDisplayMetrics().density; - - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true); - final int themeForegroundColor = outValue.data; - - mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, - DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); - - mDefaultTabColorizer = new SimpleTabColorizer(); - mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); - - mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); - mBottomBorderPaint = new Paint(); - mBottomBorderPaint.setColor(mDefaultBottomBorderColor); - - mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); - mSelectedIndicatorPaint = new Paint(); - } - - void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) { - mCustomTabColorizer = customTabColorizer; - invalidate(); - } - - void setSelectedIndicatorColors(int... colors) { - // Make sure that the custom colorizer is removed - mCustomTabColorizer = null; - mDefaultTabColorizer.setIndicatorColors(colors); - invalidate(); - } - - void onViewPagerPageChanged(int position, float positionOffset) { - mSelectedPosition = position; - mSelectionOffset = positionOffset; - invalidate(); - } - - @Override - protected void onDraw(Canvas canvas) { - final int height = getHeight(); - final int childCount = getChildCount(); - final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null - ? mCustomTabColorizer - : mDefaultTabColorizer; - - // Thick colored underline below the current selection - if (childCount > 0) { - View selectedTitle = getChildAt(mSelectedPosition); - int left = selectedTitle.getLeft(); - int right = selectedTitle.getRight(); - int color = tabColorizer.getIndicatorColor(mSelectedPosition); - - if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) { - int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1); - if (color != nextColor) { - color = blendColors(nextColor, color, mSelectionOffset); - } - - // Draw the selection partway between the tabs - View nextTitle = getChildAt(mSelectedPosition + 1); - left = (int) (mSelectionOffset * nextTitle.getLeft() + - (1.0f - mSelectionOffset) * left); - right = (int) (mSelectionOffset * nextTitle.getRight() + - (1.0f - mSelectionOffset) * right); - } - - mSelectedIndicatorPaint.setColor(color); - - canvas.drawRect(left, height - mSelectedIndicatorThickness, right, - height, mSelectedIndicatorPaint); - } - - // Thin underline along the entire bottom edge - canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint); - } - - /** - * Set the alpha value of the {@code color} to be the given {@code alpha} value. - */ - private static int setColorAlpha(int color, byte alpha) { - return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); - } - - /** - * Blend {@code color1} and {@code color2} using the given ratio. - * - * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, - * 0.0 will return {@code color2}. - */ - private static int blendColors(int color1, int color2, float ratio) { - final float inverseRation = 1f - ratio; - float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); - float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); - float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); - return Color.rgb((int) r, (int) g, (int) b); - } - - private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { - private int[] mIndicatorColors; - - @Override - public final int getIndicatorColor(int position) { - return mIndicatorColors[position % mIndicatorColors.length]; - } - - void setIndicatorColors(int... colors) { - mIndicatorColors = colors; - } - } -} diff --git a/eclipse-compile/observable/java2/androidTest/res/color/tab_text_color.xml b/eclipse-compile/observable/java2/androidTest/res/color/tab_text_color.xml deleted file mode 100755 index 48f21f866b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/color/tab_text_color.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_gridview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_gridview.xml deleted file mode 100755 index d5ddb31dda..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_gridview.xml +++ /dev/null @@ -1,20 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_listview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_listview.xml deleted file mode 100755 index 18dd210b48..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_listview.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_recyclerview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_recyclerview.xml deleted file mode 100755 index dce42c4710..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_recyclerview.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_scrollview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_scrollview.xml deleted file mode 100755 index 972537fe60..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_scrollview.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_gridview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_gridview.xml deleted file mode 100755 index 043e6175c6..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_gridview.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_listview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_listview.xml deleted file mode 100755 index 05c8e29976..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_listview.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_recyclerview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_recyclerview.xml deleted file mode 100755 index c236b3d15a..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_recyclerview.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_scrollview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_scrollview.xml deleted file mode 100755 index de7cf631c7..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_scrollview.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_webview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_webview.xml deleted file mode 100755 index 8e834969ed..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_touchinterception_webview.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab.xml deleted file mode 100755 index c55804bd5f..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab2.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab2.xml deleted file mode 100755 index 510ed95cbe..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_viewpagertab2.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/activity_webview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/activity_webview.xml deleted file mode 100755 index 75d62617cf..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/activity_webview.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_gridview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_gridview.xml deleted file mode 100755 index 65241a4d05..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_gridview.xml +++ /dev/null @@ -1,20 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_listview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_listview.xml deleted file mode 100755 index 08d5d41b8f..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_listview.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_recyclerview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_recyclerview.xml deleted file mode 100755 index 49f0959042..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_recyclerview.xml +++ /dev/null @@ -1,20 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview.xml deleted file mode 100755 index 0be95c8542..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview_noheader.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview_noheader.xml deleted file mode 100755 index 2ac408dd4b..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_scrollview_noheader.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_webview.xml b/eclipse-compile/observable/java2/androidTest/res/layout/fragment_webview.xml deleted file mode 100755 index b02d9ec387..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/fragment_webview.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/padding.xml b/eclipse-compile/observable/java2/androidTest/res/layout/padding.xml deleted file mode 100755 index b3550e378e..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/padding.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/eclipse-compile/observable/java2/androidTest/res/layout/tab_indicator.xml b/eclipse-compile/observable/java2/androidTest/res/layout/tab_indicator.xml deleted file mode 100755 index 3bf50059c8..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/layout/tab_indicator.xml +++ /dev/null @@ -1,25 +0,0 @@ - - \ No newline at end of file diff --git a/eclipse-compile/observable/java2/androidTest/res/values/colors.xml b/eclipse-compile/observable/java2/androidTest/res/values/colors.xml deleted file mode 100755 index 221c75c779..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/values/colors.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - #009688 - #00796b - #eeff41 - - diff --git a/eclipse-compile/observable/java2/androidTest/res/values/dimens.xml b/eclipse-compile/observable/java2/androidTest/res/values/dimens.xml deleted file mode 100755 index 286c5be17f..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/values/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - 48dp - 72dp - 56dp - 16dp - diff --git a/eclipse-compile/observable/java2/androidTest/res/values/strings.xml b/eclipse-compile/observable/java2/androidTest/res/values/strings.xml deleted file mode 100755 index 6f8f606284..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/values/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Lorem ipsum dolor sit amet, ut duis lorem provident sed felis blandit, condimentum donec lectus ipsum et mauris, morbi porttitor interdum feugiat nulla donec sodales, vestibulum nisl primis a molestie vestibulum quam, sapien mauris metus risus suspendisse magnis. Augue viverra nulla faucibus egestas eu, a etiam id congue rutrum ante, arcu tincidunt donec quam felis at ornare, iaculis ligula sodales venenatis commodo volutpat neque, suspendisse elit praesent tellus felis mi amet. Inceptos amet tempor lectus lorem est non, ac donec ac libero neque mauris, tellus ante metus eget leo consequat. Scelerisque dolor curabitur pretium blandit ut feugiat, amet lacus pulvinar justo convallis ut, sed natoque ipsum urna posuere nibh eu. Sed at sed vulputate sit orci, facilisis a aliquam tellus quam aliquam, eu aliquam donec at molestie ante, pellentesque mauris lorem ultrices libero faucibus porta, imperdiet adipiscing sit hac diam ut nulla. Lacus enim elit pulvinar donec vehicula dapibus, accumsan purus officia cursus dolor sapien, eu amet dis mauris mi nulla ut. Non accusamus etiam pede non urna tempus, vestibulum aliquam tortor eget pharetra sodales, in vestibulum ut justo orci nulla, lobortis purus sem semper consectetuer magni purus. Dolor a leo vestibulum amet ut sit, arcu ut eaque urna fusce aliquet turpis, sed fermentum sed vestibulum nisl pede, tristique enim lorem posuere in laborum ut. Vestibulum id id justo leo nulla, magna lobortis ullamcorper et dignissim pellentesque, duis suspendisse quis id lorem ante. Vivamus a nullam ante adipiscing amet, mi vel consectetuer nunc aenean pede quisque, eget rhoncus dis porttitor habitant nunc vivamus, duis cubilia blandit non donec justo dictumst, praesent vitae nulla nam pulvinar urna. Adipiscing adipiscing justo urna pulvinar imperdiet nullam, vitae fusce rhoncus proin nonummy suscipit, ullamcorper amet et non potenti platea ultrices, mauris nullam sapien nunc justo vel, eu semper pellentesque arcu fusce augue. Malesuada mauris nibh sit a a scelerisque, velit sem lectus tellus convallis consectetuer, ultricies auctor a ante eros amet sed.\n\n -Risus lacus duis leo platea wisi, felis maecenas rutrum in id in donec, non id a potenti libero eget, posuere elit ea sed pellentesque quis. Sunt lacus urna lorem elit duis, nibh donec purus quisque consectetuer dolor, neque vestibulum proin ornare eros nonummy phasellus. Iaculis cras eu at egestas dolor montes, viverra quisque malesuada consectetuer semper maecenas, a sed vitae donec tempor aliqua metus, ornare mollis suscipit et erat fusce, sit orci aut auctor elementum fames aliquam. Platea dui integer magnis non metus, minus dignissimos ante massa nostra et, rutrum sapien egestas quis sapien donec donec. Erat sit a eros aenean natoque, quam libero id lorem enim proin, lorem ipsum fermentum mattis metus et. Aliquam aliquet suscipit purus conubia at neque, platea vivamus vestibulum nulla quibusdam senectus, et morbi lectus malesuada gravida donec, elementum sit convallis pellentesque velit amet. Et eveniet viverra vehicula consectetuer justo, provident sed commodo non lacinia velit, tempor phasellus vel leo nisl cras, vivamus et arcu interdum dui eu amet. Volutpat wisi rhoncus vel turpis diam quibusdam, dapibus elit est quisque cubilia mauris, nulla elit magna tempor accumsan bibendum, lorem varius sed interdum eget mattis, scelerisque egestas feugiat donec dui molestie. Leo facilisis nisl sit montes ligula sed, enim commodo consectetuer nunc est et, ut sed vehicula dolor luctus elit. Fermentum cras donec eget nibh est vel, sed justo risus et pharetra diam, eu vivamus egestas ligula risus diam, sed justo eget hac ut mauris. Vestibulum diam nec vitae mi eget suspendisse, aenean arcu purus facilisis purus class in, id aliquam sit id scelerisque sapien etiam. Ut nullam sit sed at mauris lobortis, consequat dolor autem ipsum euismod nulla, elit quis proin eget conubia varius, erat arcu massa mus in mauris, scelerisque ut eu sollicitudin libero leo urna.\n\n -Consectetuer luctus tempor elit ut dolor ligula, quis dui per dui hendrerit ante sagittis, in quisque pretium in eleifend enim. Condimentum iaculis vitae feugiat dis tellus vel, lectus dolor nec dui nulla nascetur, et pellentesque curabitur lorem leo velit eget. Id nascetur arcu lobortis suspendisse imperdiet urna, natoque nascetur ante in porta a, interdum hendrerit mi bibendum platea tellus, urna in enim ornare vestibulum faucibus enim. Leo fusce egestas ante nec volutpat, in tempor vel facilisis potenti ut, pede at non lorem a commodo, nulla dolor orci interdum vestibulum nulla. Dui nulla vestibulum quisque a pharetra porta, integer nec ipsum nec sed dui pharetra, magna et dignissim ipsum sed dictum, litora eros vivamus scelerisque libero ipsum. Sed ac ac lorem molestie adipiscing morbi, pellentesque imperdiet nunc quis morbi amet ante, libero dui ligula nec risus neque et, velit nonummy phasellus et facilisi amet, ligula in elementum non sapien pulvinar faucibus. Eu leo ut posuere sed aliquet, tincidunt vel urna volutpat tempus sem, sit felis aliquet vestibulum condimentum sit, amet nibh vel tellus purus ullamcorper libero, nulla vestibulum pede ut vestibulum pretium. Eu nulla vestibulum a neque in metus, quisquam nam sed cursus eget luctus, pede ultrices nec sed dignissim pellentesque, sit class cursus metus nulla placerat mauris, consequat mollis neque vivamus amet pede. Mauris dolor nulla diam eros bibendum, quam ante vestibulum morbi non ligula vel, molestie curabitur rhoncus nulla euismod interdum non. Nulla fringilla lorem mollis ad massa, sit molestie nibh lorem arcu volutpat, accumsan commodo lectus eu et donec, sit tempor tempus rutrum in curabitur amet. Nec urna euismod a tincidunt commodo, eu pede turpis libero vitae viverra, ante vestibulum nam non habitasse potenti, mauris imperdiet in in nunc convallis. Et nostra wisi in est accumsan vehicula, quisque vitae felis mauris sed vulputate nec, ante imperdiet sollicitudin massa iaculis massa sit.\n\n -Quam libero nulla netus eu porta curae, ut nulla bibendum facilisis et urna sed, quis congue vestibulum aliquam interdum etiam. Nulla vel lobortis ullamcorper vitae excepturi, neque urna feugiat lectus vel lacinia, massa pretium orci eu metus neque vulputate. Imperdiet ac velit rhoncus nulla malesuada nullam, nec pulvinar justo gravida lorem rutrum magna, habitasse repudiandae mi eros vestibulum ante, nec euismod dui iaculis in turpis pretium, ac id metus egestas proin lacus lectus. Laoreet lorem nec vitae risus erat arcu, vitae quam ut in ante tristique, porta dolor pede quam et odio nam, arcu lacus sem congue ante cursus massa. Et mattis sagittis erat accumsan fusce quam, vehicula ligula beatae natoque fusce sodales conubia, habitasse metus cum magnis viverra nam cursus, egestas urna wisi primis blandit eu magna, eget libero elit lacus lorem dis aliquam. Ut mauris ante natoque lacus massa, justo a lectus sodales enim adipiscing id, accumsan ut ipsum vestibulum sed enim auctor, vitae congue tincidunt id phasellus lacinia scelerisque, tincidunt sapien nulla euismod volutpat iaculis. Platea sociis nec aliquet nec molestie, in mi et augue sapien in vivamus, integer fames proin vitae in ullamcorper et. Fringilla etiam sapiente rhoncus suspendisse nec id, lobortis cras eget egestas dui ac nec, justo lacus ut lorem bibendum quia eros, eget a gravida id donec nunc suscipit, porta sed in sodales non rutrum. Lectus vel dui elementum pellentesque magna aliquam, vitae non sit pede et fusce nibh, id id deserunt ornare dui sit condimentum, in adipiscing imperdiet turpis nam aliquet, facilisis metus magna lacus wisi facilisis tortor. Vulputate elit accumsan quam amet ligula, suspendisse lacus mi nonummy integer urna, libero nulla nunc varius in odio, laoreet nulla amet placerat amet nec. Consectetuer vel massa hendrerit vitae iaculis id, sed ut ut laudantium odio in, elit vestibulum duis ante maecenas interdum in, neque vehicula ultrices varius in quam, pede tellus pellentesque sed nullam quis. - - diff --git a/eclipse-compile/observable/java2/androidTest/res/values/styles.xml b/eclipse-compile/observable/java2/androidTest/res/values/styles.xml deleted file mode 100755 index 4c1781a192..0000000000 --- a/eclipse-compile/observable/java2/androidTest/res/values/styles.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - diff --git a/eclipse-compile/observable/project.properties b/eclipse-compile/observable/project.properties deleted file mode 100644 index 0a24296b13..0000000000 --- a/eclipse-compile/observable/project.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Indicates whether an apk should be generated for each density. -split.density=false -# Project target. -target=android-21 -dex.force.jumbo=true -android.library=true -android.library.reference.1=../appcompat diff --git a/eclipse-compile/observable/res/.gitkeep b/eclipse-compile/observable/res/.gitkeep deleted file mode 100755 index e69de29bb2..0000000000