android.content.Intent#getBooleanExtra ( )源码实例Demo

下面列出了android.content.Intent#getBooleanExtra ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected void onStart() {
    super.onStart();
    final Intent intent = getIntent();
    this.mInitialAccountSetup = intent != null && intent.getBooleanExtra("setup", false);

    final Uri uri = intent != null ? intent.getData() : null;

    if (uri != null && handledExternalUri.compareAndSet(false, true)) {
        cropUri(this, uri);
        return;
    }

    if (this.mInitialAccountSetup) {
        this.cancelButton.setText(R.string.skip);
    }
    configureActionBar(getSupportActionBar(), !this.mInitialAccountSetup && !handledExternalUri.get());
}
 
源代码2 项目: Pioneer   文件: ImageActions.java
private static Uri getCroppedImage(Context context, Intent requestIntent, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK || requestIntent == null) {
        return null;
    }
    boolean returnData = requestIntent.getBooleanExtra(RETURN_DATA, false);
    if (returnData && data == null) {
        return null;
    }
    Uri output = requestIntent.getParcelableExtra(MediaStore.EXTRA_OUTPUT);
    if (output != null) {
        return output;
    }
    Bitmap bm = data.getParcelableExtra("data");
    if (bm == null) {
        return null;
    }
    try {
        File dst = generateImageFile(context, ".jpg");
        if (!IoUtils.saveBitmap(dst, bm, Bitmap.CompressFormat.JPEG, 80)) {
            return null;
        }
        return Uri.fromFile(dst);
    } finally {
        bm.recycle();
    }
}
 
源代码3 项目: Pioneer   文件: ImageActions.java
private static Uri getCroppedImage(Context context, Intent requestIntent, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK || requestIntent == null) {
        return null;
    }
    boolean returnData = requestIntent.getBooleanExtra(RETURN_DATA, false);
    if (returnData && data == null) {
        return null;
    }
    Uri output = requestIntent.getParcelableExtra(MediaStore.EXTRA_OUTPUT);
    if (output != null) {
        return output;
    }
    Bitmap bm = data.getParcelableExtra("data");
    if (bm == null) {
        return null;
    }
    try {
        File dst = generateImageFile(context, ".jpg");
        if (!IoUtils.saveBitmap(dst, bm, Bitmap.CompressFormat.JPEG, 80)) {
            return null;
        }
        return Uri.fromFile(dst);
    } finally {
        bm.recycle();
    }
}
 
源代码4 项目: gsn   文件: FTDI_USB_Handler.java
@Override
public void onReceive(Context context, Intent intent) {
	if (intent.getAction().equals(ACTION_USB_PERMISSION)) {
		if (!intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
			e("Permission not granted :(");
		}
		else {
			l("Permission granted");
			UsbDevice dev = (UsbDevice) intent
					.getParcelableExtra(UsbManager.EXTRA_DEVICE);
			if (dev != null) {
				if (String.format("%04X:%04X", dev.getVendorId(),
						dev.getProductId()).equals(VID_PID)) {
					init_USB(dev);// has new thread
				}
			}
			else {
				e("device not present!");
			}
		}
	}
}
 
源代码5 项目: GravityBox   文件: StatusbarSignalCluster.java
@Override
public void onBroadcastReceived(Context context, Intent intent) {
    if (intent.getAction().equals(GravityBoxSettings.ACTION_PREF_BATTERY_STYLE_CHANGED) &&
            intent.hasExtra(GravityBoxSettings.EXTRA_BATTERY_STYLE)) {
        mBatteryStyle = intent.getIntExtra(GravityBoxSettings.EXTRA_BATTERY_STYLE, 1);
        updateBatteryPadding();
    }
    if (intent.getAction().equals(GravityBoxSettings.ACTION_PREF_BATTERY_PERCENT_TEXT_CHANGED)) {
        if (intent.hasExtra(GravityBoxSettings.EXTRA_BATTERY_PERCENT_TEXT_STATUSBAR)) {
            mPercentTextSb = intent.getBooleanExtra(
                    GravityBoxSettings.EXTRA_BATTERY_PERCENT_TEXT_STATUSBAR, false) &&
                    "LEFT".equals(sPrefs.getString(GravityBoxSettings
                            .PREF_KEY_BATTERY_PERCENT_TEXT_POSITION, "RIGHT"));
            updateBatteryPadding();
        }
    }
}
 
