UI review fixes

This commit is contained in:
cepprice 2021-04-05 17:58:04 +05:00
parent f2645a064f
commit f08b7f2f93
9 changed files with 100 additions and 57 deletions

View file

@ -25,7 +25,7 @@
android:layout_marginEnd="@dimen/map_widget_height" android:layout_marginEnd="@dimen/map_widget_height"
android:layout_marginRight="@dimen/map_widget_height" android:layout_marginRight="@dimen/map_widget_height"
app:srcCompat="@drawable/ic_action_at_mail" app:srcCompat="@drawable/ic_action_at_mail"
app:tint="?attr/active_color_basic" /> app:tint="?attr/default_icon_color" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/support_link_title" android:id="@+id/support_link_title"
@ -44,7 +44,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/contact_support_container" android:id="@+id/contact_support_title_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
@ -59,10 +59,9 @@
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/contact_support_title" android:id="@+id/contact_support_title"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/contact_support" android:text="@string/contact_support"
android:textColor="?attr/active_color_basic" android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/list_background_color">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/settings_divider_margin_start"
android:layout_marginLeft="@dimen/settings_divider_margin_start"
android:background="?attr/divider_color_basic" />
</FrameLayout>

View file

@ -8,12 +8,12 @@
android:orientation="vertical"> android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/map_widget_height" android:layout_width="@dimen/card_row_min_height"
android:layout_height="@dimen/context_menu_controller_height" android:layout_height="@dimen/card_row_min_height"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="@dimen/favorites_my_places_icon_size" android:layout_marginTop="@dimen/dialog_content_margin"
android:layout_marginBottom="@dimen/favorites_my_places_icon_size" android:layout_marginBottom="@dimen/title_padding"
app:srcCompat="@drawable/ic_action_purchases" app:srcCompat="@drawable/ic_action_purchases_outlined"
app:tint="?attr/default_icon_color" /> app:tint="?attr/default_icon_color" />
<LinearLayout <LinearLayout
@ -32,7 +32,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingBottom="@dimen/slider_thumb_size" android:paddingBottom="@dimen/content_padding_small_half"
android:text="@string/no_purchases" android:text="@string/no_purchases"
android:textColor="?attr/dialog_title_color" android:textColor="?attr/dialog_title_color"
android:textSize="@dimen/empty_state_text_desc_size" android:textSize="@dimen/empty_state_text_desc_size"
@ -45,7 +45,6 @@
android:gravity="center" android:gravity="center"
android:letterSpacing="@dimen/description_letter_spacing" android:letterSpacing="@dimen/description_letter_spacing"
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
android:minHeight="@dimen/dialog_button_ex_height"
android:text="@string/empty_purchases_description" android:text="@string/empty_purchases_description"
android:textColor="?attr/dialog_text_description_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
@ -81,12 +80,14 @@
android:id="@+id/contact_support_container" android:id="@+id/contact_support_container"
layout="@layout/contact_support" /> layout="@layout/contact_support" />
<include <FrameLayout
layout="@layout/card_bottom_divider"/>
<View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_ex_min_width" android:layout_height="@dimen/dialog_button_ex_min_width"
android:background="?attr/activity_background_color" /> android:background="?attr/activity_background_color">
<include
layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -141,7 +141,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/map_widget_height" android:layout_marginEnd="@dimen/map_widget_height"
android:layout_marginRight="@dimen/map_widget_height" android:layout_marginRight="@dimen/map_widget_height"
app:srcCompat="@drawable/ic_action_at_mail" app:srcCompat="@drawable/ic_action_osm_live"
app:tint="?attr/active_color_basic" /> app:tint="?attr/active_color_basic" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
@ -201,7 +201,14 @@
</LinearLayout> </LinearLayout>
<include <FrameLayout
layout="@layout/divider"/> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activity_background_color">
<include
layout="@layout/card_bottom_divider" />
</FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -85,12 +85,14 @@
android:id="@+id/contact_support_container" android:id="@+id/contact_support_container"
layout="@layout/contact_support" /> layout="@layout/contact_support" />
<include <FrameLayout
layout="@layout/divider"/>
<View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_ex_min_width" android:layout_height="@dimen/dialog_button_ex_min_width"
android:background="?attr/activity_background_color" /> android:background="?attr/activity_background_color">
<include
layout="@layout/card_bottom_divider" />
</FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -13,6 +13,10 @@
app:fragment="net.osmand.plus.settings.fragments.GlobalSettingsFragment" app:fragment="net.osmand.plus.settings.fragments.GlobalSettingsFragment"
tools:icon="@drawable/ic_action_settings" /> tools:icon="@drawable/ic_action_settings" />
<Preference
android:layout="@layout/divider_half_item_with_background"
android:selectable="false" />
<Preference <Preference
android:key="purchases_settings" android:key="purchases_settings"
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"

View file

