当前位置: 首页>>代码示例>>Java>>正文


Java Launcher类代码示例

本文整理汇总了Java中com.android.launcher3.Launcher的典型用法代码示例。如果您正苦于以下问题:Java Launcher类的具体用法?Java Launcher怎么用?Java Launcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Launcher类属于com.android.launcher3包,在下文中一共展示了Launcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateWallpaper

import com.android.launcher3.Launcher; //导入依赖的package包/类
private void updateWallpaper() {
    Launcher launcher = LauncherAppState.getInstance().getLauncher();
    boolean enabled = mWallpaperManager.getWallpaperInfo() == null && Utilities.isAllowBlurDrawerPrefEnabled(mContext);
    if (enabled != sEnabled) {
        launcher.scheduleKill();
    }

    if (!sEnabled) return;

    updateBlurRadius();

    Bitmap wallpaper = upscaleToScreenSize(((BitmapDrawable) mWallpaperManager.getDrawable()).getBitmap());

    mWallpaperWidth = wallpaper.getWidth();

    mWallpaper = null;
    mPlaceholder = createPlaceholder(wallpaper.getWidth(), wallpaper.getHeight());
    launcher.runOnUiThread(mNotifyRunnable);
    if (Utilities.isVibrancyEnabled(mContext)) {
        wallpaper = applyVibrancy(wallpaper, getTintColor());
    }
    mWallpaper = blur(wallpaper);
    launcher.runOnUiThread(mNotifyRunnable);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:BlurWallpaperProvider.java

示例2: AllAppsGridAdapter

import com.android.launcher3.Launcher; //导入依赖的package包/类
public AllAppsGridAdapter(Launcher launcher, AlphabeticalAppsList apps, View.OnClickListener
        iconClickListener, View.OnLongClickListener iconLongClickListener) {
    Resources res = launcher.getResources();
    mLauncher = launcher;
    mApps = apps;
    mEmptySearchMessage = res.getString(R.string.all_apps_loading_message);
    mGridSizer = new GridSpanSizer();
    mGridLayoutMgr = new AppsGridLayoutManager(launcher);
    mGridLayoutMgr.setSpanSizeLookup(mGridSizer);
    mItemDecoration = new GridItemDecoration();
    mLayoutInflater = LayoutInflater.from(launcher);
    mIconClickListener = iconClickListener;
    mIconLongClickListener = iconLongClickListener;
    mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
    mSectionHeaderOffset = res.getDimensionPixelSize(R.dimen.all_apps_grid_section_y_offset);
    mIsRtl = Utilities.isRtl(res);

    mSectionTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mSectionTextPaint.setTextSize(res.getDimensionPixelSize(
            R.dimen.all_apps_grid_section_text_size));
    mSectionTextPaint.setColor(Utilities.getColorAccent(launcher));
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:23,代码来源:AllAppsGridAdapter.java

示例3: initialize

import com.android.launcher3.Launcher; //导入依赖的package包/类
/**
 * Sets the references to the apps model and the search result callback.
 */
public final void initialize(
        AlphabeticalAppsList apps, ExtendedEditText input,
        Launcher launcher, Callbacks cb) {
    mApps = apps;
    mCb = cb;
    mLauncher = launcher;

    mInput = input;
    mInput.addTextChangedListener(this);
    mInput.setOnEditorActionListener(this);
    mInput.setOnBackKeyListener(this);

    mInputMethodManager = (InputMethodManager)
            mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

    mSearchAlgorithm = onInitializeSearch();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:AllAppsSearchBarController.java

示例4: AllAppsContainerView

import com.android.launcher3.Launcher; //导入依赖的package包/类
public AllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    Resources res = context.getResources();

    mLauncher = Launcher.getLauncher(context);
    mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
    mApps = new AlphabeticalAppsList(context);
    mAdapter = new AllAppsGridAdapter(mLauncher, mApps, mLauncher, this);
    mApps.setAdapter(mAdapter);
    mLayoutManager = mAdapter.getLayoutManager();
    mItemDecoration = mAdapter.getItemDecoration();
    DeviceProfile grid = mLauncher.getDeviceProfile();
    if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && !grid.isVerticalBarLayout()) {
        mRecyclerViewBottomPadding = 0;
        setPadding(0, 0, 0, 0);
    } else {
        mRecyclerViewBottomPadding =
                res.getDimensionPixelSize(R.dimen.all_apps_list_bottom_padding);
    }
    mSearchQueryBuilder = new SpannableStringBuilder();
    Selection.setSelection(mSearchQueryBuilder, 0);

}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:24,代码来源:AllAppsContainerView.java

示例5: Folder

import com.android.launcher3.Launcher; //导入依赖的package包/类
/**
 * Used to inflate the Workspace from XML.
 *
 * @param context The application's context.
 * @param attrs The attributes set containing the Workspace's customization values.
 */
public Folder(Context context, AttributeSet attrs) {
    super(context, attrs);
    setAlwaysDrawnWithCacheEnabled(false);
    mInputMethodManager = (InputMethodManager)
            getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

    Resources res = getResources();
    mExpandDuration = res.getInteger(R.integer.config_folderExpandDuration);
    mMaterialExpandDuration = res.getInteger(R.integer.config_materialFolderExpandDuration);
    mMaterialExpandStagger = res.getInteger(R.integer.config_materialFolderExpandStagger);

    if (sDefaultFolderName == null) {
        sDefaultFolderName = res.getString(R.string.folder_name);
    }
    if (sHintText == null) {
        sHintText = res.getString(R.string.folder_hint_text);
    }
    mLauncher = Launcher.getLauncher(context);
    // We need this view to be focusable in touch mode so that when text editing of the folder
    // name is complete, we have something to focus on, thus hiding the cursor and giving
    // reliable behavior when clicking the text field (since it will always gain focus on click).
    setFocusableInTouchMode(true);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:30,代码来源:Folder.java

示例6: drawScaledPreview

import com.android.launcher3.Launcher; //导入依赖的package包/类
private Bitmap drawScaledPreview(Canvas canvas, Bitmap.Config config) {
    Drawable d = mView.getBackground();
    Rect bounds = getDrawableBounds(d);

    int size = Launcher.getLauncher(mView.getContext()).getDeviceProfile().iconSizePx;

    final Bitmap b = Bitmap.createBitmap(
            size + DRAG_BITMAP_PADDING,
            size + DRAG_BITMAP_PADDING,
            config);

    canvas.setBitmap(b);
    canvas.save(Canvas.MATRIX_SAVE_FLAG);
    canvas.translate(DRAG_BITMAP_PADDING / 2, DRAG_BITMAP_PADDING / 2);
    canvas.scale(((float) size) / bounds.width(), ((float) size) / bounds.height(), 0, 0);
    canvas.translate(bounds.left, bounds.top);
    d.draw(canvas);
    canvas.restore();
    return b;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:ShortcutDragPreviewProvider.java

示例7: getScaleAndPosition

import com.android.launcher3.Launcher; //导入依赖的package包/类
@Override
public float getScaleAndPosition(Bitmap preview, int[] outPos) {
    Launcher launcher = Launcher.getLauncher(mView.getContext());
    int iconSize = getDrawableBounds(mView.getBackground()).width();
    float scale = launcher.getDragLayer().getLocationInDragLayer(mView, outPos);

    int iconLeft = mView.getPaddingStart();
    if (Utilities.isRtl(mView.getResources())) {
        iconLeft = mView.getWidth() - iconSize - iconLeft;
    }

    outPos[0] += Math.round(scale * iconLeft + (scale * iconSize - preview.getWidth()) / 2 +
            mPositionShift.x);
    outPos[1] += Math.round((scale * mView.getHeight() - preview.getHeight()) / 2
            + mPositionShift.y);
    float size = launcher.getDeviceProfile().iconSizePx;
    return scale * iconSize / size;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:19,代码来源:ShortcutDragPreviewProvider.java

示例8: applyShortcutInfo

import com.android.launcher3.Launcher; //导入依赖的package包/类
/** package private **/
void applyShortcutInfo(UnbadgedShortcutInfo info, DeepShortcutsContainer container) {
    mInfo = info;
    IconCache cache = LauncherAppState.getInstance().getIconCache();
    mBubbleText.applyFromShortcutInfo(info, cache);
    mIconView.setBackground(mBubbleText.getIcon());

    // Use the long label as long as it exists and fits.
    CharSequence longLabel = info.mDetail.getLongLabel();
    int availableWidth = mBubbleText.getWidth() - mBubbleText.getTotalPaddingLeft()
            - mBubbleText.getTotalPaddingRight();
    boolean usingLongLabel = !TextUtils.isEmpty(longLabel)
            && mBubbleText.getPaint().measureText(longLabel.toString()) <= availableWidth;
    mBubbleText.setText(usingLongLabel ? longLabel : info.mDetail.getShortLabel());

    // TODO: Add the click handler to this view directly and not the child view.
    mBubbleText.setOnClickListener(Launcher.getLauncher(getContext()));
    mBubbleText.setOnLongClickListener(container);
    mBubbleText.setOnTouchListener(container);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:DeepShortcutView.java

示例9: showForIcon

import com.android.launcher3.Launcher; //导入依赖的package包/类
/**
 * Shows the shortcuts container for {@param icon}
 * @return the container if shown or null.
 */
public static DeepShortcutsContainer showForIcon(BubbleTextView icon) {
    Launcher launcher = Launcher.getLauncher(icon.getContext());
    if (launcher.getOpenShortcutsContainer() != null) {
        // There is already a shortcuts container open, so don't open this one.
        icon.clearFocus();
        return null;
    }
    List<String> ids = launcher.getShortcutIdsForItem((ItemInfo) icon.getTag());
    if (!ids.isEmpty()) {
        // There are shortcuts associated with the app, so defer its drag.
        final DeepShortcutsContainer container =
                (DeepShortcutsContainer) launcher.getLayoutInflater().inflate(
                        R.layout.deep_shortcuts_container, launcher.getDragLayer(), false);
        container.setVisibility(View.INVISIBLE);
        launcher.getDragLayer().addView(container);
        container.populateAndShow(icon, ids);
        return container;
    }
    return null;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:DeepShortcutsContainer.java

示例10: performAccessibilityAction

import com.android.launcher3.Launcher; //导入依赖的package包/类
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
    Launcher launcher = Launcher.getLauncher(host.getContext());
    if (action == OVERVIEW) {
        launcher.showOverviewMode(true);
        return true;
    } else if (action == WALLPAPERS) {
        launcher.onClickWallpaperPicker(host);
        return true;
    } else if (action == WIDGETS) {
        launcher.onClickAddWidgetButton(host);
        return true;
    } else if (action == SETTINGS) {
        launcher.onClickSettingsButton(host);
        return true;
    }
    return super.performAccessibilityAction(host, action, args);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:19,代码来源:OverviewAccessibilityDelegate.java

示例11: LauncherAccessibilityDelegate

import com.android.launcher3.Launcher; //导入依赖的package包/类
public LauncherAccessibilityDelegate(Launcher launcher) {
    mLauncher = launcher;

    mActions.put(REMOVE, new AccessibilityAction(REMOVE,
            launcher.getText(R.string.remove_drop_target_label)));
    mActions.put(INFO, new AccessibilityAction(INFO,
            launcher.getText(R.string.app_info_drop_target_label)));
    mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL,
            launcher.getText(R.string.uninstall_drop_target_label)));
    mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE,
            launcher.getText(R.string.action_add_to_workspace)));
    mActions.put(MOVE, new AccessibilityAction(MOVE,
            launcher.getText(R.string.action_move)));
    mActions.put(MOVE_TO_WORKSPACE, new AccessibilityAction(MOVE_TO_WORKSPACE,
            launcher.getText(R.string.action_move_to_workspace)));
    mActions.put(RESIZE, new AccessibilityAction(RESIZE,
                    launcher.getText(R.string.action_resize)));
    mActions.put(DEEP_SHORTCUTS, new AccessibilityAction(DEEP_SHORTCUTS,
            launcher.getText(R.string.action_deep_shortcut)));
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:LauncherAccessibilityDelegate.java

示例12: addWeightWatcher

import com.android.launcher3.Launcher; //导入依赖的package包/类
public static void addWeightWatcher(Launcher launcher) {
    if (MEMORY_DUMP_ENABLED) {
        boolean show = Utilities.getPrefs(launcher).getBoolean(SHOW_WEIGHT_WATCHER, true);

        int id = launcher.getResources().getIdentifier("zzz_weight_watcher", "layout",
                launcher.getPackageName());
        View watcher = launcher.getLayoutInflater().inflate(id, null);
        watcher.setAlpha(0.5f);
        ((FrameLayout) launcher.findViewById(R.id.launcher)).addView(watcher,
                new FrameLayout.LayoutParams(
                        FrameLayout.LayoutParams.MATCH_PARENT,
                        FrameLayout.LayoutParams.WRAP_CONTENT,
                        Gravity.BOTTOM)
        );

        watcher.setVisibility(show ? View.VISIBLE : View.GONE);
        launcher.mWeightWatcher = watcher;
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:20,代码来源:TestingUtils.java

示例13: onCreate

import com.android.launcher3.Launcher; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SharedPreferences sp = Utilities.getPrefs(this);
    boolean show = sp.getBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, true);

    show = !show;
    sp.edit().putBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, show).apply();

    Launcher launcher = (Launcher) LauncherAppState.getInstance().getModel().getCallback();
    if (launcher != null && launcher.mWeightWatcher != null) {
        launcher.mWeightWatcher.setVisibility(show ? View.VISIBLE : View.GONE);
    }
    finish();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:17,代码来源:ToggleWeightWatcher.java

示例14: AllAppsContainerView

import com.android.launcher3.Launcher; //导入依赖的package包/类
public AllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    Resources res = context.getResources();

    mLauncher = Launcher.getLauncher(context);
    mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
    mApps = new AlphabeticalAppsList(context);
    mAdapter = new AllAppsGridAdapter(mLauncher, mApps, mLauncher, this);
    mApps.setAdapter(mAdapter);
    mLayoutManager = mAdapter.getLayoutManager();
    mItemDecoration = mAdapter.getItemDecoration();
    DeviceProfile grid = mLauncher.getDeviceProfile();
    if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && !grid.isVerticalBarLayout()) {
        mRecyclerViewBottomPadding = 0;
        setPadding(0, 0, 0, 0);
    } else {
        mRecyclerViewBottomPadding =
                res.getDimensionPixelSize(R.dimen.all_apps_list_bottom_padding);
    }
    mSearchQueryBuilder = new SpannableStringBuilder();
    Selection.setSelection(mSearchQueryBuilder, 0);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:23,代码来源:AllAppsContainerView.java

示例15: onPopulateNodeForVirtualView

import com.android.launcher3.Launcher; //导入依赖的package包/类
@Override
protected void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat node) {
    super.onPopulateNodeForVirtualView(id, node);


    // ExploreByTouchHelper does not currently handle view scale.
    // Update BoundsInScreen to appropriate value.
    DragLayer dragLayer = Launcher.getLauncher(mView.getContext()).getDragLayer();
    mTempCords[0] = mTempCords[1] = 0;
    float scale = dragLayer.getDescendantCoordRelativeToSelf(mView, mTempCords);

    node.getBoundsInParent(mTempRect);
    mTempRect.left = mTempCords[0] + (int) (mTempRect.left * scale);
    mTempRect.right = mTempCords[0] + (int) (mTempRect.right * scale);
    mTempRect.top = mTempCords[1] + (int) (mTempRect.top * scale);
    mTempRect.bottom = mTempCords[1] + (int) (mTempRect.bottom * scale);
    node.setBoundsInScreen(mTempRect);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:19,代码来源:WorkspaceAccessibilityHelper.java


注:本文中的com.android.launcher3.Launcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。