@Override
public int onStartCommand(final Intent intent, final int flags,
		final int startId) {
	super.onStartCommand(intent, flags, startId);

	if (null != intent) {
		if (!mIsOnStartCommandCalled) {
			if ((((PowerManager) getSystemService(Context.POWER_SERVICE))
					.isScreenOn()) != intent.getBooleanExtra(
					EXTRA_BOOLEAN_WAS_SCREEN_ON, false))
				sendBroadcast(INTENT_REQUEST_REQUERY);
		}
		ServiceWakeLockManager.releaseLock();
	}
	mIsOnStartCommandCalled = true;
	return START_STICKY;
}
 
private void onYes() {
    Intent myIntent = getIntent();
    Intent replyIntent = new Intent();
    Dataset dataset = myIntent.getParcelableExtra(EXTRA_DATASET);
    if (dataset != null) {
        replyIntent.putExtra(EXTRA_AUTHENTICATION_RESULT, dataset);
    } else {
        String[] hints = myIntent.getStringArrayExtra(EXTRA_HINTS);
        Parcelable[] ids = myIntent.getParcelableArrayExtra(EXTRA_IDS);
        boolean authenticateDatasets = myIntent.getBooleanExtra(EXTRA_AUTH_DATASETS, false);
        int size = hints.length;
        ArrayMap<String, AutofillId> fields = new ArrayMap<>(size);
        for (int i = 0; i < size; i++) {
            fields.put(hints[i], (AutofillId) ids[i]);
        }
        FillResponse response =
                DebugService.createResponse(this, fields, 1, authenticateDatasets);
        replyIntent.putExtra(EXTRA_AUTHENTICATION_RESULT, response);

    }
    setResult(RESULT_OK, replyIntent);
    finish();
}
 
源代码8 项目: GPT   文件: ApkInstallerService.java
@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (action == null) {
        return;
    }

    if (action.equals(ACTION_INSTALL)) {
        String srcFile = intent.getStringExtra(GPTPackageManager.EXTRA_SRC_FILE);
        String pkgName = intent.getStringExtra(GPTPackageManager.EXTRA_PKG_NAME);
        int extProcess = intent.getIntExtra(GPTPackageManager.EXTRA_EXT_PROCESS, Constants.GPT_PROCESS_DEFAULT);
        if (!TextUtils.isEmpty(srcFile)) {
            handleInstall(srcFile, pkgName, extProcess);
        }
    } else if (action.equals(ACTION_SAVE_SIGNATURES_FILE)) {
        HashMap<String, String> signaturesMap = (HashMap<String, String>) intent
                .getSerializableExtra(EXTRA_SIGNATURES_MAP);
        handleSaveSignaturesFile(signaturesMap);
    } else if (action.equals(ACTION_UNINSTALL)) {
        String uninstallPkgName = intent.getStringExtra(GPTPackageManager.EXTRA_PKG_NAME);
        boolean nextDelete = intent.getBooleanExtra(EXTRA_NEXT_DELETE, false);
        handleUninstall(uninstallPkgName, nextDelete);
    } else if (action.equals(ACTION_SWITCH_INSTALL_DIR)) {
        String packageName = intent.getStringExtra(GPTPackageManager.EXTRA_PKG_NAME);
        String tempInstallDir = intent.getStringExtra(GPTPackageManager.EXTRA_TEMP_INSTALL_DIR);
        String tempApkPath = intent.getStringExtra(GPTPackageManager.EXTRA_TEMP_APK_PATH);
        String srcApkPath = intent.getStringExtra(GPTPackageManager.EXTRA_SRC_PATH_WITH_SCHEME);
        handleSwitchInstallDir(packageName, tempInstallDir, tempApkPath, srcApkPath);
    } else if (action.equals(ACTION_CHECK_INSTALL_TEMP_DIR)) {
        handlleCheckInstallTempDir();
    }
}
 
源代码9 项目: Easycam   文件: easycam.java
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (ACTION_USB_PERMISSION.equals(action)) {
        synchronized (this) {
            UsbDevice uDevice = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);

            if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {

                if(uDevice != null) {
                    initView();

                    // Right now the activity doesn't have focus, so if we need to manually
                    // set immersive mode.
                    if (immersive) {
                        camView.setSystemUiVisibility(
                                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                                        | View.SYSTEM_UI_FLAG_FULLSCREEN);

                        currentLayout.post(setAspectRatio);
                    }
                }
                else {
                    Log.d(TAG, "USB Device not valid");
                }
            }
            else {
                Log.d(TAG, "permission denied for device " + uDevice);
            }
        }
    }
}
 
@Override
public void onReceive(Context context, Intent intent) {
    Timber.tag(TAG).d(intent.toString());
    if (intent.getAction() == null || !RESPONSIBILITIES.contains(intent.getAction())) {
        Timber.tag(TAG).w("Got called outside our responsibilities: %s", intent.getAction());
        return;
    }
    if (intent.getBooleanExtra("forwarded", false)) {
        Timber.tag(TAG).d("Dropping forwarded intent");
        return;
    }
    if (intent.getAction().equals(REFERRER_SOURCE_GPLAY)) {
        String referrer = intent.getStringExtra(ARG_KEY_GPLAY_REFERRER);
        if (referrer != null) {
            final PendingResult result = goAsync();
            new Thread(() -> {
                Matomo.getInstance(context.getApplicationContext()).getPreferences().edit().putString(PREF_KEY_INSTALL_REFERRER_EXTRAS, referrer).apply();
                Timber.tag(TAG).d("Stored Google Play referrer extras: %s", referrer);
                result.finish();
            }).start();
        }
    }
    // Forward to other possible recipients
    intent.setComponent(null);
    intent.setPackage(context.getPackageName());
    intent.putExtra("forwarded", true);
    context.sendBroadcast(intent);
}
 
源代码11 项目: GravityBox   文件: TrafficMeterAbstract.java
@Override
public void onBroadcastReceived(Context context, Intent intent) {
    String action = intent.getAction();
    if (action.equals(GravityBoxSettings.ACTION_PREF_DATA_TRAFFIC_CHANGED)) {
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_MODE)) {
            return;
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_POSITION)) {
            mPosition = intent.getIntExtra(GravityBoxSettings.EXTRA_DT_POSITION,
                    GravityBoxSettings.DT_POSITION_AUTO);
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_SIZE)) {
            mSize = intent.getIntExtra(GravityBoxSettings.EXTRA_DT_SIZE, 14);
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_DISPLAY_MODE)) {
            mDisplayMode = DisplayMode.valueOf(intent.getStringExtra(
                    GravityBoxSettings.EXTRA_DT_DISPLAY_MODE));
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_ACTIVE_MOBILE_ONLY)) {
            mShowOnlyForMobileData = intent.getBooleanExtra(
                    GravityBoxSettings.EXTRA_DT_ACTIVE_MOBILE_ONLY, false);
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_DT_LOCKSCREEN)) {
            mAllowInLockscreen = intent.getBooleanExtra(
                    GravityBoxSettings.EXTRA_DT_LOCKSCREEN, false);
        }

        onPreferenceChanged(intent);
        updateState();
    } else if (action.equals(Intent.ACTION_SCREEN_ON) ||
            action.equals(Intent.ACTION_SCREEN_OFF)) {
        mIsScreenOn = action.equals(Intent.ACTION_SCREEN_ON);
        updateState();
    }
}
 
源代码12 项目: android_9.0.0_r45   文件: DeviceIdleController.java
void updateConnectivityState(Intent connIntent) {
    ConnectivityService cm;
    synchronized (this) {
        cm = mConnectivityService;
    }
    if (cm == null) {
        return;
    }
    // Note: can't call out to ConnectivityService with our lock held.
    NetworkInfo ni = cm.getActiveNetworkInfo();
    synchronized (this) {
        boolean conn;
        if (ni == null) {
            conn = false;
        } else {
            if (connIntent == null) {
                conn = ni.isConnected();
            } else {
                final int networkType =
                        connIntent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE,
                                ConnectivityManager.TYPE_NONE);
                if (ni.getType() != networkType) {
                    return;
                }
                conn = !connIntent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,
                        false);
            }
        }
        if (conn != mNetworkConnected) {
            mNetworkConnected = conn;
            if (conn && mLightState == LIGHT_STATE_WAITING_FOR_NETWORK) {
                stepLightIdleStateLocked("network");
            }
        }
    }
}
 
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        boolean restart = intent.getBooleanExtra("restart", false);
        if (restart) {
            try {
                onTryUpdate(UPDATE_REASON_USER_NEXT);
            } catch (RetryException ignored) {}
        }
    }
    return super.onStartCommand(intent, flags, startId);
}
 
@Override
public void onReceive(final Context context, Intent intent) {
    Log.d(TAG, "Package changed: " + intent);
    if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) &&
            !intent.getBooleanExtra(EXTRA_REPLACING, false)) ||
            ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) ||
            ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) {
        final GcmDatabase database = new GcmDatabase(context);
        final String packageName = intent.getData().getSchemeSpecificPart();
        Log.d(TAG, "Package removed or data cleared: " + packageName);
        final GcmDatabase.App app = database.getApp(packageName);
        if (app != null) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName);
                    boolean deletedAll = true;
                    for (GcmDatabase.Registration registration : registrations) {
                        deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null;
                    }
                    if (deletedAll) {
                        database.removeApp(packageName);
                    }
                    database.close();
                }
            }).start();
        } else {
            database.close();
        }
    }
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // On non-tablet devices, we lock the screen to portrait mode.
  boolean isTablet = getResources().getBoolean(R.bool.isTablet);
  if (isTablet) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
  } else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
  }

  setContentView(R.layout.howitworks);

  if (savedInstanceState != null) {
    onFirstOnboardingExperience = savedInstanceState.getBoolean(KEY_FIRST_ONBOARDING_EXPERIENCE);
  } else {
    Intent intent = getIntent();
    onFirstOnboardingExperience =
        intent != null && intent.getBooleanExtra(KEY_FIRST_ONBOARDING_EXPERIENCE, false);
  }

  pager = (ViewPager) findViewById(R.id.howitworks_pager);
  pager.setAdapter(new HowItWorksPagerAdapter(getSupportFragmentManager()));
  pager.addOnPageChangeListener(onPageChangeListener);
  PagingIndicator pagingIndicator = (PagingIndicator) findViewById(R.id.paging_indicator);
  pagingIndicator.setViewPager(pager);

  buttonSkip = (Button) findViewById(R.id.howitworks_button_skip);
  buttonSkip.setOnClickListener(view -> finishHowItWorksActivitiy());
  buttonSkip.setVisibility(View.VISIBLE);

  buttonNext = (ImageButton) findViewById(R.id.howitworks_button_next);
  buttonNext.setOnClickListener(
      v -> {
        int currentItem = getViewPagerCurrentItem();
        pager.setCurrentItem(currentItem + 1, true);
      });
  buttonNext.setVisibility(View.VISIBLE);

  buttonDone = (Button) findViewById(R.id.howitworks_button_done);
  buttonDone.setOnClickListener(view -> finishHowItWorksActivitiy());
  buttonDone.setVisibility(View.GONE);
}
 
源代码16 项目: PHONK   文件: PhonkAppInstallerActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_phonk_installer);

    TextView txtProto = findViewById(R.id.text_proto_install_info);
    TextView txtOrigin = findViewById(R.id.from_url);
    TextView txtDestiny = findViewById(R.id.to_url);
    TextView txtWarning = findViewById(R.id.text_proto_install_warning);

    mLl = findViewById(R.id.proto_install_group);
    Button btnInstall = findViewById(R.id.button_proto_install_ok);
    Button btnCancel = findViewById(R.id.button_proto_install_cancel);
    mBtnFinish = findViewById(R.id.button_proto_install_finish);
    mProgress = findViewById(R.id.progressBar_installing);

    Intent intent = getIntent();
    if (intent == null) {
        finish();
    }

    final Uri urlData = intent.getData();
    txtProto.setText("A project is going to be installed");
    txtOrigin.setText("from: " + urlData.getPath());

    PhonkSettings.getFolderPath(PhonkSettings.USER_PROJECTS_FOLDER);

    String folder = "playground/User Projects";
    File f = new File(urlData.getPath());

    int index = f.getName().lastIndexOf("_");
    String name = f.getName().substring(0, index); //replaceFirst("[.][^.]+$", "");
    final Project p = new Project(folder, name);
    txtDestiny.setText("to: " + p.getFullPath());

    //check if project is already installed
    if (p.exists()) {
        txtWarning.setVisibility(View.VISIBLE);
    }

    btnInstall.setOnClickListener(v -> install(p, urlData));

    btnCancel.setOnClickListener(v -> finish());

    mBtnFinish.setOnClickListener(v -> finish());


    //check if is autoinstall and proceed
    // Read in the script given in the intent.
    if (null != intent) {
        boolean autoInstall = intent.getBooleanExtra("autoInstall", false);

        if (autoInstall) {
            btnInstall.performClick();
            mBtnFinish.performClick();
        }
    }
}
 
源代码17 项目: Shaarlier   文件: NetworkService.java
@Override
protected void onHandleIntent(Intent intent) {
    int action = intent.getIntExtra("action", -1);

    switch (action) {
        case INTENT_CHECK:
            ShaarliAccount accountToTest = (ShaarliAccount) intent.getSerializableExtra("account");

            int shaarliLstatus = checkShaarli(accountToTest);
            Exception object = shaarliLstatus == NETWORK_ERROR ? mError : null;
            sendBackMessage(intent, shaarliLstatus, object);
            break;
        case INTENT_POST:
            Link link = (Link) intent.getSerializableExtra("link");

            if ("".equals(link.getTitle()) && this.loadedTitle != null) {
                link.setTitle(this.loadedTitle);
                this.loadedTitle = null;
            }
            if ("".equals(link.getDescription()) && this.loadedDescription != null) {
                link.setDescription(this.loadedDescription);
                this.loadedDescription = null;
            }
            long accountId = intent.getLongExtra("chosenAccountId", -1);

            try {
                AccountsSource acs = new AccountsSource(this);
                mShaarliAccount = (accountId != -1 ? acs.getShaarliAccountById(accountId) : acs.getDefaultAccount());
            } catch (Exception e) {
                e.printStackTrace();
                sendNotificationShareError(link);
            }
            postLink(link);
            stopSelf();
            break;
        case INTENT_PREFETCH:
            Link sharedLink = (Link) intent.getSerializableExtra("link");
            mShaarliAccount = sharedLink.getAccount();

            Link prefetchedLink = prefetchLink(sharedLink);

            sendBackMessage(intent, PREFETCH_LINK, prefetchedLink);

            break;

        case INTENT_RETRIEVE_TITLE_AND_DESCRIPTION:
            this.loadedTitle = "";
            this.loadedDescription = "";

            String url = intent.getStringExtra("url");

            boolean autoTitle = intent.getBooleanExtra("autoTitle", true);
            boolean autoDescription = intent.getBooleanExtra("autoDescription", false);

            String[] pageTitleAndDescription = getPageTitleAndDescription(url);

            if (autoTitle){
                this.loadedTitle = pageTitleAndDescription[0];
            }
            if (autoDescription){
                this.loadedDescription = pageTitleAndDescription[1];
            }

            sendBackMessage(intent, RETRIEVE_TITLE_ID, pageTitleAndDescription);
            break;
        default:
            // Do nothing
            Log.e("NETWORK_ERROR", "Unknown intent action received: " + action);
            break;
    }
}
 
源代码18 项目: BackPackTrackII   文件: BackgroundService.java
private void handleShare(Intent intent) throws IOException {
    // Write file
    String trackName = intent.getStringExtra(EXTRA_TRACK_NAME);
    boolean extensions = intent.getBooleanExtra(EXTRA_WRITE_EXTENSIONS, false);
    boolean delete = intent.getBooleanExtra(EXTRA_DELETE_DATA, false);
    long from = intent.getLongExtra(EXTRA_TIME_FROM, 0);
    long to = intent.getLongExtra(EXTRA_TIME_TO, Long.MAX_VALUE);
    boolean gpx = ACTION_SHARE_GPX.equals(intent.getAction()) || EXPORTED_ACTION_WRITE_GPX.equals(intent.getAction());
    String fileName = writeFile(gpx, trackName, extensions, from, to, this);

    // Persist last share time
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (gpx)
        prefs.edit().putLong(SettingsFragment.PREF_LAST_SHARE_GPX, new Date().getTime()).apply();
    else
        prefs.edit().putLong(SettingsFragment.PREF_LAST_SHARE_KML, new Date().getTime()).apply();

    // Delete data on request
    if (delete)
        new DatabaseHelper(this).deleteTrackpoints(from, to).close();

    // View file
    if (ACTION_SHARE_GPX.equals(intent.getAction()) || ACTION_SHARE_KML.equals(intent.getAction())) {
        Uri fileUri;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
            fileUri = FileProvider.getUriForFile(this, getPackageName() + ".provider", new File(fileName));
        else
            fileUri = Uri.fromFile(new File(fileName));

        Intent viewIntent = new Intent();
        viewIntent.setAction(Intent.ACTION_VIEW);
        viewIntent.setDataAndType(fileUri, gpx ? "application/gpx+xml" : "application/vnd.google-earth.kml+xml");
        viewIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            List<ResolveInfo> ria = getPackageManager().queryIntentActivities(viewIntent, PackageManager.MATCH_DEFAULT_ONLY);
            for (ResolveInfo resolvedIntentInfo : ria)
                grantUriPermission(
                        resolvedIntentInfo.activityInfo.packageName,
                        fileUri,
                        Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
        }

        startActivity(viewIntent);
    }
}
 
源代码19 项目: PictureSelector   文件: PictureSelectorActivity.java
/**
 * Preview interface callback processing
 *
 * @param data
 */
private void previewCallback(Intent data) {
    if (data == null) {
        return;
    }
    if (config.isOriginalControl) {
        config.isCheckOriginalImage = data.getBooleanExtra(PictureConfig.EXTRA_CHANGE_ORIGINAL, config.isCheckOriginalImage);
        mCbOriginal.setChecked(config.isCheckOriginalImage);
    }
    List<LocalMedia> list = data.getParcelableArrayListExtra(PictureConfig.EXTRA_SELECT_LIST);
    if (mAdapter != null && list != null) {
        boolean isCompleteOrSelected = data.getBooleanExtra(PictureConfig.EXTRA_COMPLETE_SELECTED, false);
        if (isCompleteOrSelected) {
            onChangeData(list);
            if (config.isWithVideoImage) {
                int size = list.size();
                int imageSize = 0;
                for (int i = 0; i < size; i++) {
                    LocalMedia media = list.get(i);
                    if (PictureMimeType.isHasImage(media.getMimeType())) {
                        imageSize++;
                        break;
                    }
                }
                if (imageSize <= 0 || !config.isCompress || config.isCheckOriginalImage) {
                    onResult(list);
                } else {
                    compressImage(list);
                }
            } else {
                // Determine if the resource is of the same type
                String mimeType = list.size() > 0 ? list.get(0).getMimeType() : "";
                if (config.isCompress && PictureMimeType.isHasImage(mimeType)
                        && !config.isCheckOriginalImage) {
                    compressImage(list);
                } else {
                    onResult(list);
                }
            }
        } else {
            // Resources are selected on the preview page
            isStartAnimation = true;
        }
        mAdapter.bindSelectData(list);
        mAdapter.notifyDataSetChanged();
    }
}
 
源代码20 项目: Pix-Art-Messenger   文件: UriHandlerActivity.java
private boolean allowProvisioning() {
    final Intent launchIntent = getIntent();
    return launchIntent != null && launchIntent.getBooleanExtra(EXTRA_ALLOW_PROVISIONING, false);
}
 
 方法所在类
 同类方法