Final Tweaks

This commit is contained in:
TheBrokenRail 2024-02-18 03:45:30 -05:00
parent 9817d08f96
commit 5d49c8104b
12 changed files with 34 additions and 12 deletions

View File

@ -4,18 +4,18 @@
<value> <value>
<entry key="app"> <entry key="app">
<State> <State>
<targetSelectedWithDropDown> <runningDeviceTargetSelectedWithDropDown>
<Target> <Target>
<type value="QUICK_BOOT_TARGET" /> <type value="RUNNING_DEVICE_TARGET" />
<deviceKey> <deviceKey>
<Key> <Key>
<type value="VIRTUAL_DEVICE_PATH" /> <type value="SERIAL_NUMBER" />
<value value="$USER_HOME$/.android/avd/Pixel_2_API_21.avd" /> <value value="R5CRB1GE0RY" />
</Key> </Key>
</deviceKey> </deviceKey>
</Target> </Target>
</targetSelectedWithDropDown> </runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-02-17T21:54:23.298453058Z" /> <timeTargetWasSelectedWithDropDown value="2024-02-18T08:17:36.558261831Z" />
</State> </State>
</entry> </entry>
</value> </value>

View File

@ -19,6 +19,8 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Needed For Deserialization
-keepclassmembers class com.thebrokenrail.mtudining.api.method.** { -keepclassmembers class com.thebrokenrail.mtudining.api.method.** {
*; *;
} }

View File

@ -9,6 +9,5 @@ import com.thebrokenrail.mtudining.api.Connection;
* Data preserved between screen rotations for {@link ListActivity}. * Data preserved between screen rotations for {@link ListActivity}.
*/ */
public class ListViewModel extends ViewModel { public class ListViewModel extends ViewModel {
private final Connection connection = new Connection(); public final Task<ListData> task = new ListTask(new Connection());
public final Task<ListData> task = new ListTask(connection);
} }

View File

@ -87,7 +87,7 @@ public class ItemDialog {
message.append(item.ingredients); message.append(item.ingredients);
} }
writeNewline(message, 2); writeNewline(message, 2);
if (item.nutrients.size() > 0) { if (item.nutrients != null && item.nutrients.size() > 0) {
message.append(context.getString(R.string.nutrients), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); message.append(context.getString(R.string.nutrients), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
for (PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem.Nutrient nutrient : item.nutrients) { for (PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem.Nutrient nutrient : item.nutrients) {
writeBullet(message, nutrient.name, nutrient.value); writeBullet(message, nutrient.name, nutrient.value);

View File

@ -1,5 +1,6 @@
package com.thebrokenrail.mtudining.activity.menu; package com.thebrokenrail.mtudining.activity.menu;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -101,7 +102,11 @@ public class MenuActivity extends AppCompatActivity {
} }
Uri gmmIntentUri = Uri.parse("geo:" + latitude + ',' + longitude + "?q=" + encodedStreet); Uri gmmIntentUri = Uri.parse("geo:" + latitude + ',' + longitude + "?q=" + encodedStreet);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
try {
startActivity(mapIntent); startActivity(mapIntent);
} catch (ActivityNotFoundException e) {
// Ignore
}
return true; return true;
} else { } else {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);

View File

@ -1,11 +1,16 @@
package com.thebrokenrail.mtudining.api; package com.thebrokenrail.mtudining.api;
/**
* Interface for a simple API call.
* @param <T> The response type
*/
public interface Method<T> { public interface Method<T> {
/** /**
* Get the API method's path. * Get the API method's path.
* @return The path * @return The path
*/ */
String getPath(); String getPath();
/** /**
* Get the response class. Needed for deserialization. * Get the response class. Needed for deserialization.
* @return The response class * @return The response class

View File

@ -5,6 +5,9 @@ import com.thebrokenrail.mtudining.util.Category;
import java.util.List; import java.util.List;
/**
* API call used to list buildings and locations.
*/
public class AllLocations implements Method<AllLocations.Response> { public class AllLocations implements Method<AllLocations.Response> {
private final int platform; private final int platform;
private final String siteId; private final String siteId;

View File

@ -3,6 +3,9 @@ package com.thebrokenrail.mtudining.api.method;
import com.thebrokenrail.mtudining.api.Method; import com.thebrokenrail.mtudining.api.Method;
import com.thebrokenrail.mtudining.util.Constants; import com.thebrokenrail.mtudining.util.Constants;
/**
* API call used for getting the site ID from a site name.
*/
public class Info implements Method<Info.Response> { public class Info implements Method<Info.Response> {
@Override @Override
public String getPath() { public String getPath() {

View File

@ -7,6 +7,9 @@ import com.thebrokenrail.mtudining.util.DateUtil;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/**
* API call for retrieving the menu from a "period."
*/
public class PeriodDetail implements Method<PeriodDetail.Response> { public class PeriodDetail implements Method<PeriodDetail.Response> {
private final int platform; private final int platform;
private final String locationId; private final String locationId;

View File

@ -6,6 +6,9 @@ import com.thebrokenrail.mtudining.util.DateUtil;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/**
* API call used to list available "periods" (Breakfast, Lunch, etc).
*/
public class Periods implements Method<Periods.Response> { public class Periods implements Method<Periods.Response> {
private final int platform; private final int platform;
private final String locationId; private final String locationId;

View File

@ -4,6 +4,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="@dimen/margin"> android:padding="@dimen/margin">
<!-- Date --> <!-- Date -->

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<!-- Material Design --> <!-- Material Design -->
<color name="md_theme_primary">#725C0C</color> <color name="md_theme_primary">#725C0C</color>
<color name="md_theme_onPrimary">#FFFFFF</color> <color name="md_theme_onPrimary">#FFFFFF</color>