Skip to content

Commit

Permalink
[android] Fixes selection mode issues on grids, Media Overlay View, P…
Browse files Browse the repository at this point in the history
…inch and Zoom
  • Loading branch information
gubatron committed May 8, 2017
1 parent e33fa15 commit 71702d5
Show file tree
Hide file tree
Showing 19 changed files with 1,685 additions and 261 deletions.
21 changes: 20 additions & 1 deletion android/res/layout/fragment_image_viewer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,27 @@
android:layout_height="match_parent"
android:background="@color/app_background_body_light">

<ProgressBar
android:id="@+id/fragment_image_viewer_progress_bar"
style="@style/ProgressBarHolo.Horizontal"
android:layout_width="match_parent"
android:layout_height="3dp"
android:indeterminate="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
/>

<ImageView
android:id="@+id/fragment_image_viewer_preload_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/fragment_image_viewer_progress_bar"/>

<com.frostwire.android.gui.views.TouchImageView
android:id="@+id/fragment_image_viewer_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_below="@+id/fragment_image_viewer_progress_bar"
android:visibility="gone"
android:layout_centerInParent="true"/>
</RelativeLayout>
28 changes: 20 additions & 8 deletions android/res/layout/view_bittorrent_search_result_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@
android:baselineAligned="false"
android:orientation="horizontal" >

<com.frostwire.android.gui.views.SearchThumbnailImageView
android:id="@+id/view_bittorrent_search_result_list_item_filetype_icon"
android:layout_width="52dp"
android:layout_height="match_parent"
android:layout_gravity="center|center_vertical"
android:layout_marginLeft="3dp"
android:contentDescription="@null"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/view_bittorrent_search_result_list_item_filetype_icon"
android:layout_width="52dp"
android:layout_height="match_parent"
android:layout_gravity="center|center_vertical"
android:layout_marginLeft="3dp"
android:contentDescription="@null"
/>
<com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView
android:id="@+id/view_bittorrent_search_result_list_item_filetype_icon_media_playback_overlay_view"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:clickable="true"
android:foregroundGravity="center"
android:visibility="gone"/>
</RelativeLayout>

<ImageView
android:id="@+id/view_bittorrent_search_result_list_item_download_icon"
Expand Down
27 changes: 20 additions & 7 deletions android/res/layout/view_browse_peer_thumbnail_grid_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,32 @@
*/
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:frostwire="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center">

<com.frostwire.android.gui.views.BrowseThumbnailImageButton
<ImageButton
android:id="@+id/view_browse_peer_thumbnail_grid_item_browse_thumbnail_image_button"
android:layout_width="match_parent"
android:layout_height="128dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:background="@color/app_browse_thumbnail_background"
android:adjustViewBounds="true"
android:contentDescription="@null" />
android:background="@color/app_browse_thumbnail_background"
android:contentDescription="@null"
android:scaleType="centerCrop"/>

<com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView
android:id="@+id/view_browse_peer_thumbnail_grid_item_playback_overlay_view"
frostwire:circleStrokeWidth="10"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:clickable="true"
android:foregroundGravity="center"
android:visibility="gone"/>

<FrameLayout
android:layout_width="wrap_content"
Expand Down
38 changes: 27 additions & 11 deletions android/res/layout/view_browse_peer_thumbnail_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,33 @@
*/
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<com.frostwire.android.gui.views.BrowseThumbnailImageButton
android:id="@+id/view_browse_peer_thumbnail_grid_item_browse_thumbnail_image_button"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:background="@color/app_browse_thumbnail_background"
android:contentDescription="@null" />
<RelativeLayout
android:id="@+id/view_browse_peer_thumbnail_list_item_browse_thumbnail_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
>
<ImageButton
android:id="@+id/view_browse_peer_thumbnail_list_item_browse_thumbnail_image_button"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:background="@color/app_browse_thumbnail_background"
android:contentDescription="@null" />

<com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView
android:id="@+id/view_browse_peer_thumbnail_list_item_playback_overlay_view"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerInParent="true"
android:clickable="true"
android:visibility="visible"
/>
</RelativeLayout>

<TextView
android:id="@+id/view_browse_peer_thumbnail_list_image_item_file_title"
Expand All @@ -39,7 +55,7 @@
android:layout_marginLeft="6dp"
android:layout_marginRight="3dp"
android:layout_marginTop="4dp"
android:layout_toRightOf="@id/view_browse_peer_thumbnail_grid_item_browse_thumbnail_image_button"
android:layout_toRightOf="@id/view_browse_peer_thumbnail_list_item_browse_thumbnail_container"
android:text="@string/dummy_title" />

<TextView
Expand All @@ -57,7 +73,7 @@
style="@style/ListItemSize.browsePeerList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/view_browse_peer_thumbnail_grid_item_browse_thumbnail_image_button"
android:layout_alignBottom="@id/view_browse_peer_thumbnail_list_item_browse_thumbnail_container"
android:layout_alignLeft="@id/view_browse_peer_thumbnail_list_image_item_file_title"
android:layout_marginBottom="2dip"
android:text="@string/dummy_size" />
Expand Down
3 changes: 3 additions & 0 deletions android/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*/
-->
<resources>
<declare-styleable name="MediaPlaybackStatusOverlayView">
<attr name="circleStrokeWidth" format="integer"/>
</declare-styleable>
<declare-styleable name="ProductCardView">
<attr name="product_card_title_bold" format="string"/>
<attr name="product_card_title_normal" format="string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.frostwire.android.gui.util.UIUtils;
import com.frostwire.android.gui.views.AbstractListAdapter;
import com.frostwire.android.gui.views.ClickAdapter;
import com.frostwire.android.gui.views.MediaPlaybackOverlay;
import com.frostwire.android.gui.views.SearchThumbnailImageView;
import com.frostwire.android.gui.views.MediaPlaybackOverlayPainter;
import com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView;
import com.frostwire.android.util.ImageLoader;
import com.frostwire.licenses.Licenses;
import com.frostwire.search.FileSearchResult;
Expand Down Expand Up @@ -154,18 +154,24 @@ private void populateFilePart(View view, FileSearchResult sr) {
}

private void populateThumbnail(View view, SearchResult sr) {
SearchThumbnailImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon);
ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon);
if (sr.getThumbnailUrl() != null) {
thumbLoader.load(Uri.parse(sr.getThumbnailUrl()), fileTypeIcon, 96, 96, getFileTypeIconId());
}

MediaPlaybackStatusOverlayView overlayView = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon_media_playback_overlay_view);

fileTypeIcon.setOnClickListener(previewClickListener);
if (isAudio(sr) || sr instanceof YouTubePackageSearchResult) {
fileTypeIcon.setTag(sr);
fileTypeIcon.setOverlayState(MediaPlaybackOverlay.MediaPlaybackState.PREVIEW);
overlayView.setTag(sr);
overlayView.setVisibility(View.VISIBLE);
overlayView.setPlaybackState(MediaPlaybackOverlayPainter.MediaPlaybackState.PREVIEW);
} else {
fileTypeIcon.setTag(null);
fileTypeIcon.setOverlayState(MediaPlaybackOverlay.MediaPlaybackState.NONE);
overlayView.setTag(null);
overlayView.setVisibility(View.GONE);
overlayView.setPlaybackState(MediaPlaybackOverlayPainter.MediaPlaybackState.NONE);
}
}

Expand Down
Loading

0 comments on commit 71702d5

Please sign in to comment.