예제 #1
0
  @Override
  public View onCreateActionView() {
    // Create the view and set its data model.
    ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mHistoryFileName);
    MenuItemActionView view = new MenuItemActionView(mContext, null);
    view.setActionButtonClickListener(mCallbacks);

    if (dataModel.getHistorySize() > 0) {
      PackageManager packageManager = mContext.getPackageManager();
      ResolveInfo defaultActivity = dataModel.getDefaultActivity();
      view.setActionButton(
          defaultActivity == null ? null : defaultActivity.loadIcon(packageManager));
    }

    return view;
  }
예제 #2
0
 @Override
 public void onClick(View view) {
   ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mHistoryFileName);
   chooseActivity(dataModel.getActivityIndex(dataModel.getDefaultActivity()));
 }