zeug gemacht

This commit is contained in:
JG-Cody 2024-02-25 21:32:36 +01:00
parent b5af4d57f6
commit 4245d7fbb0
6 changed files with 85 additions and 2 deletions

View File

@ -4,11 +4,13 @@ import android.app.Activity;
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.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.RectF; import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
import android.view.MenuItem; import android.view.MenuItem;
@ -292,4 +294,60 @@ public class MainActivity extends BaseActivity {
public static int getScreenHeight() { public static int getScreenHeight() {
return Resources.getSystem().getDisplayMetrics().heightPixels; 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();
}
} }

View File

@ -12,6 +12,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import com.example.onetap_ssh.MainActivity; import com.example.onetap_ssh.MainActivity;
@ -246,4 +247,6 @@ public class SettingsFragment extends NamedFragment {
this.binding = null; this.binding = null;
} }
} }

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M11,23.59v-3.6c-5.01,-0.26 -9,-4.42 -9,-9.49C2,5.26 6.26,1 11.5,1S21,5.26 21,10.5c0,4.95 -3.44,9.93 -8.57,12.4l-1.43,0.69zM11.5,3C7.36,3 4,6.36 4,10.5S7.36,18 11.5,18L13,18v2.3c3.64,-2.3 6,-6.08 6,-9.8C19,6.36 15.64,3 11.5,3zM10.5,14.5h2v2h-2zM12.5,13h-2c0,-3.25 3,-3 3,-5 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2h-2c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,2.5 -3,2.75 -3,5z"
android:fillColor="#000000"/>
</vector>

View File

@ -7,7 +7,7 @@
android:clickable="true" android:clickable="true"
android:hapticFeedbackEnabled="true" android:hapticFeedbackEnabled="true"
android:padding="25dp" android:padding="25dp"
android:src="@drawable/background_red_blue" android:background="@drawable/background_red_blue"
tools:context=".ui.home.HomeFragment"> tools:context=".ui.home.HomeFragment">

View File

@ -2,6 +2,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:context="com.cringe_studios.code_guard.MainActivity"> tools:context="com.cringe_studios.code_guard.MainActivity">
<item
android:id="@+id/Frage"
android:icon="@drawable/contact_support_black_24dp"
android:onClick="menurighttopdocumentation"
android:orderInCategory="100"
android:title="@string/menu_documentation"
app:showAsAction="always" />
<item <item
android:id="@+id/action_lock" android:id="@+id/action_lock"
android:orderInCategory="100" android:orderInCategory="100"
@ -20,4 +27,10 @@
android:title="@string/action_about" android:title="@string/action_about"
app:showAsAction="never" app:showAsAction="never"
android:onClick="openAbout" /> android:onClick="openAbout" />
<item
android:id="@+id/close"
android:orderInCategory="100"
android:title="@string/close"
app:showAsAction="never"
android:onClick="menurighttopcloseapp" />
</menu> </menu>

View File

@ -200,7 +200,7 @@
<string name="ssh_remote">SSH-REMOTE</string> <string name="ssh_remote">SSH-REMOTE</string>
//home //home
<string name="Welcome_to_your_HOMEAUTOMATION_APP">WELCOME TO TERAPLEX</string> <string name="Welcome_to_your_HOMEAUTOMATION_APP">Welcome to OneTap SSH</string>
<string name="login_ipaddress">IP-ADDRESS</string> <string name="login_ipaddress">IP-ADDRESS</string>
<string name="login_username">USERNAME</string> <string name="login_username">USERNAME</string>
<string name="login_password">PASSWORD</string> <string name="login_password">PASSWORD</string>