aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/mygram/droid/LockActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/mygram/droid/LockActivity.java')
-rw-r--r--app/src/main/java/mygram/droid/LockActivity.java63
1 files changed, 0 insertions, 63 deletions
diff --git a/app/src/main/java/mygram/droid/LockActivity.java b/app/src/main/java/mygram/droid/LockActivity.java
deleted file mode 100644
index dd95915..0000000
--- a/app/src/main/java/mygram/droid/LockActivity.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * mygram-droid: Android TV client for Foldergram.
- * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-package mygram.droid;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.text.InputType;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-
-/** Splash with the logo and a PIN prompt; App shows it while the app is locked. */
-public final class LockActivity extends Activity {
- @Override
- protected void onCreate(Bundle state) {
- super.onCreate(state);
- LinearLayout box = Ui.column(this);
- ImageView logo = new ImageView(this);
- logo.setImageResource(R.drawable.ic_launcher);
- logo.setContentDescription("mygram");
- int s = Ui.dp(this, 96);
- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(s, s);
- lp.bottomMargin = Ui.dp(this, 24);
- box.addView(logo, lp);
- EditText pin = Ui.field(this, "PIN", InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
- box.addView(pin);
- View ok = Ui.iconButton(this, R.drawable.ic_check, "Unlock", v -> {
- if (Prefs.checkPin(pin.getText().toString())) {
- App.locked = false;
- finish();
- } else {
- pin.setText("");
- Toast.makeText(this, "Wrong PIN", Toast.LENGTH_SHORT).show();
- }
- });
- box.addView(ok);
- // The keyboard's done key unlocks; the D-pad cannot leave the keyboard.
- pin.setOnEditorActionListener((v, action, event) -> ok.performClick());
- setContentView(box);
- pin.requestFocus();
- }
-
- /** Back leaves the app instead of revealing the screen underneath. */
- @Override
- @SuppressWarnings("deprecation") // no predictive back on this TV; onBackPressed still fires
- public void onBackPressed() {
- finishAffinity();
- }
-}