Stubbed Presets and Configurations activities, stubbed fragment for configurations
2
.idea/misc.xml
generated
@@ -39,7 +39,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -23,6 +23,15 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.settings.presets.PresetsActivity"
|
||||||
|
android:label="@string/settings_manage_presets">
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.settings.configurations.ConfigurationsActivity"
|
||||||
|
android:label="@string/settings_manage_configurations">
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings;
|
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -13,6 +15,8 @@ import androidx.lifecycle.Observer;
|
|||||||
import androidx.lifecycle.ViewModelProviders;
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
|
|
||||||
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.ui.settings.configurations.ConfigurationsActivity;
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.ui.settings.presets.PresetsActivity;
|
||||||
|
|
||||||
public class SettingsFragment extends Fragment {
|
public class SettingsFragment extends Fragment {
|
||||||
|
|
||||||
@@ -23,6 +27,23 @@ public class SettingsFragment extends Fragment {
|
|||||||
settingsViewModel =
|
settingsViewModel =
|
||||||
ViewModelProviders.of(this).get(SettingsViewModel.class);
|
ViewModelProviders.of(this).get(SettingsViewModel.class);
|
||||||
View root = inflater.inflate(R.layout.fragment_settings, container, false);
|
View root = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||||
|
final Button managePresets = root.findViewById(R.id.manage_presets);
|
||||||
|
final Button manageConfigurations = root.findViewById(R.id.manage_configurations);
|
||||||
|
|
||||||
|
managePresets.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
startActivity(new Intent(getContext(), PresetsActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
manageConfigurations.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
startActivity(new Intent(getContext(), ConfigurationsActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
settingsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
settingsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable String s) {
|
public void onChanged(@Nullable String s) {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings.configurations;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||||
|
|
||||||
|
public class ConfigurationsActivity extends AppCompatActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_manage_configurations);
|
||||||
|
LinearLayout v = findViewById(R.id.configurations);
|
||||||
|
v.setBackgroundColor(getResources().getColor(R.color.list_even));
|
||||||
|
|
||||||
|
View vv = v.inflate(getApplicationContext(), R.layout.fragment_configuration, null);
|
||||||
|
v.addView(vv);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings.presets;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
public class PresetsActivity extends AppCompatActivity {
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package org.timecrafters.TimeCraftersConfigurationTool.ui.tacnet;
|
package org.timecrafters.TimeCraftersConfigurationTool.ui.tacnet;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -13,10 +16,12 @@ import androidx.lifecycle.Observer;
|
|||||||
import androidx.lifecycle.ViewModelProviders;
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
|
|
||||||
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.backend.Backend;
|
||||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.VariableDialog;
|
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.VariableDialog;
|
||||||
|
|
||||||
public class TACNETFragment extends Fragment {
|
public class TACNETFragment extends Fragment {
|
||||||
|
|
||||||
|
private static final String TAG = "TACNETFragment";
|
||||||
private TACNETViewModel TACNETViewModel;
|
private TACNETViewModel TACNETViewModel;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
@@ -24,14 +29,44 @@ public class TACNETFragment extends Fragment {
|
|||||||
TACNETViewModel =
|
TACNETViewModel =
|
||||||
ViewModelProviders.of(this).get(TACNETViewModel.class);
|
ViewModelProviders.of(this).get(TACNETViewModel.class);
|
||||||
View root = inflater.inflate(R.layout.fragment_tacnet, container, false);
|
View root = inflater.inflate(R.layout.fragment_tacnet, container, false);
|
||||||
TACNETViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
final EditText hostname = root.findViewById(R.id.hostname);
|
||||||
|
final EditText port = root.findViewById(R.id.port);
|
||||||
|
|
||||||
|
final Button connectButton = root.findViewById(R.id.tacnet_connect);
|
||||||
|
final Button startServerButton = root.findViewById(R.id.tacnet_start_server);
|
||||||
|
|
||||||
|
hostname.setText(Backend.instance().getSettings().hostname);
|
||||||
|
port.setText(String.valueOf(Backend.instance().getSettings().port));
|
||||||
|
|
||||||
|
hostname.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable String s) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
Backend.instance().getSettings().hostname = hostname.getText().toString();
|
||||||
|
Backend.instance().settingsChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button connect = root.findViewById(R.id.connect);
|
port.addTextChangedListener(new TextWatcher() {
|
||||||
connect.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
Backend.instance().getSettings().port = Integer.parseInt(port.getText().toString());
|
||||||
|
Backend.instance().settingsChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connectButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
VariableDialog dialog = new VariableDialog();
|
VariableDialog dialog = new VariableDialog();
|
||||||
@@ -39,6 +74,20 @@ public class TACNETFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
startServerButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
VariableDialog dialog = new VariableDialog();
|
||||||
|
dialog.show(getFragmentManager(), null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TACNETViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(@Nullable String s) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
app/src/main/res/drawable-hdpi/gear.png
Normal file
|
After Width: | Height: | Size: 663 B |
BIN
app/src/main/res/drawable-hdpi/trash.png
Normal file
|
After Width: | Height: | Size: 212 B |
BIN
app/src/main/res/drawable-mdpi/gear.png
Normal file
|
After Width: | Height: | Size: 416 B |
BIN
app/src/main/res/drawable-mdpi/trash.png
Normal file
|
After Width: | Height: | Size: 167 B |
BIN
app/src/main/res/drawable-xhdpi/gear.png
Normal file
|
After Width: | Height: | Size: 870 B |
BIN
app/src/main/res/drawable-xhdpi/trash.png
Normal file
|
After Width: | Height: | Size: 259 B |
BIN
app/src/main/res/drawable-xxhdpi/gear.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/trash.png
Normal file
|
After Width: | Height: | Size: 378 B |
BIN
app/src/main/res/drawable-xxxhdpi/gear.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/trash.png
Normal file
|
After Width: | Height: | Size: 474 B |
20
app/src/main/res/layout/activity_manage_configurations.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/configurations"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" />
|
||||||
|
</ScrollView>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
38
app/src/main/res/layout/fragment_configuration.xml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/configuration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/configuration_name"
|
||||||
|
style="@style/Button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:text="Button"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/rename_configuration"
|
||||||
|
style="@style/Widget.AppCompat.ImageButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.8"
|
||||||
|
android:src="@drawable/gear"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/configuration_name"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/configuration_name" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/delete_configuration"
|
||||||
|
style="@style/Widget.AppCompat.ImageButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.8"
|
||||||
|
android:src="@drawable/trash"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button4"
|
android:id="@+id/manage_presets"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/settings_manage_presets" />
|
android:text="@string/settings_manage_presets" />
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button5"
|
android:id="@+id/manage_configurations"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/settings_manage_configurations" />
|
android:text="@string/settings_manage_configurations" />
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/tacnet_connect"
|
android:id="@+id/tacnet_connect_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="48dp"
|
android:layout_marginLeft="48dp"
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
android:text="@string/tacnet_hostname" />
|
android:text="@string/tacnet_hostname" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextTextPersonName"
|
android:id="@+id/hostname"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
@@ -71,14 +71,14 @@
|
|||||||
android:inputType="number" />
|
android:inputType="number" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/connect"
|
android:id="@+id/tacnet_connect"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/tacnet_connect" />
|
android:text="@string/tacnet_connect" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/tacnet_server"
|
android:id="@+id/tacnet_server_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="48dp"
|
android:layout_marginLeft="48dp"
|
||||||
|
|||||||