List of usage examples for android.content IntentFilter IntentFilter
public IntentFilter(Parcel source)
From source file:net.majorkernelpanic.spydroid.ui.HandsetFragment.java
@Override public void onResume() { super.onResume(); if (!SessionManager.getManager().isStreaming()) displayIpAddress();/*from ww w . ja va 2s . c o m*/ else streamingState(1); getActivity().registerReceiver(mWifiStateReceiver, new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION)); }
From source file:com.roamprocess1.roaming4world.ui.messages.MessageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = getSharedPreferences("com.roamprocess1.roaming4world", Context.MODE_PRIVATE); stored_chatuserNumber = "com.roamprocess1.roaming4world.stored_chatuserNumber"; stored_user_mobile_no = "com.roamprocess1.roaming4world.user_mobile_no"; stored_user_country_code = "com.roamprocess1.roaming4world.user_country_code"; stored_supportnumber = "com.roamprocess1.roaming4world.support_no"; stored_server_ipaddress = "com.roamprocess1.roaming4world.server_ip"; usernum = prefs.getString(stored_user_country_code, "") + prefs.getString(stored_user_mobile_no, ""); System.out.println("MessageActivity.java before if statement of savedInstanceState "); if (savedInstanceState == null) { // During initial setup, plug in the details fragment. System.out.println("MessageActivity.java after if statement of savedInstanceState "); detailFragment = new MessageFragment(); detailFragment.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction().add(android.R.id.content, detailFragment).commit(); detailFragment.setOnQuitListener(this); }// www.j av a 2s . c o m if (getConnectivityStatus(getApplicationContext()) == TYPE_NOT_CONNECTED) dialogBoxNoInternet(); broadcastReceiver_socket_userStatus = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String action = intent.getAction(); Log.d("Receiver", "Broadcast received: " + action); if (action.equals(ChatSocket.USER_STATUS)) { String state = intent.getExtras().getString(ChatSocket.USER_STATUS); Log.d("Receiver state", state + " @"); setStatus(state); } } }; broadcastReceiver_lost = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Log.d("broadcastReceiver_lost", "called"); tv_userStatus.setText(""); } }; registerReceiver(broadcastReceiver_lost, new IntentFilter("INTERNET_LOST")); registerReceiver(broadcastReceiver_socket_userStatus, new IntentFilter(ChatSocket.USER_STATUS)); }
From source file:com.app.jdy.activity.GoldActivity.java
private void initView() { mContext = this; notice_tip = getResources().getString(R.string.no_more_product); linearLayout_net_error = (LinearLayout) findViewById(R.id.linearLayout_net_error); linearLayout_content = (LinearLayout) findViewById(R.id.linearLayout_content); //imageLayout_net_error = (LinearLayout) findViewById(R.id.imageLayout_net_error); back_img = (ImageView) findViewById(R.id.back_img); title_tv = (TextView) findViewById(R.id.title_tv); right_img = (ImageView) findViewById(R.id.right_img); right_img.setBackgroundResource(R.drawable.search); right_img.setOnClickListener(this); if (flag == 0) { request_url = URLs.GETPRODUCTLIST; title_tv.setText(""); back_img.setVisibility(View.INVISIBLE); } else if (flag == 1) { request_url = URLs.FOLLOWLIST_URL; title_tv.setText("?"); back_img.setVisibility(View.VISIBLE); menu = new SlidingMenu(this); menu.setMode(SlidingMenu.RIGHT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f);/*w w w. j ava2 s. c o m*/ menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); View view = LayoutInflater.from(mContext).inflate(R.layout.search_popuwindow, null); edit_search = (EditText) view.findViewById(R.id.edit_search); lv_search = (ListView) view.findViewById(R.id.lv_search); searchListViewAdapter = new SearchListViewAdapter(strs, mContext); lv_search.setAdapter(searchListViewAdapter); lv_search.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) { TextView tv = (TextView) view.findViewById(R.id.tv_search); Intent intent = new Intent(); intent.setAction("org.jdy.action.LV_SEARCH_BROADCAST"); intent.putExtra("search_ProdType", CommonUtils.CodeForName(tv.getText().toString())); intent.putExtra("reqFlag", 1); sendBroadcast(intent); menu.showContent(); }; }); btn_search = (Button) view.findViewById(R.id.btn_search); btn_search.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CommonUtils.HideKeyBoard(mContext, edit_search); Intent intent = new Intent(); intent.setAction("org.jdy.action.KEYWORD_SEARCH_BROADCAST"); intent.putExtra("search_keyWord", edit_search.getText().toString()); intent.putExtra("reqFlag", 1); sendBroadcast(intent); menu.showContent(); } }); menu.setMenu(view); slidingMenuLayout = (LinearLayout) findViewById(R.id.slidingmenu); final Bitmap bitmap = BitmapUtils.readBitMap(mContext, R.drawable.sliding_bg, slidingMenuLayout.getMeasuredWidth(), slidingMenuLayout.getMeasuredHeight()); slidingMenuLayout.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() { @Override public boolean onPreDraw() { slidingMenuLayout.getViewTreeObserver().removeOnPreDrawListener(this); BitmapUtils.blur(bitmap, slidingMenuLayout); return true; } }); } back_img.setOnClickListener(this); order_layout = (LinearLayout) findViewById(R.id.order_layout); line_minSubsAmount = (LinearLayout) findViewById(R.id.line_minSubsAmount); line_expeAnnuRevnue = (LinearLayout) findViewById(R.id.line_expeAnnuRevnue); line_period = (LinearLayout) findViewById(R.id.line_period); orderLayouts.add(line_minSubsAmount); orderLayouts.add(line_expeAnnuRevnue); orderLayouts.add(line_period); line_expeAnnuRevnue.setOnClickListener(this); line_minSubsAmount.setOnClickListener(this); line_period.setOnClickListener(this); ATListview = (MyListView) findViewById(R.id.gold_Listview); ATListview.setOnItemClickListener(new onClickview()); listViewAdapter = new ListViewAdapter(mContext, productList); ATListview.setAdapter(listViewAdapter); mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.gold_pull_refresh_scrollview); /** * */ lvSearchReceiver = new LV_SEARCH_BROADCAST(); IntentFilter intentFilter2 = new IntentFilter("org.jdy.action.LV_SEARCH_BROADCAST"); registerReceiver(lvSearchReceiver, intentFilter2); keyWordSearchReceiver = new KeyWordSearchReceiver(); IntentFilter intentFilter3 = new IntentFilter("org.jdy.action.KEYWORD_SEARCH_BROADCAST"); registerReceiver(keyWordSearchReceiver, intentFilter3); /** * ? */ mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { pageNumber++; notice_tip = getResources().getString(R.string.no_more_product); new QueryProductListTask().execute(); mPullRefreshScrollView.onRefreshComplete(); } }); new QueryProductListTask().execute(); }
From source file:com.CPTeam.VselCalc.AutoUpdateApk.java
private void setupVariables(Context ctx) { context = ctx;/*from w w w.j av a 2 s .c o m*/ packageName = context.getPackageName(); preferences = context.getSharedPreferences(packageName + "_" + TAG, Context.MODE_PRIVATE); device_id = crc32(Secure.getString(context.getContentResolver(), Secure.ANDROID_ID)); last_update = preferences.getLong("last_update", 0); NOTIFICATION_ID += crc32(packageName); ApplicationInfo appinfo = context.getApplicationInfo(); if (appinfo.icon != 0) { appIcon = appinfo.icon; } else { Log_w(TAG, "unable to find application icon"); } if (appinfo.labelRes != 0) { appName = context.getString(appinfo.labelRes); } else { Log_w(TAG, "unable to find application label"); } if (new File(appinfo.sourceDir).lastModified() > preferences.getLong(MD5_TIME, 0)) { preferences.edit().putString(MD5_KEY, MD5Hex(appinfo.sourceDir)).commit(); preferences.edit().putLong(MD5_TIME, System.currentTimeMillis()).commit(); String update_file = preferences.getString(UPDATE_FILE, ""); if (update_file.length() > 0) { if (new File(context.getFilesDir().getAbsolutePath() + "/" + update_file).delete()) { preferences.edit().remove(UPDATE_FILE).remove(SILENT_FAILED).commit(); } } } raise_notification(); if (haveInternetPermissions()) { context.registerReceiver(connectivity_receiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); } }
From source file:com.example.ronald.tracle.MainActivity.java
@Override protected void onResume() { super.onResume(); LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver, new IntentFilter(QuickstartPreferences.REGISTRATION_COMPLETE)); }
From source file:com.tweetlanes.android.core.view.TweetFeedFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); mProfileImageLoader = getApp().getProfileImageLoader(); mPreviewImageLoader = getApp().getPreviewImageLoader(); mContentHandle = TwitterManager.get().getContentHandle(getContentHandleBase(), getScreenName(), getLaneIdentifier(), getApp().getCurrentAccountKey()); View resultView = inflater.inflate(R.layout.lane, null); configureLaneWidth(resultView);//from ww w. java 2 s .co m mViewSwitcher = (ViewSwitcher) resultView.findViewById(R.id.profileSwitcher); mListHeadingTextView = (TextView) resultView.findViewById(R.id.list_heading); mListHeadingHideImage = (ImageView) resultView.findViewById(R.id.list_hide); mListHeadingHideImage.setOnClickListener(mListHeadingHideImageOnClickListener); mMultipleTweetSelectionCallback = new MultipleTweetSelectionCallback(); mTweetFeedListAdapter = new TweetFeedListAdapter(inflater); mTweetFeedListView = (PullToRefreshListView) resultView.findViewById(R.id.pull_to_refresh_listview); mTweetFeedListView.getRefreshableView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); mTweetFeedListView.getRefreshableView().setMultiChoiceModeListener(mMultipleTweetSelectionCallback); mTweetFeedListView.getRefreshableView().setOnScrollListener(mTweetFeedOnScrollListener); mTweetFeedListView.getRefreshableView().setAdapter(mTweetFeedListAdapter); mTweetFeedListView.setOnRefreshListener(mTweetFeedOnRefreshListener); mTweetFeedListView.setOnLastItemVisibleListener(mTweetFeedOnLastItemVisibleListener); mRefreshTimestampsHandler.removeCallbacks(mRefreshTimestampsTask); mRefreshTimestampsHandler.postDelayed(mRefreshTimestampsTask, REFRESH_TIMESTAMPS_INTERVAL); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mVolumeUpKeyDownReceiver, new IntentFilter("" + SystemEvent.VOLUME_UP_KEY_DOWN)); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mVolumeDownKeyDownReceiver, new IntentFilter("" + SystemEvent.VOLUME_DOWN_KEY_DOWN)); if (savedInstanceState != null) { mTwitterStatusIdWhenRefreshed = savedInstanceState.containsKey("TwitterStatusIdWhenRefreshed") ? savedInstanceState.getLong("TwitterStatusIdWhenRefreshed") : 0L; mLastTwitterStatusIdSeen = savedInstanceState.containsKey("LastTwitterStatusIdSeen") ? savedInstanceState.getLong("LastTwitterStatusIdSeen") : 0L; mNewStatuses = savedInstanceState.getInt("NewStatuses", 0); mHidingListHeading = savedInstanceState.getBoolean("HidingListHeading", false); } configureInitialStatuses(); return resultView; }
From source file:com.att.android.arodatacollector.activities.AROCollectorHomeActivity.java
/** * override the parent method to register the usb broadcast receiver */// w w w .j a v a2 s.c o m @Override public void onResume() { super.onResume(); try { registerReceiver(USBBroadcastReceiver, new IntentFilter(AROCollectorTraceService.USB_BROADCAST_ACTION)); AROLogger.d(TAG, "registered USBBroadcastReceiver in onResume()"); } catch (Exception e) { AROLogger.i(TAG, "Exception caught in onResume.registerReceiver(). Will ignore", e); } }
From source file:com.myStress.handlers.NotificationHandlerService.java
/** * Called when the service is started (usually after boot). We register the events we are interested in (change of notification) and also register to the start broadcast event, sent by myStress * Originally, we set the package filters to something that does not exist, so that we minimise the firing of the callback * After the start broadcast event will be received, the proper package names will be set for recording * @see android.accessibilityservice.AccessibilityService#onServiceConnected() *//*from w ww. j a v a2 s .com*/ @Override protected void onServiceConnected() { // register for any input from the accessbility service IntentFilter intentFilter = new IntentFilter("com.myStress.accessibility.start"); registerReceiver(SystemReceiver, intentFilter); // now switch off initially AccessibilityServiceInfo info = new AccessibilityServiceInfo(); info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; info.feedbackType = AccessibilityServiceInfo.FEEDBACK_ALL_MASK; info.notificationTimeout = 100; Log.e("myStress", "NotificationHandlerService connected"); setServiceInfo(info); Translate.setClientId("myStress"); Translate.setClientSecret("ZwRLv7hsttnjqql26s7MglS8enqHG5Wi+uLfzt7Jsgw="); }
From source file:com.google.android.gcm.GCMRegistrar.java
/** * Lazy initializes the {@link GCMBroadcastReceiver} instance. */// w w w. ja v a2s . c om private static synchronized void setRetryBroadcastReceiver(Context context) { if (sRetryReceiver == null) { sRetryReceiver = new GCMBroadcastReceiver(); String category = context.getPackageName(); IntentFilter filter = new IntentFilter(GCMConstants.INTENT_FROM_GCM_LIBRARY_RETRY); filter.addCategory(category); // must use a permission that is defined on manifest for sure String permission = category + ".permission.C2D_MESSAGE"; Log.v(TAG, "Registering receiver"); context.registerReceiver(sRetryReceiver, filter, permission, null); } }