http requests work

This commit is contained in:
Tylr-J42 2025-02-14 13:40:40 -05:00
parent 5cb2fecf8a
commit 4d9aace5dd
46 changed files with 829 additions and 742 deletions

View File

@ -47,6 +47,17 @@
<option name="screenX" value="1840" />
<option name="screenY" value="2944" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="a15" />
<option name="id" value="a15" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="A15" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="31" />
<option name="brand" value="samsung" />
@ -245,6 +256,17 @@
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="gta7lite" />
<option name="id" value="gta7lite" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy Tab A7 Lite" />
<option name="screenDensity" value="179" />
<option name="screenX" value="800" />
<option name="screenY" value="1340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="samsung" />
@ -367,6 +389,17 @@
<option name="screenY" value="384" />
<option name="type" value="WEAR_OS" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="r11q" />
<option name="id" value="r11q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-S711U" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="30" />
<option name="brand" value="google" />

View File

@ -1,4 +1,4 @@
#Mon Feb 10 12:36:10 EST 2025
#Fri Feb 14 12:55:50 EST 2025
com.example.scoutingapp-main-33\:/drawable/ic_launcher_background.xml=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\merged_res\\debug\\mergeDebugResources\\drawable_ic_launcher_background.xml.flat
com.example.scoutingapp-main-33\:/drawable/ic_launcher_foreground.xml=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\merged_res\\debug\\mergeDebugResources\\drawable_ic_launcher_foreground.xml.flat
com.example.scoutingapp-main-33\:/drawable/loop.png=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\merged_res\\debug\\mergeDebugResources\\drawable_loop.png.flat

View File

@ -1,4 +1,4 @@
#Mon Feb 10 12:36:11 EST 2025
#Fri Feb 14 12:55:51 EST 2025
com.example.scoutingapp-main-5\:/drawable/ic_launcher_background.xml=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\drawable\\ic_launcher_background.xml
com.example.scoutingapp-main-5\:/drawable/ic_launcher_foreground.xml=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\drawable\\ic_launcher_foreground.xml
com.example.scoutingapp-main-5\:/drawable/loop.png=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\drawable\\loop.png

View File

@ -1,4 +1,4 @@
#Mon Feb 10 12:37:01 EST 2025
#Fri Feb 14 13:39:16 EST 2025
base.0=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\dex\\debug\\mergeExtDexDebug\\classes.dex
base.1=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\dex\\debug\\mergeProjectDexDebug\\0\\classes.dex
base.2=C\:\\Users\\26jacquesty\\AndroidStudioProjects\\Reefscape-Scouting-App\\ScoutingApp\\app\\build\\intermediates\\dex\\debug\\mergeProjectDexDebug\\4\\classes.dex

View File

