mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
move onBackPressed() into activity superclasses
This commit is contained in:
parent
092c0f54c8
commit
a6205f3dca
9 changed files with 18 additions and 33 deletions
|
@ -65,6 +65,7 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
|
|||
protected void onPause() {}
|
||||
protected void onStop() {}
|
||||
protected void onDestroy() {}
|
||||
protected boolean onBackPressed() { return false; }
|
||||
protected void prepareDialog( int id, Dialog dialog ) {}
|
||||
|
||||
// public boolean onOptionsItemSelected( MenuItem item )
|
||||
|
|
|
@ -20,13 +20,10 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.eehouse.android.xw4.jni.CurGameInfo;
|
||||
|
||||
|
@ -81,13 +78,6 @@ public class GamesListActivity extends XWListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.onBackPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGameDictDownload( Context context, Intent intent )
|
||||
{
|
||||
intent.setClass( context, GamesListActivity.class );
|
||||
|
|
|
@ -429,7 +429,6 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
|
||||
protected void onWindowFocusChanged( boolean hasFocus )
|
||||
{
|
||||
// super.onWindowFocusChanged( hasFocus );
|
||||
if ( hasFocus ) {
|
||||
updateField();
|
||||
|
||||
|
@ -604,6 +603,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onBackPressed() {
|
||||
boolean handled = 0 < m_selGames.size() || 0 < m_selGroupIDs.size();
|
||||
if ( handled ) {
|
||||
|
|
|
@ -39,13 +39,6 @@ public class StudyListActivity extends XWListActivity {
|
|||
super.onCreate( savedInstanceState, m_dlgt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.backPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public static void launchOrAlert( Context context, int lang,
|
||||
DlgDelegate.HasDlgDelegate dlg )
|
||||
{
|
||||
|
|
|
@ -82,7 +82,8 @@ public class StudyListDelegate extends ListDelegateBase
|
|||
initOrFinish( getIntent() );
|
||||
}
|
||||
|
||||
protected boolean backPressed()
|
||||
@Override
|
||||
protected boolean onBackPressed()
|
||||
{
|
||||
boolean handled = 0 < m_checkeds.size();
|
||||
if ( handled ) {
|
||||
|
|
|
@ -72,6 +72,13 @@ public class XWActivity extends Activity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.onBackPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu( Menu menu )
|
||||
{
|
||||
|
|
|
@ -72,6 +72,13 @@ public class XWListActivity extends ListActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.onBackPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu( Menu menu )
|
||||
{
|
||||
|
|
|
@ -41,13 +41,6 @@ public class LocActivity extends XWListActivity {
|
|||
return m_dlgt.onCreateOptionsMenu( menu );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.onBackPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged( boolean hasFocus )
|
||||
{
|
||||
|
|
|
@ -38,11 +38,4 @@ public class LocItemEditActivity extends XWActivity {
|
|||
super.onCreate( savedInstanceState, m_dlgt );
|
||||
} // onCreate
|
||||
|
||||
// Belongs in superclass?
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.backPressed() ) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue