Fix TrackSelectionDialog button color. Do not automatically show control view in autoplaying videos.

This commit is contained in:
Alex Ning 2021-11-22 19:27:45 +08:00
parent 50a2db2a39
commit 841fec87dc
8 changed files with 26 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
import android.Manifest; import android.Manifest;
import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -85,6 +86,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.apis.VReddIt; import ml.docilealligator.infinityforreddit.apis.VReddIt;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PlaybackSpeedBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PlaybackSpeedBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontFamily;
import ml.docilealligator.infinityforreddit.font.ContentFontStyle; import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.font.FontFamily; import ml.docilealligator.infinityforreddit.font.FontFamily;
@ -202,6 +204,9 @@ public class ViewVideoActivity extends AppCompatActivity {
@Named("default") @Named("default")
SharedPreferences mSharedPreferences; SharedPreferences mSharedPreferences;
@Inject
CustomThemeWrapper mCustomThemeWrapper;
@Inject @Inject
Executor mExecutor; Executor mExecutor;
@ -566,10 +571,13 @@ public class ViewVideoActivity extends AppCompatActivity {
hdButton.setVisibility(View.VISIBLE); hdButton.setVisibility(View.VISIBLE);
hdButton.setOnClickListener(view -> { hdButton.setOnClickListener(view -> {
TrackSelectionDialogBuilder build = new TrackSelectionDialogBuilder(ViewVideoActivity.this, getString(R.string.select_video_quality), trackSelector, 0); TrackSelectionDialogBuilder builder = new TrackSelectionDialogBuilder(ViewVideoActivity.this, getString(R.string.select_video_quality), trackSelector, 0);
build.setShowDisableOption(true); builder.setShowDisableOption(true);
build.setAllowAdaptiveSelections(false); builder.setAllowAdaptiveSelections(false);
build.build().show(); AlertDialog alertDialog = builder.build();
alertDialog.show();
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
}); });
} }

View File

@ -1,5 +1,6 @@
package ml.docilealligator.infinityforreddit.fragments; package ml.docilealligator.infinityforreddit.fragments;
import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -207,11 +208,14 @@ public class ViewRPANBroadcastFragment extends Fragment {
hdButton.setVisibility(View.VISIBLE); hdButton.setVisibility(View.VISIBLE);
hdButton.setOnClickListener(view -> { hdButton.setOnClickListener(view -> {
TrackSelectionDialogBuilder build = new TrackSelectionDialogBuilder(mActivity, TrackSelectionDialogBuilder builder = new TrackSelectionDialogBuilder(mActivity,
getString(R.string.select_video_quality), trackSelector, 0); getString(R.string.select_video_quality), trackSelector, 0);
build.setShowDisableOption(true); builder.setShowDisableOption(true);
build.setAllowAdaptiveSelections(false); builder.setAllowAdaptiveSelections(false);
build.build().show(); AlertDialog alertDialog = builder.build();
alertDialog.show();
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
}); });
for (int i = 0; i < trackGroups.length; i++) { for (int i = 0; i < trackGroups.length; i++) {

View File

@ -31,6 +31,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView

View File

@ -31,6 +31,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView

View File

@ -214,6 +214,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView

View File

@ -214,6 +214,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView

View File

@ -208,6 +208,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView

View File

@ -208,6 +208,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:show_timeout="1500" app:show_timeout="1500"
app:auto_show="false"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" /> app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView