Java Code Examples for android.content.Intent#ACTION_SET_WALLPAPER

The following examples show how to use android.content.Intent#ACTION_SET_WALLPAPER . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: candybar   File: IntentHelper.java    License: Apache License 2.0 6 votes vote down vote up
public static int getAction(@Nullable Intent intent) {
    if (intent == null) return ACTION_DEFAULT;
    String action = intent.getAction();
    if (action != null) {
        switch (action) {
            case ACTION_ADW_PICK_ICON:
            case ACTION_TURBO_PICK_ICON:
            case ACTION_LAWNCHAIR_ICONPACK:
            case ACTION_NOVA_LAUNCHER:
            case ACTION_ONEPLUS_PICK_ICON:
            case ACTION_PLUS_HOME:
                return ICON_PICKER;
            case Intent.ACTION_PICK:
            case Intent.ACTION_GET_CONTENT:
                return IMAGE_PICKER;
            case Intent.ACTION_SET_WALLPAPER:
                return WALLPAPER_PICKER;
            default:
                return ACTION_DEFAULT;
        }
    }

    return ACTION_DEFAULT;
}
 
Example 2
@Override public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_settings:
            startActivityForResult(new Intent(this, SettingsActivity.class),
                    SETTINGS_RETURN_CODE);
            return true;
        case R.id.action_force_refresh:
            recreate();
            return true;
        case R.id.action_view_widgets:
            WidgetsDialogFragment widgetFragment = new WidgetsDialogFragment();
            widgetFragment.show(getSupportFragmentManager(), "Widgets Dialog");
            return true;
        case R.id.update_wallpaper:
            Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
            startActivity(Intent.createChooser(intent, getString(R.string.action_wallpaper)));
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 3
Source Project: candybar-library   File: IntentHelper.java    License: Apache License 2.0 6 votes vote down vote up
public static int getAction(@Nullable Intent intent) {
    if (intent == null) return ACTION_DEFAULT;
    String action = intent.getAction();
    if (action != null) {
        switch (action) {
            case ACTION_ADW_PICK_ICON:
            case ACTION_TURBO_PICK_ICON:
            case ACTION_NOVA_LAUNCHER:
            case ACTION_PLUS_HOME:
                return ICON_PICKER;
            case Intent.ACTION_PICK:
            case Intent.ACTION_GET_CONTENT:
                return IMAGE_PICKER;
            case Intent.ACTION_SET_WALLPAPER:
                return WALLPAPER_PICKER;
            default:
                return ACTION_DEFAULT;
        }
    }
    return ACTION_DEFAULT;
}
 
Example 4
@Override public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_settings:
            startActivityForResult(new Intent(this, SettingsActivity.class),
                    SETTINGS_RETURN_CODE);
            return true;
        case R.id.action_force_refresh:
            recreate();
            return true;
        case R.id.action_view_widgets:
            WidgetsDialogFragment widgetFragment = new WidgetsDialogFragment();
            widgetFragment.show(getSupportFragmentManager(), "Widgets Dialog");
            return true;
        case R.id.update_wallpaper:
            Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
            startActivity(Intent.createChooser(intent, getString(R.string.action_wallpaper)));
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 5
Source Project: paper-launcher   File: CustomizationDialog.java    License: MIT License 5 votes vote down vote up
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.customization_default_launcher:
            dismiss();

            mLauncherActivity.startActivity(new Intent("android.settings.HOME_SETTINGS"));
            break;
        case R.id.customization_wallpaper:
            dismiss();

            Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
            mLauncherActivity.startActivityForResult(intent, LauncherActivity.WALLPAPER_SELECT_INTENT_CODE);
            break;
        case R.id.customization_edit_dock_icons:
            dismiss();

            mLauncherActivity.startDockIconsEditing();
            break;
        case R.id.customization_icon_pack:
            dismiss();

            mLauncherActivity.finish();
            mLauncherActivity.startActivity(new Intent(mLauncherActivity, IconPackChooserActivity.class));
            break;
    }
}
 
