[android] Fixed installing style scheme for fragment, deleted hotfix, modified dialog' styles

This commit is contained in:
Dmitry Donskoy 2018-06-05 22:21:07 +03:00 committed by Aleksandr Zatsepin
parent 92cfd0eac0
commit 6342345d60
3 changed files with 40 additions and 4 deletions

View file

@ -99,6 +99,11 @@
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
</style>
<style name="MwmTheme.DialogFragment.NoFullscreen" parent="MwmTheme.DialogFragment.Fullscreen">
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">false</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/bg_dialog_translucent</item>
</style>
<style name="MwmTheme.DialogFragment.Fullscreen.Night" parent="Theme.AppCompat">
<item name="colorPrimary">@color/bg_primary_night</item>
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">?statusBar</item>
@ -114,6 +119,11 @@
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
</style>
<style name="MwmTheme.DialogFragment.NoFullscreen.Night" parent="MwmTheme.DialogFragment.Fullscreen.Night">
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">false</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/bg_dialog_translucent</item>
</style>
<style name="MwmTheme.DialogFragment.Fullscreen.Translucent">
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@android:color/black</item>
<item name="android:windowBackground">@color/bg_dialog_translucent</item>

View file

@ -5,16 +5,15 @@ import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.app.DialogFragment;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.util.ThemeUtils;
public class BaseMwmDialogFragment extends DialogFragment
{
protected final @StyleRes int getFullscreenTheme()
@StyleRes
protected final int getFullscreenTheme()
{
return (ThemeUtils.isNightTheme() ? R.style.MwmTheme_DialogFragment_Fullscreen_Night
: R.style.MwmTheme_DialogFragment_Fullscreen);
return ThemeUtils.isNightTheme() ? getFullscreenDarkTheme() : getFullscreenLightTheme();
}
protected int getStyle()
@ -53,4 +52,16 @@ public class BaseMwmDialogFragment extends DialogFragment
super.onPause();
org.alohalytics.Statistics.logEvent("$onPause", getClass().getSimpleName());
}
@StyleRes
protected int getFullscreenLightTheme()
{
return R.style.MwmTheme_DialogFragment_Fullscreen;
}
@StyleRes
protected int getFullscreenDarkTheme()
{
return R.style.MwmTheme_DialogFragment_Fullscreen_Night;
}
}

View file

@ -8,6 +8,7 @@ import android.support.annotation.ArrayRes;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
@ -273,6 +274,20 @@ public abstract class BaseNewsFragment extends BaseMwmDialogFragment
: getFullscreenTheme());
}
@StyleRes
@Override
protected int getFullscreenLightTheme()
{
return R.style.MwmTheme_DialogFragment_NoFullscreen;
}
@StyleRes
@Override
protected int getFullscreenDarkTheme()
{
return R.style.MwmTheme_DialogFragment_NoFullscreen_Night;
}
@Override
public @NonNull Dialog onCreateDialog(Bundle savedInstanceState)
{