Remove ignored files from tracking

This commit is contained in:
wildercayden
2026-03-03 12:21:55 -05:00
parent a7a46a3669
commit 1cadc55713
4 changed files with 309 additions and 309 deletions

View File

@@ -1,48 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.ScoutingApp" android:theme="@style/Theme.ScoutingApp"
tools:targetApi="31"> tools:targetApi="31">
<activity <activity
android:name=".OfflineActivity" android:name=".OfflineActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".startingActivity" android:name=".startingActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".EndActivity" android:name=".EndActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".TeleActivity" android:name=".TeleActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".AutoActivity" android:name=".AutoActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@@ -1,168 +1,168 @@
package com.example.scoutingapp; package com.example.scoutingapp;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.sheets.v4.Sheets; import com.google.api.services.sheets.v4.Sheets;
import com.google.api.services.sheets.v4.model.ValueRange; import com.google.api.services.sheets.v4.model.ValueRange;
import com.google.auth.http.HttpCredentialsAdapter; import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.ServiceAccountCredentials; import com.google.auth.oauth2.ServiceAccountCredentials;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Submit { public class Submit {
public static SharedPreferences getPrefs(Context context) { public static SharedPreferences getPrefs(Context context) {
return context.getSharedPreferences("MySettings", Context.MODE_PRIVATE); return context.getSharedPreferences("MySettings", Context.MODE_PRIVATE);
} }
void uploadSheets(Context context, String csvFileString) { void uploadSheets(Context context, String csvFileString) {
SharedPreferences sharedPreferences = getPrefs(context); SharedPreferences sharedPreferences = getPrefs(context);
String savedText = sharedPreferences.getString("SheetsText", ""); String savedText = sharedPreferences.getString("SheetsText", "");
new Thread(() -> { new Thread(() -> {
try { try {
//adds account info //adds account info
InputStream serviceAccountStream = context.getResources().openRawResource(R.raw.info); InputStream serviceAccountStream = context.getResources().openRawResource(R.raw.info);
ServiceAccountCredentials credentials = ServiceAccountCredentials.fromStream(serviceAccountStream); ServiceAccountCredentials credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
//Sets up the google sheet API and json factory for use later //Sets up the google sheet API and json factory for use later
Sheets sheetsService = new Sheets.Builder( Sheets sheetsService = new Sheets.Builder(
GoogleNetHttpTransport.newTrustedTransport(), GoogleNetHttpTransport.newTrustedTransport(),
GsonFactory.getDefaultInstance(), GsonFactory.getDefaultInstance(),
new HttpCredentialsAdapter(credentials) new HttpCredentialsAdapter(credentials)
).setApplicationName("Scouting App").build(); ).setApplicationName("Scouting App").build();
//make sure the file is there //make sure the file is there
File csvFile = new File(context.getFilesDir(), csvFileString); File csvFile = new File(context.getFilesDir(), csvFileString);
if (!csvFile.exists()) { if (!csvFile.exists()) {
Log.d("CSVError", "CSV file does not exist."); Log.d("CSVError", "CSV file does not exist.");
return; return;
} }
//uses parseCSVToList make the CSV file into a list for google sheet //uses parseCSVToList make the CSV file into a list for google sheet
List<List<Object>> data = parseCSVToList(csvFile); List<List<Object>> data = parseCSVToList(csvFile);
//data for the sheet API //data for the sheet API
ValueRange body = new ValueRange().setValues(data); ValueRange body = new ValueRange().setValues(data);
//the ID for the google sheet //the ID for the google sheet
String spreadsheetId = savedText; String spreadsheetId = savedText;
//starting point //starting point
String range = "Data!a2:O2"; String range = "Data!a2:O2";
//inserts data to the sheet //inserts data to the sheet
sheetsService.spreadsheets().values() sheetsService.spreadsheets().values()
.append(spreadsheetId, range, body) .append(spreadsheetId, range, body)
.setValueInputOption("USER_ENTERED") .setValueInputOption("USER_ENTERED")
.setInsertDataOption("INSERT_ROWS") .setInsertDataOption("INSERT_ROWS")
.execute(); .execute();
Log.e("GoogleSheets", "Data uploaded to Google Sheets successfully."); Log.e("GoogleSheets", "Data uploaded to Google Sheets successfully.");
deleteCSVFile(context, csvFileString); deleteCSVFile(context, csvFileString);
} catch (Exception e) { } catch (Exception e) {
Log.e("GoogleSheetFailed", "Failed to upload", e); Log.e("GoogleSheetFailed", "Failed to upload", e);
} }
}).start(); }).start();
} }
List<List<Object>> parseCSVToList(File csvFile) { List<List<Object>> parseCSVToList(File csvFile) {
List<List<Object>> data = Lists.newArrayList(); List<List<Object>> data = Lists.newArrayList();
try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) { try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
String[] values = line.split("@#@"); // Assuming CSV is comma-separated String[] values = line.split("@#@"); // Assuming CSV is comma-separated
data.add(Arrays.asList((Object[]) values)); data.add(Arrays.asList((Object[]) values));
} }
} catch (IOException e) { } catch (IOException e) {
Log.d("CSVError", "Error reading CSV file", e); Log.d("CSVError", "Error reading CSV file", e);
} }
return data; return data;
} }
public void deleteCSVFile(Context context, String csvFileString) { public void deleteCSVFile(Context context, String csvFileString) {
// Get the directory containing the files // Get the directory containing the files
File directory = context.getFilesDir(); File directory = context.getFilesDir();
// Get all files in the directory // Get all files in the directory
File[] files = directory.listFiles(); File[] files = directory.listFiles();
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
// Check if the file name matches the given string // Check if the file name matches the given string
if (file.getName().equals(csvFileString)) { if (file.getName().equals(csvFileString)) {
if (file.delete()) { if (file.delete()) {
Log.d("CSVDelete", file.getName() + " deleted successfully."); Log.d("CSVDelete", file.getName() + " deleted successfully.");
} else { } else {
Log.d("CSVDelete", "Failed to delete " + file.getName()); Log.d("CSVDelete", "Failed to delete " + file.getName());
} }
return; // Exit after deleting the file return; // Exit after deleting the file
} }
} }
Log.d("CSVDelete", "File " + csvFileString + " not found."); Log.d("CSVDelete", "File " + csvFileString + " not found.");
} else { } else {
Log.d("CSVDelete", "No files found in the directory."); Log.d("CSVDelete", "No files found in the directory.");
} }
} }
public void renameFile(Context context, String csvFileString) { public void renameFile(Context context, String csvFileString) {
File csvFile = new File(context.getFilesDir(), csvFileString); File csvFile = new File(context.getFilesDir(), csvFileString);
if (!csvFile.exists()) { if (!csvFile.exists()) {
Log.d("CSVRenameFail", "File does not exist: " + csvFile.getAbsolutePath()); Log.d("CSVRenameFail", "File does not exist: " + csvFile.getAbsolutePath());
return; return;
} }
File renamedFile = new File(context.getFilesDir(), csvFileString); File renamedFile = new File(context.getFilesDir(), csvFileString);
if (csvFile.renameTo(renamedFile)) { if (csvFile.renameTo(renamedFile)) {
Log.d("CSVRename", "File renamed successfully to: " + renamedFile.getAbsolutePath()); Log.d("CSVRename", "File renamed successfully to: " + renamedFile.getAbsolutePath());
} else { } else {
Log.d("CSVRenameFail", "File renaming failed. Possible reasons: file is in use, permission issue, or incorrect file path."); Log.d("CSVRenameFail", "File renaming failed. Possible reasons: file is in use, permission issue, or incorrect file path.");
} }
} }
public void renameFileagain(Context context, String csvFileString) { public void renameFileagain(Context context, String csvFileString) {
File csvFile = new File(context.getFilesDir(), csvFileString); File csvFile = new File(context.getFilesDir(), csvFileString);
if (!csvFile.exists()) { if (!csvFile.exists()) {
Log.d("CSVRenameFail", "File does not exist: " + csvFile.getAbsolutePath()); Log.d("CSVRenameFail", "File does not exist: " + csvFile.getAbsolutePath());
return; return;
} }
File renamedFile = new File(context.getFilesDir(), "uploaded.csv"); File renamedFile = new File(context.getFilesDir(), "uploaded.csv");
if (csvFile.renameTo(renamedFile)) { if (csvFile.renameTo(renamedFile)) {
Log.d("CSVRename", "File renamed successfully to: " + renamedFile.getAbsolutePath()); Log.d("CSVRename", "File renamed successfully to: " + renamedFile.getAbsolutePath());
} else { } else {
Log.d("CSVRenameFail", "File renaming failed. Possible reasons: file is in use, permission issue, or incorrect file path."); Log.d("CSVRenameFail", "File renaming failed. Possible reasons: file is in use, permission issue, or incorrect file path.");
} }
} }
public boolean isWifiConnected(Context context) { public boolean isWifiConnected(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) { if (cm != null) {
android.net.Network network = cm.getActiveNetwork(); android.net.Network network = cm.getActiveNetwork();
if (network == null) return false; if (network == null) return false;
NetworkCapabilities capabilities = cm.getNetworkCapabilities(network); NetworkCapabilities capabilities = cm.getNetworkCapabilities(network);
return capabilities != null && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI); return capabilities != null && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
} }
return false; return false;
} }
} }

View File

@@ -1,6 +1,6 @@
#Mon Jan 06 12:48:44 EST 2025 #Mon Jan 06 12:48:44 EST 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,89 +1,89 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1 exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega