List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.jtschohl.androidfirewall.MainActivity.java
/** * Show logs on a dialog/*from w w w .j a v a 2s .co m*/ */ private void showLog() { Api.dmesgCommand = "dmesg | $GREP \\[AndroidFirewall\\]\n"; Api.nflogCommand = "[AndroidFirewall]"; Api.logstring = "[AndroidFirewall]"; Api.rejectlog = true; Intent intent = new Intent(); intent.setClass(this, showLog.class); startActivityForResult(intent, 0); }
From source file:com.jtschohl.androidfirewall.MainActivity.java
/** * Show logs on a dialog//from ww w. j a va 2 s . com */ private void showAcceptLog() { Api.dmesgCommand = "dmesg | $GREP \\[AndroidFirewallAccept\\]\n"; Api.nflogCommand = "[AndroidFirewallAccept]"; Api.logstring = "[AndroidFirewallAccept]"; Api.rejectlog = false; Intent intent = new Intent(); intent.setClass(this, showLog.class); startActivityForResult(intent, 0); }
From source file:com.jtschohl.androidfirewall.MainActivity.java
public void importRules() { Intent intent = new Intent(); intent.setClass(this, RulesDialog.class); File filepath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/androidfirewall/"); if (filepath.isDirectory()) { startActivityForResult(intent, IMPORT_RULES_REQUEST); } else {/* w w w . j a va2 s . c o m*/ Toast.makeText(this, R.string.no_rules_file, Toast.LENGTH_LONG).show(); } }
From source file:com.jtschohl.androidfirewall.MainActivity.java
public void manageRuleFiles() { Intent intent = new Intent(); intent.setClass(this, DeleteRulesDialog.class); File filepath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/androidfirewall/"); if (filepath.isDirectory()) { startActivityForResult(intent, MANAGE_RULES_REQUEST); } else {/*from w w w . j a v a2 s . c o m*/ Toast.makeText(this, R.string.no_rules_file, Toast.LENGTH_LONG).show(); } }
From source file:com.jtschohl.androidfirewall.MainActivity.java
public void saveProfile() { Intent intent = new Intent(); intent.setClass(this, SaveProfileDialog.class); File filepath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/androidfirewall/"); if (filepath.isDirectory()) { startActivityForResult(intent, 0); } else {/*from w ww. j a va 2 s . c om*/ Toast.makeText(this, R.string.no_rules_file, Toast.LENGTH_LONG).show(); } }
From source file:com.jtschohl.androidfirewall.MainActivity.java
public void exportRules() { Intent intent = new Intent(); intent.setClass(this, ExportRulesDialog.class); String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media startActivityForResult(intent, EXPORT_RULES_REQUEST); } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media Toast.makeText(this, R.string.no_storage, Toast.LENGTH_LONG).show(); } else {// w w w . j av a 2 s . c o m // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write Toast.makeText(this, R.string.no_storage, Toast.LENGTH_LONG).show(); } }
From source file:com.app.khclub.base.easeim.activity.ContactlistFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // T??home???appcrash if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) return;//from w ww . jav a 2 s . co m inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); listView = (ListView) getView().findViewById(R.id.list); sidebar = (Sidebar) getView().findViewById(R.id.sidebar); sidebar.setListView(listView); // ??? blackList = EMContactManager.getInstance().getBlackListUsernames(); contactList = new ArrayList<User>(); // ?contactlist getContactList(); // ? query = (EditText) getView().findViewById(R.id.query); query.setHint(R.string.search); clearSearch = (ImageButton) getView().findViewById(R.id.search_clear); query.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s); if (s.length() > 0) { clearSearch.setVisibility(View.VISIBLE); } else { clearSearch.setVisibility(View.INVISIBLE); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void afterTextChanged(Editable s) { } }); clearSearch.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { query.getText().clear(); hideSoftKeyboard(); } }); // adapter adapter = new ContactAdapter(getActivity(), R.layout.row_contact, contactList); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String username = adapter.getItem(position).getUsername(); if (Constant.NEW_FRIENDS_USERNAME.equals(username)) { // ? User user = ((KHHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .get(Constant.NEW_FRIENDS_USERNAME); user.setUnreadMsgCount(0); startActivity(new Intent(getActivity(), NewFriendsMsgActivity.class)); } else if (Constant.GROUP_USERNAME.equals(username)) { // ?? startActivity(new Intent(getActivity(), GroupsActivity.class)); } else if (Constant.CHAT_ROOM.equals(username)) { // ?? startActivity(new Intent(getActivity(), PublicChatRoomsActivity.class)); } else if (Constant.CHAT_ROBOT.equals(username)) { // // Robot? // startActivity(new Intent(getActivity(), // RobotsActivity.class)); // ??? Intent intentToCardList = new Intent(getActivity(), CollectCardActivity.class); startActivity(intentToCardList); // ? getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } else { // demo?? // startActivity(new Intent(getActivity(), // ChatActivity.class) // .putExtra("userId", adapter.getItem(position) // .getUsername())); // ? Intent intent = new Intent(getActivity(), OtherPersonalActivity.class); intent.putExtra(OtherPersonalActivity.INTENT_KEY, KHUtils.stringToInt(adapter.getItem(position).getUsername().replace(KHConst.KH, ""))); startActivity(intent); getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } } }); listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // ?? if (getActivity().getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getActivity().getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); // ? qrImageView = new QRCodePopupMenu(getActivity()); final ImageView operateMenuView = (ImageView) getView().findViewById(R.id.iv_new_contact); // ??? operateMenuView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (null == mainMenu) { mainMenu = new MainPopupMenu(getActivity()); mainMenu.setListener(new ClickListener() { @Override public void scanQRcodeClick() { // ??? Intent intent = new Intent(); intent.setClass(getActivity(), MipcaCaptureActivity.class); startActivityForResult(intent, SCANNIN_GREQUEST_CODE); } @Override public void searchClick() { // ?? Intent intentToSearch = new Intent(getActivity(), SearchActivity.class); startActivity(intentToSearch); // ? getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } @Override public void createGroupClick() { // ? startActivity(new Intent(getActivity(), NewGroupActivity.class)); getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } @Override public void userQRShowClick() { // TODO ? qrImageView.setQRcode(false); qrImageView.showPopupWindow((RelativeLayout) getView().findViewById(R.id.title_bar)); } }); } mainMenu.showPopupWindow(operateMenuView); // startActivity(new Intent(getActivity(), // AddContactActivity.class)); } }); registerForContextMenu(listView); progressBar = (View) getView().findViewById(R.id.progress_bar); contactSyncListener = new HXContactSyncListener(); HXSDKHelper.getInstance().addSyncContactListener(contactSyncListener); blackListSyncListener = new HXBlackListSyncListener(); HXSDKHelper.getInstance().addSyncBlackListListener(blackListSyncListener); contactInfoSyncListener = new HXContactInfoSyncListener(); ((KHHXSDKHelper) HXSDKHelper.getInstance()).getUserProfileManager() .addSyncContactInfoListener(contactInfoSyncListener); if (!HXSDKHelper.getInstance().isContactsSyncedWithServer()) { progressBar.setVisibility(View.VISIBLE); } else { progressBar.setVisibility(View.GONE); } }
From source file:com.anysoftkeyboard.AnySoftKeyboard.java
private void launchSettings() { hideWindow();//from w w w. j ava 2 s . c o m Intent intent = new Intent(); intent.setClass(AnySoftKeyboard.this, MainSettingsActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }
From source file:com.android.settings.HWSettings.java
@Override public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) { Intent intent = super.onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); // Some fragments want split ActionBar; these should stay in sync with // uiOptions for fragments also defined as activities in manifest. if (WifiSettings.class.getName().equals(fragmentName) || WifiP2pSettings.class.getName().equals(fragmentName) || BluetoothSettings.class.getName().equals(fragmentName) || DreamSettings.class.getName().equals(fragmentName) || LocationSettings.class.getName().equals(fragmentName) || ToggleAccessibilityServicePreferenceFragment.class.getName().equals(fragmentName) || PrintSettingsFragment.class.getName().equals(fragmentName) || PrintServiceSettingsFragment.class.getName().equals(fragmentName)) { intent.putExtra(EXTRA_UI_OPTIONS, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }/*from w w w . j a v a 2 s . c om*/ if ((mActionBar.getSelectedTab().getPosition() == TAB_INDEX_NETWORKS) && DisplaySettings.class.getName().equals(fragmentName)) { intent.putExtra("onlyforfontsettings", true); } intent.setClass(this, SubSettings.class); return intent; }
From source file:com.android.settings.Settings.java
@Override public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) { Intent intent = super.onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); // Some fragments want split ActionBar; these should stay in sync with // uiOptions for fragments also defined as activities in manifest. if (WifiSettings.class.getName().equals(fragmentName) || WifiP2pSettings.class.getName().equals(fragmentName) || BluetoothSettings.class.getName().equals(fragmentName) || DreamSettings.class.getName().equals(fragmentName) || LocationSettings.class.getName().equals(fragmentName) || ToggleAccessibilityServicePreferenceFragment.class.getName().equals(fragmentName) || PrintSettingsFragment.class.getName().equals(fragmentName) || PrintServiceSettingsFragment.class.getName().equals(fragmentName)) { intent.putExtra(EXTRA_UI_OPTIONS, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }/* w w w. ja va 2 s . com*/ if (DataUsageSummary.class.getName().equals(fragmentName)) { intent.setClass(this, DataUsageSummaryActivity.class); } else { intent.setClass(this, SubSettings.class); } return intent; }