Decluttered action menus a bit. Added feature to send arrival time message.
This commit is contained in:
parent
a2d79b5a41
commit
85734ab9ef
@ -2,8 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.dougkeen.bart"
|
package="com.dougkeen.bart"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="29"
|
android:versionCode="30"
|
||||||
android:versionName="2.2.2" >
|
android:versionName="2.2.3" >
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
BIN
res/drawable-hdpi/ic_action_mail.png
Normal file
BIN
res/drawable-hdpi/ic_action_mail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 501 B |
BIN
res/drawable-ldpi/ic_action_mail.png
Normal file
BIN
res/drawable-ldpi/ic_action_mail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 281 B |
BIN
res/drawable-mdpi/ic_action_mail.png
Normal file
BIN
res/drawable-mdpi/ic_action_mail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 404 B |
BIN
res/drawable-xhdpi/ic_action_mail.png
Normal file
BIN
res/drawable-xhdpi/ic_action_mail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 295 B |
@ -4,13 +4,13 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/view_on_bart_site_button"
|
android:id="@+id/view_on_bart_site_button"
|
||||||
android:icon="@drawable/ic_action_web"
|
android:icon="@drawable/ic_action_web"
|
||||||
android:showAsAction="always|withText"
|
android:showAsAction="never"
|
||||||
android:title="@string/view_on_bart_site">
|
android:title="@string/view_on_bart_site">
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/view_system_map_button"
|
android:id="@+id/view_system_map_button"
|
||||||
android:icon="@drawable/ic_action_map"
|
android:icon="@drawable/ic_action_map"
|
||||||
android:showAsAction="always|withText"
|
android:showAsAction="ifRoom|withText"
|
||||||
android:title="@string/view_system_map">
|
android:title="@string/view_system_map">
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
android:icon="@drawable/ic_action_alarm"
|
android:icon="@drawable/ic_action_alarm"
|
||||||
android:showAsAction="always|withText"
|
android:showAsAction="always|withText"
|
||||||
android:title="@string/set_alarm"/>
|
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
|
<item
|
||||||
android:id="@+id/delete"
|
android:id="@+id/delete"
|
||||||
android:icon="@drawable/ic_action_delete"
|
android:icon="@drawable/ic_action_delete"
|
||||||
|
@ -45,4 +45,7 @@
|
|||||||
<string name="leaving">Leaving</string>
|
<string name="leaving">Leaving</string>
|
||||||
<string name="departed">Departed</string>
|
<string name="departed">Departed</string>
|
||||||
<string name="arrives_at_destination">Arrive @ dest. ~</string>
|
<string name="arrives_at_destination">Arrive @ dest. ~</string>
|
||||||
</resources>
|
<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>
|
@ -619,9 +619,10 @@ public class ViewDeparturesActivity extends Activity implements
|
|||||||
@Override
|
@Override
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
final int itemId = item.getItemId();
|
final int itemId = item.getItemId();
|
||||||
|
final Departure boardedDeparture = getBoardedDeparture();
|
||||||
if (itemId == R.id.set_alarm_button) {
|
if (itemId == R.id.set_alarm_button) {
|
||||||
// Don't prompt for alarm if train is about to leave
|
// Don't prompt for alarm if train is about to leave
|
||||||
if (getBoardedDeparture().getMeanSecondsLeft() > 60) {
|
if (boardedDeparture.getMeanSecondsLeft() > 60) {
|
||||||
new TrainAlarmDialogFragment()
|
new TrainAlarmDialogFragment()
|
||||||
.show(getSupportFragmentManager()
|
.show(getSupportFragmentManager()
|
||||||
.beginTransaction());
|
.beginTransaction());
|
||||||
@ -638,6 +639,22 @@ public class ViewDeparturesActivity extends Activity implements
|
|||||||
mSwipeHelper.dismissWithAnimation(true);
|
mSwipeHelper.dismissWithAnimation(true);
|
||||||
mode.finish();
|
mode.finish();
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user