Fix wrong text color on secondary splash screen
This commit is contained in:
parent
79f0508e64
commit
f6213ca9f8
1 changed files with 17 additions and 11 deletions
|
@ -17,6 +17,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
@ -75,14 +76,16 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
OsmandApplication app = requireMyApplication();
|
||||
FragmentActivity activity = requireActivity();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
boolean systemDefaultNightMode = app.getSettings().isSupportSystemDefaultTheme() &&
|
||||
!app.getSettings().isLightSystemDefaultTheme();
|
||||
|
||||
RelativeLayout view = new RelativeLayout(activity);
|
||||
view.setOnClickListener(null);
|
||||
int backgroundColorId = R.color.map_background_color_light;
|
||||
if (app.getSettings().isSupportSystemDefaultTheme()
|
||||
&& !app.getSettings().isLightSystemDefaultTheme()) {
|
||||
backgroundColorId = R.color.map_background_color_dark;
|
||||
}
|
||||
|
||||
int backgroundColorId = systemDefaultNightMode ?
|
||||
R.color.map_background_color_dark :
|
||||
R.color.map_background_color_light;
|
||||
view.setBackgroundColor(getResources().getColor(backgroundColorId));
|
||||
|
||||
ImageView logo = new ImageView(getContext());
|
||||
|
@ -102,19 +105,22 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
|
||||
ImageView text = new ImageView(activity);
|
||||
text.setId(TEXT_ID);
|
||||
int textColorId = systemDefaultNightMode ?
|
||||
R.color.text_color_tertiary_dark :
|
||||
R.color.text_color_tertiary_light;
|
||||
if (Version.isFreeVersion(app)) {
|
||||
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||
text.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_osmand_osmlive));
|
||||
text.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_osmand_osmlive, textColorId));
|
||||
} else if (InAppPurchaseHelper.isFullVersionPurchased(app)) {
|
||||
text.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_osmand_inapp));
|
||||
text.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_osmand_inapp, textColorId));
|
||||
} else {
|
||||
text.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_osmand));
|
||||
text.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_osmand, textColorId));
|
||||
}
|
||||
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
||||
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||
text.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_osmand_plus_osmlive));
|
||||
text.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_osmand_plus_osmlive, textColorId));
|
||||
} else {
|
||||
text.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_osmand_plus));
|
||||
text.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_osmand_plus, textColorId));
|
||||
}
|
||||
}
|
||||
RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
@ -123,7 +129,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
|
||||
ImageView osmText = new ImageView(activity);
|
||||
osmText.setId(OSM_TEXT_ID);
|
||||
osmText.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.image_text_openstreetmap));
|
||||
osmText.setImageDrawable(iconsCache.getIcon(R.drawable.image_text_openstreetmap, textColorId));
|
||||
RelativeLayout.LayoutParams osmTextLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
osmTextLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
osmTextLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||
|
|
Loading…
Reference in a new issue