Some Tweaks

This commit is contained in:
TheBrokenRail 2024-02-17 15:24:32 -05:00
parent b1b2ab5a60
commit efacd10fb5
5 changed files with 20 additions and 3 deletions

View File

@ -51,7 +51,7 @@ public abstract class Task<E> {
*/
protected void done(long id, E obj) {
// Check ID
if (id != lastStart) {
if (lastStart == null || id != lastStart) {
// Ignore
return;
}

View File

@ -10,6 +10,7 @@ import com.squareup.moshi.Moshi;
import com.thebrokenrail.mtudining.util.Constants;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import okhttp3.Call;
@ -23,7 +24,15 @@ public class Connection {
/**
* HTTP Client
*/
private final OkHttpClient client = new OkHttpClient();
private final OkHttpClient client;
public Connection() {
client = new OkHttpClient.Builder()
.connectTimeout(Constants.TIMEOUT, TimeUnit.SECONDS)
.readTimeout(Constants.TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(Constants.TIMEOUT, TimeUnit.SECONDS)
.build();
}
/**
* Link to main thread.
@ -40,6 +49,7 @@ public class Connection {
public <T> void send(Method<T> method, Consumer<T> success, Runnable error) {
// Build URL
String url = Constants.API_BASE + method.getPath();
System.out.println("GO: " + url);
// Build Request
Request request = new Request.Builder()

View File

@ -4,4 +4,5 @@ public class Constants {
public final static String API_BASE = "https://api.dineoncampus.com/v1";
public final static String SITE_NAME = "MTU";
public final static int PLATFORM = 0;
public final static int TIMEOUT = 30; // Seconds
}

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,4h-1V2h-2v2H8V2H6v2H5C3.89,4 3.01,4.9 3.01,6L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V6C21,4.9 20.1,4 19,4zM19,20H5V10h14V20zM9,14H7v-2h2V14zM13,14h-2v-2h2V14zM17,14h-2v-2h2V14zM9,18H7v-2h2V18zM13,18h-2v-2h2V18zM17,18h-2v-2h2V18z"/>
</vector>

View File

@ -13,7 +13,8 @@
android:layout_margin="@dimen/margin"
android:hint="@string/date"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
app:endIconMode="none">
app:endIconMode="custom"
app:endIconDrawable="@drawable/baseline_calendar_month_24">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/menu_date"