mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Created dummy menu item for showing blocked messages in menu
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.moez.QKSMS.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Telephony;
|
||||
import android.view.MenuItem;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -66,4 +69,18 @@ public class BlockedConversationHelper {
|
||||
|
||||
return selection.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user has message blocking enabled, then in the menu of the conversation list, there's an item that says
|
||||
* Blocked (#). This method will find the number of blocked unread messages to show in that menu item and bind it
|
||||
*/
|
||||
public static void bindBlockedMenuItem(Context context, SharedPreferences prefs, MenuItem item) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.setVisible(prefs.getBoolean(SettingsFragment.BLOCKED_ENABLED, false));
|
||||
item.setTitle(context.getString(R.string.menu_blocked_conversations, 4));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -139,6 +139,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
} else {
|
||||
mAdapter.disableMultiSelectMode(false);
|
||||
}
|
||||
|
||||
BlockedConversationHelper.bindBlockedMenuItem(mContext, mPrefs, menu.findItem(R.id.blocked));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,7 +286,7 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
}
|
||||
|
||||
private void initLoaderManager() {
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
getLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
|
||||
private void switchFragment(Fragment fragment) {
|
||||
|
||||
Reference in New Issue
Block a user