void startSelected(int which, boolean always) { if (isFinishing()) { return; } ResolveInfo ri = mAdapter.resolveInfoForPosition(which); Intent intent = mAdapter.intentForPosition(which); onIntentSelected(ri, intent, always); finish(); }
public void handlePackagesChanged() { final int oldItemCount = getCount(); rebuildList(); notifyDataSetChanged(); final int newItemCount = getCount(); if (newItemCount == 0) { // We no longer have any items... just finish the activity. finish(); } }
@Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { ResolveInfo ri = mAdapter.resolveInfoForPosition(position); showAppDetails(ri); return true; }
public final AccountManagerFuture<Bundle> start() { try { doWork(); } catch (RemoteException e) { setException(e); } return this; }
public void onOkButtonClicked(View view) { if (mSelectedItemIndex == mAccounts.size()) { // Selected "Add New Account" option startChooseAccountTypeActivity(); } else if (mSelectedItemIndex != SELECTED_ITEM_NONE) { onAccountSelected(mAccounts.get(mSelectedItemIndex)); } }
@Override public Bundle getResult() throws OperationCanceledException, IOException, AuthenticatorException { return internalGetResult(null, null); }
@Override protected void onPostExecute(DisplayResolveInfo info) { mAdapter.notifyDataSetChanged(); } }
@Override public void onCancel(DialogInterface dialog) { finish(); } });
@Override protected void done() { if (mCallback != null) { postToHandler(mHandler, mCallback, this); } }
@Override public void onError(int code, String message) { if (code == ERROR_CODE_CANCELED || code == ERROR_CODE_USER_RESTRICTED || code == ERROR_CODE_MANAGEMENT_DISABLED_FOR_ACCOUNT_TYPE) { // the authenticator indicated that this request was canceled or we were // forbidden to fulfill; cancel now cancel(true /* mayInterruptIfRunning */); return; } setException(convertErrorToException(code, message)); } }
@Override protected DisplayResolveInfo doInBackground(DisplayResolveInfo... params) { final DisplayResolveInfo info = params[0]; if (info.displayIcon == null) { info.displayIcon = loadIconForResolveInfo(info.ri); } return info; }
public void onCancelButtonClicked(View view) { onBackPressed(); }
/** * The default activity theme shows label at the top. Set a theme which does * not show label, which effectively makes the activity invisible. Note that * no content is being set. If something gets set, using this theme may be * useless. */ private void setNonLabelThemeAndCallSuperCreate(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setTheme(android.R.style.Theme_Material_Light_Dialog_NoActionBar); } else { setTheme(android.R.style.Theme_Holo_Light_Dialog_NoActionBar); } super.onCreate(savedInstanceState); }
@Override public void onDestroy() { super.onDestroy(); startup(this); }
public AmsTask(Activity activity, Handler handler, AccountManagerCallback<Bundle> callback) { super(new Callable<Bundle>() { @Override public Bundle call() throws Exception { throw new IllegalStateException("this should never be called"); } }); mHandler = handler; mCallback = callback; mActivity = activity; mResponse = new Response(); }
private void onAccountSelected(Account account) { Log.d(TAG, "selected account " + account); setResultAndFinish(account.name, account.type); }
private Intent makeMyIntent() { Intent intent = new Intent(getIntent()); intent.setComponent(null); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); return intent; }
@Override protected void onRestart() { super.onRestart(); if (!mRegistered) { mRegistered = true; } mAdapter.handlePackagesChanged(); }
@Override public Bundle call(String method, String arg, Bundle extras) { if ("_VA_|_init_process_".equals(method)) { return initProcess(extras); } return null; }
@Override public Bundle getResult(long timeout, TimeUnit unit) throws OperationCanceledException, IOException, AuthenticatorException { return internalGetResult(timeout, unit); }