Pebble: Add context menu option in app manager to search a watchapp in the pebble appstore

This commit is contained in:
Andreas Shimokawa 2016-10-29 11:41:08 +02:00
parent c2a9348c6e
commit f755d99023
3 changed files with 22 additions and 4 deletions

View File

@ -287,6 +287,14 @@ public abstract class AbstractAppManagerFragment extends Fragment {
if (!selectedApp.isConfigurable()) {
menu.removeItem(R.id.appmanager_app_configure);
}
switch (selectedApp.getType()) {
case WATCHFACE:
case APP_GENERIC:
case APP_ACTIVITYTRACKER:
break;
default:
menu.removeItem(R.id.appmanager_app_openinstore);
}
//menu.setHeaderTitle(selectedApp.getName());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
@ -354,6 +362,12 @@ public abstract class AbstractAppManagerFragment extends Fragment {
startIntent.putExtra(GBDevice.EXTRA_DEVICE, mGBDevice);
startActivity(startIntent);
return true;
case R.id.appmanager_app_openinstore:
String url = "https://apps.getpebble.com/en_US/search/" + ((selectedApp.getType() == GBDeviceApp.Type.WATCHFACE) ? "watchfaces" : "watchapps") + "/1?query=" + selectedApp.getName() + "&dev_settings=true";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
default:
return super.onContextItemSelected(item);
}

View File

@ -18,4 +18,7 @@
<item
android:id="@+id/appmanager_app_configure"
android:title="@string/app_configure"/>
<item
android:id="@+id/appmanager_app_openinstore"
android:title="@string/appmanager_app_openinstore"/>
</menu>

View File

@ -25,6 +25,7 @@
<string name="appmananger_app_delete">Delete</string>
<string name="appmananger_app_delete_cache">Delete and remove from cache</string>
<string name="appmananger_app_reinstall">Reinstall</string>
<string name="appmanager_app_openinstore">Open in Pebble Appstore</string>
<string name="appmanager_health_activate">Activate</string>
<string name="appmanager_health_deactivate">Deactivate</string>
<string name="app_configure">Configure</string>
@ -151,6 +152,10 @@
<string name="android_pairing_hint">Use the Android Bluetooth Pairing dialog to pair the device.</string>
<string name="title_activity_mi_band_pairing">Pair your Mi Band</string>
<string name="miband_pairing">Pairing with %s…</string>
<string name="miband_pairing_creating_bond_with">"Creating bond with %1$s (%2$s)"</string>
<string name="miband_pairing_unable_to_pair_with">"Unable to pair with %1$s (%2$s)"</string>
<string name="miband_pairing_in_progress">Bonding in progress: %1$s (%2$s)</string>
<string name="miband_pairing_already_bonded">"Already bonded with %1$s (%2$s), connecting…"</string>
<string name="message_cannot_pair_no_mac">No mac address passed, cannot pair.</string>
<string name="preferences_category_device_specific_settings">Device Specific Settings</string>
<string name="preferences_miband_settings">Mi Band Settings</string>
@ -338,8 +343,4 @@
<!-- Strings related to Vibration Activity -->
<string name="title_activity_vibration">Vibration</string>
<string name="miband_pairing_creating_bond_with">"Creating bond with %1$s (%2$s)"</string>
<string name="miband_pairing_unable_to_pair_with">"Unable to pair with %1$s (%2$s)"</string>
<string name="miband_pairing_in_progress">Bonding in progress: %1$s (%2$s)</string>
<string name="miband_pairing_already_bonded">"Already bonded with %1$s (%2$s), connecting…"</string>
</resources>