holder.itemTitle.setText(target.toString()); holder.itemTitle.setTextColor(ContextCompat.getColor(getActivity().getApplicationContext(), (target.isConnected() ? R.color.app_color : R.color.gray_text)));
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (System.checkNetworking(getActivity())) { Plugin plugin = mAvailable.get(position); System.setCurrentPlugin(plugin); if (plugin.hasLayoutToShow()) { Toast.makeText(getActivity(), getString(R.string.selected) + getString(plugin.getName()), Toast.LENGTH_SHORT).show(); startActivity(new Intent( getActivity(), plugin.getClass() )); getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein); } else plugin.onActionClick(getActivity().getApplicationContext()); } } });
private boolean initSystem() { // retry try { System.init(getActivity().getApplicationContext()); } catch (Exception e) { boolean isFatal = !(e instanceof NoRouteToHostException); if (isFatal) { System.errorLogging(e); onInitializationError(System.getLastError()); } return !isFatal; } registerPlugins(); return true; }
@Override public void onClick(View v) { String note = ((EditText) dialog.findViewById(R.id.edit_note)).getText().toString(); if (!TextUtils.isEmpty(note)) { highlightImpl.setNote(note); if (HighLightTable.updateHighlight(highlightImpl)) { HighlightUtil.sendHighlightBroadcastEvent( HighlightFragment.this.getActivity().getApplicationContext(), highlightImpl, HighLight.HighLightAction.MODIFY); adapter.editNote(note, position); } dialog.dismiss(); } else { Toast.makeText(getActivity(), getString(R.string.please_enter_note), Toast.LENGTH_SHORT).show(); } } });
@Override public void onDestroy() { super.onDestroy(); if (proxyChanged) { Toast.makeText(getActivity().getApplicationContext(), R.string.proxy_settings_apply_after_reboot, Toast.LENGTH_SHORT) .show(); } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } } }
private void startKismet() { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", "/usr/bin/start-kismet"); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } }
private void intentClickListener_NH(final String command) { try { Intent intent = new Intent("com.offsec.nhterm.RUN_SCRIPT_NH"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("com.offsec.nhterm.iInitialCommand", command); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_install_terminal), Toast.LENGTH_SHORT).show(); } } }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog d = OldStorageChooser.dialog; d.setContentView(getLayout(LayoutInflater.from(getActivity().getApplicationContext()), mContainer)); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(d.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.WRAP_CONTENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; d.getWindow().setAttributes(lp); d.getWindow().setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.dialog_rounded)); return d; } }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog d = OldStorageChooser.dialog; if(getActivity() != null) { d.setContentView(getLayout(LayoutInflater.from(getActivity().getApplicationContext()), mContainer)); } WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(d.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; d.getWindow().setAttributes(lp); d.getWindow().setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.dialog_rounded)); return setMargins(d, 16, 16, 16, 16); }
void captureImage(Fragment fragment, BaseConfig config, int requestCode) { Context context = fragment.getActivity().getApplicationContext(); Intent intent = getCameraModule().getCameraIntent(fragment.getActivity(), config); if (intent == null) { Toast.makeText(context, context.getString(R.string.ef_error_create_image_file), Toast.LENGTH_LONG).show(); return; } fragment.startActivityForResult(intent, requestCode); }
private void closeServer() { Helper.closeBgServer(getActivity().getApplicationContext()).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<Boolean>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(Boolean value) { Activity activity = getActivity(); if (activity != null) { Toast.makeText(activity, R.string.bg_closed, Toast.LENGTH_SHORT).show(); } } @Override public void onError(Throwable e) { } }); }
@Override public void onDetach() { super.onDetach(); // Unregister the memory trim callback with the system. getActivity().getApplicationContext().unregisterComponentCallbacks(mComponentCallback); }
/** * Remove the selected track from the playlist in the mediastore. * * @param position the position of the selected track in the adapter */ private void removeTrackFromPlaylist(int position) { final boolean reloadData = MusicLibraryHelper.removeTrackFromPlaylist(mPlaylistID, position, getActivity().getApplicationContext()); if (reloadData) { // reload data refreshContent(); } } }
private boolean logIn() { //noinspection ConstantConditions Context ctx = getActivity().getApplicationContext(); final String username = mModel.authenticatedAccess ? mModel.username : null; final String password = mModel.authenticatedAccess ? mModel.password : null; Authorization authorization = new Authorization( username, password, mModel.repoTrustAllCertificates); GerritApi client = GerritServiceFactory.getInstance(ctx, mModel.repoUrl, authorization); mModel.accountInfo = client.getAccount(GerritApi.SELF_ACCOUNT).blockingFirst(); return mModel.accountInfo != null; }
/** * Call the PBS to delete the selected bookmark. * * @param position the position of the selected bookmark in the adapter */ private void deleteBookmark(int position) { // identify current bookmark BookmarkModel bookmark = mAdapter.getItem(position); OdysseyDatabaseManager.getInstance(getActivity().getApplicationContext()).removeState(bookmark.getId()); refreshContent(); } }