當前位置: 首頁>>代碼示例>>Java>>正文


Java WallpaperManager.getDesiredMinimumWidth方法代碼示例

本文整理匯總了Java中android.app.WallpaperManager.getDesiredMinimumWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java WallpaperManager.getDesiredMinimumWidth方法的具體用法?Java WallpaperManager.getDesiredMinimumWidth怎麽用?Java WallpaperManager.getDesiredMinimumWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.WallpaperManager的用法示例。


在下文中一共展示了WallpaperManager.getDesiredMinimumWidth方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: suggestWallpaperDimension

import android.app.WallpaperManager; //導入方法依賴的package包/類
public static void suggestWallpaperDimension(Resources res,
        final SharedPreferences sharedPrefs,
        WindowManager windowManager,
        final WallpaperManager wallpaperManager, boolean fallBackToDefaults) {
    final Point defaultWallpaperSize = WallpaperUtils.getDefaultWallpaperSize(res, windowManager);
    // If we have saved a wallpaper width/height, use that instead

    int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, -1);
    int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, -1);

    if (savedWidth == -1 || savedHeight == -1) {
        if (!fallBackToDefaults) {
            return;
        } else {
            savedWidth = defaultWallpaperSize.x;
            savedHeight = defaultWallpaperSize.y;
        }
    }

    if (savedWidth != wallpaperManager.getDesiredMinimumWidth() ||
            savedHeight != wallpaperManager.getDesiredMinimumHeight()) {
        wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight);
    }
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:25,代碼來源:WallpaperUtils.java

示例2: suggestWallpaperDimension

import android.app.WallpaperManager; //導入方法依賴的package包/類
static public void suggestWallpaperDimension(Resources res,
        final SharedPreferences sharedPrefs,
        WindowManager windowManager,
        final WallpaperManager wallpaperManager, boolean fallBackToDefaults) {
    final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager);
    // If we have saved a wallpaper width/height, use that instead

    int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, -1);
    int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, -1);

    if (savedWidth == -1 || savedHeight == -1) {
        if (!fallBackToDefaults) {
            return;
        } else {
            savedWidth = defaultWallpaperSize.x;
            savedHeight = defaultWallpaperSize.y;
        }
    }

    if (savedWidth != wallpaperManager.getDesiredMinimumWidth() ||
            savedHeight != wallpaperManager.getDesiredMinimumHeight()) {
        wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight);
    }
}
 
開發者ID:AndroidDeveloperLB,項目名稱:WallpaperPicker,代碼行數:25,代碼來源:WallpaperCropActivity.java

示例3: setCustomLockscreenImage

