diff --git a/build.gradle b/build.gradle index 0366260..e24622a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:1.0.1' + classpath 'com.android.tools.build:gradle:2.1.3' } } diff --git a/draggablepanel/AndroidManifest.xml b/draggablepanel/AndroidManifest.xml index 13e81a2..2654063 100644 --- a/draggablepanel/AndroidManifest.xml +++ b/draggablepanel/AndroidManifest.xml @@ -3,7 +3,7 @@ package="com.github.pedrovgs"> diff --git a/draggablepanel/build.gradle b/draggablepanel/build.gradle index 149fbde..272e796 100644 --- a/draggablepanel/build.gradle +++ b/draggablepanel/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'checkstyle' dependencies { - compile 'com.android.support:support-v4:20.0.0' + compile 'com.android.support:support-v4:20.0.0' compile 'com.nineoldandroids:library:2.4.0' } diff --git a/draggablepanel/res/layout/draggable_panel.xml b/draggablepanel/res/layout/draggable_panel.xml index 97545a0..1132578 100644 --- a/draggablepanel/res/layout/draggable_panel.xml +++ b/draggablepanel/res/layout/draggable_panel.xml @@ -5,19 +5,22 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" draggable_view:bottom_view_id="@+id/second_view" - draggable_view:top_view_id="@+id/drag_view"> + draggable_view:top_view_id="@+id/drag_view" + > + android:layout_below="@+id/drag_view" + /> + android:orientation="vertical" + /> \ No newline at end of file diff --git a/draggablepanel/res/values/attrs.xml b/draggablepanel/res/values/attrs.xml index 7521a99..7fec4e6 100644 --- a/draggablepanel/res/values/attrs.xml +++ b/draggablepanel/res/values/attrs.xml @@ -1,29 +1,30 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java index 1747659..be5aee2 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java @@ -15,6 +15,8 @@ */ package com.github.pedrovgs; +import android.view.MotionEvent; + /** * Listener created to be notified when some drag actions are performed over DraggablePanel or * DraggableView instances. @@ -42,4 +44,28 @@ public interface DraggableListener { * Called when the view is closed to the right. */ void onClosedToRight(); + + /** + * Called when the view is being touched at present + */ + + void onTouchListener(MotionEvent ev); + + /** + * Called when the view is maximized with click instead of drag + */ + + void onClickedToMaximize(); + + /** + * Called when the view is minimized with click instead of drag + */ + + void onClickedToMinimize(); + + /** + * Called when the view is being dragged to either minimize or maximize + */ + + void onSmoothSlide(); } diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/DraggablePanel.java b/draggablepanel/src/main/java/com/github/pedrovgs/DraggablePanel.java index b94245c..c0fc312 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/DraggablePanel.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/DraggablePanel.java @@ -146,7 +146,6 @@ public void setClickToMinimizeEnabled(boolean enableClickToMinimize) { } /** - * * Slide the view based on scroll of the nav drawer. * "setEnableTouch" user prevents click to expand while the drawer is moving. * It's only possible to maximize the view when @slideOffset is equals to 0.0, diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java index d1b1e06..066bf93 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.github.pedrovgs; import android.content.Context; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.support.v4.app.Fragment; @@ -36,6 +38,7 @@ * * @author Pedro Vicente Gómez Sánchez */ + public class DraggableView extends RelativeLayout { private static final int DEFAULT_SCALE_FACTOR = 2; @@ -75,6 +78,10 @@ public class DraggableView extends RelativeLayout { private float scaleFactorX, scaleFactorY; private int marginBottom, marginRight; private int dragViewId, secondViewId; + private String orientationForEvents = "all"; + + private boolean clickedToMaximize; + private boolean clickedToMinimize; public DraggableView(Context context) { super(context); @@ -243,7 +250,6 @@ public void setTopViewResize(boolean topViewResize) { */ public void maximize() { smoothSlideTo(SLIDE_TOP); - notifyMaximizeToListener(); } /** @@ -252,7 +258,6 @@ public void maximize() { */ public void minimize() { smoothSlideTo(SLIDE_BOTTOM); - notifyMinimizeToListener(); } /** @@ -359,6 +364,7 @@ public boolean isClosed() { * @return true if the touch event is realized over the drag or second view. */ @Override public boolean onTouchEvent(MotionEvent ev) { + notifyTouchEventListener(ev); int actionMasked = MotionEventCompat.getActionMasked(ev); if ((actionMasked & MotionEventCompat.ACTION_MASK) == MotionEvent.ACTION_DOWN) { activePointerId = MotionEventCompat.getPointerId(ev, actionMasked); @@ -366,7 +372,20 @@ public boolean isClosed() { if (activePointerId == INVALID_POINTER) { return false; } - viewDragHelper.processTouchEvent(ev); + if (orientationForEvents.equals("all")) { + viewDragHelper.processTouchEvent(ev); + } else if (orientationForEvents.equals("portrait")) { + if (getContext().getResources().getConfiguration().orientation + == Configuration.ORIENTATION_PORTRAIT) { + viewDragHelper.processTouchEvent(ev); + } + } else if (orientationForEvents.equals("landscape")) { + if (getContext().getResources().getConfiguration().orientation + == Configuration.ORIENTATION_LANDSCAPE) { + viewDragHelper.processTouchEvent(ev); + } + } + if (isClosed()) { return false; } @@ -382,7 +401,7 @@ public boolean isClosed() { } private void analyzeTouchToMaximizeIfNeeded(MotionEvent ev, boolean isDragViewHit) { - switch(ev.getAction()) { + switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastTouchActionDownXPosition = ev.getX(); break; @@ -390,8 +409,12 @@ private void analyzeTouchToMaximizeIfNeeded(MotionEvent ev, boolean isDragViewHi float clickOffset = ev.getX() - lastTouchActionDownXPosition; if (shouldMaximizeOnClick(ev, clickOffset, isDragViewHit)) { if (isMinimized() && isClickToMaximizeEnabled()) { + notifyClickedToMaximizeListener(); + clickedToMaximize = true; maximize(); } else if (isMaximized() && isClickToMinimizeEnabled()) { + notifyClickedToMinimizeListener(); + clickedToMinimize = true; minimize(); } } @@ -426,9 +449,9 @@ private MotionEvent cloneMotionEventWithAction(MotionEvent event, int action) { * Override method to configure the dragged view and secondView layout properly. */ @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - if (isInEditMode()) + if (isInEditMode()) { super.onLayout(changed, left, top, right, bottom); - else if (isDragViewAtTop()) { + } else if (isDragViewAtTop()) { dragView.layout(left, top, right, transformer.getOriginalHeight()); secondView.layout(left, transformer.getOriginalHeight(), right, bottom); ViewHelper.setY(dragView, top); @@ -521,6 +544,11 @@ void changeBackgroundAlpha() { */ void changeSecondViewAlpha() { ViewHelper.setAlpha(secondView, 1 - getVerticalDragOffset()); + if (getSecondViewAlpha() > 0.95) { + notifyMaximizeToListener(); + } else if (getSecondViewAlpha() < 0.15) { + notifyMinimizeToListener(); + } } /** @@ -635,7 +663,8 @@ private void addFragmentToView(final int viewId, final Fragment fragment) { * Initialize the viewDragHelper. */ private void initializeViewDragHelper() { - viewDragHelper = ViewDragHelper.create(this, SENSITIVITY, new DraggableViewCallback(this, dragView)); + viewDragHelper = + ViewDragHelper.create(this, SENSITIVITY, new DraggableViewCallback(this, dragView)); } /** @@ -668,21 +697,34 @@ private void initializeAttributes(AttributeSet attrs) { attributes.getBoolean(R.styleable.draggable_view_enable_click_to_minimize_view, DEFAULT_ENABLE_CLICK_TO_MINIMIZE); this.topViewResize = - attributes.getBoolean(R.styleable.draggable_view_top_view_resize, DEFAULT_TOP_VIEW_RESIZE); - this.topViewHeight = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_height, + attributes.getBoolean(R.styleable.draggable_view_top_view_resize, DEFAULT_TOP_VIEW_RESIZE); + this.topViewHeight = + attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_height, DEFAULT_TOP_VIEW_HEIGHT); this.scaleFactorX = attributes.getFloat(R.styleable.draggable_view_top_view_x_scale_factor, - DEFAULT_SCALE_FACTOR); + DEFAULT_SCALE_FACTOR); this.scaleFactorY = attributes.getFloat(R.styleable.draggable_view_top_view_y_scale_factor, - DEFAULT_SCALE_FACTOR); - this.marginBottom = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_bottom, + DEFAULT_SCALE_FACTOR); + this.marginBottom = + attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_bottom, DEFAULT_TOP_VIEW_MARGIN); - this.marginRight = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_right, + this.marginRight = + attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_right, DEFAULT_TOP_VIEW_MARGIN); this.dragViewId = - attributes.getResourceId(R.styleable.draggable_view_top_view_id, R.id.drag_view); + attributes.getResourceId(R.styleable.draggable_view_top_view_id, R.id.drag_view); this.secondViewId = - attributes.getResourceId(R.styleable.draggable_view_bottom_view_id, R.id.second_view); + attributes.getResourceId(R.styleable.draggable_view_bottom_view_id, R.id.second_view); + this.orientationForEvents = + attributes.getString(R.styleable.draggable_view_orientation_for_events); + if (this.orientationForEvents == null + || !orientationForEvents.equals("all") + && !orientationForEvents.equals("portrait") + && !orientationForEvents.equals("landscape")) { + //Default is to work in both orientation + //Ensures to handle wrong entry for attr + this.orientationForEvents = "all"; + } attributes.recycle(); } @@ -694,6 +736,7 @@ private void initializeAttributes(AttributeSet attrs) { * @return true if the view is slided. */ private boolean smoothSlideTo(float slideOffset) { + notifySmoothSlideListener(); final int topBound = getPaddingTop(); int x = (int) (slideOffset * (getWidth() - transformer.getMinWidthPlusMarginRight())); int y = (int) (topBound + slideOffset * getVerticalDragRange()); @@ -781,7 +824,75 @@ private void notifyCloseToLeftListener() { } } + /** + * Notify te view is touched to drag in any directions + */ + private void notifyTouchEventListener(MotionEvent ev) { + if (listener != null) { + listener.onTouchListener(ev); + } + } + + /** + * Notify when the smooth sliding of DraggableView is in process + */ + private void notifySmoothSlideListener() { + if (listener != null) { + listener.onSmoothSlide(); + } + } + + /** + * Notify when the minimized view is clicked to maximize + */ + private void notifyClickedToMaximizeListener() { + if (listener != null) { + listener.onClickedToMaximize(); + } + } + + /** + * Notify when the maximized view is clicked to minimize + */ + private void notifyClickedToMinimizeListener() { + if (listener != null) { + listener.onClickedToMinimize(); + } + } + public int getDraggedViewHeightPlusMarginTop() { return transformer.getMinHeightPlusMargin(); } + + public float getSecondViewAlpha() { + return secondView.getAlpha(); + } + + public boolean isClickedMaximize() { + return clickedToMaximize; + } + + public void setClickedtoMaximize() { + clickedToMaximize = false; + } + + public boolean isClickedMinimize() { + return clickedToMinimize; + } + + public void minimizeButtonClicked() { + clickedToMinimize = true; + } + + public void setClickedtoMinimize() { + clickedToMinimize = false; + } + + public String getorientationForEvents() { + return orientationForEvents; + } + + public void setorientationForEvents(String orientationForEvents) { + this.orientationForEvents = orientationForEvents; + } } diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ResizeTransformer.java b/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ResizeTransformer.java index 6af7bc3..d3b4a06 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ResizeTransformer.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ResizeTransformer.java @@ -40,19 +40,18 @@ class ResizeTransformer extends Transformer { */ @Override public void updateScale(float verticalDragOffset) { layoutParams.width = (int) (getOriginalWidth() * (1 - verticalDragOffset / getXScaleFactor())); - layoutParams.height = (int) (getOriginalHeight() * (1 - verticalDragOffset / getYScaleFactor())); + layoutParams.height = + (int) (getOriginalHeight() * (1 - verticalDragOffset / getYScaleFactor())); getView().setLayoutParams(layoutParams); } - /** * Changes X view position using layout() method. * * @param verticalDragOffset used to calculate the new X position. */ - @Override - public void updatePosition(float verticalDragOffset) { + @Override public void updatePosition(float verticalDragOffset) { int right = getViewRightPosition(verticalDragOffset); int left = right - layoutParams.width; int top = getView().getTop(); @@ -61,7 +60,6 @@ public void updatePosition(float verticalDragOffset) { getView().layout(left, top, right, bottom); } - /** * @return true if the right position of the view plus the right margin is equals to the parent * width. @@ -116,5 +114,4 @@ public void updatePosition(float verticalDragOffset) { private int getViewRightPosition(float verticalDragOffset) { return (int) ((getOriginalWidth()) - getMarginRight() * verticalDragOffset); } - } diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ScaleTransformer.java b/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ScaleTransformer.java index e49a13e..5dce565 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ScaleTransformer.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/transformer/ScaleTransformer.java @@ -94,5 +94,4 @@ class ScaleTransformer extends Transformer { @Override public int getMinWidthPlusMarginRight() { return getOriginalWidth(); } - } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 95cd84a..63bb0bd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Jan 27 09:03:37 BRST 2015 +#Wed Sep 07 10:05:51 EEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/sample/AndroidManifest.xml b/sample/AndroidManifest.xml index 960a0f2..abdec1d 100755 --- a/sample/AndroidManifest.xml +++ b/sample/AndroidManifest.xml @@ -2,7 +2,7 @@ - + diff --git a/sample/res/drawable/drawer_shadow.xml b/sample/res/drawable/drawer_shadow.xml index b344781..3eac37a 100644 --- a/sample/res/drawable/drawer_shadow.xml +++ b/sample/res/drawable/drawer_shadow.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/sample/res/layout/activity_main.xml b/sample/res/layout/activity_main.xml index 60cd311..62a08f0 100644 --- a/sample/res/layout/activity_main.xml +++ b/sample/res/layout/activity_main.xml @@ -1,57 +1,65 @@ + android:layout_height="fill_parent" + > + android:layout_weight="1" + > + android:layout_height="wrap_content" + android:layout_weight="1" + > + /> + style="@style/main_activity_button_title" + /> + android:layout_height="wrap_content" + android:layout_weight="1" + > + style="@style/image_view" + /> + style="@style/main_activity_button_title" + /> @@ -62,51 +70,58 @@ + android:layout_weight="1" + > + android:layout_height="wrap_content" + android:layout_weight="1" + > + style="@style/image_view" + /> + style="@style/main_activity_button_title" + /> + android:layout_height="wrap_content" + android:layout_weight="1" + > + style="@style/image_view" + /> + style="@style/main_activity_button_title" + /> diff --git a/sample/res/layout/activity_place_sample.xml b/sample/res/layout/activity_place_sample.xml index 560fded..0248971 100644 --- a/sample/res/layout/activity_place_sample.xml +++ b/sample/res/layout/activity_place_sample.xml @@ -3,27 +3,31 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_left" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + > + android:layout_height="fill_parent" + /> + android:layout_height="fill_parent" + /> + /> diff --git a/sample/res/layout/activity_tv_shows_sample.xml b/sample/res/layout/activity_tv_shows_sample.xml index 10c4855..d26f2cb 100644 --- a/sample/res/layout/activity_tv_shows_sample.xml +++ b/sample/res/layout/activity_tv_shows_sample.xml @@ -4,7 +4,8 @@ android:id="@+id/ll_container" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#f1f1f1"> + android:background="#f1f1f1" + > @@ -12,7 +13,8 @@ android:id="@+id/gv_tv_shows" android:layout_width="fill_parent" android:layout_height="fill_parent" - style="@style/tv_show_grid_view"/> + style="@style/tv_show_grid_view" + /> @@ -22,13 +24,14 @@ android:id="@+id/draggable_view" android:layout_width="fill_parent" android:layout_height="fill_parent" - draggable_view:top_view_id="@+id/iv_fan_art" + android:background="@color/black" draggable_view:bottom_view_id="@+id/lv_episodes" + draggable_view:top_view_id="@+id/iv_fan_art" + draggable_view:top_view_margin_bottom="@dimen/top_fragment_margin" + draggable_view:top_view_margin_right="@dimen/top_fragment_margin" draggable_view:top_view_x_scale_factor="@dimen/x_scale_factor" draggable_view:top_view_y_scale_factor="@dimen/y_scale_factor" - draggable_view:top_view_margin_right="@dimen/top_fragment_margin" - draggable_view:top_view_margin_bottom="@dimen/top_fragment_margin" - android:background="@color/black"> + > @@ -37,7 +40,8 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/iv_fan_art" - style="@style/episodes_list_view"/> + style="@style/episodes_list_view" + /> @@ -46,7 +50,8 @@ android:layout_width="fill_parent" android:layout_height="@dimen/tv_show_fan_art_height" android:layout_alignParentTop="true" - style="@style/image_view"/> + style="@style/image_view" + /> diff --git a/sample/res/layout/activity_video_sample.xml b/sample/res/layout/activity_video_sample.xml index 2ce622a..1418b82 100644 --- a/sample/res/layout/activity_video_sample.xml +++ b/sample/res/layout/activity_video_sample.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent" + > @@ -10,7 +11,8 @@ android:id="@+id/iv_poster" android:layout_width="fill_parent" android:layout_height="fill_parent" - style="@style/image_view"/> + style="@style/image_view" + /> @@ -20,33 +22,37 @@ android:id="@+id/draggable_view" android:layout_width="fill_parent" android:layout_height="fill_parent" - draggable_view:top_view_id="@+id/video_view" + android:background="@color/black" draggable_view:bottom_view_id="@+id/iv_thumbnail" - draggable_view:top_view_x_scale_factor="@dimen/x_scale_factor" - draggable_view:top_view_y_scale_factor="@dimen/y_scale_factor" + draggable_view:enable_minimized_horizontal_alpha_effect="false" + draggable_view:orientation_for_events="portrait" draggable_view:top_view_height="@dimen/top_fragment_height" - draggable_view:top_view_margin_right="@dimen/top_fragment_margin" + draggable_view:top_view_id="@+id/video_view" draggable_view:top_view_margin_bottom="@dimen/top_fragment_margin" - draggable_view:enable_minimized_horizontal_alpha_effect="false" + draggable_view:top_view_margin_right="@dimen/top_fragment_margin" draggable_view:top_view_resize="true" - android:background="@color/black"> + draggable_view:top_view_x_scale_factor="@dimen/x_scale_factor" + draggable_view:top_view_y_scale_factor="@dimen/y_scale_factor" + > + android:layout_below="@+id/dragView" + style="@style/image_view" + /> + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + /> diff --git a/sample/res/layout/activity_youtube_sample.xml b/sample/res/layout/activity_youtube_sample.xml index c278f12..e2b4473 100644 --- a/sample/res/layout/activity_youtube_sample.xml +++ b/sample/res/layout/activity_youtube_sample.xml @@ -4,7 +4,8 @@ xmlns:draggable_panel="http://schemas.android.com/apk/res-auto" android:id="@+id/fl_container" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + > @@ -12,7 +13,8 @@ android:id="@+id/iv_thumbnail" android:layout_width="fill_parent" android:layout_height="fill_parent" - style="@style/image_view"/> + style="@style/image_view" + /> @@ -20,11 +22,12 @@ android:id="@+id/draggable_panel" android:layout_width="fill_parent" android:layout_height="fill_parent" - draggable_panel:x_scale_factor="@dimen/x_scale_factor" - draggable_panel:y_scale_factor="@dimen/y_scale_factor" + draggable_panel:enable_horizontal_alpha_effect="false" draggable_panel:top_fragment_height="@dimen/top_fragment_height" - draggable_panel:top_fragment_margin_right="@dimen/top_fragment_margin" draggable_panel:top_fragment_margin_bottom="@dimen/top_fragment_margin" - draggable_panel:enable_horizontal_alpha_effect="false"/> + draggable_panel:top_fragment_margin_right="@dimen/top_fragment_margin" + draggable_panel:x_scale_factor="@dimen/x_scale_factor" + draggable_panel:y_scale_factor="@dimen/y_scale_factor" + /> \ No newline at end of file diff --git a/sample/res/layout/episode_header.xml b/sample/res/layout/episode_header.xml index 1832921..63a6f90 100644 --- a/sample/res/layout/episode_header.xml +++ b/sample/res/layout/episode_header.xml @@ -1,6 +1,7 @@ \ No newline at end of file + android:layout_height="wrap_content" + style="@style/episodes_list_view_header" + /> \ No newline at end of file diff --git a/sample/res/layout/episode_row.xml b/sample/res/layout/episode_row.xml index 9518487..772ecd3 100644 --- a/sample/res/layout/episode_row.xml +++ b/sample/res/layout/episode_row.xml @@ -3,32 +3,39 @@ + style="@style/episode_row" + > - + style="@style/episode_number" + /> - + style="@style/episode_title" + /> - + style="@style/episode_publish_date" + /> \ No newline at end of file diff --git a/sample/res/layout/fragment_movie_poster.xml b/sample/res/layout/fragment_movie_poster.xml index 03d9a3c..79e8a0d 100644 --- a/sample/res/layout/fragment_movie_poster.xml +++ b/sample/res/layout/fragment_movie_poster.xml @@ -4,6 +4,7 @@ android:id="@+id/iv_thumbnail" android:layout_width="fill_parent" android:layout_height="fill_parent" - style="@style/image_view"> + style="@style/image_view" + > \ No newline at end of file diff --git a/sample/res/layout/place_row.xml b/sample/res/layout/place_row.xml index 2bc2ed7..19d628c 100644 --- a/sample/res/layout/place_row.xml +++ b/sample/res/layout/place_row.xml @@ -2,18 +2,21 @@ + android:background="@color/white" + > + android:layout_height="@dimen/place_renderer_height" + style="@style/image_view" + /> + style="@style/place_title" + /> \ No newline at end of file diff --git a/sample/res/layout/tv_show_row.xml b/sample/res/layout/tv_show_row.xml index 1b14818..49a7be5 100644 --- a/sample/res/layout/tv_show_row.xml +++ b/sample/res/layout/tv_show_row.xml @@ -2,27 +2,31 @@ + android:background="@color/white" + > + style="@style/image_view" + /> + style="@style/tv_show_title" + /> + style="@style/tv_show_seasons_counter" + /> \ No newline at end of file diff --git a/sample/res/values-land/dimens.xml b/sample/res/values-land/dimens.xml index 9eeefd0..5027f6e 100644 --- a/sample/res/values-land/dimens.xml +++ b/sample/res/values-land/dimens.xml @@ -1,4 +1,4 @@ 150dip - 1.5 + 1.5 diff --git a/sample/res/values/dimens.xml b/sample/res/values/dimens.xml index e61d3e5..1a3c9c5 100644 --- a/sample/res/values/dimens.xml +++ b/sample/res/values/dimens.xml @@ -6,8 +6,8 @@ 10dip 18sp 10dip - 2.3 - 2.3 + 2.3 + 2.3 10dip 10dip 10dip diff --git a/sample/src/main/java/com/github/pedrovgs/sample/activity/TvShowsActivity.java b/sample/src/main/java/com/github/pedrovgs/sample/activity/TvShowsActivity.java index ebf2dc5..65caa6d 100644 --- a/sample/src/main/java/com/github/pedrovgs/sample/activity/TvShowsActivity.java +++ b/sample/src/main/java/com/github/pedrovgs/sample/activity/TvShowsActivity.java @@ -17,6 +17,7 @@ import android.os.Bundle; import android.os.Handler; +import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; @@ -102,8 +103,8 @@ private void initializeDraggableView() { private void initializeGridView() { tvShowsGridView.setAdapter(adapter); tvShowsGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override public void onItemClick(AdapterView adapterView, View view, int position, - long id) { + @Override + public void onItemClick(AdapterView adapterView, View view, int position, long id) { TvShowViewModel tvShow = adapter.getItem(position); tvShowSelected = tvShow; Picasso.with(getBaseContext()) @@ -139,6 +140,22 @@ private void hookListeners() { @Override public void onClosedToRight() { resetActionBarTitle(); } + + @Override public void onTouchListener(MotionEvent ev) { + + } + + @Override public void onClickedToMaximize() { + + } + + @Override public void onClickedToMinimize() { + + } + + @Override public void onSmoothSlide() { + + } }); } @@ -186,8 +203,8 @@ private void renderEpisodesHeader(TvShowViewModel tvShow) { episodesListView.setAdapter(null); episodesListView.addHeaderView(header); episodesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override public void onItemClick(AdapterView adapterView, View view, int position, - long id) { + @Override + public void onItemClick(AdapterView adapterView, View view, int position, long id) { if (tvShowSelected != null) { if (position > 0) { EpisodeViewModel episodeViewModel = tvShowSelected.getEpisodes().get(position - 1); diff --git a/sample/src/main/java/com/github/pedrovgs/sample/activity/VideoSampleActivity.java b/sample/src/main/java/com/github/pedrovgs/sample/activity/VideoSampleActivity.java index 83e2dbf..d2b6926 100644 --- a/sample/src/main/java/com/github/pedrovgs/sample/activity/VideoSampleActivity.java +++ b/sample/src/main/java/com/github/pedrovgs/sample/activity/VideoSampleActivity.java @@ -18,6 +18,7 @@ import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentActivity; +import android.view.MotionEvent; import android.widget.ImageView; import android.widget.Toast; import android.widget.VideoView; @@ -100,6 +101,22 @@ private void hookDraggableViewListener() { @Override public void onClosedToRight() { pauseVideo(); } + + @Override public void onTouchListener(MotionEvent ev) { + + } + + @Override public void onClickedToMaximize() { + + } + + @Override public void onClickedToMinimize() { + + } + + @Override public void onSmoothSlide() { + + } }); } diff --git a/sample/src/main/java/com/github/pedrovgs/sample/activity/YoutubeSampleActivity.java b/sample/src/main/java/com/github/pedrovgs/sample/activity/YoutubeSampleActivity.java index 756e20d..2208e09 100644 --- a/sample/src/main/java/com/github/pedrovgs/sample/activity/YoutubeSampleActivity.java +++ b/sample/src/main/java/com/github/pedrovgs/sample/activity/YoutubeSampleActivity.java @@ -17,6 +17,7 @@ import android.os.Bundle; import android.support.v4.app.FragmentActivity; +import android.view.MotionEvent; import android.widget.ImageView; import butterknife.ButterKnife; import butterknife.InjectView; @@ -81,8 +82,9 @@ private void initializeYoutubeFragment() { youtubeFragment = new YouTubePlayerSupportFragment(); youtubeFragment.initialize(YOUTUBE_API_KEY, new YouTubePlayer.OnInitializedListener() { - @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, - YouTubePlayer player, boolean wasRestored) { + @Override + public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, + boolean wasRestored) { if (!wasRestored) { youtubePlayer = player; youtubePlayer.loadVideo(VIDEO_KEY); @@ -134,6 +136,22 @@ private void hookDraggablePanelListeners() { @Override public void onClosedToRight() { pauseVideo(); } + + @Override public void onTouchListener(MotionEvent ev) { + + } + + @Override public void onClickedToMaximize() { + + } + + @Override public void onClickedToMinimize() { + + } + + @Override public void onSmoothSlide() { + + } }); } diff --git a/sample/src/main/java/com/github/pedrovgs/sample/renderer/PlaceRenderer.java b/sample/src/main/java/com/github/pedrovgs/sample/renderer/PlaceRenderer.java index 3235c06..acaa7e4 100644 --- a/sample/src/main/java/com/github/pedrovgs/sample/renderer/PlaceRenderer.java +++ b/sample/src/main/java/com/github/pedrovgs/sample/renderer/PlaceRenderer.java @@ -36,10 +36,9 @@ */ public class PlaceRenderer extends Renderer { - private Context context; - @InjectView(R.id.tv_name) TextView nameTextView; @InjectView(R.id.iv_photo) ImageView photoImageView; + private Context context; public PlaceRenderer(Context context) { this.context = context;