mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +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;
|
package com.moez.QKSMS.common;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.provider.Telephony;
|
import android.provider.Telephony;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import com.moez.QKSMS.R;
|
||||||
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -66,4 +69,18 @@ public class BlockedConversationHelper {
|
|||||||
|
|
||||||
return selection.toString();
|
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 {
|
} else {
|
||||||
mAdapter.disableMultiSelectMode(false);
|
mAdapter.disableMultiSelectMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlockedConversationHelper.bindBlockedMenuItem(mContext, mPrefs, menu.findItem(R.id.blocked));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -284,7 +286,7 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initLoaderManager() {
|
private void initLoaderManager() {
|
||||||
getLoaderManager().initLoader(0, null, this);
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchFragment(Fragment fragment) {
|
private void switchFragment(Fragment fragment) {
|
||||||
|
|||||||
@@ -25,6 +25,11 @@
|
|||||||
android:id="@+id/menu_settings"
|
android:id="@+id/menu_settings"
|
||||||
android:title="@string/menu_settings" />
|
android:title="@string/menu_settings" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/blocked"
|
||||||
|
android:title="@string/pref_blocked_conversations"
|
||||||
|
android:visible="false" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_changelog"
|
android:id="@+id/menu_changelog"
|
||||||
android:title="@string/menu_changelog" />
|
android:title="@string/menu_changelog" />
|
||||||
|
|||||||
@@ -164,8 +164,8 @@
|
|||||||
<string name="pref_delivery_vibrate_summary">Vibrate on message delivery</string>
|
<string name="pref_delivery_vibrate_summary">Vibrate on message delivery</string>
|
||||||
<string name="pref_yappy">Yappy integration</string>
|
<string name="pref_yappy">Yappy integration</string>
|
||||||
<string name="pref_endlessjabber_summary">Enable full support for Yappy</string>
|
<string name="pref_endlessjabber_summary">Enable full support for Yappy</string>
|
||||||
<string name="pref_blocked_senders">Blocked senders</string>
|
<string name="pref_blocked_conversations">Blocked conversations</string>
|
||||||
<string name="pref_blocked_senders_summary">Long-press on a conversation to block messages</string>
|
<string name="pref_blocked_conversations_summary">Long-press on a conversation and block to move to blocked inbox and stop notifications</string>
|
||||||
<string name="pref_mobile_only">Mobile numbers</string>
|
<string name="pref_mobile_only">Mobile numbers</string>
|
||||||
<string name="pref_mobile_only_summary">Only show mobile numbers in contact suggestions</string>
|
<string name="pref_mobile_only_summary">Only show mobile numbers in contact suggestions</string>
|
||||||
<string name="pref_auto_emoji">Automatic emoji</string>
|
<string name="pref_auto_emoji">Automatic emoji</string>
|
||||||
@@ -634,6 +634,7 @@
|
|||||||
<string name="menu_unmute_conversation">Unmute conversation</string>
|
<string name="menu_unmute_conversation">Unmute conversation</string>
|
||||||
<string name="menu_block_conversation">Block conversation</string>
|
<string name="menu_block_conversation">Block conversation</string>
|
||||||
<string name="menu_unblock_conversation">Unblock conversation</string>
|
<string name="menu_unblock_conversation">Unblock conversation</string>
|
||||||
|
<string name="menu_blocked_conversations">Blocked (%s)</string>
|
||||||
<string name="menu_notification_settings">Notification settings</string>
|
<string name="menu_notification_settings">Notification settings</string>
|
||||||
<string name="menu_view_details">View details</string>
|
<string name="menu_view_details">View details</string>
|
||||||
<string name="menu_mark_read">Mark read</string>
|
<string name="menu_mark_read">Mark read</string>
|
||||||
|
|||||||
@@ -93,8 +93,8 @@
|
|||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_key_blocked_enabled"
|
android:key="pref_key_blocked_enabled"
|
||||||
android:layout="@layout/list_item_preference"
|
android:layout="@layout/list_item_preference"
|
||||||
android:summary="@string/pref_blocked_senders_summary"
|
android:summary="@string/pref_blocked_conversations_summary"
|
||||||
android:title="@string/pref_blocked_senders"
|
android:title="@string/pref_blocked_conversations"
|
||||||
android:widgetLayout="@layout/view_checkbox" />
|
android:widgetLayout="@layout/view_checkbox" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
|
|||||||
Reference in New Issue
Block a user