Example usage for android.content IntentFilter addAction

List of usage examples for android.content IntentFilter addAction

Introduction

In this page you can find the example usage for android.content IntentFilter addAction.

Prototype

public final void addAction(String action) 

Source Link

Document

Add a new Intent action to match against.

Usage

From source file:com.cerema.cloud2.ui.preview.PreviewImageActivity.java

@Override
protected void onResume() {
    super.onResume();

    mDownloadFinishReceiver = new DownloadFinishReceiver();

    IntentFilter filter = new IntentFilter(FileDownloader.getDownloadFinishMessage());
    filter.addAction(FileDownloader.getDownloadAddedMessage());
    registerReceiver(mDownloadFinishReceiver, filter);
}

From source file:com.lchtime.safetyexpress.ui.chat.hx.activity.ContactActivity.java

private void registerBroadcastReceiver() {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED);
    intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED);
    //      intentFilter.addAction(RPConstant.REFRESH_GROUP_RED_PACKET_ACTION);
    broadcastReceiver = new BroadcastReceiver() {

        @Override//from w w w.  j ava  2  s. c o m
        public void onReceive(Context context, Intent intent) {
            updateUnreadLabel();
            updateUnreadAddressLable();
            if (currentTabIndex == 0) {
                // refresh conversation list
            } else if (currentTabIndex == 1) {
                if (contactListFragment != null) {
                    contactListFragment.refresh();
                }
            }
            String action = intent.getAction();
            if (action.equals(Constant.ACTION_GROUP_CHANAGED)) {
                if (EaseCommonUtils.getTopActivity(ContactActivity.this)
                        .equals(GroupsActivity.class.getName())) {
                    GroupsActivity.instance.onResume();
                }
            }

            if (action.equals(Constant.ACTION_CONTACT_CHANAGED)) {

            }
        }
    };
    broadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}

From source file:system.info.reader.java

@Override
protected void onResume() {
    super.onResume();
    //register to receive battery intent
    Properties.BatteryString = (String) propertyItems[0];
    Properties.batteryHealth = getResources().getTextArray(R.array.batteryHealthState);
    Properties.batteryStatus = getResources().getTextArray(R.array.batteryStatus);
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_BATTERY_CHANGED);
    registerReceiver(Properties.BroadcastReceiver, filter);
}

From source file:net.sf.diningout.app.ui.FriendsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReceiver = new Receiver();
    IntentFilter filter = new IntentFilter(ACTION_CONTACTS_SYNCING);
    filter.addAction(ACTION_CONTACTS_SYNCED);
    LocalBroadcastManager.getInstance(a).registerReceiver(mReceiver, filter);
    a.getActionBar().setIcon(R.drawable.logo); // expanded SearchView uses icon
    setHasOptionsMenu(true);// w  w  w. jav a  2s. com
}

From source file:com.easemob.chatuidemo.ui.MainActivity.java

private void registerBroadcastReceiver() {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED);
    intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED);
    broadcastReceiver = new BroadcastReceiver() {

        @Override/*from ww w . j  a v a 2s .c o  m*/
        public void onReceive(Context context, Intent intent) {
            updateUnreadLabel();
            updateUnreadAddressLable();
            if (currentTabIndex == 0) {
                // ??????
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            } else if (currentTabIndex == 1) {
                if (contactListFragment != null) {
                    contactListFragment.refresh();
                }
            }
            String action = intent.getAction();
            if (action.equals(Constant.ACTION_GROUP_CHANAGED)) {
                if (EaseCommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) {
                    GroupsActivity.instance.onResume();
                }
            }
        }
    };
    broadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}

From source file:cn.xcom.helper.chat.ui.MainActivity.java