Example 6
@Override
public void onClick(WallpaperPickerActivity a) {
    final ComponentName itemComponentName = new ComponentName(
            mResolveInfo.activityInfo.packageName, mResolveInfo.activityInfo.name);
    Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    launchIntent.setComponent(itemComponentName);
    a.startActivityForResultSafely(
            launchIntent, WallpaperPickerActivity.PICK_WALLPAPER_THIRD_PARTY_ACTIVITY);
}
 
Example 7
@Override
public void onClick(WallpaperPickerActivity a) {
    final ComponentName itemComponentName = new ComponentName(
            mResolveInfo.activityInfo.packageName, mResolveInfo.activityInfo.name);
    Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    launchIntent.setComponent(itemComponentName);
    a.startActivityForResultSafely(
            launchIntent, WallpaperPickerActivity.PICK_WALLPAPER_THIRD_PARTY_ACTIVITY);
}
 
Example 8
@Override
public void onClick(WallpaperPickerActivity a) {
    final ComponentName itemComponentName = new ComponentName(
            mResolveInfo.activityInfo.packageName, mResolveInfo.activityInfo.name);
    Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    launchIntent.setComponent(itemComponentName);
    a.startActivityForResultSafely(
            launchIntent, WallpaperPickerActivity.PICK_WALLPAPER_THIRD_PARTY_ACTIVITY);
}
 
Example 9
Source Project: HayaiLauncher   File: SearchActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
        case R.id.action_settings:
            final Intent intentSettings = new Intent(this, SettingsActivity.class);
            startActivity(intentSettings);
            return true;
        case R.id.action_refresh_app_list:
            recreate();
            return true;
        case R.id.action_system_settings:
            final Intent intentSystemSettings = new Intent(Settings.ACTION_SETTINGS);
            intentSystemSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intentSystemSettings);
            return true;
        case R.id.action_manage_apps:
            final Intent intentManageApps = new Intent(Settings.ACTION_APPLICATION_SETTINGS);
            intentManageApps.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intentManageApps);
            return true;
        case R.id.action_set_wallpaper:
            final Intent intentWallpaperPicker = new Intent(Intent.ACTION_SET_WALLPAPER);
            startActivity(intentWallpaperPicker);
            return true;
        case R.id.action_about:
            final Intent intentAbout = new Intent(this, AboutActivity.class);
            startActivity(intentAbout);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 10
Source Project: LiveWallPaper   File: MainActivity.java    License: Apache License 2.0 4 votes vote down vote up
private void startWallpaper(){
    final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
    Intent chooser = Intent.createChooser(pickWallpaper,"设置壁纸");
    startActivity(chooser);
}
 
Example 11
public ThirdPartyWallpaperPickerListAdapter(Context context) {
    mInflater = LayoutInflater.from(context);
    mPackageManager = context.getPackageManager();
    mIconSize = context.getResources().getDimensionPixelSize(R.dimen.wallpaperItemIconSize);
    final PackageManager pm = mPackageManager;

    final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    final List<ResolveInfo> apps =
            pm.queryIntentActivities(pickWallpaperIntent, 0);

    // Get list of image picker intents
    Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
    pickImageIntent.setType("image/*");
    final List<ResolveInfo> imagePickerActivities =
            pm.queryIntentActivities(pickImageIntent, 0);
    final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];
    for (int i = 0; i < imagePickerActivities.size(); i++) {
        ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;
        imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);
    }

    outerLoop:
    for (ResolveInfo info : apps) {
        final ComponentName itemComponentName =
                new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
        final String itemPackageName = itemComponentName.getPackageName();
        // Exclude anything from our own package, and the old Launcher,
        // and live wallpaper picker
        if (itemPackageName.equals(context.getPackageName()) ||
                itemPackageName.equals("com.android.launcher") ||
                itemPackageName.equals("com.android.wallpaper.livepicker")) {
            continue;
        }
        // Exclude any package that already responds to the image picker intent
        for (ResolveInfo imagePickerActivityInfo : imagePickerActivities) {
            if (itemPackageName.equals(
                    imagePickerActivityInfo.activityInfo.packageName)) {
                continue outerLoop;
            }
        }
        mThirdPartyWallpaperPickers.add(new ThirdPartyWallpaperTile(info));
    }
}
 
Example 12
Source Project: TurboLauncher   File: Launcher.java    License: Apache License 2.0 4 votes vote down vote up
public void startWallpaper() {
	final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
	pickWallpaper.setComponent(getWallpaperPickerComponent());
	startActivityForResult(pickWallpaper, REQUEST_PICK_WALLPAPER);
}
 
Example 13
public ThirdPartyWallpaperPickerListAdapter(Context context) {
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPackageManager = context.getPackageManager();
    mIconSize = context.getResources().getDimensionPixelSize(R.dimen.wallpaperItemIconSize);
    final PackageManager pm = mPackageManager;

    final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    final List<ResolveInfo> apps =
            pm.queryIntentActivities(pickWallpaperIntent, 0);

    // Get list of image picker intents
    Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
    pickImageIntent.setType("image/*");
    final List<ResolveInfo> imagePickerActivities =
            pm.queryIntentActivities(pickImageIntent, 0);
    final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];
    for (int i = 0; i < imagePickerActivities.size(); i++) {
        ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;
        imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);
    }

    outerLoop:
    for (ResolveInfo info : apps) {
        final ComponentName itemComponentName =
                new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
        final String itemPackageName = itemComponentName.getPackageName();
        // Exclude anything from our own package, and the old Launcher,
        // and live wallpaper picker
        if (itemPackageName.equals(context.getPackageName()) ||
                itemPackageName.equals("com.android.launcher") ||
                itemPackageName.equals("com.android.wallpaper.livepicker")) {
            continue;
        }
        // Exclude any package that already responds to the image picker intent
        for (ResolveInfo imagePickerActivityInfo : imagePickerActivities) {
            if (itemPackageName.equals(
                    imagePickerActivityInfo.activityInfo.packageName)) {
                continue outerLoop;
            }
        }
        mThirdPartyWallpaperPickers.add(new ThirdPartyWallpaperTile(info));
    }
}
 
Example 14
public ThirdPartyWallpaperPickerListAdapter(Context context) {
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPackageManager = context.getPackageManager();
    mIconSize = context.getResources().getDimensionPixelSize(R.dimen.wallpaperItemIconSize);
    final PackageManager pm = mPackageManager;

    final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
    final List<ResolveInfo> apps =
            pm.queryIntentActivities(pickWallpaperIntent, 0);

    // Get list of image picker intents
    Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
    pickImageIntent.setType("image/*");
    final List<ResolveInfo> imagePickerActivities =
            pm.queryIntentActivities(pickImageIntent, 0);
    final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];
    for (int i = 0; i < imagePickerActivities.size(); i++) {
        ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;
        imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);
    }

    outerLoop:
    for (ResolveInfo info : apps) {
        final ComponentName itemComponentName =
                new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
        final String itemPackageName = itemComponentName.getPackageName();
        // Exclude anything from our own package, and the old Launcher,
        // and live wallpaper picker
        if (itemPackageName.equals(context.getPackageName()) ||
                itemPackageName.equals("com.android.launcher") ||
                itemPackageName.equals("com.android.wallpaper.livepicker")) {
            continue;
        }
        // Exclude any package that already responds to the image picker intent
        for (ResolveInfo imagePickerActivityInfo : imagePickerActivities) {
            if (itemPackageName.equals(
                    imagePickerActivityInfo.activityInfo.packageName)) {
                continue outerLoop;
            }
        }
        mThirdPartyWallpaperPickers.add(new ThirdPartyWallpaperTile(info));
    }
}
 
Example 15
Source Project: LiveWallpaper   File: MainActivity.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 选择系统壁纸
 *
 * @param view
 */
public void onSelectSystemWallpaper(View view) {
    Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
    startActivityForResult(Intent.createChooser(intent, "选择壁纸"), REQUEST_CODE_SELECT_SYSTEM_WALLPAPER);
}