revised settingstab and added switches for turning off or on logoanimation and haptic-feedback

This commit is contained in:
JG-Cody 2021-08-23 19:55:15 +02:00
parent b915b860c8
commit d5463b335f
8 changed files with 481 additions and 235 deletions

View File

@ -1,6 +1,8 @@
package de.jg_cody.Teraplex; package de.jg_cody.Teraplex;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -8,23 +10,40 @@ import android.os.Looper;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
public class IntroActivity extends AppCompatActivity { public class IntroActivity extends AppCompatActivity {
public static boolean show_logoanimation = false;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
SharedPreferences p = getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
show_logoanimation = p.getBoolean("Logoanimation", true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro); if (show_logoanimation) {
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 100ms
Intent m = new Intent(getApplicationContext(),MainActivity.class);
m.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(m);
}
}, 4000);
setContentView(R.layout.activity_intro);
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 4000ms
Intent m = new Intent(getApplicationContext(), MainActivity.class);
m.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(m);
}
}, 4000);
} else {
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 100ms
Intent m = new Intent(getApplicationContext(), MainActivity.class);
m.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(m);
}
}, 0);
}
} }
} }

View File

@ -81,6 +81,8 @@ public class MainActivity extends AppCompatActivity {
public static final int CREATE_FILE = 1; public static final int CREATE_FILE = 1;
public static boolean editmode = false; public static boolean editmode = false;
public static boolean button_vibration = false;
EditText editText_name; EditText editText_name;
@ -116,6 +118,9 @@ public class MainActivity extends AppCompatActivity {
config.locale = locale; config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
button_vibration = p.getBoolean("Vibration", false );
IntroActivity.show_logoanimation = p.getBoolean("Logoanimation", true );
String Theme = p.getString("Theme", "RED_BLUE"); String Theme = p.getString("Theme", "RED_BLUE");
if (Theme.equals("RED_BLUE")) { if (Theme.equals("RED_BLUE")) {
setTheme(R.style.Theme_red_blue); setTheme(R.style.Theme_red_blue);
@ -154,9 +159,13 @@ public class MainActivity extends AppCompatActivity {
((Switch) navigationView.getMenu().getItem(2).getActionView().findViewById(R.id.switch_editmode)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { ((Switch) navigationView.getMenu().getItem(2).getActionView().findViewById(R.id.switch_editmode)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null; if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
editmode = isChecked; editmode = isChecked;
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment); Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavHostFragment nhf = (NavHostFragment) currentFragment; NavHostFragment nhf = (NavHostFragment) currentFragment;
@ -177,9 +186,11 @@ public class MainActivity extends AppCompatActivity {
navigationView.getMenu().getItem(3).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { navigationView.getMenu().getItem(3).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this); AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
@ -193,9 +204,11 @@ public class MainActivity extends AppCompatActivity {
mBuilder.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { mBuilder.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
String tabname = editText_name.getText().toString().trim(); String tabname = editText_name.getText().toString().trim();
SharedPreferences p = getSharedPreferences("appsettings", MODE_PRIVATE); SharedPreferences p = getSharedPreferences("appsettings", MODE_PRIVATE);
@ -223,9 +236,11 @@ public class MainActivity extends AppCompatActivity {
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -245,9 +260,11 @@ public class MainActivity extends AppCompatActivity {
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -259,9 +276,11 @@ public class MainActivity extends AppCompatActivity {
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
DrawerLayout mDrawerLayout; DrawerLayout mDrawerLayout;
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerLayout.closeDrawer(GravityCompat.START); mDrawerLayout.closeDrawer(GravityCompat.START);
@ -286,9 +305,11 @@ public class MainActivity extends AppCompatActivity {
mBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { mBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}); });
@ -302,9 +323,11 @@ public class MainActivity extends AppCompatActivity {
navigationView.getMenu().getItem(4).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { navigationView.getMenu().getItem(4).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences p = getSharedPreferences("appsettings", MODE_PRIVATE); SharedPreferences p = getSharedPreferences("appsettings", MODE_PRIVATE);
String tabsString = p.getString("tabs", null); String tabsString = p.getString("tabs", null);
List<String> tabs = new ArrayList<String>(); List<String> tabs = new ArrayList<String>();
@ -337,9 +360,11 @@ public class MainActivity extends AppCompatActivity {
mBuilder.setPositiveButton(getString(R.string.remove), new DialogInterface.OnClickListener() { mBuilder.setPositiveButton(getString(R.string.remove), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
tabs.removeAll(selectedTabs); tabs.removeAll(selectedTabs);
SharedPreferences.Editor editor = p.edit(); SharedPreferences.Editor editor = p.edit();
editor.putString("tabs", new JSONArray(tabs).toString()); editor.putString("tabs", new JSONArray(tabs).toString());
@ -356,9 +381,11 @@ public class MainActivity extends AppCompatActivity {
mBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { mBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}); });
AlertDialog mDialog = mBuilder.create(); AlertDialog mDialog = mBuilder.create();
@ -385,9 +412,11 @@ public class MainActivity extends AppCompatActivity {
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
DrawerLayout mDrawerLayout; DrawerLayout mDrawerLayout;
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerLayout.closeDrawer(GravityCompat.START); mDrawerLayout.closeDrawer(GravityCompat.START);
@ -457,8 +486,11 @@ public class MainActivity extends AppCompatActivity {
public void menurighttopsettings(MenuItem i) { public void menurighttopsettings(MenuItem i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment); Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavHostFragment nhf = (NavHostFragment) currentFragment; NavHostFragment nhf = (NavHostFragment) currentFragment;
nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new SettingsFragment()).commit(); nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new SettingsFragment()).commit();
@ -466,8 +498,11 @@ public class MainActivity extends AppCompatActivity {
} }
public void menurighttopabout(MenuItem i) { public void menurighttopabout(MenuItem i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment); Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavHostFragment nhf = (NavHostFragment) currentFragment; NavHostFragment nhf = (NavHostFragment) currentFragment;
nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new CreditsFragment()).commit(); nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new CreditsFragment()).commit();
@ -475,8 +510,11 @@ public class MainActivity extends AppCompatActivity {
} }
public void menurighttopdocumentation(MenuItem i) { public void menurighttopdocumentation(MenuItem i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
AlertDialog mDialog = new AlertDialog.Builder(this) AlertDialog mDialog = new AlertDialog.Builder(this)
.setTitle(getString(R.string.menu_documentation)) .setTitle(getString(R.string.menu_documentation))
.setMessage(getString(R.string.you_will_be_redirected)) .setMessage(getString(R.string.you_will_be_redirected))
@ -485,8 +523,11 @@ public class MainActivity extends AppCompatActivity {
// The dialog is automatically dismissed when a dialog button is clicked. // The dialog is automatically dismissed when a dialog button is clicked.
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.jg-cody.de/")); Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.jg-cody.de/"));
startActivity(in); startActivity(in);
} }
@ -496,9 +537,11 @@ public class MainActivity extends AppCompatActivity {
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
@ -510,8 +553,11 @@ public class MainActivity extends AppCompatActivity {
} }
public void menurighttopcloseapp(MenuItem i) { public void menurighttopcloseapp(MenuItem i) {
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (button_vibration) {
vr.vibrate(100); Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
finishAffinity(); finishAffinity();
} else { } else {
@ -601,14 +647,14 @@ public class MainActivity extends AppCompatActivity {
JSONObject jso = new JSONObject(s); JSONObject jso = new JSONObject(s);
SharedPreferences p = this.getSharedPreferences("appsettings", Activity.MODE_PRIVATE); SharedPreferences p = this.getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
JSONArray tabs = jso.getJSONArray("tabs"); JSONArray tabs = jso.getJSONArray("tabs");
SharedPreferences.Editor sharedEditor = p.edit(); SharedPreferences.Editor sharedEditor = p.edit();
sharedEditor.putString("tabs",tabs.toString()); sharedEditor.putString("tabs", tabs.toString());
JSONObject tabitems = jso.getJSONObject("tabitems"); JSONObject tabitems = jso.getJSONObject("tabitems");
for (int i = 0; i < tabs.length(); i++) { for (int i = 0; i < tabs.length(); i++) {
String tab = tabs.getString(i); String tab = tabs.getString(i);
JSONArray tArray = tabitems.getJSONArray(tab); JSONArray tArray = tabitems.getJSONArray(tab);
sharedEditor.putString("listItems." + tab,tArray.toString()); sharedEditor.putString("listItems." + tab, tArray.toString());
} }
sharedEditor.apply(); sharedEditor.apply();
@ -616,7 +662,6 @@ public class MainActivity extends AppCompatActivity {
finish(); finish();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {

View File

@ -104,9 +104,11 @@ public class HomeFragment extends Fragment {
loginButton.setOnClickListener(new View.OnClickListener() { loginButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
if (userInput.getText().toString().trim().length() == 0 || ipInput.getText().toString().trim().length() == 0 || passwordInput.getText().toString().trim().length() == 0) { if (userInput.getText().toString().trim().length() == 0 || ipInput.getText().toString().trim().length() == 0 || passwordInput.getText().toString().trim().length() == 0) {
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
mp.start(); mp.start();
@ -119,9 +121,11 @@ public class HomeFragment extends Fragment {
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -190,9 +194,11 @@ public class HomeFragment extends Fragment {
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -224,9 +230,11 @@ public class HomeFragment extends Fragment {
logoutButton.setOnClickListener(new View.OnClickListener() { logoutButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").apply(); requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").apply();
startActivity(requireActivity().getIntent()); startActivity(requireActivity().getIntent());
requireActivity().finish(); requireActivity().finish();
@ -236,9 +244,11 @@ public class HomeFragment extends Fragment {
reboot_Button.setOnClickListener(new View.OnClickListener() { reboot_Button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
mp.start(); mp.start();
AlertDialog mDialog = new AlertDialog.Builder(getContext()) AlertDialog mDialog = new AlertDialog.Builder(getContext())
@ -249,9 +259,11 @@ public class HomeFragment extends Fragment {
// The dialog is automatically dismissed when a dialog button is clicked. // The dialog is automatically dismissed when a dialog button is clicked.
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
try { try {
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down);
mp.start(); mp.start();
@ -268,9 +280,11 @@ public class HomeFragment extends Fragment {
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -284,9 +298,11 @@ public class HomeFragment extends Fragment {
shutdown_Button.setOnClickListener(new View.OnClickListener() { shutdown_Button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
mp.start(); mp.start();
AlertDialog mDialog = new AlertDialog.Builder(getContext()) AlertDialog mDialog = new AlertDialog.Builder(getContext())
@ -297,9 +313,11 @@ public class HomeFragment extends Fragment {
// The dialog is automatically dismissed when a dialog button is clicked. // The dialog is automatically dismissed when a dialog button is clicked.
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
try { try {
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down);
mp.start(); mp.start();
@ -316,9 +334,11 @@ public class HomeFragment extends Fragment {
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);

View File

@ -17,8 +17,10 @@ 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.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Switch;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -26,6 +28,7 @@ import androidx.fragment.app.Fragment;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import de.jg_cody.Teraplex.IntroActivity;
import de.jg_cody.Teraplex.MainActivity; import de.jg_cody.Teraplex.MainActivity;
import de.jg_cody.Teraplex.R; import de.jg_cody.Teraplex.R;
@ -52,9 +55,11 @@ public class SettingsFragment extends Fragment {
Language.setOnClickListener(new View.OnClickListener() { Language.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
showChangeLanguageDialog(); showChangeLanguageDialog();
} }
@ -63,9 +68,11 @@ public class SettingsFragment extends Fragment {
Export.setOnClickListener(new View.OnClickListener() { Export.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
createFile(); createFile();
} }
}); });
@ -73,9 +80,11 @@ public class SettingsFragment extends Fragment {
Import.setOnClickListener(new View.OnClickListener() { Import.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
//showImportDialog(); //showImportDialog();
openFile(); openFile();
} }
@ -84,9 +93,11 @@ public class SettingsFragment extends Fragment {
Reset.setOnClickListener(new View.OnClickListener() { Reset.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.alert_error); MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.alert_error);
mp.start(); mp.start();
AlertDialog mDialog = new AlertDialog.Builder(getContext()) AlertDialog mDialog = new AlertDialog.Builder(getContext())
@ -97,9 +108,11 @@ public class SettingsFragment extends Fragment {
// The dialog is automatically dismissed when a dialog button is clicked. // The dialog is automatically dismissed when a dialog button is clicked.
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
try { try {
requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().clear().apply(); requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().clear().apply();
startActivity(requireActivity().getIntent()); startActivity(requireActivity().getIntent());
@ -115,9 +128,11 @@ public class SettingsFragment extends Fragment {
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -130,9 +145,11 @@ public class SettingsFragment extends Fragment {
choose_background.setOnClickListener(new View.OnClickListener() { choose_background.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
showChangeBackgroundDialog(); showChangeBackgroundDialog();
@ -142,9 +159,11 @@ public class SettingsFragment extends Fragment {
theme1.setOnClickListener(new View.OnClickListener() { theme1.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putString("Theme", "RED_BLUE"); editor.putString("Theme", "RED_BLUE");
editor.apply(); editor.apply();
@ -158,9 +177,11 @@ public class SettingsFragment extends Fragment {
theme2.setOnClickListener(new View.OnClickListener() { theme2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putString("Theme", "GREEN_YELLOW"); editor.putString("Theme", "GREEN_YELLOW");
editor.apply(); editor.apply();
@ -174,9 +195,11 @@ public class SettingsFragment extends Fragment {
theme3.setOnClickListener(new View.OnClickListener() { theme3.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putString("Theme", "ORANGE_TURQUOISE"); editor.putString("Theme", "ORANGE_TURQUOISE");
editor.apply(); editor.apply();
@ -190,9 +213,11 @@ public class SettingsFragment extends Fragment {
theme4.setOnClickListener(new View.OnClickListener() { theme4.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putString("Theme", "YELLOW_BLUE"); editor.putString("Theme", "YELLOW_BLUE");
editor.apply(); editor.apply();
@ -206,9 +231,11 @@ public class SettingsFragment extends Fragment {
theme5.setOnClickListener(new View.OnClickListener() { theme5.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putString("Theme", "PINK_GREEN"); editor.putString("Theme", "PINK_GREEN");
editor.apply(); editor.apply();
@ -218,7 +245,36 @@ public class SettingsFragment extends Fragment {
} }
}); });
((Switch) root.findViewById(R.id.buttonvibration_switch)).setChecked(MainActivity.button_vibration);
((Switch) root.findViewById(R.id.buttonvibration_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (MainActivity.button_vibration) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
MainActivity.button_vibration = isChecked;
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putBoolean("Vibration", MainActivity.button_vibration);
editor.apply();
}
});
((Switch) root.findViewById(R.id.animation_switch)).setChecked(IntroActivity.show_logoanimation);
((Switch) root.findViewById(R.id.animation_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (MainActivity.button_vibration) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
IntroActivity.show_logoanimation = isChecked;
SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit();
editor.putBoolean("Logoanimation", IntroActivity.show_logoanimation);
editor.apply();
}
});
return root; return root;
} }
@ -229,9 +285,11 @@ public class SettingsFragment extends Fragment {
mBuilder.setSingleChoiceItems(listItems, -1, new DialogInterface.OnClickListener() { mBuilder.setSingleChoiceItems(listItems, -1, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
if (i == 0) { if (i == 0) {
setLocale("de"); setLocale("de");
startActivity(requireActivity().getIntent()); startActivity(requireActivity().getIntent());
@ -257,9 +315,11 @@ public class SettingsFragment extends Fragment {
mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() { mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
if (i == 0) { if (i == 0) {
Intent a = new Intent( Intent a = new Intent(
Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import android.os.Vibrator; import android.os.Vibrator;
import android.view.View; import android.view.View;
import de.jg_cody.Teraplex.MainActivity;
import de.jg_cody.Teraplex.SSH_connection; import de.jg_cody.Teraplex.SSH_connection;
public class CommandExecutor implements View.OnClickListener { public class CommandExecutor implements View.OnClickListener {
@ -15,9 +16,11 @@ public class CommandExecutor implements View.OnClickListener {
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) v.getContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
SharedPreferences prefs = v.getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); SharedPreferences prefs = v.getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
String user = prefs.getString("user", null); String user = prefs.getString("user", null);
String password = prefs.getString("password", null); String password = prefs.getString("password", null);

View File

@ -20,6 +20,7 @@ import androidx.fragment.app.Fragment;
import java.util.Objects; import java.util.Objects;
import de.jg_cody.Teraplex.MainActivity;
import de.jg_cody.Teraplex.R; import de.jg_cody.Teraplex.R;
public class TerminalFragment extends Fragment { public class TerminalFragment extends Fragment {
@ -53,9 +54,11 @@ public class TerminalFragment extends Fragment {
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); if (MainActivity.button_vibration) {
assert vr != null; Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
vr.vibrate(100); assert vr != null;
vr.vibrate(100);
}
} }
}).create(); }).create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
@ -70,7 +73,11 @@ public class TerminalFragment extends Fragment {
send_button.setOnClickListener(new View.OnClickListener() { send_button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (MainActivity.button_vibration) {
Vibrator vr = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
assert vr != null;
vr.vibrate(100);
}
if (terminal != null) { if (terminal != null) {
terminal.sendTerminalCommand(terminal_edit_text.getText().toString()); terminal.sendTerminalCommand(terminal_edit_text.getText().toString());
} }

View File

@ -33,92 +33,75 @@
android:id="@drawable/backgroundoverlay" android:id="@drawable/backgroundoverlay"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="-25dp" android:layout_marginStart="-17dp"
android:layout_marginTop="-25dp" android:layout_marginTop="-25dp"
android:layout_marginEnd="-25dp" android:layout_marginEnd="-17dp"
android:layout_marginBottom="-25dp" android:layout_marginBottom="-25dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/backgroundoverlay" android:src="@drawable/backgroundoverlay"
app:layout_constraintBottom_toBottomOf="@+id/button_export" app:layout_constraintBottom_toBottomOf="@+id/buttonvibration_switch"
app:layout_constraintEnd_toEndOf="@+id/button_theme_red_blue" app:layout_constraintEnd_toEndOf="@+id/button_theme_green_yellow"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="@+id/themes" app:layout_constraintStart_toStartOf="@+id/button_theme_orange_turquoise"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue" /> app:layout_constraintTop_toTopOf="@+id/themes"
app:layout_constraintVertical_bias="0.0" />
<TextView <TextView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="35dp" android:layout_marginTop="10dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left" android:gravity="center_horizontal|left"
android:text="@string/background" android:text="@string/background"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector" android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/divider" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_pickimage"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_pickimage" app:layout_constraintTop_toBottomOf="@+id/divider2" />
app:layout_constraintVertical_bias="0.45" />
<TextView <TextView
android:id="@+id/themes" android:id="@+id/themes"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="35dp" android:layout_marginTop="100dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left" android:gravity="center_horizontal|left"
android:text="@string/color_scheme" android:text="@string/color_scheme"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector" android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/button_theme_pink_green" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_theme_red_blue"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/sprache" android:id="@+id/sprache"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="35dp" android:layout_marginTop="10dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left" android:gravity="center_horizontal|left"
android:text="@string/language" android:text="@string/language"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector" android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/button_language" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_language"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_language" /> app:layout_constraintTop_toBottomOf="@+id/divider" />
<TextView <TextView
android:id="@+id/reset_settings" android:id="@+id/reset_settings"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="35dp" android:layout_marginTop="10dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left" android:gravity="center_horizontal|left"
android:text="@string/reset_settings" android:text="@string/reset_settings"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector" android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/button_reset" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_reset"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_reset" /> app:layout_constraintTop_toBottomOf="@+id/divider3" />
<TextView <TextView
android:id="@+id/import_export" android:id="@+id/import_export"
@ -135,97 +118,169 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider4" /> app:layout_constraintTop_toBottomOf="@+id/divider4" />
<TextView
android:id="@+id/buttonvibration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal|left"
android:text="@string/hapticfeedback"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider10" />
<TextView
android:id="@+id/introanimation2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal|left"
android:text="@string/logoanimation"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider8" />
<TextView
android:id="@+id/animation_off"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:gravity="center_horizontal|left"
android:text="@string/no"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/animation_switch"
app:layout_constraintEnd_toStartOf="@+id/animation_switch"
app:layout_constraintTop_toTopOf="@+id/animation_switch" />
<TextView
android:id="@+id/animation_off3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:gravity="center_horizontal|left"
android:text="@string/off"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/buttonvibration_switch"
app:layout_constraintEnd_toStartOf="@+id/buttonvibration_switch"
app:layout_constraintTop_toTopOf="@+id/buttonvibration_switch" />
<TextView
android:id="@+id/animation_off2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:gravity="center_horizontal|left"
android:text="@string/yes"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/animation_switch"
app:layout_constraintStart_toEndOf="@+id/animation_switch"
app:layout_constraintTop_toTopOf="@+id/animation_switch" />
<TextView
android:id="@+id/animation_off4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:gravity="center_horizontal|left"
android:text="@string/on"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/buttonvibration_switch"
app:layout_constraintStart_toEndOf="@+id/buttonvibration_switch"
app:layout_constraintTop_toTopOf="@+id/buttonvibration_switch" />
<Button <Button
android:id="@+id/button_reset" android:id="@+id/button_reset"
android:layout_width="140dp" android:layout_width="160dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:text="@string/button_reset" android:text="@string/button_reset"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider3" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/reset_settings" />
<Button <Button
android:id="@+id/button_export" android:id="@+id/button_export"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:text="@string/button_export" android:text="@string/button_export"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="@+id/button_theme_yellow_blue"
app:layout_constraintTop_toBottomOf="@+id/import_export" /> app:layout_constraintTop_toBottomOf="@+id/import_export" />
<Button <Button
android:id="@+id/button_import" android:id="@+id/button_import"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginStart="35dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:text="@string/button_import" android:text="@string/button_import"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="@+id/button_theme_pink_green"
app:layout_constraintTop_toBottomOf="@+id/import_export" /> app:layout_constraintTop_toBottomOf="@+id/import_export" />
<Button <Button
android:id="@+id/button_theme_red_blue" android:id="@+id/button_theme_red_blue"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="100dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_red_blue" android:background="@drawable/button_theme_red_blue"
android:text="@string/red_blue" android:text="@string/red_blue"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/button_theme_green_yellow" app:layout_constraintBottom_toTopOf="@+id/button_theme_green_yellow"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/themes" />
<Button <Button
android:id="@+id/button_theme_orange_turquoise" android:id="@+id/button_theme_orange_turquoise"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginStart="35dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_orange_turquoise" android:background="@drawable/button_theme_orange_turquoise"
android:text="@string/orange_turquoise" android:text="@string/orange_turquoise"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/button_theme_yellow_blue" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/button_theme_red_blue" />
app:layout_constraintTop_toBottomOf="@+id/button_theme_green_yellow" />
<Button <Button
android:id="@+id/button_theme_yellow_blue" android:id="@+id/button_theme_yellow_blue"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_yellow_blue" android:background="@drawable/button_theme_yellow_blue"
android:text="@string/yellow_blue" android:text="@string/yellow_blue"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/button_theme_pink_green" app:layout_constraintEnd_toEndOf="@+id/button_theme_green_yellow"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/button_theme_green_yellow" />
app:layout_constraintTop_toBottomOf="@+id/button_theme_orange_turquoise" />
<Button <Button
android:id="@+id/button_theme_pink_green" android:id="@+id/button_theme_pink_green"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_pink_green" android:background="@drawable/button_theme_pink_green"
android:text="@string/pink_green" android:text="@string/pink_green"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/button_theme_orange_turquoise"
app:layout_constraintTop_toBottomOf="@+id/button_theme_yellow_blue" /> app:layout_constraintTop_toTopOf="@+id/button_theme_yellow_blue" />
<Button <Button
android:id="@+id/button_theme_green_yellow" android:id="@+id/button_theme_green_yellow"
@ -233,62 +288,57 @@
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp" android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_green_yellow" android:background="@drawable/button_theme_green_yellow"
android:text="@string/green_yellow" android:text="@string/green_yellow"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/button_theme_orange_turquoise"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_theme_red_blue" /> app:layout_constraintTop_toBottomOf="@+id/button_theme_red_blue" />
<Button <Button
android:id="@+id/button_language" android:id="@+id/button_language"
android:layout_width="140dp" android:layout_width="160dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:text="@string/language" android:text="@string/language"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider3" app:layout_constraintBottom_toTopOf="@+id/divider3"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sprache" />
<Button <Button
android:id="@+id/button_pickimage" android:id="@+id/button_pickimage"
android:layout_width="140dp" android:layout_width="160dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:text="@string/button_choose_background" android:text="@string/button_choose_background"
app:backgroundTint="@null" app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/background" />
<View <View
android:id="@+id/divider" android:id="@+id/divider"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="2dp" android:layout_height="2dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/background_full" android:background="@drawable/background_full"
app:layout_constraintEnd_toEndOf="@+id/divider2" app:layout_constraintEnd_toEndOf="@+id/divider2"
app:layout_constraintStart_toStartOf="@+id/divider2" app:layout_constraintStart_toStartOf="@+id/divider2"
app:layout_constraintTop_toBottomOf="@+id/button_pickimage" /> app:layout_constraintTop_toBottomOf="@+id/button_pickimage" />
<View <View
android:id="@+id/divider2" android:id="@+id/divider2"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="2dp" android:layout_height="2dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/background_full" android:background="@drawable/background_full"
app:layout_constraintEnd_toEndOf="@+id/button_theme_red_blue" app:layout_constraintEnd_toEndOf="@+id/button_theme_yellow_blue"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="@+id/themes" app:layout_constraintStart_toStartOf="@+id/button_theme_pink_green"
app:layout_constraintTop_toBottomOf="@+id/button_theme_pink_green" /> app:layout_constraintTop_toBottomOf="@+id/button_theme_pink_green" />
<View <View
android:id="@+id/divider3" android:id="@+id/divider3"
@ -310,6 +360,26 @@
app:layout_constraintStart_toStartOf="@+id/divider" app:layout_constraintStart_toStartOf="@+id/divider"
app:layout_constraintTop_toBottomOf="@+id/button_reset" /> app:layout_constraintTop_toBottomOf="@+id/button_reset" />
<View
android:id="@+id/divider8"
android:layout_width="0dp"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="@drawable/background_full"
app:layout_constraintEnd_toEndOf="@+id/divider"
app:layout_constraintStart_toStartOf="@+id/divider"
app:layout_constraintTop_toBottomOf="@+id/button_export" />
<View
android:id="@+id/divider10"
android:layout_width="0dp"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="@drawable/background_full"
app:layout_constraintEnd_toEndOf="@+id/divider"
app:layout_constraintStart_toStartOf="@+id/divider"
app:layout_constraintTop_toBottomOf="@+id/animation_switch" />
<Space <Space
android:id="@+id/space" android:id="@+id/space"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -318,7 +388,25 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_export" /> app:layout_constraintTop_toBottomOf="@+id/buttonvibration_switch" />
<Switch
android:id="@+id/buttonvibration_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonvibration" />
<Switch
android:id="@+id/animation_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/introanimation2" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>

View File

@ -59,6 +59,10 @@
<string name="import_export">IMPORT/EXPORT</string> <string name="import_export">IMPORT/EXPORT</string>
<string name="filename">FILENAME</string> <string name="filename">FILENAME</string>
<string name="are_you_sure_to_reset">ARE YOU SURE YOU WANT TO RESET THE APP AND DELETE ALL YOUR SETTINGS?</string> <string name="are_you_sure_to_reset">ARE YOU SURE YOU WANT TO RESET THE APP AND DELETE ALL YOUR SETTINGS?</string>
<string name="off">OFF</string>
<string name="on">ON</string>
<string name="logoanimation">SHOW LOGOANIMATION</string>
<string name="hapticfeedback">HAPTIC FEEDBACK</string>
//credits //credits
<string name="version">TERAPLEX v1.1.1</string> <string name="version">TERAPLEX v1.1.1</string>