@ -3,14 +3,14 @@
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\drawable_loop.png.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\drawable\\loop.png"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-xxhdpi_ic_launcher_round.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-xxhdpi\\ic_launcher_round.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-xxxhdpi_ic_launcher_round.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-xxxhdpi\\ic_launcher_round.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-xxhdpi_ic_launcher_round.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-xxhdpi\\ic_launcher_round.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\xml_data_extraction_rules.xml.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\xml\\data_extraction_rules.xml"
@ -40,21 +40,21 @@
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\raw\\info.json"
},
{
"merged": "com.example.scoutingapp-debug-31:/layout_activity_end.xml.flat",
"source": "com.example.scoutingapp-main-33:/layout/activity_end.xml"
"merged": "com.example.scoutingapp-debug-31:/layout_activity_main.xml.flat",
"source": "com.example.scoutingapp-main-33:/layout/activity_main.xml"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-xhdpi_ic_launcher_round.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-xhdpi\\ic_launcher_round.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-mdpi_ic_launcher.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-mdpi\\ic_launcher.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\layout_activity_end.xml.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\layout\\activity_end.xml"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\mipmap-mdpi_ic_launcher.webp.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\mipmap-mdpi\\ic_launcher.webp"
},
{
"merged": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-debug-31:\\drawable_screenshot_2025_01_16_115155.png.flat",
"source": "C:\\Users\\26jacquesty\\.gradle\\daemon\\8.7\\com.example.scoutingapp-main-33:\\drawable\\screenshot_2025_01_16_115155.png"

View File

@ -22,8 +22,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
tools:layout_editor_absoluteX="55dp"
tools:layout_editor_absoluteY="113dp" />
tools:layout_editor_absoluteX="33dp"
tools:layout_editor_absoluteY="316dp" />
<TextView
android:id="@+id/textView3"

View File

@ -3,6 +3,7 @@ package com.example.scoutingapp;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
import android.view.View;
import android.widget.Button;
@ -16,10 +17,19 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import okhttp3.Call;
import okhttp3.Callback;
@ -42,6 +52,7 @@ public class MainActivity extends AppCompatActivity {
public String fein;
SychronousGet getTBAInfo;
InputStream stream;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -81,10 +92,22 @@ public class MainActivity extends AppCompatActivity {
TextView TBAView = (TextView)findViewById(R.id.TBATest);
getTBAInfo = new SychronousGet();
// getTBAInfo = new SychronousGet();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
stream = getJSON("https://www.thebluealliance.com/api/v3/match/2024melew_qm1");
JsonElement jsonElement = JsonParser.parseReader(new InputStreamReader(stream));
JsonObject teamsJSON = jsonElement.getAsJsonObject();
String blueTeams = teamsJSON.get("alliances").getAsJsonObject().get("blue").getAsJsonObject().get("team_keys").toString();
TBAView.setText(blueTeams);
// JSONArray blueTeamsJSON = teamsJSON.getJSONObject("alliances").getJSONObject("blue").getJSONArray("team_keys");
// JSONArray redTeamsJSON = teamsJSON.getJSONObject("alliances").getJSONObject("blue").getJSONArray("team_keys");
try {
getTBAInfo.run();
// getTBAInfo.run();
//TBAView.setText(getTBAInfo.getMatchTeams("melew", 1)[0][1]);
} catch (Exception e) {
throw new RuntimeException(e);
@ -100,7 +123,8 @@ public class MainActivity extends AppCompatActivity {
// https://www.thebluealliance.com/api/v3/match/2024melew_qm1?X-TBA-Auth-Key=0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt
Request request = new Request.Builder()
.url("https://www.thebluealliance.com/api/v3/match/2024melew_qm1?X-TBA-Auth-Key=0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt")
.url("https://www.thebluealliance.com/api/v3/match/2024melew_qm1")
.header("X-TBA-Auth-Key", "0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt")
.build();
/*
try(Response response = client.newCall(request).enqueue(new Callback())){
@ -161,11 +185,16 @@ public class MainActivity extends AppCompatActivity {
private final OkHttpClient client = new OkHttpClient();
public void run() throws Exception{
Log.d( "test", "before");
Request request = new Request.Builder()
.url("https://www.thebluealliance.com/api/v3/match/2024melew_qm1?X-TBA-Auth-Key=0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt")
.url("https://www.thebluealliance.com/api/v3/match/2024melew_qm1")
.header("X-TBA-Auth-Key", "0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt")
.build();
try(Response response = client.newCall(request).execute()){
Log.d("test", String.valueOf(response.isSuccessful()));
if(!response.isSuccessful()) throw new IOException("bruh moment" + response);
Headers responseHeaders = response.headers();
@ -178,6 +207,31 @@ public class MainActivity extends AppCompatActivity {
}
}
public InputStream getJSON(String path){
InputStream stream = null;
try{
URL url = new URL(path);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", "TBA_API");
connection.setRequestProperty("X-TBA-Auth-Key", "0zxxGYSvY7xI2onqcWg0NT0sEtmtR6hCpmYJ29nwfxvqrP3Mf1M3lRZO5x6Kc3kt");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("charset", "utf-8");
connection.setUseCaches(false);
stream = (InputStream)connection.getInputStream();
//Log.d("test", "after assigned stream");
//Log.d("test", stream.toString());
}
catch (Exception e){
Log.d("test", "inside catch");
e.printStackTrace();
}
return stream;
}
private void makeIntent()
{
Intent intent = new Intent(this, AutoActivity.class);

View File

@ -22,8 +22,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
tools:layout_editor_absoluteX="55dp"
tools:layout_editor_absoluteY="113dp" />
tools:layout_editor_absoluteX="33dp"
tools:layout_editor_absoluteY="316dp" />
<TextView
android:id="@+id/textView3"