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

View File

@ -19,6 +19,8 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Needed For Deserialization
-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}.
*/
public class ListViewModel extends ViewModel {
private final Connection connection = new Connection();
public final Task<ListData> task = new ListTask(connection);
public final Task<ListData> task = new ListTask(new Connection());
}

View File

@ -87,7 +87,7 @@ public class ItemDialog {
message.append(item.ingredients);
}
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);
for (PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem.Nutrient nutrient : item.nutrients) {
writeBullet(message, nutrient.name, nutrient.value);

View File

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

View File

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

View File

@ -5,6 +5,9 @@ import com.thebrokenrail.mtudining.util.Category;
import java.util.List;
/**
* API call used to list buildings and locations.
*/
public class AllLocations implements Method<AllLocations.Response> {
private final int platform;
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.util.Constants;
/**
* API call used for getting the site ID from a site name.
*/
public class Info implements Method<Info.Response> {
@Override
public String getPath() {

View File

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

View File

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

View File

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

View File

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