A few bits here and there
This commit is contained in:
parent
ce6499a3d2
commit
5936e12c5b
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/Theme.DCAv2GUI.NoActionBar">
|
android:theme="@style/Theme.DCAv2GUI.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import com.example.dcav2gui.R;
|
import com.example.dcav2gui.R;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class SettingsFragment extends Fragment {
|
public class SettingsFragment extends Fragment {
|
||||||
|
|
||||||
private SettingsViewModel settingsViewModel;
|
private SettingsViewModel settingsViewModel;
|
||||||
|
|
@ -36,7 +34,7 @@ public class SettingsFragment extends Fragment {
|
||||||
EditText editChatId = root.findViewById(R.id.editChatId);
|
EditText editChatId = root.findViewById(R.id.editChatId);
|
||||||
EditText editTimeBetweenQueries = root.findViewById(R.id.editTimeBetweenQueries);
|
EditText editTimeBetweenQueries = root.findViewById(R.id.editTimeBetweenQueries);
|
||||||
EditText editAmountOfLogLines = root.findViewById(R.id.editAmountOfLogLines);
|
EditText editAmountOfLogLines = root.findViewById(R.id.editAmountOfLogLines);
|
||||||
EditText editAmountofLastTrades = root.findViewById(R.id.editAmountOfLastTrades);
|
EditText editAmountOfLastTrades = root.findViewById(R.id.editAmountOfLastTrades);
|
||||||
|
|
||||||
Button buttonSaveSettings = root.findViewById(R.id.buttonSaveSettings);
|
Button buttonSaveSettings = root.findViewById(R.id.buttonSaveSettings);
|
||||||
|
|
||||||
|
|
@ -61,9 +59,9 @@ public class SettingsFragment extends Fragment {
|
||||||
boolean useTelegram = checkBox.isChecked();
|
boolean useTelegram = checkBox.isChecked();
|
||||||
String botToken = editBotToken.getText().toString();
|
String botToken = editBotToken.getText().toString();
|
||||||
String chatId = editChatId.getText().toString();
|
String chatId = editChatId.getText().toString();
|
||||||
float timeBetweenQueries = 0;
|
float timeBetweenQueries;
|
||||||
int amountOfLogLines = 0;
|
int amountOfLogLines;
|
||||||
int amountOfLastTrades = 0;
|
int amountOfLastTrades;
|
||||||
|
|
||||||
//Check if the user entered valid strings
|
//Check if the user entered valid strings
|
||||||
if (profileName.isEmpty() || apiUrl.isEmpty() || apiKey.isEmpty()) {
|
if (profileName.isEmpty() || apiUrl.isEmpty() || apiKey.isEmpty()) {
|
||||||
|
|
@ -83,10 +81,20 @@ public class SettingsFragment extends Fragment {
|
||||||
//Check if the user entered valid numbers
|
//Check if the user entered valid numbers
|
||||||
try {
|
try {
|
||||||
timeBetweenQueries = Float.parseFloat(editTimeBetweenQueries.getText().toString());
|
timeBetweenQueries = Float.parseFloat(editTimeBetweenQueries.getText().toString());
|
||||||
amountOfLogLines = Integer.parseInt(editAmountOfLogLines.getText().toString());
|
|
||||||
amountOfLastTrades = Integer.parseInt(editAmountofLastTrades.getText().toString());
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Toast.makeText(getContext(), "Invalid input, please enter valid numbers", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "Invalid input in time between queries", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
amountOfLogLines = Integer.parseInt(editAmountOfLogLines.getText().toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Toast.makeText(getContext(), "Invalid input in amount of log lines", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
amountOfLastTrades = Integer.parseInt(editAmountOfLastTrades.getText().toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Toast.makeText(getContext(), "Invalid input in amount of last trades", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue