Fix layout issue in non-immersive interface. Rename ThemePreviewActivity to CustomThemePreviewActivity.

This commit is contained in:
Alex Ning 2020-10-19 11:38:48 +08:00
parent b2732f1d79
commit 658af22c04
13 changed files with 28 additions and 21 deletions

View File

@ -103,7 +103,7 @@
android:parentActivityName=".Activity.MainActivity"
android:theme="@style/AppTheme.Slidable" />
<activity
android:name=".Activity.ThemePreviewActivity"
android:name=".Activity.CustomThemePreviewActivity"
android:label="@string/theme_preview_activity_label"
android:parentActivityName=".Activity.MainActivity"
android:theme="@style/AppTheme.SlidableWithTranslucentWindow" />

View File

@ -87,6 +87,8 @@ public class CustomThemeListingActivity extends BaseActivity implements
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_theme_listing);

View File

@ -59,7 +59,7 @@ 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;
public class ThemePreviewActivity extends AppCompatActivity {
public class CustomThemePreviewActivity extends AppCompatActivity {
public static final String EXTRA_CUSTOM_THEME_SETTINGS_ITEMS = "ECTSI";

View File

@ -84,6 +84,8 @@ public class CustomizeThemeActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customize_theme);
@ -191,8 +193,8 @@ public class CustomizeThemeActivity extends BaseActivity {
finish();
return true;
case R.id.action_preview_customize_theme_activity:
Intent intent = new Intent(this, ThemePreviewActivity.class);
intent.putParcelableArrayListExtra(ThemePreviewActivity.EXTRA_CUSTOM_THEME_SETTINGS_ITEMS, customThemeSettingsItems);
Intent intent = new Intent(this, CustomThemePreviewActivity.class);
intent.putParcelableArrayListExtra(CustomThemePreviewActivity.EXTRA_CUSTOM_THEME_SETTINGS_ITEMS, customThemeSettingsItems);
startActivity(intent);
return true;

View File

@ -80,7 +80,10 @@ public class LoginActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_login);
} catch (InflateException ie) {

View File

@ -435,7 +435,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);
@ -460,7 +460,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);

View File

@ -9,6 +9,7 @@ import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
import ml.docilealligator.infinityforreddit.Activity.CommentFullMarkdownActivity;
import ml.docilealligator.infinityforreddit.Activity.CreateMultiRedditActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomThemeListingActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomThemePreviewActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
import ml.docilealligator.infinityforreddit.Activity.EditMultiRedditActivity;
@ -37,7 +38,6 @@ import ml.docilealligator.infinityforreddit.Activity.SubmitCrosspostActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditMultiselectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.Activity.ThemePreviewActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewImageOrGifActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewImgurMediaActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewMultiRedditDetailActivity;
@ -170,7 +170,7 @@ public interface AppComponent {
void inject(AdvancedPreferenceFragment advancedPreferenceFragment);
void inject(ThemePreviewActivity themePreviewActivity);
void inject(CustomThemePreviewActivity customThemePreviewActivity);
void inject(EditMultiRedditActivity editMultiRedditActivity);

View File

@ -194,7 +194,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);
@ -219,7 +219,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);

View File

@ -295,7 +295,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
nColumns = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT, "1"));
} else {
nColumns = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "1"));
nColumns = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "2"));
}
if (nColumns == 1) {
@ -714,7 +714,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);
@ -739,7 +739,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
exceedThreshold = true;
if (vibrateWhenActionTriggered && v != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(10, 175));
v.vibrate(VibrationEffect.createOneShot(10, 255));
} else {
//deprecated in API 26
v.vibrate(10);

View File

@ -14,7 +14,7 @@ import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.ThemePreviewActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomThemePreviewActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
import ml.docilealligator.infinityforreddit.R;
@ -95,7 +95,7 @@ public class ThemePreviewCommentsFragment extends Fragment {
TextView scoreTextViewFullyCollapsed;
@BindView(R.id.time_text_view_fully_collapsed_theme_preview_comments_fragment)
TextView timeTextViewFullyCollapsed;
private ThemePreviewActivity activity;
private CustomThemePreviewActivity activity;
public ThemePreviewCommentsFragment() {
// Required empty public constructor
@ -149,6 +149,6 @@ public class ThemePreviewCommentsFragment extends Fragment {
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (ThemePreviewActivity) context;
activity = (CustomThemePreviewActivity) context;
}
}

View File

@ -24,7 +24,7 @@ import com.libRG.CustomTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import ml.docilealligator.infinityforreddit.Activity.ThemePreviewActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomThemePreviewActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
import ml.docilealligator.infinityforreddit.R;
@ -84,7 +84,7 @@ public class ThemePreviewPostsFragment extends Fragment {
ImageView saveButton;
@BindView(R.id.share_button_theme_preview_posts_fragment)
ImageView shareButton;
private ThemePreviewActivity activity;
private CustomThemePreviewActivity activity;
public ThemePreviewPostsFragment() {
// Required empty public constructor
@ -148,6 +148,6 @@ public class ThemePreviewPostsFragment extends Fragment {
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (ThemePreviewActivity) context;
activity = (CustomThemePreviewActivity) context;
}
}

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinator_layout_theme_preview_activity"
tools:context=".Activity.ThemePreviewActivity">
tools:context=".Activity.CustomThemePreviewActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_theme_preview_activity"

View File

@ -489,7 +489,7 @@
<string name="settings_bottom_app_bar_option_4">Option 4</string>
<string name="settings_bottom_app_bar_fab">Floating Action Button</string>
<string name="settings_data_saving_mode">Data Saving Mode</string>
<string name="settings_data_saving_mode_info_summary">In data saving mode, preview images are in lower resolution.</string>
<string name="settings_data_saving_mode_info_summary">In data saving mode:\nPreview images are in lower resolution.\nReddit videos are in lower resolution.</string>
<string name="settings_translation_title">Translation</string>
<string name="settings_translation_summary">Translate this app on POEditor. Thanks to all contributors.</string>
<string name="settings_credits_national_flags">National Flags</string>