mirror of
https://github.com/TimeCrafters/TimeCraftersConfigurationTool.git
synced 2025-12-13 04:02:34 +00:00
Added LaunchActivity to show logo and ask for permissions before reaching MainActivity, started work on saving Actions as presets and drafted Presets menu.
This commit is contained in:
6
.idea/compiler.xml
generated
Normal file
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -15,6 +15,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -39,7 +39,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</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" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
apply plugin: 'com.android.application'
|
||||
android.defaultConfig.vectorDrawables.useSupportLibrary = true
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.timecrafters.TimeCraftersConfigurationTool">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
@@ -16,7 +17,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".LauncherActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -24,6 +25,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".MainActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.timecrafters.TimeCraftersConfigurationTool;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.PermissionsRequestDialog;
|
||||
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
public class LauncherActivity extends AppCompatActivity {
|
||||
private static final int REQUEST_WRITE_PERMISSION = 70;
|
||||
private static final String TAG = "LauncherActivity";
|
||||
private static final long timerDelay = 2_000;
|
||||
private static final long timerDelayAfterPermissionRequest = 500;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_launcher);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
Button websiteButton = findViewById(R.id.timecrafters_website_button);
|
||||
websiteButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://timecrafters.org"));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
|
||||
if (havePermissions()) {
|
||||
startTimer(timerDelay);
|
||||
} else {
|
||||
new PermissionsRequestDialog().show(getSupportFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_WRITE_PERMISSION: {
|
||||
if (grantResults.length > 0 && grantResults[0] == PERMISSION_GRANTED) {
|
||||
// Permission granted
|
||||
startTimer(timerDelayAfterPermissionRequest);
|
||||
} else {
|
||||
// Permission not given
|
||||
new PermissionsRequestDialog().show(getSupportFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startTimer(long milliseconds) {
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finish();
|
||||
Intent intent = new Intent(LauncherActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}, milliseconds);
|
||||
}
|
||||
|
||||
private boolean havePermissions() {
|
||||
return ContextCompat.checkSelfPermission(LauncherActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
public void requestStoragePermissions() {
|
||||
ActivityCompat.requestPermissions(LauncherActivity.this,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
REQUEST_WRITE_PERMISSION);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,18 @@
|
||||
package org.timecrafters.TimeCraftersConfigurationTool;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.Backend;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.PermissionsRequestDialog;
|
||||
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private static final int REQUEST_WRITE_PERMISSION = 70;
|
||||
private static final String TAG = "MainActivity";
|
||||
private AppBarConfiguration appBarConfiguration;
|
||||
|
||||
@@ -39,15 +32,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
||||
NavigationUI.setupWithNavController(navView, navController);
|
||||
|
||||
if (!havePermissions()) {
|
||||
new PermissionsRequestDialog().show(getSupportFragmentManager(), null);
|
||||
} else {
|
||||
if (Backend.instance() == null) {
|
||||
new Backend();
|
||||
}
|
||||
|
||||
Backend.instance().applicationContext = getApplicationContext();
|
||||
if (Backend.instance() == null) {
|
||||
new Backend();
|
||||
}
|
||||
|
||||
Backend.instance().applicationContext = getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,31 +45,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
return NavigationUI.navigateUp(navController, appBarConfiguration) || super.onSupportNavigateUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_WRITE_PERMISSION: {
|
||||
if (grantResults.length > 0 && grantResults[0] == PERMISSION_GRANTED) {
|
||||
// Permission granted
|
||||
new Backend();
|
||||
} else {
|
||||
// Permission not given
|
||||
new PermissionsRequestDialog().show(getSupportFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean havePermissions() {
|
||||
return ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
public void requestStoragePermissions() {
|
||||
ActivityCompat.requestPermissions(MainActivity.this,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
REQUEST_WRITE_PERMISSION);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.LauncherActivity;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.MainActivity;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.TAC;
|
||||
@@ -40,7 +41,7 @@ public class PermissionsRequestDialog extends TimeCraftersDialog {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
((MainActivity) getActivity()).requestStoragePermissions();
|
||||
((LauncherActivity) getActivity()).requestStoragePermissions();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package org.timecrafters.TimeCraftersConfigurationTool.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.Backend;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.Config;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Action;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Group;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersDialog;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.ui.editor.ActionsFragment;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.ui.editor.GroupsFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PresetDialog extends TimeCraftersDialog {
|
||||
final String TAG = "PresetDialog";
|
||||
private Group group;
|
||||
private Action action;
|
||||
private boolean isNewPreset = false;
|
||||
private TextView nameError;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
setCancelable(false);
|
||||
|
||||
View root = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
if (getArguments() != null) {
|
||||
isNewPreset = getArguments().getBoolean("is_new_preset", false);
|
||||
|
||||
if (isNewPreset) {
|
||||
this.group = Backend.instance().getConfig().getGroups().get(getArguments().getInt("group_index"));
|
||||
this.action = group.getActions().get(getArguments().getInt("action_index"));
|
||||
} else {
|
||||
this.action = Backend.instance().getConfig().getPresets().getActions().get(getArguments().getInt("action_index"));
|
||||
}
|
||||
}
|
||||
|
||||
final TextView title = root.findViewById(R.id.dialog_title);
|
||||
final LinearLayout view = root.findViewById(R.id.dialog_content);
|
||||
view.addView(getLayoutInflater().inflate(R.layout.dialog_edit_group, null));
|
||||
final EditText name = view.findViewById(R.id.name);
|
||||
nameError = view.findViewById(R.id.name_error);
|
||||
|
||||
final Button cancel = view.findViewById(R.id.cancel);
|
||||
final Button mutate = view.findViewById(R.id.mutate);
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
if (group != null) {
|
||||
title.setText("Editing " + group.name);
|
||||
name.setText(group.name);
|
||||
mutate.setText(getResources().getString(R.string.dialog_update));
|
||||
} else {
|
||||
title.setText("Add Preset");
|
||||
}
|
||||
|
||||
name.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
validated(name.getText().toString().trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mutate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final String presetName = name.getText().toString().trim();
|
||||
Action actionClone = deepCopyAction(action);
|
||||
// if (group != null && group.name.equals(groupName)) {
|
||||
// dismiss();
|
||||
// }
|
||||
|
||||
if (validated(presetName)) {
|
||||
if (action.name != presetName) {
|
||||
actionClone.name = presetName;
|
||||
}
|
||||
|
||||
Backend.instance().getConfig().getPresets().getActions().add(actionClone);
|
||||
|
||||
Backend.instance().configChanged();
|
||||
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private boolean validated(String name) {
|
||||
String message = "";
|
||||
ArrayList<Action> actions = Backend.instance().getConfig().getPresets().getActions();
|
||||
boolean nameUnique = true;
|
||||
|
||||
for (Action a : actions) {
|
||||
if (a.name.equals(name)) {
|
||||
nameUnique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fix editing preset name impossible
|
||||
if (!nameUnique) {
|
||||
message += "Name is not unique!";
|
||||
|
||||
} else if (name.length() <= 0) {
|
||||
message += "Name cannot be blank!";
|
||||
|
||||
}
|
||||
|
||||
if (message.length() > 0) {
|
||||
nameError.setVisibility(View.VISIBLE);
|
||||
nameError.setText(message);
|
||||
return false;
|
||||
} else {
|
||||
nameError.setVisibility(View.GONE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private Action deepCopyAction(Action action) {
|
||||
String json = Backend.instance().gsonForConfig().toJson(action);
|
||||
|
||||
return Backend.instance().gsonForConfig().fromJson(json, Action.class);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,21 @@
|
||||
package org.timecrafters.TimeCraftersConfigurationTool.ui.editor;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -25,6 +31,7 @@ import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Action;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Group;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.ActionDialog;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.ConfirmationDialog;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.dialogs.PresetDialog;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersDialog;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersDialogRunnable;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersFragment;
|
||||
@@ -97,6 +104,21 @@ public class ActionsFragment extends TimeCraftersFragment {
|
||||
styleSwitch(buttonView, isChecked);
|
||||
}
|
||||
});
|
||||
final int index = i;
|
||||
name.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
showContextMenu(name, index);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
name.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
getActivity().getMenuInflater().inflate(R.menu.action_extras_menu, menu);
|
||||
}
|
||||
});
|
||||
|
||||
edit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -158,4 +180,36 @@ public class ActionsFragment extends TimeCraftersFragment {
|
||||
container.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void showContextMenu(View view, final int action_index) {
|
||||
Context context = new ContextThemeWrapper(getActivity(), R.style.PopUpMenu);
|
||||
PopupMenu menu = new PopupMenu(context, view);
|
||||
menu.getMenuInflater().inflate(R.menu.action_extras_menu, menu.getMenu());
|
||||
|
||||
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.clone: {
|
||||
// SHOW CLONE DIALOG
|
||||
return true;
|
||||
}
|
||||
case R.id.save_as_preset: {
|
||||
PresetDialog dialog = new PresetDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("group_index", getArguments().getInt("group_index"));
|
||||
bundle.putInt("action_index", action_index);
|
||||
bundle.putBoolean("is_new_preset", true);
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(getFragmentManager(), "preset_dialog");
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,76 @@
|
||||
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings.presets;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.R;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.Backend;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Action;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.backend.config.Group;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersFragment;
|
||||
|
||||
public class PresetsFragment extends TimeCraftersFragment {
|
||||
private LayoutInflater inflater;
|
||||
private LinearLayout groupsContainer, actionsContainer;
|
||||
private View root;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.inflater = inflater;
|
||||
this.root = inflater.inflate(R.layout.fragment_presets, container, false);
|
||||
this.groupsContainer = root.findViewById(R.id.groups_container);
|
||||
this.actionsContainer = root.findViewById(R.id.actions_container);
|
||||
|
||||
populatePresets();
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
void populatePresets() {
|
||||
groupsContainer.removeAllViews();
|
||||
actionsContainer.removeAllViews();
|
||||
|
||||
int i = 0;
|
||||
for (Group group : Backend.instance().getConfig().getPresets().getGroups()) {
|
||||
View view = inflater.inflate(R.layout.fragment_part_presets, null);
|
||||
|
||||
if (i % 2 == 0) { // even
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_even));
|
||||
} else {
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_odd));
|
||||
}
|
||||
|
||||
groupsContainer.addView(view);
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for (Action action : Backend.instance().getConfig().getPresets().getActions()) {
|
||||
View view = inflater.inflate(R.layout.fragment_part_presets, null);
|
||||
|
||||
if (i % 2 == 0) { // even
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_even));
|
||||
} else {
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_odd));
|
||||
}
|
||||
|
||||
Button name = view.findViewById(R.id.name);
|
||||
ImageButton rename = view.findViewById(R.id.rename);
|
||||
ImageButton delete = view.findViewById(R.id.delete);
|
||||
|
||||
name.setText(action.name);
|
||||
|
||||
actionsContainer.addView(view);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
46
app/src/main/res/layout/activity_launcher.xml
Normal file
46
app/src/main/res/layout/activity_launcher.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorSecondary">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_launcher_foreground" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/timecrafters_website_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="TimeCrafters.org"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/quit_button"
|
||||
style="@style/DangerousButton"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
android:id="@+id/group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/name"
|
||||
|
||||
39
app/src/main/res/layout/fragment_part_presets.xml
Normal file
39
app/src/main/res/layout/fragment_part_presets.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="Button" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/rename"
|
||||
style="@style/Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
app:srcCompat="@drawable/gear" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/delete"
|
||||
style="@style/DangerousButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
app:srcCompat="@drawable/trash" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
67
app/src/main/res/layout/fragment_presets.xml
Normal file
67
app/src/main/res/layout/fragment_presets.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/button_margin_bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="[In Development]"
|
||||
android:textColor="@color/buttonDangerHover" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Groups"
|
||||
android:textColor="#000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/groups_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/button_margin_bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Actions"
|
||||
android:textColor="#000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actions_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
10
app/src/main/res/menu/action_extras_menu.xml
Normal file
10
app/src/main/res/menu/action_extras_menu.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/clone"
|
||||
android:title="@string/clone" />
|
||||
<item
|
||||
android:id="@+id/save_as_preset"
|
||||
android:title="@string/save_as_preset" />
|
||||
</menu>
|
||||
@@ -40,4 +40,6 @@
|
||||
<string name="tacnet_connected">Connected</string>
|
||||
<string name="tacnet_connecting">Connecting...</string>
|
||||
<string name="tacnet_not_connected">Not Connected</string>
|
||||
<string name="clone">Clone</string>
|
||||
<string name="save_as_preset">Save as preset</string>
|
||||
</resources>
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Fri Jun 12 21:05:33 CDT 2020
|
||||
#Sun Oct 25 13:32:16 CDT 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
|
||||
Reference in New Issue
Block a user