From 7d07a2319b91d66309cc16b85adbd6e10a91b507 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Jul 2021 19:38:00 -0700 Subject: [PATCH] get rid of HostActivity New Prefs framework doesn't require it. --- .../android/app/src/main/AndroidManifest.xml | 4 - .../org/eehouse/android/xw4/HostActivity.java | 30 ------ .../org/eehouse/android/xw4/HostDelegate.java | 98 ------------------- .../eehouse/android/xw4/PrefsDelegate.java | 26 ----- 4 files changed, 158 deletions(-) delete mode 100644 xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java delete mode 100644 xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java diff --git a/xwords4/android/app/src/main/AndroidManifest.xml b/xwords4/android/app/src/main/AndroidManifest.xml index 52affacb3..c5cd698ad 100644 --- a/xwords4/android/app/src/main/AndroidManifest.xml +++ b/xwords4/android/app/src/main/AndroidManifest.xml @@ -93,10 +93,6 @@ - - diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java deleted file mode 100644 index ba8d6aaa9..000000000 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */ -/* - * Copyright 2017 by Eric House (xwords@eehouse.org). All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -package org.eehouse.android.xw4; - -import android.os.Bundle; - -public class HostActivity extends XWActivity { - - @Override - public void onCreate( Bundle sis ) { - super.onCreate( sis, new HostDelegate( this, sis ) ); - } -} diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java deleted file mode 100644 index 3cb31de56..000000000 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */ -/* - * Copyright 2014-2016 by Eric House (xwords@eehouse.org). All rights - * reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -package org.eehouse.android.xw4; - -import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; - -import org.eehouse.android.xw4.DlgDelegate.Action; - - -class HostDelegate extends DelegateBase { - private static final String ACTION = "ACTION"; - private static final String IS_POS_BUTTON = "POS_BUTTON"; - private static final String STATE = "STATE"; - - private Bundle mArgs; - - public HostDelegate( Delegator delegator, Bundle sis ) - { - super( delegator, sis, 0 ); - mArgs = delegator.getArguments(); - } - - @Override - protected void init( Bundle savedInstanceState ) - { - show( (DlgState)mArgs.getParcelable( STATE ) ); - } - - @Override - public boolean onPosButton( Action action, Object[] params ) - { - setResult( action, true ); - return true; - } - - @Override - public boolean onNegButton( Action action, Object[] params ) - { - setResult( action, false ); - return true; - } - - @Override - public boolean onDismissed( Action action, Object[] params ) - { - finish(); - return true; - } - - private void setResult( Action action, boolean wasPos ) - { - Intent intent = new Intent(); - intent.putExtra( ACTION, action.ordinal() ); - intent.putExtra( IS_POS_BUTTON, wasPos ); - setResult( Activity.RESULT_OK, intent ); - finish(); - } - - protected static void showForResult( Activity parent, DlgState state ) - { - Intent intent = new Intent( parent, HostActivity.class ); - intent.putExtra( STATE, state ); - parent.startActivityForResult( intent, - RequestCode.HOST_DIALOG.ordinal() ); - } - - protected static void resultReceived( DlgDelegate.DlgClickNotify target, - RequestCode requestCode, - Intent data ) - { - Action action = Action.values()[data.getIntExtra(ACTION, -1)]; - if ( data.getBooleanExtra( IS_POS_BUTTON, false ) ) { - target.onPosButton( action ); - } else { - target.onNegButton( action ); - } - } -} diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index 17714ecbc..87629268b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -302,32 +302,6 @@ public class PrefsDelegate extends DelegateBase return handled; } - @Override - protected void show( DlgState state ) - { - Assert.assertNotNull( state ); - switch ( state.m_id ) { - case CONFIRM_THEN: - case DIALOG_OKONLY: - case DIALOG_ENABLESMS: - case DIALOG_NOTAGAIN: - HostDelegate.showForResult( mActivity, state ); - break; - - default: - Assert.failDbg(); - } - } - - @Override - protected void onActivityResult( RequestCode requestCode, int resultCode, - Intent data ) - { - if ( Activity.RESULT_CANCELED != resultCode ) { - HostDelegate.resultReceived( this, requestCode, data ); - } - } - private void relaunch() { resetPrefs( mActivity, true );