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:net.oschina.app.ui.MainActivity.java

@Override
public void initView() {
    mDoubleClickExit = new DoubleClickExitHelper(this);
    //        @InjectView(android.R.id.tabhost)
    //        public MyFragmentTabHost mTabHost;

    mAddBt = findViewById(R.id.quick_option_iv);

    mTabHost = (MyFragmentTabHost) findViewById(android.R.id.tabhost);
    //TODO/*from  w w w  . j a  v  a  2 s  . c  o  m*/
    //        mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
    //                .findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    //TODO
    //        mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
    //                (DrawerLayout) findViewById(R.id.drawer_layout));

    mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    if (android.os.Build.VERSION.SDK_INT > 10) {
        mTabHost.getTabWidget().setShowDividers(0);
    }

    initTabs();

    // ?
    mAddBt.setOnClickListener(this);
    mAddBt.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            startActivity(new Intent(MainActivity.this, NetSetupActivity.class));
            return true;
        }
    });

    mTabHost.setCurrentTab(0);
    mTabHost.setOnTabChangedListener(this);

    IntentFilter filter = new IntentFilter(Constants.INTENT_ACTION_NOTICE);
    filter.addAction(Constants.INTENT_ACTION_LOGOUT);
    registerReceiver(mReceiver, filter);
    NoticeUtils.bindToService(this);

    if (AppContext.isFristStart()) {
        //            mNavigationDrawerFragment.openDrawerMenu();
        DataCleanManager.cleanInternalCache(AppContext.getInstance());
        AppContext.setFristStart(false);
    }

    //        checkUpdate();
}

From source file:com.iss.android.wearable.datalayer.MainActivity.java

private void RegisterBroadcastsReceiver() {

    IntentFilter filter = new IntentFilter();
    filter.addAction(SensorsDataService.ACTION_BATTERY_STATUS);
    filter.addAction(SensorsDataService.ACTION_HR);
    filter.addAction(SensorsDataService.NEW_MESSAGE_AVAILABLE);
    filter.addAction(SensorsDataService.ASK_USER_FOR_RPE);
    filter.addAction(SensorsDataService.UPDATE_TIMER_VALUE);
    filter.addAction(SensorsDataService.UPDATE_GPS_PARAMS);
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    registerReceiver(br, filter);/*ww  w.  j ava 2 s . co m*/

}

From source file:com.google.android.gcm.demo.app.BluetoothHDPActivity.java

private IntentFilter initIntentFilter() {
    IntentFilter filter = new IntentFilter();
    filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
    return filter;
}

From source file:com.example.haber.ui.activity.CallActivity.java

private void initialize() {
    myCallOutFragmentBroadcaseReceiver = new MyCallOutFragmentBroadcaseReceiver();
    IntentFilter filter = new IntentFilter(Const.UPDATE_CALL_HISTORY);
    filter.addAction(Const.CALL_OUT);
    filter.addAction(Const.CALL_FAIL);//w  w  w  .  jav  a  2  s .c  o  m
    filter.addAction(Const.HANDLE_BASICGKCONFIG);
    filter.addAction(Const.ACTION_UPDATA_LICENSE_INFO);
    filter.addAction(Const.CALL_STATUS);
    registerReceiver(myCallOutFragmentBroadcaseReceiver, filter);
    callHistories = new HashSet<String>();
    Tools.startCloseSoftKeyboard(this);

    addCallHistory();
    callOutBiz = getCallOutBiz();//?biz

    int bw = getIntFromSharedPreferences(CALL_BW);
    LogUtil.i(TAG, bw + "");
    if (bw == -1) {
        currentDefaultBW = 1024;
    } else {
        currentDefaultBW = bw;
        for (int i = 0; i < callBWs.length; i++) {//?
            if (Integer.parseInt(callBWs[i]) == currentDefaultBW) {
                currentDefaultBWPosition = i;
            }
        }
        seekBar.setProgress(currentDefaultBWPosition);
        tvBW.setText(String.valueOf(currentDefaultBW));
    }
    //?Haber??
    handlerBasicGKConfig();
    handlerCallStatus();
    updataLicenseInfo();
}

From source file:com.tumaku.msmble.HM10Activity.java

@Override
public void onResume() {
    super.onResume();
    IntentFilter filter = new IntentFilter(TumakuBLE.WRITE_SUCCESS);
    filter.addAction(TumakuBLE.READ_SUCCESS);
    filter.addAction(TumakuBLE.DEVICE_CONNECTED);
    filter.addAction(TumakuBLE.DEVICE_DISCONNECTED);
    filter.addAction(TumakuBLE.SERVICES_DISCOVERED);
    filter.addAction(TumakuBLE.NOTIFICATION);
    filter.addAction(TumakuBLE.WRITE_DESCRIPTOR_SUCCESS);
    this.registerReceiver(mBroadcastReceiver, filter);
    if (mTumakuBLE.isConnected()) {
        mState = WSTATE_NOTIFY_KEY;/*from www  .  j  av a 2  s .  c o  m*/
        nextState();
        updateInfoText("Resume connection to device");
    } else {
        mState = WSTATE_CONNECT;
        nextState();
        //          updateInfoText("Start connection to device");
    }

}

