From 4245d7fbb04aa30a26484bf5a29fe290e38b1e47 Mon Sep 17 00:00:00 2001 From: JG-Cody Date: Sun, 25 Feb 2024 21:32:36 +0100 Subject: [PATCH] zeug gemacht --- .../com/example/onetap_ssh/MainActivity.java | 58 +++++++++++++++++++ .../onetap_ssh/fragment/SettingsFragment.java | 3 + .../drawable/contact_support_black_24dp.xml | 9 +++ app/src/main/res/layout/fragment_home.xml | 2 +- app/src/main/res/menu/menu_main.xml | 13 +++++ app/src/main/res/values/strings.xml | 2 +- 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/contact_support_black_24dp.xml diff --git a/app/src/main/java/com/example/onetap_ssh/MainActivity.java b/app/src/main/java/com/example/onetap_ssh/MainActivity.java index 7f5d4e1..79ac54b 100644 --- a/app/src/main/java/com/example/onetap_ssh/MainActivity.java +++ b/app/src/main/java/com/example/onetap_ssh/MainActivity.java @@ -4,11 +4,13 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.RectF; +import android.net.Uri; import android.os.Bundle; import android.os.Vibrator; import android.view.MenuItem; @@ -292,4 +294,60 @@ public class MainActivity extends BaseActivity { public static int getScreenHeight() { return Resources.getSystem().getDisplayMetrics().heightPixels; } + public void menurighttopdocumentation(MenuItem i) { + if (button_vibration) { + Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); + assert vr != null; + vr.vibrate(100); + } + AlertDialog mDialog = new AlertDialog.Builder(this) + .setTitle(getString(R.string.menu_documentation)) + .setMessage(getString(R.string.you_will_be_redirected)) + + // Specifying a listener allows you to take an action before dismissing the dialog. + // The dialog is automatically dismissed when a dialog button is clicked. + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + if (button_vibration) { + 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/teraplex")); + startActivity(in); + } + }) + + // A null listener allows the button to dismiss the dialog and take no further action. + .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + if (button_vibration) { + Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); + assert vr != null; + vr.vibrate(100); + } + + } + }).create(); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); + mDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; //style id + mDialog.show(); + + + } + public void menurighttopcloseapp(MenuItem i) { + if (button_vibration) { + Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); + assert vr != null; + vr.vibrate(100); + } + finishAndRemoveTask(); + } + @Override + public void recreate() { + lockOnStop = false; + super.recreate(); + } + } \ No newline at end of file diff --git a/app/src/main/java/com/example/onetap_ssh/fragment/SettingsFragment.java b/app/src/main/java/com/example/onetap_ssh/fragment/SettingsFragment.java index ca65011..3d48cec 100644 --- a/app/src/main/java/com/example/onetap_ssh/fragment/SettingsFragment.java +++ b/app/src/main/java/com/example/onetap_ssh/fragment/SettingsFragment.java @@ -12,6 +12,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import com.example.onetap_ssh.MainActivity; @@ -246,4 +247,6 @@ public class SettingsFragment extends NamedFragment { this.binding = null; } + + } diff --git a/app/src/main/res/drawable/contact_support_black_24dp.xml b/app/src/main/res/drawable/contact_support_black_24dp.xml new file mode 100644 index 0000000..c02e281 --- /dev/null +++ b/app/src/main/res/drawable/contact_support_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index c9b7e93..2bd8b25 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -7,7 +7,7 @@ android:clickable="true" android:hapticFeedbackEnabled="true" android:padding="25dp" - android:src="@drawable/background_red_blue" + android:background="@drawable/background_red_blue" tools:context=".ui.home.HomeFragment"> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 56b4708..3358595 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -2,6 +2,13 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.cringe_studios.code_guard.MainActivity"> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 14b4ff1..26216e1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -200,7 +200,7 @@ SSH-REMOTE //home - WELCOME TO TERAPLEX + Welcome to OneTap SSH IP-ADDRESS USERNAME PASSWORD