Tap & pay: change empty state UX and strings.
Bug: 10965661 Change-Id: Iee0b8bf111ef2105babb0912942f5c764b75ac59
This commit is contained in:
@@ -23,6 +23,18 @@
|
||||
android:visibility="gone"
|
||||
android:paddingTop="16dp"
|
||||
android:text="@string/nfc_payment_no_apps"/>
|
||||
<TextView
|
||||
android:id="@+id/nfc_payment_learn_more"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:paddingTop="16dp"
|
||||
android:text="@string/nfc_payment_learn_more"/>
|
||||
</LinearLayout>
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
|
@@ -4757,7 +4757,10 @@
|
||||
<!-- NFC payment settings --><skip/>
|
||||
<string name="nfc_payment_settings_title">Tap & pay</string>
|
||||
<!-- String shown when there are no NFC payment applications installed -->
|
||||
<string name="nfc_payment_no_apps">You have no apps configured for tap & pay with NFC.</string>
|
||||
<string name="nfc_payment_no_apps">Pay with just a tap</string>
|
||||
<!-- String shown when there are no NFC payment applications installed, clickable, pointing to
|
||||
a website to learn more-->
|
||||
<string name="nfc_payment_learn_more">Learn more</string>
|
||||
<string name="nfc_payment_menu_item_add_service">Find apps</string>
|
||||
<!-- Label for the dialog that is shown when the user is asked to set a
|
||||
preferred payment application -->
|
||||
@@ -4809,6 +4812,8 @@
|
||||
<string name="help_url_location_access" translatable="false"></string>
|
||||
<!-- Help URL, Security settings [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_security" translatable="false"></string>
|
||||
<!-- Help URL, Tap & pay [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_nfc_payment" translatable="false"></string>
|
||||
|
||||
<!-- User account title [CHAR LIMIT=30] -->
|
||||
<string name="user_account_title">Account for content</string>
|
||||
|
@@ -109,7 +109,7 @@ public class HelpUtils {
|
||||
* of the app's package as gotten via the context.
|
||||
* @return the uri with added query parameters
|
||||
*/
|
||||
private static Uri uriWithAddedParameters(Context context, Uri baseUri) {
|
||||
public static Uri uriWithAddedParameters(Context context, Uri baseUri) {
|
||||
Uri.Builder builder = baseUri.buildUpon();
|
||||
|
||||
// Add in the preferred language
|
||||
|
@@ -25,6 +25,7 @@ import android.os.Message;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -38,6 +39,7 @@ import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.content.PackageMonitor;
|
||||
import com.android.settings.HelpUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
|
||||
@@ -49,7 +51,6 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
|
||||
public static final String TAG = "PaymentSettings";
|
||||
private LayoutInflater mInflater;
|
||||
private PaymentBackend mPaymentBackend;
|
||||
|
||||
private final PackageMonitor mSettingsPackageMonitor = new SettingsPackageMonitor();
|
||||
|
||||
|
||||
@@ -57,7 +58,6 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
setHasOptionsMenu(false);
|
||||
mPaymentBackend = new PaymentBackend(getActivity());
|
||||
mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
setHasOptionsMenu(true);
|
||||
@@ -83,13 +83,18 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
TextView emptyText = (TextView) getView().findViewById(R.id.nfc_payment_empty_text);
|
||||
TextView learnMore = (TextView) getView().findViewById(R.id.nfc_payment_learn_more);
|
||||
ImageView emptyImage = (ImageView) getView().findViewById(R.id.nfc_payment_tap_image);
|
||||
if (screen.getPreferenceCount() == 0) {
|
||||
emptyText.setVisibility(View.VISIBLE);
|
||||
learnMore.setVisibility(View.VISIBLE);
|
||||
emptyImage.setVisibility(View.VISIBLE);
|
||||
getListView().setVisibility(View.GONE);
|
||||
} else {
|
||||
emptyText.setVisibility(View.GONE);
|
||||
learnMore.setVisibility(View.GONE);
|
||||
emptyImage.setVisibility(View.GONE);
|
||||
getListView().setVisibility(View.VISIBLE);
|
||||
}
|
||||
setPreferenceScreen(screen);
|
||||
}
|
||||
@@ -99,6 +104,24 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = mInflater.inflate(R.layout.nfc_payment, container, false);
|
||||
TextView learnMore = (TextView) v.findViewById(R.id.nfc_payment_learn_more);
|
||||
learnMore.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String helpUrl;
|
||||
if (!TextUtils.isEmpty(helpUrl = getResources().getString(
|
||||
R.string.help_url_nfc_payment))) {
|
||||
final Uri fullUri = HelpUtils.uriWithAddedParameters(
|
||||
PaymentSettings.this.getActivity(), Uri.parse(helpUrl));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, fullUri);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
Log.e(TAG, "Help url not set.");
|
||||
}
|
||||
}
|
||||
});
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -190,4 +213,4 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
|
||||
banner.setImageDrawable(appInfo.banner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user