From source file:com.aware.ui.Plugins_Manager.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.plugins_store_ui);

    super.onCreate(savedInstanceState);

    inflater = getLayoutInflater();/*from   w  w w  .java 2s  . c  om*/
    store_grid = (GridLayout) findViewById(R.id.plugins_store_grid);
    loading_plugins = (ProgressBar) findViewById(R.id.loading_plugins);

    IntentFilter filter = new IntentFilter();
    filter.addAction(Aware.ACTION_AWARE_PLUGIN_MANAGER_REFRESH);
    registerReceiver(plugins_listener, filter);
}

From source file:com.digitalarx.android.ui.preview.PreviewImageActivity.java

@Override
protected void onResume() {
    super.onResume();
    //Log.e(TAG, "ACTIVITY, ONRESUME");
    mDownloadFinishReceiver = new DownloadFinishReceiver();

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

From source file:com.andrew.apollo.ui.activities.BaseActivity.java

/**
 * {@inheritDoc}//from w  w  w . j  av a2 s  . co m
 */
@Override
protected void onStart() {
    super.onStart();
    final IntentFilter filter = new IntentFilter();
    // Play and pause changes
    filter.addAction(MusicPlaybackService.PLAYSTATE_CHANGED);
    // Shuffle and repeat changes
    filter.addAction(MusicPlaybackService.SHUFFLEMODE_CHANGED);
    filter.addAction(MusicPlaybackService.REPEATMODE_CHANGED);
    // Track changes
    filter.addAction(MusicPlaybackService.META_CHANGED);
    // Update a list, probably the playlist fragment's
    filter.addAction(MusicPlaybackService.REFRESH);
    registerReceiver(mPlaybackStatus, filter);
    MusicUtils.notifyForegroundStateChanged(this, true);
}

From source file:com.cityfreqs.littlesirecho.MainActivity.java

private void initLittleSirEcho() {
    IntentFilter filter = new IntentFilter();
    filter.addAction(LISTENER_STRING);
    LSEsr = new LSEServiceReceiver();

    LocalBroadcastManager.getInstance(this).registerReceiver(LSEsr, new IntentFilter(LISTENER_STRING));
    soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    setAwakeView();//from   w ww.j a v a2 s.c  om
    startHourPicker = (NumberPicker) findViewById(R.id.start_hour_picker);
    startHourPicker.setMinValue(0);
    startHourPicker.setMaxValue(11);
    startHourPicker.setValue(DEFAULT_AWAKE_START);
    startHourPicker.setWrapSelectorWheel(false);
    // stop numpad auto appearing
    startHourPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    // set listener here instead of implementing at activity level
    startHourPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            if (picker == startHourPicker) {
                if (newVal != userAwakeStart) {
                    userAwakeStart = newVal;
                    setAwakeView();
                }
            }
        }
    });

    endHourPicker = (NumberPicker) findViewById(R.id.end_hour_picker);
    endHourPicker.setMinValue(12);
    endHourPicker.setMaxValue(23);
    endHourPicker.setValue(DEFAULT_AWAKE_END);
    endHourPicker.setWrapSelectorWheel(false);
    // stop numpad auto appearing
    endHourPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    // set listener here instead of implementing at activity level
    endHourPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            if (picker == endHourPicker) {
                if (newVal != userAwakeEnd) {
                    userAwakeEnd = newVal;
                    setAwakeView();
                }
            }
        }
    });
}

From source file:com.boko.vimusic.ui.activities.BaseActivity.java

/**
 * {@inheritDoc}/*from  ww w .  j  av  a  2  s . co m*/
 */
@Override
protected void onStart() {
    super.onStart();
    final IntentFilter filter = new IntentFilter();
    // Play and pause changes
    filter.addAction(MediaPlaybackService.EVENT_PLAYSTATE_CHANGED);
    // Shuffle and repeat changes
    filter.addAction(MediaPlaybackService.EVENT_SHUFFLEMODE_CHANGED);
    filter.addAction(MediaPlaybackService.EVENT_REPEATMODE_CHANGED);
    // Track changes
    filter.addAction(MediaPlaybackService.EVENT_META_CHANGED);
    // Update a list, probably the playlist fragment's
    filter.addAction(REFRESH_REQUESTED);
    registerReceiver(mPlaybackStatus, filter);
    MusicUtils.notifyForegroundStateChanged(this, true);
}