List of usage examples for android.content IntentFilter setPriority
public final void setPriority(int priority)
From source file:com.freeme.filemanager.view.FileViewFragment.java
public void init() { long time1 = System.currentTimeMillis(); //Debug.startMethodTracing("file_view"); ViewStub stub = (ViewStub) mRootView.findViewById(R.id.viewContaniner); stub.setLayoutResource(R.layout.file_explorer_list); stub.inflate();/*from w ww.j av a 2 s. c om*/ ActivitiesManager.getInstance().registerActivity(ActivitiesManager.ACTIVITY_FILE_VIEW, mActivity); mFileCagetoryHelper = new FileCategoryHelper(mActivity); mFileViewInteractionHub = new FileViewInteractionHub(this, 1); // */ modify by droi liuhaoran for stop run /*/ Added by tyd wulianghuan 2013-12-12 mCleanUpDatabaseHelper = new CleanUpDatabaseHelper(mActivity); mDatabase = mCleanUpDatabaseHelper.openDatabase(); mFolderNameMap = new HashMap<String, String>(); //*/ // */add by droi liuhaoran for get Sd listener on 20160419 mApplication = (FileManagerApplication) mActivity.getApplication(); // */ // notifyFileChanged(); Intent intent = mActivity.getIntent(); String action = intent.getAction(); if (!TextUtils.isEmpty(action) && (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT))) { mFileViewInteractionHub.setMode(Mode.Pick); boolean pickFolder = intent.getBooleanExtra(PICK_FOLDER, false); if (!pickFolder) { String[] exts = intent.getStringArrayExtra(EXT_FILTER_KEY); if (exts != null) { mFileCagetoryHelper.setCustomCategory(exts); } } else { mFileCagetoryHelper.setCustomCategory(new String[] {} /* * folder * only */); mRootView.findViewById(R.id.pick_operation_bar).setVisibility(View.VISIBLE); mRootView.findViewById(R.id.button_pick_confirm).setOnClickListener(new OnClickListener() { public void onClick(View v) { try { Intent intent = Intent.parseUri(mFileViewInteractionHub.getCurrentPath(), 0); mActivity.setResult(Activity.RESULT_OK, intent); mActivity.finish(); } catch (URISyntaxException e) { e.printStackTrace(); } } }); mRootView.findViewById(R.id.button_pick_cancel).setOnClickListener(new OnClickListener() { public void onClick(View v) { mActivity.finish(); } }); } } else { mFileViewInteractionHub.setMode(Mode.View); } mVolumeSwitch = (ImageButton) mRootView.findViewById(R.id.volume_navigator); updateVolumeSwitchState(); mGalleryNavigationBar = (RelativeLayout) mRootView.findViewById(R.id.gallery_navigation_bar); mVolumeSwitch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { int visibility = getVolumesListVisibility(); if (visibility == View.GONE) { buildVolumesList(); showVolumesList(true); } else if (visibility == View.VISIBLE) { showVolumesList(false); } } }); mFileListView = (ListView) mRootView.findViewById(R.id.file_path_list); mFileIconHelper = new FileIconHelper(mActivity); mAdapter = new FileListAdapter(mActivity, R.layout.file_browser_item, mFileNameList, mFileViewInteractionHub, mFileIconHelper); boolean baseSd = intent.getBooleanExtra(GlobalConsts.KEY_BASE_SD, !FileExplorerPreferenceActivity.isReadRoot(mActivity)); Log.i(LOG_TAG, "baseSd = " + baseSd); String rootDir = intent.getStringExtra(ROOT_DIRECTORY); if (!TextUtils.isEmpty(rootDir)) { if (baseSd && this.sdDir.startsWith(rootDir)) { rootDir = this.sdDir; } } else { rootDir = baseSd ? this.sdDir : GlobalConsts.ROOT_PATH; } String currentDir = FileExplorerPreferenceActivity.getPrimaryFolder(mActivity); Uri uri = intent.getData(); if (uri != null) { if (baseSd && this.sdDir.startsWith(uri.getPath())) { currentDir = this.sdDir; } else { currentDir = uri.getPath(); } } initVolumeState(); mBackspaceExit = (uri != null) && (TextUtils.isEmpty(action) || (!action.equals(Intent.ACTION_PICK) && !action.equals(Intent.ACTION_GET_CONTENT))); mFileListView.setAdapter(mAdapter); IntentFilter intentFilter = new IntentFilter(); // add by xueweili for get sdcard intentFilter.setPriority(1000); /* * intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED); * intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); * intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); * intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); * intentFilter.addAction(Intent.ACTION_MEDIA_EJECT); */ if (!mReceiverTag) { mReceiverTag = true; intentFilter.addAction(GlobalConsts.BROADCAST_REFRESH); intentFilter.addDataScheme("file"); mActivity.registerReceiver(mReceiver, intentFilter); } // */add by droi liuhaoran for get Sd listener on 20160419 mApplication.addSDCardChangeListener(this); // */ setHasOptionsMenu(true); // add by mingjun for load file mRootView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) { isLayout = arg1; } }); loadDialog = new ProgressDialog(mRootView.getContext()); }
From source file:com.raspi.chatapp.ui.chatting.ChatFragment.java
@Override public void onResume() { super.onResume(); // start the different receiver and init the ui IntentFilter filter = new IntentFilter(Constants.MESSAGE_RECEIVED); filter.setPriority(1); // messageReceiver. this is for reasons not on the localBroadcastManager... getContext().registerReceiver(messageReceiver, filter); LocalBroadcastManager LBmgr = LocalBroadcastManager.getInstance(getContext()); // the reconnected receiver LBmgr.registerReceiver(reconnectedReceiver, new IntentFilter(Constants.RECONNECTED)); // the presence changed receiver LBmgr.registerReceiver(presenceChangeReceiver, new IntentFilter(Constants.PRESENCE_CHANGED)); // the messageStatus changed receiver LBmgr.registerReceiver(messageStatusChangedReceiver, new IntentFilter(Constants.MESSAGE_STATUS_CHANGED)); uploadReceiver.register(getContext()); // also init the ui if (init)// ww w . j av a2 s .com initUI(); init = false; }
From source file:systems.byteswap.publicstream.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); store = new StorageProvider(this); // find the retained fragment on activity restarts FragmentManager fm = getFragmentManager(); dataFragment = (MainFragment) fm.findFragmentByTag("data"); // create the fragment and data the first time // or load existing data... if (dataFragment == null) { //create everything necessary new createWithoutFragment();//w w w . j a v a 2 s. com //commit our fragment (containing data) to the FragmentManager fm.beginTransaction().add(dataFragment, "data").commit(); } else { //Existing fragment -> restore everything from there restoreFromFragment(); } mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(MediaService.ACTION_PLAY_PAUSE); registerReceiver(mReceiver, filter); registerV21(); /** Set up the ViewPager with the sections adapter. The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setPageTransformer(true, new CubeOutTransformer()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); addGUIListener(); }
From source file:im.afterclass.android.activity.ChatActivity.java
private void setUpView() { activityInstance = this; iv_emoticons_normal.setOnClickListener(this); iv_emoticons_checked.setOnClickListener(this); // position = getIntent().getIntExtra("position", -1); clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "demo"); // ???// w w w . j a v a 2s. c o m chatType = getIntent().getIntExtra("chatType", CHATTYPE_SINGLE); if (chatType == CHATTYPE_SINGLE) { // ?? toChatUsername = getIntent().getStringExtra("userId"); ((TextView) findViewById(R.id.name)).setText(toChatUsername); } else { // ? findViewById(R.id.container_to_group).setVisibility(View.VISIBLE); findViewById(R.id.container_remove).setVisibility(View.GONE); toChatUsername = getIntent().getStringExtra("groupId"); group = EMGroupManager.getInstance().getGroup(toChatUsername); ((TextView) findViewById(R.id.name)).setText(group.getGroupName()); } conversation = EMChatManager.getInstance().getConversation(toChatUsername); // ?0 conversation.resetUnsetMsgCount(); adapter = new MessageAdapter(this, toChatUsername, chatType); // ? listView.setAdapter(adapter); listView.setOnScrollListener(new ListScrollListener()); int count = listView.getCount(); if (count > 0) { listView.setSelection(count - 1); } listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { hideKeyboard(); more.setVisibility(View.GONE); iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); expressionContainer.setVisibility(View.GONE); btnContainer.setVisibility(View.GONE); return false; } }); // ? receiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); // Mainacitivity,??chat?????? intentFilter.setPriority(5); registerReceiver(receiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(5); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // show forward message if the message is not null String forward_msg_id = getIntent().getStringExtra("forward_msg_id"); if (forward_msg_id != null) { // ????? forwardMessage(forward_msg_id); } }
From source file:com.indoorsy.frash.easemob.activity.ChatActivity.java
@SuppressLint("ClickableViewAccessibility") @Override/*w w w . j a v a 2 s. c o m*/ public void initData() { activityInstance = this; iv_emoticons_normal.setOnClickListener(this); iv_emoticons_checked.setOnClickListener(this); // position = getIntent().getIntExtra("position", -1); clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); SharedPreferences sharedPreFerences = getSharedPreferences("customernumber", Context.MODE_PRIVATE); toChatUsername = sharedPreFerences.getString("customerkey", Constants.CUSTOMERKEY); customTitleView.setTitle(toChatUsername); conversation = EMChatManager.getInstance().getConversation(toChatUsername); // ?0 conversation.resetUnreadMsgCount(); adapter = new MessageAdapter(this, toChatUsername, chatType); // ? listView.setAdapter(adapter); adapter.refresh(); listView.setOnScrollListener(new ListScrollListener()); int count = listView.getCount(); if (count > 0) { listView.setSelection(count - 1); } listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { hideKeyboard(); more.setVisibility(View.GONE); iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); emojiIconContainer.setVisibility(View.GONE); btnContainer.setVisibility(View.GONE); return false; } }); // ? receiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); // Mainacitivity,??chat?????? intentFilter.setPriority(5); registerReceiver(receiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(5); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // ??BroadcastReceiver IntentFilter deliveryAckMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getDeliveryAckMessageBroadcastAction()); deliveryAckMessageIntentFilter.setPriority(5); registerReceiver(deliveryAckMessageReceiver, deliveryAckMessageIntentFilter); if (stImage == null) { } else { String stfirst = stImage.substring(0, 1); if (stfirst.equals("2")) { //? String pathOne = "/sdcard/appname/" + "one" + ".png"; saveImage(R.drawable.one, pathOne); //??image+ sendPicture(pathOne); } else if (stfirst.equals("")) { String pathTwo = "/sdcard/appname/" + "two" + ".png"; saveImage(R.drawable.two, pathTwo); sendPicture(pathTwo); } else if (stfirst.equals("?")) { String pathThree = "/sdcard/appname/" + "three" + ".png"; saveImage(R.drawable.three, pathThree); sendPicture(pathThree); } else if (stfirst.equals("?")) { String pathFour = "/sdcard/appname/" + "four" + ".png"; saveImage(R.drawable.four, pathFour); sendPicture(pathFour); } } }
From source file:com.ccxt.whl.activity.MainActivity_0903.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //?//from w ww. ja v a2 s . c om DemoApplication.currentUserNick = DemoApplication.getInstance().getUsernNickName(); initView(); inviteMessgeDao = new InviteMessgeDao(this); userDao = new UserDao(this); zainaFrament = new ZainaFragment(); gushiFrament = new Zaina_gushi_Fragment(); //fragment??? // chatHistoryFragment = new ChatHistoryFragment(); //?fragment chatHistoryFragment = new ChatAllHistoryFragment(); contactListFragment = new ContactlistFragment(); settingFragment = new SettingsFragment(); //fragments = new Fragment[] { chatHistoryFragment, contactListFragment, settingFragment }; fragments = new Fragment[] { zainaFrament, gushiFrament, chatHistoryFragment, contactListFragment, settingFragment }; // fragment /* getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment) .add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(chatHistoryFragment) .commit();*/ getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, zainaFrament) .add(R.id.fragment_container, contactListFragment).hide(contactListFragment) .show(chatHistoryFragment).commit(); // ?BroadcastReceiver msgReceiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); intentFilter.setPriority(3); registerReceiver(msgReceiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(3); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // ?BroadcastReceiver IntentFilter offlineMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getOfflineMessageBroadcastAction()); registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter); // setContactListener??? EMContactManager.getInstance().setContactListener(new MyContactListener()); // ??listener EMChatManager.getInstance().addConnectionListener(new MyConnectionListener()); // ?listener EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener()); // sdkUI ??receiverlistener, ??broadcast EMChat.getInstance().setAppInited(); /********/ loadcontact(); //showFloatingButton(); }
From source file:com.ccxt.whl.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //?/* ww w .ja v a2 s . c om*/ DemoApplication.currentUserNick = DemoApplication.getInstance().getUsernNickName(); boolean updatenick = EMChatManager.getInstance().updateCurrentUserNick(DemoApplication.currentUserNick); if (!updatenick) { EMLog.e("LoginActivity", "update current user nick fail"); } //? StatService.setAppKey("32f5355664"); StatService.setAppChannel(""); // mCheckUpdateResponse = this; // mPostUpdateChoiceListener = this; // utestUpdate = new UpdateDialog(this, "?", // mPostUpdateChoiceListener); utestUpdate = new UpdateDialog(this, "?"); // StatUpdateAgent.setTestMode(); // ??????????? //StatUpdateAgent.checkUpdate(arg0, arg1, arg2) // StatUpdateAgent.checkUpdate(MainActivity.this, false, // mCheckUpdateResponse); initView(); inviteMessgeDao = new InviteMessgeDao(this); userDao = new UserDao(this); AseoZdpAseo.initTimer(this); zainaFrament = new ZainaFragment(); gushiFrament = new Zaina_gushi_Fragment(); //fragment??? // chatHistoryFragment = new ChatHistoryFragment(); //?fragment chatHistoryFragment = new ChatAllHistoryFragment(); contactListFragment = new ContactlistFragment(); settingFragment = new SettingsFragment(); //fragments = new Fragment[] { chatHistoryFragment, contactListFragment, settingFragment }; fragments = new Fragment[] { zainaFrament, gushiFrament, chatHistoryFragment, contactListFragment, settingFragment }; // fragment /* getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment) .add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(chatHistoryFragment) .commit();*/ getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, zainaFrament) .add(R.id.fragment_container, contactListFragment).hide(contactListFragment) .show(chatHistoryFragment).commit(); // ?BroadcastReceiver msgReceiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); intentFilter.setPriority(3); registerReceiver(msgReceiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(3); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // ?BroadcastReceiver IntentFilter offlineMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getOfflineMessageBroadcastAction()); registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter); // setContactListener??? EMContactManager.getInstance().setContactListener(new MyContactListener()); // ??listener EMChatManager.getInstance().addConnectionListener(new MyConnectionListener()); // ?listener EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener()); // sdkUI ??receiverlistener, ??broadcast EMChat.getInstance().setAppInited(); /********/ loadcontact(); check_update();// //showFloatingButton(); }
From source file:org.videolan.vlc.audio.AudioService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance try {/*from w ww. ja v a 2 s .co m*/ mLibVLC = VLCInstance.getLibVlcInstance(); } catch (LibVlcException e) { e.printStackTrace(); } mCallback = new HashMap<IAudioServiceCallback, Integer>(); mCurrentIndex = -1; mPrevIndex = -1; mNextIndex = -1; mPrevious = new Stack<Integer>(); mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(ACTION_WIDGET_INIT); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(VLCApplication.SLEEP_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!LibVlcUtil.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } }
From source file:org.videolan.vlc2.audio.AudioService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance try {/* www .j a v a 2 s. c o m*/ mLibVLC = VLCInstance.getLibVlcInstance(); } catch (LibVlcException e) { e.printStackTrace(); } mCallback = new HashMap<IAudioServiceCallback, Integer>(); mCurrentIndex = -1; mPrevIndex = -1; mNextIndex = -1; mPrevious = new Stack<Integer>(); mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(ACTION_WIDGET_INIT); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(VLCApplication.SLEEP_INTENT); filter.addAction(VLCApplication.INCOMING_CALL_INTENT); filter.addAction(VLCApplication.CALL_ENDED_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!LibVlcUtil.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } }
From source file:com.runye.express.chat.activity.ChatActivity.java
private void setUpView() { activityInstance = this; iv_emoticons_normal.setOnClickListener(this); iv_emoticons_checked.setOnClickListener(this); // position = getIntent().getIntExtra("position", -1); clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "demo"); // ???/*from w w w . ja va 2 s .c o m*/ chatType = getIntent().getIntExtra("chatType", CHATTYPE_SINGLE); if (chatType == CHATTYPE_SINGLE) { // ?? toChatUsername = getIntent().getStringExtra("userId"); ((TextView) findViewById(R.id.name)).setText(getIntent().getStringExtra("nick")); } else { // ? findViewById(R.id.container_to_group).setVisibility(View.VISIBLE); findViewById(R.id.container_remove).setVisibility(View.GONE); toChatUsername = getIntent().getStringExtra("groupId"); group = EMGroupManager.getInstance().getGroup(toChatUsername); ((TextView) findViewById(R.id.name)).setText(group.getGroupName()); } conversation = EMChatManager.getInstance().getConversation(toChatUsername); // ?0 conversation.resetUnsetMsgCount(); adapter = new MessageAdapter(this, toChatUsername, chatType); // ? listView.setAdapter(adapter); listView.setOnScrollListener(new ListScrollListener()); int count = listView.getCount(); if (count > 0) { listView.setSelection(count - 1); } listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { hideKeyboard(); more.setVisibility(View.GONE); iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); expressionContainer.setVisibility(View.GONE); btnContainer.setVisibility(View.GONE); return false; } }); // ? receiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); // Mainacitivity,??chat?????? intentFilter.setPriority(5); registerReceiver(receiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(5); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // ????T groupListener = new GroupListener(); EMGroupManager.getInstance().addGroupChangeListener(groupListener); // show forward message if the message is not null String forward_msg_id = getIntent().getStringExtra("forward_msg_id"); if (forward_msg_id != null) { // ????? forwardMessage(forward_msg_id); } }