More Dialog Tweaks!

This commit is contained in:
TheBrokenRail 2024-02-18 02:58:37 -05:00
parent 3895b1c477
commit 9817d08f96
5 changed files with 53 additions and 7 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties local.properties
/keystore.jks

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 TheBrokenRail
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -18,6 +18,8 @@ android {
buildTypes { buildTypes {
release { release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
} }
} }
@ -27,6 +29,24 @@ android {
// Desugaring (Java 8+ APIs) // Desugaring (Java 8+ APIs)
isCoreLibraryDesugaringEnabled = true isCoreLibraryDesugaringEnabled = true
} }
// Release Builds
val keystoreFile = File(rootDir, "keystore.jks")
if (keystoreFile.exists()) {
signingConfigs {
create("release") {
keyAlias = "key0"
keyPassword = "password"
storeFile = keystoreFile
storePassword = "password"
}
}
buildTypes {
release {
signingConfig = signingConfigs["release"]
}
}
}
} }
dependencies { dependencies {

View File

@ -68,7 +68,7 @@ public class ItemDialog {
for (String filterType : new String[]{LABEL_FILTER, ALLERGEN_FILTER}) { for (String filterType : new String[]{LABEL_FILTER, ALLERGEN_FILTER}) {
List<String> filters = getFilters(item, filterType); List<String> filters = getFilters(item, filterType);
if (filters.size() > 0) { if (filters.size() > 0) {
writeNewline(message, 1); writeNewline(message, 2);
@StringRes int filterName = filterType.equals(LABEL_FILTER) ? R.string.labels : R.string.allergens; @StringRes int filterName = filterType.equals(LABEL_FILTER) ? R.string.labels : R.string.allergens;
message.append(context.getString(filterName), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); message.append(context.getString(filterName), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
for (String filter : filters) { for (String filter : filters) {
@ -81,7 +81,7 @@ public class ItemDialog {
message.append(context.getString(R.string.portion), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); message.append(context.getString(R.string.portion), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
message.append(item.portion); message.append(item.portion);
} }
writeNewline(message, 1); writeNewline(message, 2);
if (item.ingredients != null) { if (item.ingredients != null) {
message.append(context.getString(R.string.ingredients), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); message.append(context.getString(R.string.ingredients), new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
message.append(item.ingredients); message.append(item.ingredients);
@ -112,11 +112,13 @@ public class ItemDialog {
*/ */
private static List<String> getFilters(PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem item, String type) { private static List<String> getFilters(PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem item, String type) {
List<String> out = new ArrayList<>(); List<String> out = new ArrayList<>();
if (item.filters != null) {
for (PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem.Filter filter : item.filters) { for (PeriodDetail.Response.Menu.PeriodData.MenuCategory.MenuItem.Filter filter : item.filters) {
if (filter.type.equals(type)) { if (filter.type.equals(type)) {
out.add(filter.name); out.add(filter.name);
} }
} }
}
return out; return out;
} }
@ -132,8 +134,10 @@ public class ItemDialog {
if (name != null) { if (name != null) {
message.append(name + ": ", new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); message.append(name + ": ", new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
if (value != null) {
message.append(value); message.append(value);
} }
}
/** /**
* Write newline to string. * Write newline to string.

View File

@ -9,12 +9,12 @@ import com.thebrokenrail.mtudining.api.Connection;
* Data preserved between screen rotations for {@link MenuActivity}. * Data preserved between screen rotations for {@link MenuActivity}.
*/ */
public class MenuViewModel extends ViewModel { public class MenuViewModel extends ViewModel {
private final Connection connection = new Connection();
public final MenuState state; public final MenuState state;
public final MenuTask task; public final MenuTask task;
public MenuViewModel(SavedStateHandle savedStateHandle) { public MenuViewModel(SavedStateHandle savedStateHandle) {
state = new MenuState(savedStateHandle); state = new MenuState(savedStateHandle);
Connection connection = new Connection();
task = new MenuTask(connection, state); task = new MenuTask(connection, state);
} }
} }