import android.app.WallpaperManager; //導入方法依賴的package包/類
private void setCustomLockscreenImage() {
    Intent intent = new Intent(getActivity(), PickImageActivity.class);
    intent.putExtra(PickImageActivity.EXTRA_CROP, true);
    intent.putExtra(PickImageActivity.EXTRA_SCALE, true);
    Display display = getActivity().getWindowManager().getDefaultDisplay();
    Point displaySize = new Point();
    display.getRealSize(displaySize);
    // Lock screen for tablets visible section are different in landscape/portrait,
    // image need to be cropped correctly, like wallpaper setup for scrolling in background in home screen
    // other wise it does not scale correctly
    if (Utils.isTabletUI(getActivity())) {
        WallpaperManager wpManager = WallpaperManager.getInstance(getActivity());
        int wpWidth = wpManager.getDesiredMinimumWidth();
        int wpHeight = wpManager.getDesiredMinimumHeight();
        float spotlightX = (float) displaySize.x / wpWidth;
        float spotlightY = (float) displaySize.y / wpHeight;
        intent.putExtra(PickImageActivity.EXTRA_ASPECT_X, wpWidth);
        intent.putExtra(PickImageActivity.EXTRA_ASPECT_Y, wpHeight);
        intent.putExtra(PickImageActivity.EXTRA_OUTPUT_X, wpWidth);
        intent.putExtra(PickImageActivity.EXTRA_OUTPUT_Y, wpHeight);
        intent.putExtra(PickImageActivity.EXTRA_SPOTLIGHT_X, spotlightX);
        intent.putExtra(PickImageActivity.EXTRA_SPOTLIGHT_Y, spotlightY);
    } else {
        boolean isPortrait = getResources().getConfiguration().orientation ==
                Configuration.ORIENTATION_PORTRAIT;
        intent.putExtra(PickImageActivity.EXTRA_ASPECT_X, isPortrait ? displaySize.x : displaySize.y);
        intent.putExtra(PickImageActivity.EXTRA_ASPECT_Y, isPortrait ? displaySize.y : displaySize.x);
    }
    getActivity().startActivityFromFragment(this, intent, REQ_LOCKSCREEN_BACKGROUND);
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:31,代碼來源:GravityBoxSettings.java

示例4: loadSourceBitmap

import android.app.WallpaperManager; //導入方法依賴的package包/類
private void loadSourceBitmap(final OnLoadSourceListener l) {
    InputStream stream = getPhotoStream();
    if (stream == null) {
        return;
    }

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeStream(stream, new Rect(0, 0, 0, 0), options);

    try {
        stream.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    WallpaperManager manager = WallpaperManager.getInstance(this);
    int width;
    int height;
    if (1.0 * options.outWidth / options.outHeight
            > 1.0 * manager.getDesiredMinimumWidth() / manager.getDesiredMinimumHeight()) {
        width = (int) (1.0 * options.outWidth / options.outHeight * manager.getDesiredMinimumHeight());
        height = manager.getDesiredMinimumHeight();
    } else {
        width = manager.getDesiredMinimumWidth();
        height = (int) (1.0 * options.outHeight / options.outWidth * manager.getDesiredMinimumWidth());
    }
    ImageHelper.loadBitmap(
            this,
            new SimpleTarget<Bitmap>(width, height) {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    if (l != null) {
                        l.onLoadSourceBitmap(resource);
                    }
                }
            },
            getIntent().getData());
}
 
開發者ID:WangDaYeeeeee,項目名稱:Mysplash,代碼行數:40,代碼來源:SetWallpaperActivity.java

示例5: suggestWallpaperDimension

import android.app.WallpaperManager; //導入方法依賴的package包/類
static public void suggestWallpaperDimension(Resources res,
        final SharedPreferences sharedPrefs,
        WindowManager windowManager,
        final WallpaperManager wallpaperManager) {
    final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager);
    // If we have saved a wallpaper width/height, use that instead
    int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, defaultWallpaperSize.x);
    int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, defaultWallpaperSize.y);
    if (savedWidth != wallpaperManager.getDesiredMinimumWidth() ||
            savedHeight != wallpaperManager.getDesiredMinimumHeight()) {
        wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight);
    }
}
 
開發者ID:Phonemetra,項目名稱:TurboLauncher,代碼行數:14,代碼來源:WallpaperCropActivity.java

示例6: handleRatioChange

import android.app.WallpaperManager; //導入方法依賴的package包/類
private void handleRatioChange(final int width, final int height)
{
	WallpaperManager wm = WallpaperManager.getInstance(context);
	// width of the background as is has been created
	final float background_width = (float) context.getResources().getInteger(Defines.getResourceIDbyName("integer", "background_width"));
	// the amount of pixels which will be 'scrolled', 'width' pixels will always be visible
	max_offset = wm.getDesiredMinimumWidth() - width;
	// ratio between the width which will be used to display the wallpaper and the width of the width of the
	// background resource
	current_ratio = (float) (2 * height) / background_width;
	max_parallax = context.getResources().getInteger(Defines.getResourceIDbyName("integer", "parallax")) * current_ratio;
	min_parallax = -max_parallax;

	scroll_factor = (background_width * current_ratio - width) / max_offset;
	scroll_speed_factor = calcSpeedFactor(2 * height, max_offset * scroll_factor);

	setCurrentPositionSF();
	for (int l = 0; l < layer_array.length; l++) {
		final float offset = -(virtual_scroll_speed_factor[l][1]) * max_parallax;
		for (int i = 0; i < layer_array[l].length; i++) {
			layer_array[l][i].setNewPositionParallaxOffset(offset);
		}
	}
	resetParallax();
	render_width = width;
	setXOffset(x_offset);
	setMetrics(pixelToInchesFactor);
}
 
開發者ID:divosolutions,項目名稱:android-livewallpaper,代碼行數:29,代碼來源:PuvoWallpaperRenderer.java


注:本文中的android.app.WallpaperManager.getDesiredMinimumWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。