diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-07-24 19:19:03 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-07-24 19:19:03 -0700 |
commit | e58788a9fc47164e3586e862df1427b89cbe02db (patch) | |
tree | d5311650a5a00f9f0aa8def3d2c1124768d9ba43 /InCallUI/src | |
parent | 3d1b6528a199c5a3e5a9053d476955037c4c6836 (diff) |
Finishing in call screen when call ends.
Change-Id: I80220deb47ec17fbfb017795f916ba0822ea41da
Diffstat (limited to 'InCallUI/src')
3 files changed, 35 insertions, 9 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 8b90c5d49..0e9fa9a47 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -23,15 +23,14 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.CompoundButton; import android.widget.ToggleButton; /** * Fragment for call control buttons */ -public class CallButtonFragment extends BaseFragment<CallButtonPresenter> implements - CallButtonPresenter.CallButtonUi { +public class CallButtonFragment extends BaseFragment<CallButtonPresenter> + implements CallButtonPresenter.CallButtonUi { @Override CallButtonPresenter createPresenter() { @@ -85,9 +84,12 @@ public class CallButtonFragment extends BaseFragment<CallButtonPresenter> implem } @Override - public void setVisible() { - Log.e("TEST", "" + getView()); - getView().setVisibility(View.VISIBLE); + public void setVisible(boolean on) { + if (on) { + getView().setVisibility(View.VISIBLE); + } else { + getView().setVisibility(View.INVISIBLE); + } } @Override diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 122e48d85..ab47867a2 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -24,6 +24,7 @@ import android.media.AudioManager; public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButtonUi> { private AudioManager mAudioManager; + private EndCallListener mEndCallListener; public void init(AudioManager audioManager) { mAudioManager = audioManager; @@ -37,12 +38,21 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } public void show() { - getUi().setVisible(); + getUi().setVisible(true); } public void endCallClicked() { // TODO(klp): hook up call id. CallCommandClient.getInstance().disconnectCall(1); + + mEndCallListener.onCallEnd(); + reset(); + } + + private void reset() { + getUi().setVisible(false); + getUi().setMute(false); + getUi().setSpeaker(false); } public void muteClicked(boolean checked) { @@ -55,9 +65,17 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto getUi().setSpeaker(checked); } + public void setEndCallListener(EndCallListener endCallListener) { + mEndCallListener = endCallListener; + } + public interface CallButtonUi extends Ui { - void setVisible(); + void setVisible(boolean on); void setMute(boolean on); void setSpeaker(boolean on); } + + public interface EndCallListener { + void onCallEnd(); + } } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index c2e0b0516..71e981b94 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -30,7 +30,7 @@ import android.widget.Toast; /** * Phone app "in call" screen. */ -public class InCallActivity extends Activity { +public class InCallActivity extends Activity implements CallButtonPresenter.EndCallListener { private static final String TAG = InCallActivity.class.getSimpleName(); @@ -68,6 +68,7 @@ public class InCallActivity extends Activity { final CallButtonFragment callButtonFragment = (CallButtonFragment) getFragmentManager() .findFragmentById(R.id.callButtonFragment); mCallButtonPresenter = callButtonFragment.getPresenter(); + mCallButtonPresenter.setEndCallListener(this); // TODO(klp): create once and reset when needed. final AnswerFragment answerFragment = new AnswerFragment(); @@ -216,4 +217,9 @@ public class InCallActivity extends Activity { Log.d(TAG, msg); } } + + @Override + public void onCallEnd() { + finish(); + } } |