Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
mediaviewer layout fix
Browse files Browse the repository at this point in the history
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
  • Loading branch information
nuclearfog committed Oct 12, 2021
1 parent 55fcc72 commit 95a69b4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
29 changes: 15 additions & 14 deletions app/src/main/java/org/nuclearfog/twidda/activity/MediaViewer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
package org.nuclearfog.twidda.activity;

import static android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START;
import static android.media.MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_SHORT;
import static androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -46,19 +59,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import static android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START;
import static android.media.MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_SHORT;
import static androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL;

/**
* Media viewer activity for images and videos
*
Expand Down Expand Up @@ -139,6 +139,7 @@ protected void onCreate(@Nullable Bundle b) {
super.onCreate(b);
setContentView(R.layout.page_media);
RecyclerView imageList = findViewById(R.id.image_list);
View imageListContainer = findViewById(R.id.image_preview_list);
controlPanel = findViewById(R.id.media_controlpanel);
loadingCircle = findViewById(R.id.media_progress);
zoomImage = findViewById(R.id.image_full);
Expand Down Expand Up @@ -171,7 +172,7 @@ protected void onCreate(@Nullable Bundle b) {
switch (type) {
case MEDIAVIEWER_IMAGE:
zoomImage.setVisibility(VISIBLE);
imageList.setVisibility(VISIBLE);
imageListContainer.setVisibility(VISIBLE);
if (!mediaLinks[0].startsWith("http"))
adapter.disableSaveButton();
imageList.setLayoutManager(new LinearLayoutManager(this, HORIZONTAL, false));
Expand Down
21 changes: 14 additions & 7 deletions app/src/main/res/layout/page_media.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@
app:max_zoom_in="10.0"
app:max_zoom_out="0.7" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_list"
android:layout_width="0dp"
<LinearLayout
android:id="@+id/image_preview_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/mediapage_preview_margin"
android:scrollbars="horizontal"
android:orientation="horizontal"
android:visibility="gone"
android:layout_margin="@dimen/mediapage_preview_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.2" />
app:layout_constraintHeight_percent="0.2">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_list"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scrollbars="horizontal" />

</LinearLayout>

<VideoView
android:id="@+id/video_view"
Expand Down

0 comments on commit 95a69b4

Please sign in to comment.