mediaviewer layout fix

Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
nuclearfog 2021-10-12 15:17:44 +02:00
parent 55fcc7250a
commit 95a69b4dac
No known key found for this signature in database
GPG Key ID: AA0271FBE406DB98
2 changed files with 29 additions and 21 deletions

View File

@ -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;
@ -46,19 +59,6 @@ import java.util.concurrent.Executors;
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
*
@ -139,6 +139,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
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);
@ -171,7 +172,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
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));

View File

@ -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"