@ -14,6 +14,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
@ -52,7 +53,6 @@ import net.osmand.plus.activities.actions.OsmAndDialogs;
import net.osmand.plus.api.SQLiteAPI; import net.osmand.plus.api.SQLiteAPI;
import net.osmand.plus.api.SQLiteAPIImpl; import net.osmand.plus.api.SQLiteAPIImpl;
import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dialogs.CrashBottomSheetDialogFragment;
import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadService; import net.osmand.plus.download.DownloadService;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
@ -1054,26 +1054,40 @@ public class OsmandApplication extends MultiDexApplication {
intent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(this, file)); intent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(this, file));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setType("vnd.android.cursor.dir/email"); intent.setType("vnd.android.cursor.dir/email");
intent.putExtra(Intent.EXTRA_SUBJECT, "OsmAnd bug"); intent.putExtra(Intent.EXTRA_SUBJECT, "OsmAnd bug");
StringBuilder text = new StringBuilder(); intent.putExtra(Intent.EXTRA_TEXT, getDeviceInfo());
text.append("\nDevice : ").append(Build.DEVICE);
text.append("\nBrand : ").append(Build.BRAND);
text.append("\nModel : ").append(Build.MODEL);
text.append("\nProduct : ").append(Build.PRODUCT);
text.append("\nBuild : ").append(Build.DISPLAY);
text.append("\nVersion : ").append(Build.VERSION.RELEASE);
text.append("\nApp Version : ").append(Version.getAppName(this));
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
if (info != null) {
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode);
}
} catch (PackageManager.NameNotFoundException e) {
PlatformUtil.getLog(CrashBottomSheetDialogFragment.class).error("", e);
}
intent.putExtra(Intent.EXTRA_TEXT, text.toString());
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.send_report)); Intent chooserIntent = Intent.createChooser(intent, getString(R.string.send_report));
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(chooserIntent); startActivity(chooserIntent);
} }
}
public void sendSupportEmail(String screenName) {
final Intent emailIntent = new Intent(Intent.ACTION_SEND)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(Intent.EXTRA_EMAIL, new String[]{"support@osmand.net"})
.putExtra(Intent.EXTRA_SUBJECT, screenName)
.putExtra(Intent.EXTRA_TEXT, getDeviceInfo());
emailIntent.setSelector(new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")));
startActivity(emailIntent);
}
public String getDeviceInfo() {
StringBuilder text = new StringBuilder();
text.append("Device : ").append(Build.DEVICE);
text.append("\nBrand : ").append(Build.BRAND);
text.append("\nModel : ").append(Build.MODEL);
text.append("\nProduct : ").append(Build.PRODUCT);
text.append("\nBuild : ").append(Build.DISPLAY);
text.append("\nVersion : ").append(Build.VERSION.RELEASE);
text.append("\nApp Version : ").append(Version.getAppName(this));
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
if (info != null) {
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode);
}
} catch (PackageManager.NameNotFoundException e) {
LOG.error("", e);
}
return text.toString();
}
}

View file

@ -1,7 +1,6 @@
package net.osmand.plus.settings.fragments; package net.osmand.plus.settings.fragments;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -142,7 +141,8 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
View iconToolbarContainer = toolbar.findViewById(R.id.icon_toolbar); View iconToolbarContainer = toolbar.findViewById(R.id.icon_toolbar);
ImageView icon = iconToolbarContainer.findViewById(R.id.profile_icon); ImageView icon = iconToolbarContainer.findViewById(R.id.profile_icon);
icon.setImageResource(R.drawable.ic_action_help_online); int iconColorRes = nightMode ? R.color.icon_color_primary_dark : R.color.active_buttons_and_links_text_light;
icon.setImageDrawable(getIcon(R.drawable.ic_action_help_online, iconColorRes));
icon.setOnClickListener(new View.OnClickListener() { icon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -202,6 +202,11 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
} }
} }
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
private MapActivity getMapActivity() { private MapActivity getMapActivity() {
return (MapActivity) getActivity(); return (MapActivity) getActivity();
} }

View file

@ -5,10 +5,7 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.text.style.URLSpan;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
@ -28,7 +25,6 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
private static final String OSMAND_NEW_DEVICE_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account"; private static final String OSMAND_NEW_DEVICE_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account";
private static final String OSMAND_EMAIL = "support@osmand.net"; private static final String OSMAND_EMAIL = "support@osmand.net";
private static final String EMAIL_DEEPLINK_URI = "mailto:support@osmand.net";
protected InAppPurchaseHelper purchaseHelper; protected InAppPurchaseHelper purchaseHelper;
@ -114,12 +110,13 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
supportDescription.setText(spannableStringMail); supportDescription.setText(spannableStringMail);
} }
protected void setupContactUsLink() { private void setupContactUsLink() {
TextView contactSupportLink = view.findViewById(R.id.contact_support_title); View contactSupportLinkContainer = view.findViewById(R.id.contact_support_title_container);
SpannableString spannableStringSupport = new SpannableString(app.getString(R.string.contact_support)); contactSupportLinkContainer.setOnClickListener(new View.OnClickListener() {
spannableStringSupport.setSpan(new URLSpan(EMAIL_DEEPLINK_URI), 0, spannableStringSupport.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @Override
contactSupportLink.setText(spannableStringSupport); public void onClick(View v) {
AndroidUtils.removeLinkUnderline(contactSupportLink); app.sendSupportEmail(app.getString(R.string.purchases));
contactSupportLink.setMovementMethod(LinkMovementMethod.getInstance()); }
});
} }
} }