diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-08-30 14:58:47 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-08-30 14:58:47 -0700 |
commit | 1f9f163262efb7efd5d782b6151f20f8cfc1438e (patch) | |
tree | ee81fd949e92a5471f40598d9e2c8ca185f4d1fe | |
parent | ced3c18be61394a658a05d80b54a3853430572a8 (diff) |
Automating calls to onUiUnready() in parent fragment.
The code was duplicated un-necessarily in each child fragment.
Change-Id: I619b723c9afc690ff9011fc43367fe5752094fb6
4 files changed, 7 insertions, 22 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java index 40462ce1f..e105289b2 100644 --- a/InCallUI/src/com/android/incallui/AnswerFragment.java +++ b/InCallUI/src/com/android/incallui/AnswerFragment.java @@ -72,12 +72,6 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente } @Override - public void onDestroyView() { - super.onDestroyView(); - getPresenter().onUiUnready(this); - } - - @Override public void showAnswerUi(boolean show) { getView().setVisibility(show ? View.VISIBLE : View.GONE); } diff --git a/InCallUI/src/com/android/incallui/BaseFragment.java b/InCallUI/src/com/android/incallui/BaseFragment.java index a348ce49a..ae207f3a1 100644 --- a/InCallUI/src/com/android/incallui/BaseFragment.java +++ b/InCallUI/src/com/android/incallui/BaseFragment.java @@ -18,12 +18,9 @@ package com.android.incallui; import android.app.Fragment; import android.os.Bundle; -import android.view.View; - -import com.android.internal.util.Preconditions; /** - * + * Parent for all fragments that use Presenters and Ui design. */ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends Fragment { @@ -51,4 +48,10 @@ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends super.onActivityCreated(savedInstanceState); mPresenter.onUiReady(getUi()); } + + @Override + public void onDestroyView() { + super.onDestroyView(); + mPresenter.onUiUnready(getUi()); + } } diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index bd193818a..1c3e737e6 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -127,12 +127,6 @@ public class CallButtonFragment } @Override - public void onDestroyView() { - super.onDestroyView(); - getPresenter().onUiUnready(this); - } - - @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index d880b973a..60090365f 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -111,12 +111,6 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } @Override - public void onDestroyView() { - super.onDestroyView(); - getPresenter().onUiUnready(this); - } - - @Override public void setVisible(boolean on) { if (on) { getView().setVisibility(View.VISIBLE); |