Decluttered action menus a bit. Added feature to send arrival time message.

This commit is contained in:
Doug Keen 2013-10-14 08:19:14 -07:00
parent a2d79b5a41
commit 85734ab9ef
9 changed files with 31 additions and 6 deletions

View File

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dougkeen.bart"
android:installLocation="auto"
android:versionCode="29"
android:versionName="2.2.2" >
android:versionCode="30"
android:versionName="2.2.3" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

View File

@ -4,13 +4,13 @@
<item
android:id="@+id/view_on_bart_site_button"
android:icon="@drawable/ic_action_web"
android:showAsAction="always|withText"
android:showAsAction="never"
android:title="@string/view_on_bart_site">
</item>
<item
android:id="@+id/view_system_map_button"
android:icon="@drawable/ic_action_map"
android:showAsAction="always|withText"
android:showAsAction="ifRoom|withText"
android:title="@string/view_system_map">
</item>

View File

@ -12,6 +12,11 @@
android:icon="@drawable/ic_action_alarm"
android:showAsAction="always|withText"
android:title="@string/set_alarm"/>
<item
android:id="@+id/share_arrival"
android:icon="@drawable/ic_action_mail"
android:showAsAction="always|withText"
android:title="@string/share_arrival_time" />
<item
android:id="@+id/delete"
android:icon="@drawable/ic_action_delete"

View File

@ -45,4 +45,7 @@
<string name="leaving">Leaving</string>
<string name="departed">Departed</string>
<string name="arrives_at_destination">Arrive @ dest. ~</string>
<string name="arrival_message">I\'ll be arriving at %1$s around %2$s</string>
<string name="share_arrival_time">Share arrival time</string>
</resources>

View File

@ -619,9 +619,10 @@ public class ViewDeparturesActivity extends Activity implements
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
final int itemId = item.getItemId();
final Departure boardedDeparture = getBoardedDeparture();
if (itemId == R.id.set_alarm_button) {
// Don't prompt for alarm if train is about to leave
if (getBoardedDeparture().getMeanSecondsLeft() > 60) {
if (boardedDeparture.getMeanSecondsLeft() > 60) {
new TrainAlarmDialogFragment()
.show(getSupportFragmentManager()
.beginTransaction());
@ -638,6 +639,22 @@ public class ViewDeparturesActivity extends Activity implements
mSwipeHelper.dismissWithAnimation(true);
mode.finish();
return true;
} else if (itemId == R.id.share_arrival) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "My BART train");
intent.putExtra(
Intent.EXTRA_TEXT,
getString(
R.string.arrival_message,
boardedDeparture.getStationPair()
.getDestination().name,
boardedDeparture
.getEstimatedArrivalTimeText(ViewDeparturesActivity.this)));
startActivity(Intent.createChooser(intent,
getString(R.string.share_arrival_time)));
return true;
}
return false;
}