Minor cleanup
1. Remove uncalled empty methods.
2. Remove methods from interface if nobody else is calling them.
3. Remove unused DragListener interface and all references.
Change-Id: Iac498336209b8e73f9a0e13dd8954652e83fd1fc
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 76841d1..dc472fe 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -65,7 +65,6 @@
import com.android.mail.providers.UIProvider.ConversationColumns;
import com.android.mail.ui.AnimatedAdapter;
import com.android.mail.ui.ConversationSelectionSet;
-import com.android.mail.ui.DragListener;
import com.android.mail.ui.FolderDisplayer;
import com.android.mail.ui.SwipeableItemView;
import com.android.mail.ui.ViewMode;
@@ -162,7 +161,6 @@
private boolean mSwipeEnabled;
private int mLastTouchX;
private int mLastTouchY;
- private DragListener mDragListener;
private AnimatedAdapter mAdapter;
private static Bitmap MORE_FOLDERS;
@@ -367,29 +365,27 @@
}
public void bind(Cursor cursor, ViewMode viewMode, ConversationSelectionSet set, Folder folder,
- boolean checkboxesDisabled, boolean swipeEnabled, DragListener dragListener,
- AnimatedAdapter adapter) {
+ boolean checkboxesDisabled, boolean swipeEnabled, AnimatedAdapter adapter) {
bind(ConversationItemViewModel.forCursor(cursor), viewMode, set, folder,
- checkboxesDisabled, swipeEnabled, dragListener, adapter);
+ checkboxesDisabled, swipeEnabled, adapter);
}
public void bind(Conversation conversation, ViewMode viewMode, ConversationSelectionSet set,
Folder folder, boolean checkboxesDisabled, boolean swipeEnabled,
- DragListener dragListener, AnimatedAdapter adapter) {
+ AnimatedAdapter adapter) {
bind(ConversationItemViewModel.forConversation(conversation), viewMode, set, folder,
- checkboxesDisabled, swipeEnabled, dragListener, adapter);
+ checkboxesDisabled, swipeEnabled, adapter);
}
private void bind(ConversationItemViewModel header, ViewMode viewMode,
ConversationSelectionSet set, Folder folder, boolean checkboxesDisabled,
- boolean swipeEnabled, DragListener dragListener, AnimatedAdapter adapter) {
+ boolean swipeEnabled, AnimatedAdapter adapter) {
mViewMode = viewMode;
mHeader = header;
mSelectedConversationSet = set;
mDisplayedFolder = folder;
mCheckboxesEnabled = !checkboxesDisabled;
mSwipeEnabled = swipeEnabled;
- mDragListener = dragListener;
mAdapter = adapter;
setContentDescription(mHeader.getContentDescription(mContext));
requestLayout();
@@ -1298,7 +1294,6 @@
// Begin drag mode. Keep the conversation selected (NOT toggle
// selection) and start drag.
selectConversation();
- mDragListener.onStartDragMode();
// Clip data has form: [conversations_uri, conversationId1,
// maxMessageId1, label1, conversationId2, maxMessageId2, label2, ...]
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index b7ecc7b..6de5ce3 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -242,22 +242,12 @@
}
@Override
- public int getMode() {
- return mViewMode.getMode();
- }
-
- @Override
public String getUnshownSubject(String subject) {
// Calculate how much of the subject is shown, and return the remaining.
return null;
}
@Override
- public void handleConversationLoadError() {
- // TODO(viki): Auto-generated method stub
- }
-
- @Override
public final ConversationCursor getConversationListCursor() {
return mConversationListCursor;
}
@@ -789,7 +779,6 @@
@Override
public void onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
// TODO(viki): Auto-generated method stub
-
}
@Override
@@ -801,7 +790,6 @@
@Override
public void onPause() {
isLoaderInitialized = false;
-
enableNotifications();
commitLeaveBehindItems();
}
@@ -851,17 +839,7 @@
}
@Override
- public void onStartDragMode() {
- // TODO(viki): Auto-generated method stub
- }
-
- @Override
public void onStop() {
- // TODO(viki): Auto-generated method stub
- }
-
- @Override
- public void onStopDragMode() {
// TODO(viki): Auto-generated method stub
}
@@ -1089,7 +1067,11 @@
}
}
- @Override
+ /**
+ * Returns true if we are waiting for the account to sync, and cannot show any folders or
+ * conversation for the current account yet.
+ * @return
+ */
public boolean inWaitMode() {
final FragmentManager manager = mActivity.getFragmentManager();
final WaitFragment waitFragment =
@@ -1199,18 +1181,6 @@
lm.restartLoader(id, Bundle.EMPTY, this);
}
- /**
- * Start a loader with the given id. This should be called when we know that the previous
- * state of the application matches this state, and we are happy if we get the previously
- * created loader with this id. If that is not true, consider calling
- * {@link #restartOptionalLoader(int)} instead.
- * @param id
- */
- private void startLoader(int id) {
- final LoaderManager lm = mActivity.getLoaderManager();
- lm.initLoader(id, Bundle.EMPTY, this);
- }
-
@Override
public void registerConversationListObserver(DataSetObserver observer) {
mConversationListObservable.registerObserver(observer);
diff --git a/src/com/android/mail/ui/ActivityController.java b/src/com/android/mail/ui/ActivityController.java
index ee36df0..1eef46e 100644
--- a/src/com/android/mail/ui/ActivityController.java
+++ b/src/com/android/mail/ui/ActivityController.java
@@ -36,14 +36,12 @@
import com.android.mail.ui.FoldersSelectionDialog.FolderChangeCommitListener;
import com.android.mail.ui.ViewMode.ModeChangeListener;
-import java.util.Collection;
-
/**
* An Activity controller knows how to combine views and listeners into a functioning activity.
* ActivityControllers are delegates that implement methods by calling underlying views to modify,
* or respond to user action.
*/
-public interface ActivityController extends DragListener, LayoutListener, SubjectDisplayChanger,
+public interface ActivityController extends LayoutListener, SubjectDisplayChanger,
ModeChangeListener, ConversationListCallbacks, FolderChangeCommitListener,
FolderChangeListener, AccountChangeListener, LoaderManager.LoaderCallbacks<Cursor>,
ConversationSetObserver,
@@ -63,18 +61,6 @@
ConversationListContext getCurrentListContext();
/**
- * Return the current mode the activity is in. Values need to be matched against constants in
- * {@link ViewMode}.
- * @return
- */
- int getMode();
-
- /**
- *
- */
- void handleConversationLoadError();
-
- /**
* @see android.app.Activity#onActivityResult
* @param requestCode
* @param resultCode
@@ -241,8 +227,6 @@
*/
public void updateWaitMode();
- public boolean inWaitMode();
-
/**
* Show the folder list associated with the currently selected account.
*/
@@ -265,6 +249,11 @@
*/
boolean shouldShowFirstConversation();
+ /**
+ * Get the selected set of conversations. Guaranteed to return non-null, this should return
+ * an empty set if no conversation is currently selected.
+ * @return
+ */
public ConversationSelectionSet getSelectedSet();
/**
@@ -298,10 +287,10 @@
/**
* Load the default inbox associated with the current account.
*/
- public abstract void loadAccountInbox();
+ public void loadAccountInbox();
/**
* Return the folder currently being viewed by the activity.
*/
- public abstract Folder getFolder();
+ public Folder getFolder();
}
diff --git a/src/com/android/mail/ui/AnimatedAdapter.java b/src/com/android/mail/ui/AnimatedAdapter.java
index 63fb1be..9856be9 100644
--- a/src/com/android/mail/ui/AnimatedAdapter.java
+++ b/src/com/android/mail/ui/AnimatedAdapter.java
@@ -78,7 +78,6 @@
private final SwipeableListView mListView;
private Settings mCachedSettings;
private boolean mSwipeEnabled;
- private DragListener mDragListener;
private HashMap<Long, LeaveBehindItem> mLeaveBehindItems = new HashMap<Long, LeaveBehindItem>();
/**
@@ -88,7 +87,7 @@
public AnimatedAdapter(Context context, int textViewResourceId, ConversationCursor cursor,
ConversationSelectionSet batch, Account account, Settings settings, ViewMode viewMode,
- SwipeableListView listView, DragListener dragListener) {
+ SwipeableListView listView) {
// Use FLAG_REGISTER_CONTENT_OBSERVER to ensure special
// ConversationCursor notifications (triggered by UI actions) cause any
// connected ListView to redraw.
@@ -101,7 +100,6 @@
mShowFooter = false;
mListView = listView;
mCachedSettings = settings;
- mDragListener = dragListener;
mSwipeEnabled = account.supportsCapability(UIProvider.AccountCapabilities.UNDO);
}
@@ -134,7 +132,7 @@
}
((ConversationItemView) view).bind(cursor, mViewMode, mBatchConversations, mFolder,
mCachedSettings != null ? mCachedSettings.hideCheckboxes : false,
- mSwipeEnabled, mDragListener, this);
+ mSwipeEnabled, this);
}
@Override
@@ -321,7 +319,7 @@
parent);
convView.bind(conversation, mViewMode, mBatchConversations, mFolder,
mCachedSettings != null ? mCachedSettings.hideCheckboxes : false, mSwipeEnabled,
- mDragListener, this);
+ this);
convView.startUndoAnimation(mViewMode, this);
return convView;
}
diff --git a/src/com/android/mail/ui/ControllableActivity.java b/src/com/android/mail/ui/ControllableActivity.java
index 486b863..ce573be 100644
--- a/src/com/android/mail/ui/ControllableActivity.java
+++ b/src/com/android/mail/ui/ControllableActivity.java
@@ -76,8 +76,6 @@
*/
FolderListFragment.FolderListSelectionListener getFolderListSelectionListener();
- DragListener getDragListener();
-
void onConversationSeen(Conversation conv);
/**
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index a7b02f7..1dbf8e0 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -204,8 +204,7 @@
mListAdapter = new AnimatedAdapter(mActivity.getApplicationContext(), -1,
getConversationListCursor(), mActivity.getSelectedSet(), mAccount,
- mActivity.getSettings(), mActivity.getViewMode(), mListView,
- mActivity.getDragListener());
+ mActivity.getSettings(), mActivity.getViewMode(), mListView);
mFooterView = (ConversationListFooterView) LayoutInflater.from(
mActivity.getActivityContext()).inflate(R.layout.conversation_list_footer_view,
null);
diff --git a/src/com/android/mail/ui/DragListener.java b/src/com/android/mail/ui/DragListener.java
deleted file mode 100644
index 1b693ba..0000000
--- a/src/com/android/mail/ui/DragListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 Google Inc.
- * Licensed to The Android Open Source Project.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-
-package com.android.mail.ui;
-
-
-/**
- * This interface is used to send notifications back to the calling
- * activity. MenuHandler takes care of updating the provider, so this
- * interface should be used for notification purposes only (such as updating
- * the UI).
- */
-// Called MenuHandler.ActivityCallback in the previous code.
-public interface DragListener {
- /**
- * Invoked when user starts drag and drop mode.
- */
- void onStartDragMode();
-
- /**
- * Invoked when user stops drag and drop mode.
- */
- void onStopDragMode();
-}
-
diff --git a/src/com/android/mail/ui/FolderSelectionActivity.java b/src/com/android/mail/ui/FolderSelectionActivity.java
index b9deaaf..bcf8c6f 100644
--- a/src/com/android/mail/ui/FolderSelectionActivity.java
+++ b/src/com/android/mail/ui/FolderSelectionActivity.java
@@ -291,11 +291,6 @@
}
@Override
- public DragListener getDragListener() {
- return null;
- }
-
- @Override
public boolean supportsDrag(DragEvent event, Folder folder) {
return false;
}
diff --git a/src/com/android/mail/ui/MailActivity.java b/src/com/android/mail/ui/MailActivity.java
index dd2c149..d09bb71 100644
--- a/src/com/android/mail/ui/MailActivity.java
+++ b/src/com/android/mail/ui/MailActivity.java
@@ -272,11 +272,6 @@
}
@Override
- public DragListener getDragListener() {
- return mController;
- }
-
- @Override
public boolean supportsDrag(DragEvent event, Folder folder) {
return mController.supportsDrag(event, folder);
}