Small fixes to dash fragment
This commit is contained in:
parent
f4da1ee2c9
commit
f2b23e61da
2 changed files with 12 additions and 18 deletions
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/search"
|
android:id="@+id/search"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -10,17 +11,18 @@
|
||||||
android:layout_marginRight="@dimen/dash_margin_h"
|
android:layout_marginRight="@dimen/dash_margin_h"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/header"
|
android:id="@+id/header"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/do_you_like_osmand"
|
android:text="@string/do_you_like_osmand"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/welcome_header_text_size"
|
android:textSize="20sp"
|
||||||
android:paddingBottom="@dimen/list_content_padding"
|
android:paddingBottom="10dp"
|
||||||
android:paddingLeft="@dimen/list_content_padding"
|
android:paddingLeft="@dimen/list_content_padding"
|
||||||
android:paddingRight="@dimen/list_content_padding"
|
android:paddingRight="@dimen/list_content_padding"
|
||||||
android:paddingTop="@dimen/list_content_padding"/>
|
android:paddingTop="8dp"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subheader"
|
android:id="@+id/subheader"
|
||||||
|
@ -60,8 +62,7 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/shared_string_no"
|
android:text="@string/shared_string_no" />
|
||||||
android:textColor="?attr/dashboard_subheader_text_color"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -24,6 +24,9 @@ import java.util.Calendar;
|
||||||
public class DashRateUsFragment extends DashBaseFragment {
|
public class DashRateUsFragment extends DashBaseFragment {
|
||||||
public static final String TAG = "DASH_RATE_US_FRAGMENT";
|
public static final String TAG = "DASH_RATE_US_FRAGMENT";
|
||||||
|
|
||||||
|
// TODO move to resources
|
||||||
|
public static final String EMAIL = "support@osmand.net";
|
||||||
|
|
||||||
// Imported in shouldShow method
|
// Imported in shouldShow method
|
||||||
private static OsmandSettings settings;
|
private static OsmandSettings settings;
|
||||||
private FragmentState state = FragmentState.INITIAL_STATE;
|
private FragmentState state = FragmentState.INITIAL_STATE;
|
||||||
|
@ -118,9 +121,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Log.v(TAG, "onClick(" + "v=" + v + ")");
|
|
||||||
Log.v(TAG, this.getClass().getName());
|
|
||||||
Log.v(TAG, "state=" + state);
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case INITIAL_STATE:
|
case INITIAL_STATE:
|
||||||
state = FragmentState.USER_LIKES_APP;
|
state = FragmentState.USER_LIKES_APP;
|
||||||
|
@ -129,7 +129,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
subheader.setText(getResources().getString(R.string.rate_this_app_long));
|
subheader.setText(getResources().getString(R.string.rate_this_app_long));
|
||||||
positiveButton.setText(getResources().getString(R.string.shared_string_ok));
|
positiveButton.setText(getResources().getString(R.string.shared_string_ok));
|
||||||
negativeButton.setText(getResources().getString(R.string.shared_string_no_thanks));
|
negativeButton.setText(getResources().getString(R.string.shared_string_no_thanks));
|
||||||
Log.v(TAG, "state2=" + state);
|
|
||||||
return;
|
return;
|
||||||
case USER_LIKES_APP:
|
case USER_LIKES_APP:
|
||||||
settings.RATE_US_STATE.set(RateUsState.LIKED);
|
settings.RATE_US_STATE.set(RateUsState.LIKED);
|
||||||
|
@ -144,7 +143,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
+ getActivity().getPackageName())));
|
+ getActivity().getPackageName())));
|
||||||
}
|
}
|
||||||
dashboard.refreshDashboardFragments();
|
dashboard.refreshDashboardFragments();
|
||||||
Log.v(TAG, "state2=" + state);
|
|
||||||
return;
|
return;
|
||||||
case USER_HATES_APP:
|
case USER_HATES_APP:
|
||||||
settings.RATE_US_STATE.set(RateUsState.DISLIKED_WITH_MESSAGE);
|
settings.RATE_US_STATE.set(RateUsState.DISLIKED_WITH_MESSAGE);
|
||||||
|
@ -153,10 +151,9 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
dashboard.refreshDashboardFragments();
|
dashboard.refreshDashboardFragments();
|
||||||
Intent sendEmail = new Intent(Intent.ACTION_SENDTO);
|
Intent sendEmail = new Intent(Intent.ACTION_SENDTO);
|
||||||
sendEmail.setType("text/plain");
|
sendEmail.setType("text/plain");
|
||||||
// TODO replace email address with constant
|
sendEmail.setData(Uri.parse("mailto:" + EMAIL));
|
||||||
sendEmail.putExtra(Intent.EXTRA_EMAIL, "support@osmand.net");
|
sendEmail.putExtra(Intent.EXTRA_EMAIL, EMAIL);
|
||||||
startActivity(sendEmail);
|
startActivity(sendEmail);
|
||||||
Log.v(TAG, "state2=" + state);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,8 +176,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Log.v(TAG, this.getClass().getName());
|
|
||||||
Log.v(TAG, "state=" + state);
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case INITIAL_STATE:
|
case INITIAL_STATE:
|
||||||
state = FragmentState.USER_HATES_APP;
|
state = FragmentState.USER_HATES_APP;
|
||||||
|
@ -189,7 +184,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
subheader.setText(getResources().getString(R.string.user_hates_app_get_feedback_long));
|
subheader.setText(getResources().getString(R.string.user_hates_app_get_feedback_long));
|
||||||
positiveButton.setText(getResources().getString(R.string.shared_string_ok));
|
positiveButton.setText(getResources().getString(R.string.shared_string_ok));
|
||||||
negativeButton.setText(getResources().getString(R.string.shared_string_no_thanks));
|
negativeButton.setText(getResources().getString(R.string.shared_string_no_thanks));
|
||||||
Log.v(TAG, "state2=" + state);
|
|
||||||
return;
|
return;
|
||||||
case USER_LIKES_APP:
|
case USER_LIKES_APP:
|
||||||
settings.RATE_US_STATE.set(RateUsState.IGNORED);
|
settings.RATE_US_STATE.set(RateUsState.IGNORED);
|
||||||
|
@ -201,7 +195,6 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
settings.NUMBER_OF_APPLICATION_STARTS.set(0);
|
settings.NUMBER_OF_APPLICATION_STARTS.set(0);
|
||||||
settings.LAST_DISPLAY_TIME.set(System.currentTimeMillis());
|
settings.LAST_DISPLAY_TIME.set(System.currentTimeMillis());
|
||||||
dashboard.refreshDashboardFragments();
|
dashboard.refreshDashboardFragments();
|
||||||
Log.v(TAG, "state2=" + state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue