List of usage examples for android.app Activity getApplicationContext
@Override
public Context getApplicationContext()
From source file:com.scoreflex.Scoreflex.java
/** * If network is available, preload a view with the specified ressource and * hold a reference on it until the view is shown or freed. * * @param activity/*from ww w . j a v a2 s .c o m*/ * The activity that will host the view. * @param resource * The ressource to preload. */ public static void preloadResource(Activity activity, String resource) { if (activity == null) { throw new IllegalArgumentException("activity can not be null"); } if (resource == null) { throw new IllegalArgumentException("resource can not be null"); } if (mPreloadedViews == null) { mPreloadedViews = new HashMap<String, ScoreflexView>(); } if (mPreloadedViews.containsKey(resource)) { return; } if (null == getPlayerId() || !isReachable()) { return; } if (sApplicationContext == null) { sApplicationContext = activity.getApplicationContext(); } ScoreflexView preloadView = new ScoreflexView(activity); preloadView.preloadResource(resource); addPreloadedView(resource, preloadView); return; }
From source file:com.sentaroh.android.Utilities.Dialog.FileSelectDialogFragment.java
private void initViewWidget() { if (mDebugEnable) Log.v(APPLICATION_TAG, "initViewWidget"); if (mDebugEnable) Log.v(APPLICATION_TAG, "Create=" + mDialogEnableCreate + ", Title=" + mDialogTitle + ", lurl=" + mDialogLocalUrl + ", ldir=" + mDialogLocalDir + ", file name=" + mDialogFileName); mThemeColorList = ThemeUtil.getThemeColorList(getActivity()); mDialog.setContentView(R.layout.file_select_edit_dlg); LinearLayout title_view = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); TextView title = (TextView) mDialog.findViewById(R.id.file_select_edit_dlg_title); title.setTextColor(mThemeColorList.text_color_dialog_title); title.setText(mDialogTitle);//w ww . java 2s . com final TextView dlg_msg = (TextView) mDialog.findViewById(R.id.file_select_edit_dlg_msg); final Button btnHome = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_home_dir_btn); btnHome.setTextColor(mThemeColorList.text_color_primary); btnHome.setVisibility(Button.VISIBLE); final Button btnCreate = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_create_btn); btnCreate.setTextColor(mThemeColorList.text_color_primary); final Button btnOk = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_ok_btn); // btnOk.setTextColor(mThemeColorList.text_color_primary); final Button btnCancel = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_cancel_btn); btnCancel.setTextColor(mThemeColorList.text_color_primary); final Button btnRefresh = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_refresh_btn); btnRefresh.setTextColor(mThemeColorList.text_color_primary); LinearLayout ll_dlg_view = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_view); ll_dlg_view.setBackgroundColor(mThemeColorList.dialog_msg_background_color); final Activity activity = getActivity(); final Context context = activity.getApplicationContext(); if (mDialogEnableCreate) { btnCreate.setVisibility(TextView.VISIBLE); } mLocalMountPointSpinner = (Spinner) mDialog.findViewById(R.id.file_select_edit_dlg_rdir); setSpinnerBackground(context, mLocalMountPointSpinner, mThemeColorList.theme_is_light); mLocalMountPointSpinner.setVisibility(Spinner.VISIBLE); // Root directory spinner CustomSpinnerAdapter adapter = new CustomSpinnerAdapter(activity, R.layout.custom_simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mLocalMountPointSpinner.setPrompt(context.getString(R.string.msgs_file_select_edit_local_mount_point)); mLocalMountPointSpinner.setAdapter(adapter); int a_no = -1; ArrayList<String> ml = LocalMountPoint.getLocalMountPointList(context); mLocalMountPointSpinner.setOnItemSelectedListener(null); if (mDialogMpLimitInternalAndSdcard) { adapter.add(Environment.getExternalStorageDirectory().toString()); File[] fl = ContextCompat.getExternalFilesDirs(context, null); for (File item : fl) { if (!item.getPath().startsWith(Environment.getExternalStorageDirectory().toString())) { adapter.add(item.getPath().substring(0, item.getPath().indexOf("/Android"))); break; } } mLocalMountPointSpinner.setEnabled(true); for (int i = 0; i < adapter.getCount(); i++) { if (adapter.getItem(i).equals(mDialogLocalUrl)) { a_no = i; break; } } mLocalMountPointSpinner.setSelection(a_no); } else { if (ml.size() == 0) { if (mDialogIncludeRoot) adapter.add("/"); adapter.add(mDialogLocalUrl); mLocalMountPointSpinner.setEnabled(false); } else { mLocalMountPointSpinner.setEnabled(true); if (mDialogIncludeRoot) adapter.add("/"); for (int i = 0; i < ml.size(); i++) adapter.add(ml.get(i)); for (int i = 0; i < ml.size(); i++) { if (mDialogLocalUrl.startsWith(ml.get(i))) { a_no = i; break; } } mLocalMountPointSpinner.setSelection(a_no); } } LinearLayout ll_mp = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_mp_view); if (mDialogHideMp) ll_mp.setVisibility(LinearLayout.GONE); else ll_mp.setVisibility(LinearLayout.VISIBLE); // ll_mp.setVisibility(LinearLayout.GONE); // final TextView v_spacer=(TextView)mDialog.findViewById(R.id.file_select_edit_dlg_spacer); mTreeFileListView = (ListView) mDialog.findViewById(android.R.id.list); final CustomTextView dir_name = (CustomTextView) mDialog.findViewById(R.id.file_select_edit_dlg_dir_name); dir_name.setTextColor(mThemeColorList.text_color_primary); final EditText file_name = (EditText) mDialog.findViewById(R.id.file_select_edit_dlg_file_name); if (!mDialogSingleSelect) file_name.setVisibility(EditText.GONE); else file_name.setVisibility(EditText.VISIBLE); if (mDialogFileOnly) { file_name.setVisibility(EditText.VISIBLE); file_name.setEnabled(true); dir_name.setVisibility(EditText.VISIBLE); } else { if (mDialogDirectoryOnly) { file_name.setVisibility(EditText.GONE); file_name.setEnabled(false); dir_name.setVisibility(EditText.VISIBLE); btnHome.setVisibility(EditText.VISIBLE); } else { file_name.setVisibility(EditText.VISIBLE); file_name.setEnabled(true); dir_name.setVisibility(EditText.VISIBLE); btnHome.setVisibility(EditText.VISIBLE); } } file_name.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View arg0, int keyCode, KeyEvent event) { if (//event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { return true; } return false; } }); // if (dirs.size()<=2) v_spacer.setVisibility(TextView.VISIBLE); mTreeFilelistAdapter = new TreeFilelistAdapter(activity, mDialogSingleSelect, true); mTreeFileListView.setAdapter(mTreeFilelistAdapter); if (mDialogLocalUrl.equals("")) mDialogLocalUrl = ml.get(0); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, mDialogLocalUrl, ""); if (tfl.size() == 0) { tfl.add(new TreeFilelistItem(context.getString(R.string.msgs_file_select_edit_dir_empty))); } else { mTreeFilelistAdapter.setDataList(tfl); if (!mDialogLocalDir.equals("")) { String sel_dir = mDialogLocalDir; String n_dir = "", e_dir = ""; if (sel_dir.startsWith("/")) n_dir = sel_dir.substring(1); else n_dir = sel_dir; if (n_dir.endsWith("/")) e_dir = n_dir.substring(0, n_dir.length() - 1); else e_dir = n_dir; // Log.v("","mp="+mDialogLocalUrl+", se;_dir="+sel_dir+", e_dir="+e_dir); selectLocalDirTree(e_dir); } if (!mDialogFileName.equals("")) selectLocalDirTreeFile(mDialogFileName); } mTreeFileListView.setScrollingCacheEnabled(false); mTreeFileListView.setScrollbarFadingEnabled(false); if (mSavedViewContentsValue != null && mSavedViewContentsValue.mainDialogFilename != null) { file_name.setText(mSavedViewContentsValue.mainDialogFilename); file_name.setSelection(mSavedViewContentsValue.mainDialogFilenameSelStart, mSavedViewContentsValue.mainDialogFilenameTextSelEnd); dir_name.setText(mSavedViewContentsValue.mainDialogDirName); } else { String d_name = mDialogLocalDir.equals("") ? mDialogLocalUrl + "/" : mDialogLocalUrl + mDialogLocalDir + "/"; dir_name.setText(d_name); file_name.setText(mDialogFileName); } if (!mDialogSingleSelect) btnOk.setEnabled(false); NotifyEvent cb_ntfy = new NotifyEvent(context); // set file list thread response listener cb_ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { int p = (Integer) o[0]; boolean p_chk = (Boolean) o[1]; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (mDialogSingleSelect) { if (mTreeFilelistAdapter.getDataItem(p).isChecked() && !p_chk) { if (p != -1) { if (mTreeFilelistAdapter.getDataItem(p).isChecked()) { if (mTreeFilelistAdapter.getDataItem(p).isDir()) { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath() + mTreeFilelistAdapter.getDataItem(p).getName() + "/"); // file_name.setText(""); } else { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath()); file_name.setText(mTreeFilelistAdapter.getDataItem(p).getName()); } } } } if (mDialogFileOnly) { if (file_name.getText().length() > 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } } else { if (mTreeFilelistAdapter.isDataItemIsSelected() || file_name.getText().length() > 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_directory_not_selected)); btnOk.setEnabled(false); } } } else { if (mTreeFilelistAdapter.getDataItem(p).isDir()) { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath() + mTreeFilelistAdapter.getDataItem(p).getName() + "/"); // file_name.setText(""); } else { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath()); file_name.setText(mTreeFilelistAdapter.getDataItem(p).getName()); } putDlgMsg(dlg_msg, ""); btnOk.setEnabled(true); } } @Override public void negativeResponse(Context c, Object[] o) { boolean checked = false; // int p=(Integer) o[0]; boolean p_chk = (Boolean) o[1]; if (mDialogSingleSelect) { if (p_chk) { for (int i = 0; i < mTreeFilelistAdapter.getDataItemCount(); i++) { if (mTreeFilelistAdapter.getDataItem(i).isChecked()) { checked = true; break; } } if (checked) btnOk.setEnabled(true); else btnOk.setEnabled(false); } } else { // Log.v("","sel="+p_chk); btnOk.setEnabled(false); for (int i = 0; i < mTreeFilelistAdapter.getDataItemCount(); i++) { if (mTreeFilelistAdapter.getDataItem(i).isChecked()) { btnOk.setEnabled(true); break; } } } } }); mTreeFilelistAdapter.setCbCheckListener(cb_ntfy); if (mDialogLocalUrl.equals(file_name.getText().toString())) btnOk.setEnabled(false); if (mDialogFileOnly && mDialogFileName.equals("")) { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } file_name.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { if (mDialogSingleSelect) { if (s.length() != 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } }); NotifyEvent ntfy_expand_close = new NotifyEvent(context); ntfy_expand_close.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { int idx = (Integer) o[0]; final int pos = mTreeFilelistAdapter.getItem(idx); final TreeFilelistItem tfi = mTreeFilelistAdapter.getDataItem(pos); if (tfi.getName().startsWith("---")) return; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (tfi.isDir()) processLocalDirTree(mDialogFileOnly, turl, pos, tfi, mTreeFilelistAdapter); else { mTreeFilelistAdapter.setDataItemIsSelected(pos); dir_name.setText((turl + mTreeFilelistAdapter.getDataItem(pos).getPath())); file_name.setText(mTreeFilelistAdapter.getDataItem(pos).getName()); if (mTreeFilelistAdapter.getDataItem(pos).isDir() && mDialogFileOnly) btnOk.setEnabled(false); else btnOk.setEnabled(true); } } @Override public void negativeResponse(Context c, Object[] o) { } }); mTreeFilelistAdapter.setExpandCloseListener(ntfy_expand_close); mTreeFileListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> items, View view, int idx, long id) { final int pos = mTreeFilelistAdapter.getItem(idx); final TreeFilelistItem tfi = mTreeFilelistAdapter.getDataItem(pos); if (tfi.getName().startsWith("---")) return; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (tfi.isDir()) processLocalDirTree(mDialogFileOnly, turl, pos, tfi, mTreeFilelistAdapter); else { mTreeFilelistAdapter.setDataItemIsSelected(pos); dir_name.setText((turl + mTreeFilelistAdapter.getDataItem(pos).getPath())); file_name.setText(mTreeFilelistAdapter.getDataItem(pos).getName()); if (mTreeFilelistAdapter.getDataItem(pos).isDir() && mDialogFileOnly) btnOk.setEnabled(false); else btnOk.setEnabled(true); } } }); mTreeFileListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, final int position, long arg3) { return true; } }); btnHome.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dir_name.setText(mLocalMountPointSpinner.getSelectedItem().toString() + "/"); } }); //Create button btnCreate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { NotifyEvent ntfy = new NotifyEvent(context); // set file list thread response listener ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { // btnRefresh.performClick(); } @Override public void negativeResponse(Context c, Object[] o) { } }); fileSelectEditDialogCreateBtn(activity, context, dir_name.getText().substring(0, dir_name.getText().length() - 1), "", mLocalMountPointSpinner.getSelectedItem().toString(), mTreeFilelistAdapter, ntfy, mTreeFileListView); } }); //Refresh button btnRefresh.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String mp = mLocalMountPointSpinner.getSelectedItem().toString(); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, mp, "");//mDialogLocalUrl,""); if (tfl.size() < 1) tfl.add(new TreeFilelistItem(context.getString(R.string.msgs_file_select_edit_dir_empty))); mTreeFilelistAdapter.setDataList(tfl); } }); //OK button // btnOk.setEnabled(false); btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (mDialogSingleSelect) { String[] sl_array = new String[] { dir_name.getText() + file_name.getText().toString() }; if (mNotifyEvent != null) mNotifyEvent.notifyToListener(true, sl_array); } else { ArrayList<String> sl = new ArrayList<String>(); ArrayList<TreeFilelistItem> tfl = mTreeFilelistAdapter.getDataList(); for (TreeFilelistItem li : tfl) { if (li.isChecked()) { if (li.isDir()) sl.add(li.getPath() + li.getName()); else sl.add(li.getPath() + li.getName()); } } String[] sl_array = new String[sl.size()]; String mp = mLocalMountPointSpinner.getSelectedItem().toString(); for (int i = 0; i < sl.size(); i++) { if (mDialogSelectedFilePathWithMountPoint) sl_array[i] = mp + sl.get(i); else sl_array[i] = sl.get(i); // Log.v("","sel="+sl_array[i]); } if (mNotifyEvent != null) mNotifyEvent.notifyToListener(true, sl_array); } // mDialog.dismiss(); mFragment.dismiss(); } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // mDialog.dismiss(); mFragment.dismiss(); if (mNotifyEvent != null) mNotifyEvent.notifyToListener(false, null); } }); Handler hndl = new Handler(); hndl.postDelayed(new Runnable() { @Override public void run() { mLocalMountPointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // Log.v("","MP selected="+position); Spinner spinner = (Spinner) parent; String turl = (String) spinner.getSelectedItem(); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, turl, ""); if (tfl.size() < 1) tfl.add(new TreeFilelistItem( context.getString(R.string.msgs_file_select_edit_dir_empty))); mTreeFilelistAdapter.setDataList(tfl); mTreeFilelistAdapter.notifyDataSetChanged(); if (turl.startsWith(mSafFileMgr.getExternalSdcardPath())) { if (mSafFileMgr.getSdcardSafFile() == null) btnCreate.setEnabled(false); else btnCreate.setEnabled(true); } else btnCreate.setEnabled(true); dir_name.setText(turl + "/"); Handler hndl_sel = new Handler(); hndl_sel.post(new Runnable() { @Override public void run() { mTreeFileListView.setSelection(0); } }); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); } }, 100); }
From source file:org.csp.everyaware.offline.Map.java
public final void createLegalNoticesDialog(Activity activity) { AlertDialog ad = new AlertDialog.Builder(activity).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(activity.getApplicationContext())); ad.setButton("OK", new DialogInterface.OnClickListener() { @Override/* w ww .j a v a2 s. com*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); }
From source file:com.android.launcher3.Utilities.java
public static void answerToRestoreIconPack(final Activity context, String packName) { AlertDialog.Builder alert = new AlertDialog.Builder( new ContextThemeWrapper(context, R.style.AlertDialogCustom)); alert.setTitle(context.getResources().getString(R.string.app_name)); alert.setMessage(context.getResources().getString(R.string.ask_icon) + " " + packName + "?"); alert.setPositiveButton(context.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { applyChange(context); }/*w w w.j ava 2 s . co m*/ }); alert.setNegativeButton(context.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Utilities.setAppIconPackageNamePrefEnabled(context.getApplicationContext(), "NULL"); dialog.dismiss(); } }); alert.setIcon(R.mipmap.ic_launcher_home); alert.show(); }
From source file:jmri.enginedriver.threaded_application.java
public boolean setActivityOrientation(Activity activity, Boolean webPref) { String to;//from w w w . j a v a 2 s . c o m to = prefs.getString("ThrottleOrientation", activity.getApplicationContext().getResources() .getString(R.string.prefThrottleOrientationDefaultValue)); if (to.equals("Auto-Web")) { int orient = activity.getResources().getConfiguration().orientation; if ((webPref && orient == Configuration.ORIENTATION_PORTRAIT) || (!webPref && orient == Configuration.ORIENTATION_LANDSCAPE)) return (false); } else if (webPref) { to = prefs.getString("WebOrientation", activity.getApplicationContext().getResources() .getString(R.string.prefWebOrientationDefaultValue)); } int co = activity.getRequestedOrientation(); if (to.equals("Landscape") && (co != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); else if (to.equals("Auto-Rotate") && (co != ActivityInfo.SCREEN_ORIENTATION_SENSOR)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); else if (to.equals("Portrait") && (co != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); return true; }
From source file:com.chen.mail.browse.ConversationCursor.java
public ConversationCursor(Activity activity, Uri uri, boolean initialConversationLimit, String name) { mInitialConversationLimit = initialConversationLimit; mResolver = activity.getApplicationContext().getContentResolver(); qUri = uri;//from w w w . j a v a 2 s .c o m mName = name; qProjection = UIProvider.CONVERSATION_PROJECTION; mCursorObserver = new CursorObserver(new Handler(Looper.getMainLooper())); }
From source file:paulscode.android.mupen64plusae.jni.CoreFragment.java
private void actuallyStartCore(Activity activity) { if (!mIsRunning) { mIsRunning = true;//from ww w. ja va2s.co m // Defines callbacks for service binding, passed to bindService() mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { // We've bound to LocalService, cast the IBinder and get LocalService instance LocalBinder binder = (LocalBinder) service; mCoreService = binder.getService(); mCoreService.setSurface(mSurface); mCoreService.setOnFpsChangedListener(mFpsChangeListener, mFpsRecalcPeriod); mCoreService.setCoreServiceListener(CoreFragment.this); if (mCoreEventListener != null && getActivity() != null) { mCoreEventListener.onCoreServiceStarted(); } } @Override public void onServiceDisconnected(ComponentName arg0) { //Nothing to do here } }; ArrayList<Integer> pakTypes = new ArrayList<>(); pakTypes.add(mGlobalPrefs.getPakType(1).getNativeValue()); pakTypes.add(mGlobalPrefs.getPakType(2).getNativeValue()); pakTypes.add(mGlobalPrefs.getPakType(3).getNativeValue()); pakTypes.add(mGlobalPrefs.getPakType(4).getNativeValue()); boolean[] isPlugged = new boolean[4]; isPlugged[0] = mGamePrefs.isPlugged1; isPlugged[1] = mGamePrefs.isPlugged2; isPlugged[2] = mGamePrefs.isPlugged3; isPlugged[3] = mGamePrefs.isPlugged4; // Start the core ActivityHelper.startCoreService(activity.getApplicationContext(), mServiceConnection, mRomGoodName, mRomPath, mRomMd5, mRomCrc, mRomHeaderName, mRomCountryCode, mRomArtPath, mRomLegacySave, mCheatArgs, mIsRestarting, mSaveToLoad, mAppData.coreLib, mGlobalPrefs.useHighPriorityThread, pakTypes, isPlugged, mGlobalPrefs.isFramelimiterEnabled, mGlobalPrefs.coreUserDataDir, mGlobalPrefs.coreUserCacheDir, mGamePrefs.coreUserConfigDir, mGamePrefs.userSaveDir, mAppData.libsDir); } }
From source file:com.android.mail.browse.ConversationCursor.java
public ConversationCursor(Activity activity, Uri uri, boolean useInitialConversationLimit, String name) { mUseInitialConversationLimit = useInitialConversationLimit; mResolver = activity.getApplicationContext().getContentResolver(); qUri = uri;//from w w w . jav a2 s. c o m mName = name; qProjection = UIProvider.CONVERSATION_PROJECTION; mCursorObserver = new CursorObserver(new Handler(Looper.getMainLooper())); // Disable caching on low memory devices mCachingEnabled = !Utils.isLowRamDevice(activity); }
From source file:com.android.mms.ui.MessageUtils.java
public static void confirmDeleteMessage(final Activity activity, final Uri msgUri) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.confirm_dialog_title); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setCancelable(true);/*from w ww .j av a 2 s. co m*/ builder.setMessage(R.string.confirm_delete_message); builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /// M: fix bug ALPS00351620; for requery searchactivity. SearchActivity.setNeedRequery(); SqliteWrapper.delete(activity.getApplicationContext(), activity.getContentResolver(), msgUri, null, null); dialog.dismiss(); activity.finish(); } }); builder.setNegativeButton(R.string.no, null); builder.show(); }