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


Java WallpaperManager.suggestDesiredDimensions方法代碼示例

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


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

示例4: doInBackground

import android.app.WallpaperManager; //導入方法依賴的package包/類
@Override
            protected Void doInBackground(Object... objects) {

                DisplayMetrics metrics = new DisplayMetrics();
                getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
                int height = metrics.heightPixels;
                int width = metrics.widthPixels;

                WallpaperManager wallpaperManager = WallpaperManager.getInstance(getActivity());
                wallpaperManager.setWallpaperOffsetSteps(1, 1);
                wallpaperManager.suggestDesiredDimensions(width, height);

                try {
                    String urlWalpaper = urlImage.replace("/r_10000_" + getActivity().getResources().getInteger(R.integer.fragment_movie_fond_height), "/r_" + (width) + "_" + (height));
                    wallpaperManager.setStream(new URL(urlWalpaper).openStream());


                     /*   Bitmap bmap2 = BitmapFactory.decodeStream(new URL(urlWalpaper).openStream());

                        DisplayMetrics metrics = new DisplayMetrics();
                        activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
                        int height = metrics.heightPixels;
                        int width = metrics.widthPixels;
                        Bitmap bitmap = Bitmap.createScaledBitmap(bmap2, width, height, true);
activity.setWallpaper(bitmap);
                           // wallpaperManager.setBitmap(bitmap);
*/

                } catch (Exception e) {
                    if (e.getMessage() != null)
                        e.printStackTrace();
                }

                return null;
            }
 
開發者ID:florent37,項目名稱:OCiney,代碼行數:36,代碼來源:ImagesPagerAdapter.java


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