terminalfont changed to monospacefont, fixed scroll on commandexecution and fixed visible/invisible-bug on homesite
This commit is contained in:
parent
20b49adeca
commit
fe0da8e7ac
@ -1,12 +1,10 @@
|
|||||||
package de.jg_cody.Teraplex;
|
package de.jg_cody.Teraplex;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.AlertDialog;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@ -56,8 +54,7 @@ public class AddButtonDialogSingle extends DialogFragment {
|
|||||||
String name = editText_name.getText().toString();
|
String name = editText_name.getText().toString();
|
||||||
String button = editText_button_name.getText().toString();
|
String button = editText_button_name.getText().toString();
|
||||||
if(command.isEmpty()||button.isEmpty()||name.isEmpty()){
|
if(command.isEmpty()||button.isEmpty()||name.isEmpty()){
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.invalid))
|
.setTitle(getString(R.string.invalid))
|
||||||
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
||||||
|
@ -4,7 +4,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -45,8 +44,7 @@ public class AddButtonsDialogDouble extends DialogFragment {
|
|||||||
String button1 = editText_button1.getText().toString();
|
String button1 = editText_button1.getText().toString();
|
||||||
String button2 = editText_button2.getText().toString();
|
String button2 = editText_button2.getText().toString();
|
||||||
if(command1.isEmpty()||command2.isEmpty()||name.isEmpty()||button1.isEmpty()||button2.isEmpty()){
|
if(command1.isEmpty()||command2.isEmpty()||name.isEmpty()||button1.isEmpty()||button2.isEmpty()){
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.invalid))
|
.setTitle(getString(R.string.invalid))
|
||||||
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
||||||
|
@ -3,7 +3,6 @@ package de.jg_cody.Teraplex;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -45,8 +44,7 @@ public class AddHeadlineDialog extends DialogFragment {
|
|||||||
.setPositiveButton(R.string.add, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.add, (dialogInterface, i) -> {
|
||||||
String headline = editText_name.getText().toString();
|
String headline = editText_name.getText().toString();
|
||||||
if(headline.isEmpty()){
|
if(headline.isEmpty()){
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.invalid))
|
.setTitle(getString(R.string.invalid))
|
||||||
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
||||||
|
@ -15,7 +15,6 @@ import android.graphics.Canvas;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -56,7 +55,6 @@ import org.json.JSONObject;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -214,8 +212,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tabs.contains(tabname)) {
|
if (tabs.contains(tabname)) {
|
||||||
MediaPlayer mp = MediaPlayer.create(MainActivity.this, R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
||||||
.setTitle(getString(R.string.tabname))
|
.setTitle(getString(R.string.tabname))
|
||||||
.setMessage(getString(R.string.tabname_already_exist))
|
.setMessage(getString(R.string.tabname_already_exist))
|
||||||
@ -238,8 +235,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tabname.isEmpty()) {
|
if (tabname.isEmpty()) {
|
||||||
MediaPlayer mp = MediaPlayer.create(MainActivity.this, R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
||||||
.setTitle(getString(R.string.tabname))
|
.setTitle(getString(R.string.tabname))
|
||||||
.setMessage(getString(R.string.invalid))
|
.setMessage(getString(R.string.invalid))
|
||||||
|
@ -8,7 +8,6 @@ import android.content.DialogInterface;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.text.method.HideReturnsTransformationMethod;
|
import android.text.method.HideReturnsTransformationMethod;
|
||||||
@ -51,6 +50,7 @@ public class HomeFragment extends Fragment {
|
|||||||
Button loginButton;
|
Button loginButton;
|
||||||
Button logoutButton;
|
Button logoutButton;
|
||||||
ImageView togglepassword;
|
ImageView togglepassword;
|
||||||
|
ImageView backgroundoverlay_bottom;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -86,12 +86,14 @@ public class HomeFragment extends Fragment {
|
|||||||
reboot_Button = (Button) root.findViewById(R.id.reboot);
|
reboot_Button = (Button) root.findViewById(R.id.reboot);
|
||||||
shutdown_Button = (Button) root.findViewById(R.id.shutdown);
|
shutdown_Button = (Button) root.findViewById(R.id.shutdown);
|
||||||
togglepassword = (ImageView) root.findViewById(R.id.togglepassword);
|
togglepassword = (ImageView) root.findViewById(R.id.togglepassword);
|
||||||
|
backgroundoverlay_bottom = (ImageView) root.findViewById(R.id.backgroundoverlay_bottom);
|
||||||
SharedPreferences t = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
|
SharedPreferences t = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
|
||||||
if (user == null || ip == null) {
|
if (user == null || ip == null) {
|
||||||
loginButton.setVisibility(View.VISIBLE);
|
loginButton.setVisibility(View.VISIBLE);
|
||||||
togglepassword.setVisibility(View.VISIBLE);
|
togglepassword.setVisibility(View.VISIBLE);
|
||||||
reboot_Button.setVisibility(View.GONE);
|
reboot_Button.setVisibility(View.GONE);
|
||||||
shutdown_Button.setVisibility(View.GONE);
|
shutdown_Button.setVisibility(View.GONE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
loginButton.setVisibility(View.INVISIBLE);
|
loginButton.setVisibility(View.INVISIBLE);
|
||||||
togglepassword.setVisibility(View.INVISIBLE);
|
togglepassword.setVisibility(View.INVISIBLE);
|
||||||
@ -100,6 +102,7 @@ public class HomeFragment extends Fragment {
|
|||||||
passwordInput.setVisibility(View.GONE);
|
passwordInput.setVisibility(View.GONE);
|
||||||
reboot_Button.setVisibility(View.VISIBLE);
|
reboot_Button.setVisibility(View.VISIBLE);
|
||||||
shutdown_Button.setVisibility(View.VISIBLE);
|
shutdown_Button.setVisibility(View.VISIBLE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
loginButton.setOnClickListener(new View.OnClickListener() {
|
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -110,8 +113,7 @@ public class HomeFragment extends Fragment {
|
|||||||
vr.vibrate(100);
|
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);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.invalid))
|
.setTitle(getString(R.string.invalid))
|
||||||
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
.setMessage(getString(R.string.inputfields_cant_be_empty))
|
||||||
@ -166,6 +168,7 @@ public class HomeFragment extends Fragment {
|
|||||||
login_data.setText("");
|
login_data.setText("");
|
||||||
reboot_Button.setVisibility(View.GONE);
|
reboot_Button.setVisibility(View.GONE);
|
||||||
shutdown_Button.setVisibility(View.GONE);
|
shutdown_Button.setVisibility(View.GONE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
login_data.setText(getString(R.string.sie_sind_als_angemeldet).replace("{IP}", ip).replace("{USERNAME}", user));
|
login_data.setText(getString(R.string.sie_sind_als_angemeldet).replace("{IP}", ip).replace("{USERNAME}", user));
|
||||||
@ -177,6 +180,7 @@ public class HomeFragment extends Fragment {
|
|||||||
passwordInput.setVisibility(View.GONE);
|
passwordInput.setVisibility(View.GONE);
|
||||||
reboot_Button.setVisibility(View.VISIBLE);
|
reboot_Button.setVisibility(View.VISIBLE);
|
||||||
shutdown_Button.setVisibility(View.VISIBLE);
|
shutdown_Button.setVisibility(View.VISIBLE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -222,10 +226,12 @@ public class HomeFragment extends Fragment {
|
|||||||
passwordInput.setVisibility(View.VISIBLE);
|
passwordInput.setVisibility(View.VISIBLE);
|
||||||
reboot_Button.setVisibility(View.GONE);
|
reboot_Button.setVisibility(View.GONE);
|
||||||
shutdown_Button.setVisibility(View.GONE);
|
shutdown_Button.setVisibility(View.GONE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
logoutButton.setVisibility(View.VISIBLE);
|
logoutButton.setVisibility(View.VISIBLE);
|
||||||
reboot_Button.setVisibility(View.VISIBLE);
|
reboot_Button.setVisibility(View.VISIBLE);
|
||||||
shutdown_Button.setVisibility(View.VISIBLE);
|
shutdown_Button.setVisibility(View.VISIBLE);
|
||||||
|
backgroundoverlay_bottom.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
logoutButton.setOnClickListener(new View.OnClickListener() {
|
logoutButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -249,8 +255,7 @@ public class HomeFragment extends Fragment {
|
|||||||
assert vr != null;
|
assert vr != null;
|
||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.restart_server))
|
.setTitle(getString(R.string.restart_server))
|
||||||
.setMessage(getString(R.string.are_you_sure))
|
.setMessage(getString(R.string.are_you_sure))
|
||||||
@ -265,8 +270,7 @@ public class HomeFragment extends Fragment {
|
|||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down);
|
|
||||||
mp.start();
|
|
||||||
Toast.makeText(getContext(), R.string.rebooting, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), R.string.rebooting, Toast.LENGTH_SHORT).show();
|
||||||
SSH_connection.executeRemoteCommand(ip, user, password, "reboot");
|
SSH_connection.executeRemoteCommand(ip, user, password, "reboot");
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
@ -303,8 +307,7 @@ public class HomeFragment extends Fragment {
|
|||||||
assert vr != null;
|
assert vr != null;
|
||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.shutdown_server))
|
.setTitle(getString(R.string.shutdown_server))
|
||||||
.setMessage(getString(R.string.are_you_sure))
|
.setMessage(getString(R.string.are_you_sure))
|
||||||
@ -319,8 +322,7 @@ public class HomeFragment extends Fragment {
|
|||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_down);
|
|
||||||
mp.start();
|
|
||||||
Toast.makeText(getContext(), R.string.shutting_down, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), R.string.shutting_down, Toast.LENGTH_SHORT).show();
|
||||||
SSH_connection.executeRemoteCommand(ip, user, password, "shutdown now");
|
SSH_connection.executeRemoteCommand(ip, user, password, "shutdown now");
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
@ -9,7 +9,6 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
@ -98,8 +97,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
assert vr != null;
|
assert vr != null;
|
||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.alert_error);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(getContext())
|
||||||
.setTitle(R.string.reset_app)
|
.setTitle(R.string.reset_app)
|
||||||
.setMessage(R.string.are_you_sure_to_reset)
|
.setMessage(R.string.are_you_sure_to_reset)
|
||||||
|
@ -3,7 +3,6 @@ package de.jg_cody.Teraplex.ui.tabs;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -181,8 +180,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListItemViewHo
|
|||||||
String name = editText_name.getText().toString();
|
String name = editText_name.getText().toString();
|
||||||
String button = editText_button_name.getText().toString();
|
String button = editText_button_name.getText().toString();
|
||||||
if(command.isEmpty()||button.isEmpty()||name.isEmpty()){
|
if(command.isEmpty()||button.isEmpty()||name.isEmpty()){
|
||||||
MediaPlayer mp = MediaPlayer.create(v.getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
||||||
.setTitle(R.string.invalid)
|
.setTitle(R.string.invalid)
|
||||||
.setMessage(R.string.inputfields_cant_be_empty)
|
.setMessage(R.string.inputfields_cant_be_empty)
|
||||||
@ -240,8 +238,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListItemViewHo
|
|||||||
String button1 = editText_button1.getText().toString();
|
String button1 = editText_button1.getText().toString();
|
||||||
String button2 = editText_button2.getText().toString();
|
String button2 = editText_button2.getText().toString();
|
||||||
if (command1.isEmpty() || command2.isEmpty() || name.isEmpty() || button1.isEmpty() || button2.isEmpty()) {
|
if (command1.isEmpty() || command2.isEmpty() || name.isEmpty() || button1.isEmpty() || button2.isEmpty()) {
|
||||||
MediaPlayer mp = MediaPlayer.create(v.getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
||||||
.setTitle(R.string.invalid)
|
.setTitle(R.string.invalid)
|
||||||
.setMessage(R.string.inputfields_cant_be_empty)
|
.setMessage(R.string.inputfields_cant_be_empty)
|
||||||
@ -306,8 +303,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListItemViewHo
|
|||||||
.setPositiveButton(R.string.add, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.add, (dialogInterface, i) -> {
|
||||||
String headline = editText_name.getText().toString();
|
String headline = editText_name.getText().toString();
|
||||||
if(headline.isEmpty()){
|
if(headline.isEmpty()){
|
||||||
MediaPlayer mp = MediaPlayer.create(v.getContext(), R.raw.state_change_confirm_up);
|
|
||||||
mp.start();
|
|
||||||
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
AlertDialog mDialog = new AlertDialog.Builder(v.getContext())
|
||||||
.setTitle(R.string.invalid)
|
.setTitle(R.string.invalid)
|
||||||
.setMessage(R.string.inputfields_cant_be_empty)
|
.setMessage(R.string.inputfields_cant_be_empty)
|
||||||
|
@ -5,6 +5,8 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -25,6 +27,8 @@ import de.jg_cody.Teraplex.R;
|
|||||||
|
|
||||||
public class TerminalFragment extends Fragment {
|
public class TerminalFragment extends Fragment {
|
||||||
|
|
||||||
|
public static boolean atBottom = false;
|
||||||
|
|
||||||
public static String command;
|
public static String command;
|
||||||
|
|
||||||
Button send_button;
|
Button send_button;
|
||||||
@ -79,7 +83,16 @@ public class TerminalFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
terminal.sendTerminalCommand(terminal_edit_text.getText().toString());
|
terminal.sendTerminalCommand(terminal_edit_text.getText().toString());
|
||||||
}
|
if (atBottom) {
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
scrollView.fullScroll(View.FOCUS_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 500);
|
||||||
|
}}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,13 +132,13 @@ public class TerminalFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean atBottom = scrollView.getChildAt(0).getBottom() <= (scrollView.getHeight() + scrollView.getScrollY());
|
atBottom = scrollView.getChildAt(0).getBottom() <= (scrollView.getHeight() + scrollView.getScrollY());
|
||||||
terminal_textView.setText(terminal.getTerminalOutput());
|
terminal_textView.setText(terminal.getTerminalOutput());
|
||||||
System.out.println(atBottom);
|
System.out.println(atBottom);
|
||||||
|
|
||||||
terminal_textView.invalidate();
|
terminal_textView.invalidate();
|
||||||
scrollView.invalidate();
|
scrollView.invalidate();
|
||||||
scrollView.fullScroll(View.FOCUS_DOWN);
|
//scrollView.fullScroll(View.FOCUS_DOWN);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
app:layout_constraintVertical_bias="0.0" />
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/backgroundoverlay"
|
android:id="@+id/backgroundoverlay_bottom"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="-25dp"
|
android:layout_marginStart="-25dp"
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
android:id="@+id/terminal_textView"
|
android:id="@+id/terminal_textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="serif-monospace"
|
||||||
android:text="TextView"
|
android:text="TextView"
|
||||||
android:textColor="#FFFFFF" />
|
android:textColor="#FFFFFF" />
|
||||||
|
|
||||||
@ -56,6 +57,7 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
|
android:fontFamily="serif-monospace"
|
||||||
android:hint="@string/command"
|
android:hint="@string/command"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user