mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-27 03:12:18 -05:00
ConversationActivity: Small changes in onKeyDown() (also removed onBackPressed())
This commit is contained in:
parent
8bfe1d1a75
commit
6e2c835869
@ -271,7 +271,9 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
deckAdapter.removeItem(target);
|
deckAdapter.removeItem(target);
|
||||||
|
|
||||||
if (deckAdapter.isSwitched()) {
|
if (deckAdapter.isSwitched()) {
|
||||||
onBackPressed();
|
switcher.showNext();
|
||||||
|
switcher.removeView(deckAdapter.getSwitchedView());
|
||||||
|
deckAdapter.setSwitched(null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,32 +312,21 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* On key down
|
* On key down
|
||||||
*
|
*
|
||||||
* This is glue code to call onBackPressed() which
|
* XXX: As we only track the back key: Android >= 2.0 will call a method called onBackPressed()
|
||||||
* will be automatically called by later android releases
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||||
onBackPressed();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On back key pressed
|
|
||||||
*/
|
|
||||||
public void onBackPressed()
|
|
||||||
{
|
|
||||||
if (deckAdapter.isSwitched()) {
|
if (deckAdapter.isSwitched()) {
|
||||||
switcher.showNext();
|
switcher.showNext();
|
||||||
switcher.removeView(deckAdapter.getSwitchedView());
|
switcher.removeView(deckAdapter.getSwitchedView());
|
||||||
deckAdapter.setSwitched(null, null);
|
deckAdapter.setSwitched(null, null);
|
||||||
} else {
|
return true;
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On key pressed (input line)
|
* On key pressed (input line)
|
||||||
|
Loading…
Reference in New Issue
Block a user