earn details in settings

This commit is contained in:
Nicolás Sánchez 2025-01-08 19:40:02 -03:00
parent f35b552e38
commit 61e2d5b5d6
5 changed files with 38 additions and 1 deletions

View File

@ -5,6 +5,8 @@ public class SettingsData {
public String profileName;
public String apiUrl;
public String apiKey;
public boolean useEarn;
public String earnApiKey;
public boolean useTelegram;
public String botToken;
public String chatId;
@ -16,6 +18,8 @@ public class SettingsData {
String profileName,
String apiUrl,
String apiKey,
boolean useEarn,
String earnApiKey,
boolean useTelegram,
String botToken,
String chatId,
@ -26,6 +30,8 @@ public class SettingsData {
this.profileName = profileName;
this.apiUrl = apiUrl;
this.apiKey = apiKey;
this.useEarn = useEarn;
this.earnApiKey = earnApiKey;
this.useTelegram = useTelegram;
this.botToken = botToken;
this.chatId = chatId;

View File

@ -30,6 +30,8 @@ public class SettingsFragment extends Fragment {
EditText editProfileName = root.findViewById(R.id.editProfileName);
EditText editApiUrl = root.findViewById(R.id.editApiUrl);
EditText editApiKey = root.findViewById(R.id.editApiKey);
CheckBox useEarn = root.findViewById(R.id.useEarn);
EditText editEarnApiKey = root.findViewById(R.id.earnApiKey);
CheckBox checkBox = root.findViewById(R.id.useTelegram);
EditText editBotToken = root.findViewById(R.id.editBotToken);
EditText editChatId = root.findViewById(R.id.editChatId);
@ -46,6 +48,8 @@ public class SettingsFragment extends Fragment {
editProfileName.setText(settingsData.profileName);
editApiUrl.setText(settingsData.apiUrl);
editApiKey.setText(settingsData.apiKey);
useEarn.setChecked(settingsData.useEarn);
editEarnApiKey.setText(settingsData.earnApiKey);
checkBox.setChecked(settingsData.useTelegram);
editBotToken.setText(settingsData.botToken);
editChatId.setText(settingsData.chatId);
@ -72,6 +76,8 @@ public class SettingsFragment extends Fragment {
String profileName = editProfileName.getText().toString();
String apiUrl = editApiUrl.getText().toString();
String apiKey = editApiKey.getText().toString();
boolean useEarn = checkBox.isChecked();
String earnApiKey = editEarnApiKey.getText().toString();
boolean useTelegram = checkBox.isChecked();
String botToken = editBotToken.getText().toString();
String chatId = editChatId.getText().toString();
@ -119,6 +125,8 @@ public class SettingsFragment extends Fragment {
profileName,
apiUrl,
apiKey,
useEarn,
earnApiKey,
useTelegram,
botToken,
chatId,

View File

@ -17,6 +17,8 @@ public class SettingsViewModel extends ViewModel {
public String profileName;
public String apiUrl;
public String apiKey;
public boolean useEarn;
public String earnApiKey;
public boolean useTelegram;
public String botToken;
public String chatId;
@ -29,6 +31,8 @@ public class SettingsViewModel extends ViewModel {
String profileName,
String apiUrl,
String apiKey,
boolean useEarn,
String earnApiKey,
boolean useTelegram,
String botToken,
String chatId,
@ -41,6 +45,8 @@ public class SettingsViewModel extends ViewModel {
this.profileName = profileName;
this.apiUrl = apiUrl;
this.apiKey = apiKey;
this.useEarn = useEarn;
this.earnApiKey = earnApiKey;
this.useTelegram = useTelegram;
this.botToken = botToken;
this.chatId = chatId;
@ -54,6 +60,8 @@ public class SettingsViewModel extends ViewModel {
profileName,
apiUrl,
apiKey,
useEarn,
earnApiKey,
useTelegram,
botToken,
chatId,

View File

@ -69,6 +69,20 @@
android:inputType="text"
android:textSize="16sp"/>
<CheckBox
android:id="@+id/useEarn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Earn" />
<EditText
android:id="@+id/earnApiKey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/earn_key_hint"
android:textStyle="italic"
android:inputType="text"
android:textSize="16sp"/>
<CheckBox
android:id="@+id/useTelegram"

View File

@ -15,7 +15,8 @@
<string name="profile_name_hint">Enter the profile name</string>
<string name="api_url_hint">Enter the API URL</string>
<string name="api_key_hint">Enter the API Key</string>
<string name="api_key_hint">Enter the API key</string>
<string name="earn_key_hint">Enter the Earn API key</string>
<string name="use_telegram">Use Telegram</string>
<string name="bot_token_hint">Enter the bot token</string>
<string name="chat_id_hint">Enter the chat ID</string>