Make buttons still visible when composing with media

pull/939/head
Thomas 1 year ago
parent 1965d196ae
commit c63ae5df4f

@ -21,6 +21,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -246,7 +247,7 @@ public class FragmentMedia extends Fragment {
}
binding.pbarInf.setIndeterminate(false);
binding.pbarInf.setScaleY(3f);
binding.mediaVideo.setVisibility(View.VISIBLE);
binding.videoViewContainer.setVisibility(View.VISIBLE);
Uri uri = Uri.parse(url);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
int video_cache = sharedpreferences.getInt(getString(R.string.SET_VIDEO_CACHE), Helper.DEFAULT_VIDEO_CACHE_MB);
@ -266,7 +267,16 @@ public class FragmentMedia extends Fragment {
player.setRepeatMode(Player.REPEAT_MODE_ONE);
binding.mediaVideo.setUseController(false);
}
binding.mediaVideo.setOnTouchListener((view, motionEvent) -> {
if (binding.controls.getVisibility() != View.VISIBLE) {
binding.controls.setVisibility(View.VISIBLE);
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(() -> binding.controls.setVisibility(View.GONE), 2000);
}
return false;
});
binding.mediaVideo.setPlayer(player);
binding.controls.setPlayer(player);
binding.loader.setVisibility(View.GONE);
binding.mediaPicture.setVisibility(View.GONE);
player.setMediaSource(videoSource);
@ -349,7 +359,7 @@ public class FragmentMedia extends Fragment {
@Override
public void onSlideChange(float percent) {
if (percent < 0.70) {
binding.mediaVideo.setVisibility(View.GONE);
binding.videoViewContainer.setVisibility(View.GONE);
binding.videoLayout.setVisibility(View.GONE);
ActivityCompat.finishAfterTransition(requireActivity());
}

@ -35,6 +35,7 @@
android:id="@+id/media_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:maxHeight="300dp"
android:scrollbars="vertical"
android:layout_gravity="center_horizontal|bottom"
@ -44,12 +45,13 @@
android:textColor="#ffffffff"
android:textIsSelectable="true"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/original_message"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/translate"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<TextView
android:layout_marginTop="100dp"
android:id="@+id/media_description_translated"
android:layout_width="0dp"
android:maxHeight="300dp"
@ -63,12 +65,13 @@
android:textColor="#ffffffff"
android:textIsSelectable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
android:layout_marginTop="100dp"
android:id="@+id/translate"
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
@ -77,7 +80,7 @@
android:visibility="gone"
app:icon="@drawable/ic_baseline_translate_24"
app:iconPadding="0dp"
app:layout_constraintBottom_toBottomOf="@+id/media_description"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/media_description"
tools:visibility="visible" />

@ -59,12 +59,29 @@
</FrameLayout>
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/media_video"
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/video_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone" />
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/media_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:use_controller="false" />
<com.google.android.exoplayer2.ui.PlayerControlView
android:id="@+id/controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="50dp"
app:show_timeout="2000" />
</FrameLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/load_remote"

@ -0,0 +1,19 @@
Added:
- Markdown support (can be disabled in Settings > Timelines)
- Hide / Show Self boosts and self replies (Long press the Home tab)
Changed:
- Full screen size when writing media descriptions.
- Move media descriptions to the top
Fixed:
- Holes in timelines due to a cache bug
- Spoiler issue when composing threads
- CamelCase tags when forwarding them in replies
- Buttons hidden by keyboard when composing
- Overlay with menu and buttons when playing videos
- Clicks on card do not open Mastodon posts inside the app
- Scrollable bio when editing profiles
- Crash when adding a user into a list
- Longer fields when editing bio
- Crash with Pixelfed
Loading…
Cancel
Save