Merge pull request #7273 from osmandapp/splashScreenUpgrade
Add text "Powered by OpenStreetMap data." to the second program splash screen
This commit is contained in:
commit
dab24790c3
5 changed files with 42 additions and 23 deletions
|
@ -2,8 +2,9 @@
|
|||
<resources>
|
||||
<dimen name="map_go_button_width">200dp</dimen>
|
||||
|
||||
<dimen name="splash_screen_logo_top">24dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">48dp</dimen>
|
||||
<dimen name="splash_screen_logo_top">12dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">12dp</dimen>
|
||||
<dimen name="splash_screen_osm_text_bottom">12dp</dimen>
|
||||
|
||||
<dimen name="empty_state_image_margin_top">39dp</dimen>
|
||||
<dimen name="empty_state_image_margin_bottom">39dp</dimen>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="splash_screen_logo_top">200dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">150dp</dimen>
|
||||
<dimen name="splash_screen_logo_top">24dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">12dp</dimen>
|
||||
<dimen name="splash_screen_osm_text_bottom">24dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="splash_screen_logo_top">300dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">200dp</dimen>
|
||||
<dimen name="splash_screen_logo_top">160dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">36dp</dimen>
|
||||
<dimen name="splash_screen_osm_text_bottom">24dp</dimen>
|
||||
|
||||
<dimen name="measurement_tool_select_radius">48dp</dimen>
|
||||
</resources>
|
|
@ -199,8 +199,9 @@
|
|||
|
||||
<dimen name="dialog_header_text_size">20sp</dimen>
|
||||
|
||||
<dimen name="splash_screen_logo_top">150dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">128dp</dimen>
|
||||
<dimen name="splash_screen_logo_top">80dp</dimen>
|
||||
<dimen name="splash_screen_text_bottom">36dp</dimen>
|
||||
<dimen name="splash_screen_osm_text_bottom">24dp</dimen>
|
||||
|
||||
<dimen name="guide_line_text_size">14sp</dimen>
|
||||
<dimen name="guide_line_vertical_offset">6dp</dimen>
|
||||
|
|
|
@ -22,6 +22,10 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
|||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
|
||||
public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
||||
private final static int LOGO_ID = 1001;
|
||||
private final static int TEXT_ID = 1002;
|
||||
private final static int OSM_TEXT_ID = 1003;
|
||||
|
||||
public static final String TAG = "SecondSplashScreenFragment";
|
||||
public static boolean SHOW = true;
|
||||
public static boolean VISIBLE = false;
|
||||
|
@ -86,6 +90,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
|
||||
|
||||
ImageView logo = new ImageView(getContext());
|
||||
logo.setId(LOGO_ID);
|
||||
if (Version.isFreeVersion(app)) {
|
||||
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand));
|
||||
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
||||
|
@ -94,7 +99,9 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||
|
||||
ImageView text = new ImageView(activity);
|
||||
text.setId(TEXT_ID);
|
||||
if (Version.isFreeVersion(app)) {
|
||||
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_osmlive));
|
||||
|
@ -111,37 +118,44 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
textLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
textLayoutParams.addRule(RelativeLayout.ABOVE, OSM_TEXT_ID);
|
||||
textLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||
|
||||
ImageView osmText = new ImageView(activity);
|
||||
osmText.setId(OSM_TEXT_ID);
|
||||
osmText.setImageDrawable(getResources().getDrawable(R.drawable.image_text_openstreetmap));
|
||||
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);
|
||||
|
||||
int defaultLogoMarginTop = (int) getResources().getDimension(R.dimen.splash_screen_logo_top);
|
||||
int logoMarginTop = defaultLogoMarginTop - (Build.VERSION.SDK_INT >= 21 ? 0 : getStatusBarHeight());
|
||||
int logoPaddingLeft = 0;
|
||||
int logoPaddingRight = 0;
|
||||
int defaultTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom);
|
||||
int textMarginBottom = defaultTextMarginBottom - getNavigationBarHeight();
|
||||
int textPaddingLeft = 0;
|
||||
int textPaddingRight = 0;
|
||||
int textMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom);
|
||||
int osmTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_osm_text_bottom);
|
||||
int elementsPaddingLeft = 0;
|
||||
int elementsPaddingRight = 0;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
|
||||
int screenOrientation = AndroidUiHelper.getScreenOrientation(activity);
|
||||
if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||
logoPaddingLeft = getNavigationBarWidth();
|
||||
textPaddingLeft = getNavigationBarWidth();
|
||||
elementsPaddingLeft = getNavigationBarWidth();
|
||||
} else if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
|
||||
logoPaddingRight = getNavigationBarWidth();
|
||||
textPaddingRight = getNavigationBarWidth();
|
||||
elementsPaddingRight = getNavigationBarWidth();
|
||||
}
|
||||
} else {
|
||||
logoPaddingLeft = getNavigationBarWidth();
|
||||
textPaddingLeft = getNavigationBarWidth();
|
||||
elementsPaddingLeft = getNavigationBarWidth();
|
||||
}
|
||||
logoLayoutParams.setMargins(0, logoMarginTop, 0, 0);
|
||||
logo.setPadding(logoPaddingLeft, 0, logoPaddingRight, 0);
|
||||
logo.setPadding(elementsPaddingLeft, 0, elementsPaddingRight, 0);
|
||||
logo.setLayoutParams(logoLayoutParams);
|
||||
view.addView(logo);
|
||||
textLayoutParams.setMargins(0, 0, 0, textMarginBottom);
|
||||
text.setPadding(textPaddingLeft, 0, textPaddingRight, 0);
|
||||
text.setPadding(elementsPaddingLeft, 0, elementsPaddingRight, 0);
|
||||
text.setLayoutParams(textLayoutParams);
|
||||
view.addView(text);
|
||||
osmTextLayoutParams.setMargins(0, 0, 0, osmTextMarginBottom);
|
||||
osmText.setPadding(elementsPaddingLeft, 0, elementsPaddingRight, 0);
|
||||
osmText.setLayoutParams(osmTextLayoutParams);
|
||||
view.addView(osmText);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue