diff --git a/res/layout/nfc_payment.xml b/res/layout/nfc_payment.xml index 54ac403b855..d6f9fa44f99 100644 --- a/res/layout/nfc_payment.xml +++ b/res/layout/nfc_payment.xml @@ -23,6 +23,18 @@ android:visibility="gone" android:paddingTop="16dp" android:text="@string/nfc_payment_no_apps"/> + Tap & pay - You have no apps configured for tap & pay with NFC. + Pay with just a tap + + Learn more Find apps @@ -4809,6 +4812,8 @@ + + Account for content diff --git a/src/com/android/settings/HelpUtils.java b/src/com/android/settings/HelpUtils.java index 6cd5eb65c8e..a4c46b07683 100644 --- a/src/com/android/settings/HelpUtils.java +++ b/src/com/android/settings/HelpUtils.java @@ -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 diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java index f839b241cd4..06697a463e8 100644 --- a/src/com/android/settings/nfc/PaymentSettings.java +++ b/src/com/android/settings/nfc/PaymentSettings.java @@ -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); } } -} \ No newline at end of file +}