private void registerBroadcastReceiver() {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED);
    intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED);
    intentFilter.addAction(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION);
    broadcastReceiver = new BroadcastReceiver() {

        @Override//w w  w.  j  a  va 2 s .co  m
        public void onReceive(Context context, Intent intent) {
            updateUnreadLabel();
            updateUnreadAddressLable();
            if (currentTabIndex == 0) {
                // refresh conversation list
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            } else if (currentTabIndex == 1) {
                if (contactListFragment != null) {
                    contactListFragment.refresh();
                }
            }
            String action = intent.getAction();
            if (action.equals(Constant.ACTION_GROUP_CHANAGED)) {
                if (EaseCommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) {
                    GroupsActivity.instance.onResume();
                }
            }
            if (action.equals(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION)) {
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            }
        }
    };
    broadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}

From source file:com.avcall.app.ui.MainActivity.java

private void registerBroadcastReceiver() {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED);
    intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED);
    intentFilter.addAction(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION);
    broadcastReceiver = new BroadcastReceiver() {

        @Override/*  w  w  w. j  a v  a2  s. c om*/
        public void onReceive(Context context, Intent intent) {
            updateUnreadLabel();
            updateUnreadAddressLable();
            if (currentTabIndex == 0) {
                // refresh conversation list
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            } else if (currentTabIndex == 1) {
                if (contactListFragment != null) {
                    contactListFragment.refresh();
                }
            }
            String action = intent.getAction();
            if (action.equals(Constant.ACTION_GROUP_CHANAGED)) {
                if (EaseCommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) {
                    GroupsActivity.instance.onResume();
                }
            }
            //red packet code : ???
            if (action.equals(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION)) {
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            }
            //end of red packet code
        }
    };
    broadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}

From source file:com.lge.helloFriendsCamera.ConnectionActivity.java

/**
 * make Intent filter//from ww  w .jav  a 2s .  com
 *
 * @return IntentFilter
 */
private IntentFilter getFilter() {
    IntentFilter scanFilter = new IntentFilter();
    // filter about scan result
    scanFilter.addAction(Central.ACTION_LE_SCANRESULT);
    // filter about result of request gatt connection
    scanFilter.addAction(Central.ACTION_FRIENDS_LE_RESULT);

    // filter about result of connecting with friends camera
    scanFilter.addAction(WifiClient.ACTION_FRIENDS_WIFI_RESULT);
    // filter about state of Wi-Fi connection
    scanFilter.addAction(WifiClient.ACTION_WIFI_STATE);
    return scanFilter;
}

From source file:com.android.music.AlbumBrowserFragment.java

@Override
public void onResume() {
    super.onResume();
    IntentFilter f = new IntentFilter();
    f.addAction(MediaPlaybackService.META_CHANGED);
    f.addAction(MediaPlaybackService.QUEUE_CHANGED);
    getActivity().registerReceiver(mTrackListListener, f);
    mTrackListListener.onReceive(null, null);

    MusicUtils.setSpinnerState(getActivity());
}

From source file:com.abroad.ruianju.im.ui.MainActivity.java

private void registerBroadcastReceiver() {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED);
    intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED);
    //      intentFilter.addAction(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION);
    broadcastReceiver = new BroadcastReceiver() {

        @Override/* w  w  w  .  ja  v a 2s. c  o  m*/
        public void onReceive(Context context, Intent intent) {
            updateUnreadLabel();
            updateUnreadAddressLable();
            if (currentTabIndex == 0) {
                // refresh conversation list
                if (conversationListFragment != null) {
                    conversationListFragment.refresh();
                }
            } else if (currentTabIndex == 1) {
                if (contactListFragment != null) {
                    contactListFragment.refresh();
                }
            }
            String action = intent.getAction();
            if (action.equals(Constant.ACTION_GROUP_CHANAGED)) {
                if (EaseCommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) {
                    GroupsActivity.instance.onResume();
                }
            }
            //            //red packet code : ???
            //            if (action.equals(RedPacketConstant.REFRESH_GROUP_RED_PACKET_ACTION)){
            //               if (conversationListFragment != null){
            //                  conversationListFragment.refresh();
            //               }
            //            }
            //end of red packet code
        }
    };
    broadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}