mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix dark theme issue when selecting playback speed. Minor bugs fixed.
This commit is contained in:
parent
fd1b6fa6fe
commit
725921dac1
@ -25,7 +25,7 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<application
|
||||
android:name=".Infinity"
|
||||
android:name="ml.docilealligator.infinityforreddit.Infinity"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/application_name"
|
||||
|
@ -129,10 +129,10 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean userDefinedChangeSatusBarIconColorInImmersiveInterface =
|
||||
boolean userDefinedChangeStatusBarIconColorInImmersiveInterface =
|
||||
customThemeWrapper.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface();
|
||||
if (immersiveInterface && isImmersiveInterfaceApplicable) {
|
||||
changeStatusBarIconColor = userDefinedChangeSatusBarIconColorInImmersiveInterface;
|
||||
changeStatusBarIconColor = userDefinedChangeStatusBarIconColorInImmersiveInterface;
|
||||
} else {
|
||||
changeStatusBarIconColor = false;
|
||||
}
|
||||
|
@ -270,9 +270,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
drawer.setFitsSystemWindows(false);
|
||||
getWindow().setDecorFitsSystemWindows(false);
|
||||
/*drawer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);*/
|
||||
} else {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.r0adkll.slidr.Slidr;
|
||||
@ -100,10 +101,10 @@ public class TrendingActivity extends BaseActivity {
|
||||
@Inject
|
||||
Executor mExecutor;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
private boolean isRefreshing = false;
|
||||
private ArrayList<TrendingSearch> trendingSearches;
|
||||
private TrendingSearchRecyclerViewAdapter adapter;
|
||||
private RequestManager mGlide;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -151,7 +152,8 @@ public class TrendingActivity extends BaseActivity {
|
||||
setToolbarGoToTop(toolbar);
|
||||
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
@ -277,7 +279,7 @@ public class TrendingActivity extends BaseActivity {
|
||||
|
||||
private void showErrorView(int stringId) {
|
||||
errorLinearLayout.setVisibility(View.VISIBLE);
|
||||
Glide.with(this).load(R.drawable.error_image).into(errorImageView);
|
||||
mGlide.load(R.drawable.error_image).into(errorImageView);
|
||||
errorTextView.setText(stringId);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
package ml.docilealligator.infinityforreddit.activities;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -32,6 +37,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -150,6 +156,8 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
TextView titleTextView;
|
||||
@BindView(R.id.download_image_view_exo_playback_control_view)
|
||||
ImageView downloadImageView;
|
||||
@BindView(R.id.playback_speed_image_view_exo_playback_control_view)
|
||||
ImageView playbackSpeedImageView;
|
||||
@BindView(R.id.lockable_nested_scroll_view_view_video_activity)
|
||||
LockableNestedScrollView nestedScrollView;
|
||||
|
||||
@ -206,7 +214,37 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (systemThemeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
getTheme().applyStyle(R.style.Theme_Normal, true);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal, true);
|
||||
} else {
|
||||
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
@ -250,6 +288,14 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
isDownloading = true;
|
||||
requestPermissionAndDownload();
|
||||
});
|
||||
|
||||
playbackSpeedImageView.setOnClickListener(view -> {
|
||||
PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
|
||||
playbackSpeedBottomSheetFragment.setArguments(bundle);
|
||||
playbackSpeedBottomSheetFragment.show(getSupportFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
|
||||
});
|
||||
} else {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
Drawable upArrow = resources.getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||
|
@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.r0adkll.slidr.Slidr;
|
||||
@ -113,6 +114,7 @@ public class WikiActivity extends BaseActivity {
|
||||
private Markwon markwon;
|
||||
private MarkwonAdapter markwonAdapter;
|
||||
private boolean isRefreshing = false;
|
||||
private RequestManager mGlide;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -154,6 +156,8 @@ public class WikiActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
|
||||
swipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true));
|
||||
swipeRefreshLayout.setOnRefreshListener(this::loadWiki);
|
||||
|
||||
@ -328,7 +332,7 @@ public class WikiActivity extends BaseActivity {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
mFetchWikiInfoLinearLayout.setVisibility(View.VISIBLE);
|
||||
mFetchWikiInfoTextView.setText(stringResId);
|
||||
Glide.with(this).load(R.drawable.error_image).into(mFetchWikiInfoImageView);
|
||||
mGlide.load(R.drawable.error_image).into(mFetchWikiInfoImageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,6 +119,14 @@
|
||||
android:src="@drawable/ic_file_download_toolbar_white_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/playback_speed_image_view_exo_playback_control_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_playback_speed_toolbar_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.bottomappbar.BottomAppBar>
|
||||
|
Loading…
Reference in New Issue
Block a user