Replaced anonymous classes with lambda

This commit is contained in:
Moez Bhatti
2015-10-30 19:59:52 -04:00
parent 9186e5a9cb
commit bcef7a225f
@@ -19,7 +19,6 @@ import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView; import android.widget.ImageView;
import com.melnykov.fab.FloatingActionButton; import com.melnykov.fab.FloatingActionButton;
@@ -115,17 +114,14 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor())); mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor()));
mFab.attachToRecyclerView(mRecyclerView); mFab.attachToRecyclerView(mRecyclerView);
mFab.getDrawable().setColorFilter(new PorterDuffColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.MULTIPLY)); mFab.getDrawable().setColorFilter(new PorterDuffColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.MULTIPLY));
mFab.setOnClickListener(new View.OnClickListener() { mFab.setOnClickListener(v -> {
@Override // Show the compose fragment, showing the keyboard and focusing on the recipients edittext.
public void onClick(View v) { Bundle args = new Bundle();
// Show the compose fragment, showing the keyboard and focusing on the recipients edittext. args.putBoolean(ComposeFragment.ARG_SHOW_KEYBOARD, true);
Bundle args = new Bundle(); args.putString(ComposeFragment.ARG_FOCUS, ComposeFragment.FOCUS_RECIPIENTS);
args.putBoolean(ComposeFragment.ARG_SHOW_KEYBOARD, true);
args.putString(ComposeFragment.ARG_FOCUS, ComposeFragment.FOCUS_RECIPIENTS);
Fragment content = getFragmentManager().findFragmentById(R.id.content_frame); Fragment content = getFragmentManager().findFragmentById(R.id.content_frame);
switchFragment(ComposeFragment.getInstance(args, content)); switchFragment(ComposeFragment.getInstance(args, content));
}
}); });
mViewHasLoaded = true; mViewHasLoaded = true;
@@ -252,60 +248,57 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
dialog.addMenuItem(R.string.menu_delete_conversation, MENU_DELETE_CONVERSATION); dialog.addMenuItem(R.string.menu_delete_conversation, MENU_DELETE_CONVERSATION);
dialog.buildMenu(new AdapterView.OnItemClickListener() { dialog.buildMenu((parent, view1, position, id) -> {
@Override switch ((int) id) {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { case MENU_MUTE_CONVERSATION:
switch ((int) id) { conversationPrefs.putBoolean(SettingsFragment.NOTIFICATIONS, false);
case MENU_MUTE_CONVERSATION: mAdapter.notifyDataSetChanged();
conversationPrefs.putBoolean(SettingsFragment.NOTIFICATIONS, false); break;
mAdapter.notifyDataSetChanged();
break;
case MENU_UNMUTE_CONVERSATION: case MENU_UNMUTE_CONVERSATION:
conversationPrefs.putBoolean(SettingsFragment.NOTIFICATIONS, true); conversationPrefs.putBoolean(SettingsFragment.NOTIFICATIONS, true);
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();
break; break;
case MENU_NOTIFICATION_SETTINGS: case MENU_NOTIFICATION_SETTINGS:
ConversationNotificationSettingsDialog.newInstance(threadId, name).setContext(mContext) ConversationNotificationSettingsDialog.newInstance(threadId, name).setContext(mContext)
.show(getFragmentManager(), "notification prefs"); .show(getFragmentManager(), "notification prefs");
break; break;
case MENU_VIEW_DETAILS: case MENU_VIEW_DETAILS:
mConversationDetailsDialog.showDetails(conversation); mConversationDetailsDialog.showDetails(conversation);
break; break;
case MENU_BLOCK_CONVERSATION: case MENU_BLOCK_CONVERSATION:
BlockedConversationHelper.blockConversation(mPrefs, conversation.getThreadId()); BlockedConversationHelper.blockConversation(mPrefs, conversation.getThreadId());
initLoaderManager(); initLoaderManager();
break; break;
case MENU_UNBLOCK_CONVERSATION: case MENU_UNBLOCK_CONVERSATION:
BlockedConversationHelper.unblockConversation(mPrefs, conversation.getThreadId()); BlockedConversationHelper.unblockConversation(mPrefs, conversation.getThreadId());
initLoaderManager(); initLoaderManager();
break; break;
case MENU_MARK_READ: case MENU_MARK_READ:
new ConversationLegacy(mContext, threadId).markRead(); new ConversationLegacy(mContext, threadId).markRead();
break; break;
case MENU_MARK_UNREAD: case MENU_MARK_UNREAD:
new ConversationLegacy(mContext, threadId).markUnread(); new ConversationLegacy(mContext, threadId).markUnread();
break; break;
case MENU_MULTI_SELECT: case MENU_MULTI_SELECT:
mAdapter.setSelected(threadId); mAdapter.setSelected(threadId);
break; break;
case MENU_DELETE_CONVERSATION: case MENU_DELETE_CONVERSATION:
DialogHelper.showDeleteConversationDialog((MainActivity) mContext, threadId); DialogHelper.showDeleteConversationDialog((MainActivity) mContext, threadId);
break; break;
case MENU_DELETE_FAILED: case MENU_DELETE_FAILED:
//Deletes all failed messages from all conversations //Deletes all failed messages from all conversations
DialogHelper.showDeleteFailedMessagesDialog((MainActivity) mContext, threadId); DialogHelper.showDeleteFailedMessagesDialog((MainActivity) mContext, threadId);
break; break;
}
} }
}).show(mContext.getFragmentManager(), "conversation options"); }).show(mContext.getFragmentManager(), "conversation options");
} }