コード例 #1
0
 public void hideDialpadFragment(boolean animate, boolean clearDialpad) {
   if (mDialpadFragment == null) return;
   if (clearDialpad) {
     mDialpadFragment.clearDialpad();
   }
   if (!mDialpadFragment.isVisible()) return;
   mDialpadFragment.setAdjustTranslationForAnimation(animate);
   final FragmentTransaction ft = getFragmentManager().beginTransaction();
   if (animate) {
     ft.setCustomAnimations(0, R.anim.slide_out);
   }
   ft.hide(mDialpadFragment);
   ft.commit();
 }
コード例 #2
0
 @Override
 public void onBackPressed() {
   if (mDialpadFragment != null && mDialpadFragment.isVisible()) {
     hideDialpadFragment(true, false);
   } else if (getInSearchUi()) {
     mSearchView.setText(null);
     mDialpadFragment.clearDialpad();
   } else if (isTaskRoot()) {
     // Instead of stopping, simply push this to the back of the stack.
     // This is only done when running at the top of the stack;
     // otherwise, we have been launched by someone else so need to
     // allow the user to go back to the caller.
     moveTaskToBack(false);
   } else {
     super.onBackPressed();
   }
 }
コード例 #3
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.overflow_menu:
       {
         mOverflowMenu.show();
         break;
       }
     case R.id.dialpad_button:
       // Reset the boolean flag that tracks whether the dialpad was up because
       // we were in call. Regardless of whether it was true before, we want to
       // show the dialpad because the user has explicitly clicked the dialpad
       // button.
       mInCallDialpadUp = false;
       showDialpadFragment(true);
       break;
     case R.id.call_history_on_dialpad_button:
     case R.id.call_history_button:
       // Use explicit CallLogActivity intent instead of ACTION_VIEW +
       // CONTENT_TYPE, so that we always open our call log from our dialer
       final Intent intent = new Intent(this, CallLogActivity.class);
       startActivity(intent);
       break;
     case R.id.search_close_button:
       // Clear the search field
       if (!TextUtils.isEmpty(mSearchView.getText())) {
         mDialpadFragment.clearDialpad();
         mSearchView.setText("");
       }
       break;
     case R.id.voice_search_button:
       final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
       startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH);
       break;
     default:
       {
         Log.wtf(TAG, "Unexpected onClick event from " + view);
         break;
       }
   }
 }