mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 19:02:17 -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,31 +312,20 @@ 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();
|
if (deckAdapter.isSwitched()) {
|
||||||
return true;
|
switcher.showNext();
|
||||||
}
|
switcher.removeView(deckAdapter.getSwitchedView());
|
||||||
return false;
|
deckAdapter.setSwitched(null, null);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* On back key pressed
|
|
||||||
*/
|
|
||||||
public void onBackPressed()
|
|
||||||
{
|
|
||||||
if (deckAdapter.isSwitched()) {
|
|
||||||
switcher.showNext();
|
|
||||||
switcher.removeView(deckAdapter.getSwitchedView());
|
|
||||||
deckAdapter.setSwitched(null, null);
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user