本文整理汇总了Java中com.android.launcher3.InvariantDeviceProfile类的典型用法代码示例。如果您正苦于以下问题:Java InvariantDeviceProfile类的具体用法?Java InvariantDeviceProfile怎么用?Java InvariantDeviceProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvariantDeviceProfile类属于com.android.launcher3包,在下文中一共展示了InvariantDeviceProfile类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GridSizeMigrationTask
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
protected GridSizeMigrationTask(Context context, InvariantDeviceProfile idp,
HashSet<String> validPackages, Point sourceSize, Point targetSize) {
mContext = context;
mValidPackages = validPackages;
mIdp = idp;
mSrcX = sourceSize.x;
mSrcY = sourceSize.y;
mTrgX = targetSize.x;
mTrgY = targetSize.y;
mShouldRemoveX = mTrgX < mSrcX;
mShouldRemoveY = mTrgY < mSrcY;
// Non-used variables
mSrcHotseatSize = mDestHotseatSize = -1;
}
示例2: FolderPagedView
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
public FolderPagedView(Context context, AttributeSet attrs) {
super(context, attrs);
LauncherAppState app = LauncherAppState.getInstance();
InvariantDeviceProfile profile = app.getInvariantDeviceProfile();
mMaxCountX = profile.numFolderColumns;
mMaxCountY = profile.numFolderRows;
mMaxItemsPerPage = mMaxCountX * mMaxCountY;
mInflater = LayoutInflater.from(context);
mIconCache = app.getIconCache();
mIsRtl = Utilities.isRtl(getResources());
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
setEdgeGlowColor(getResources().getColor(R.color.folder_edge_effect_color));
mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
}
示例3: updateDynamicGridSizeSettingsItem
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
public void updateDynamicGridSizeSettingsItem(TextView stateView, Switch settingSwitch) {
InvariantDeviceProfile.GridSize gridSize = InvariantDeviceProfile.GridSize.getModeForValue(
SettingsProvider.getIntCustomDefault(mLauncher,
SettingsProvider.SETTINGS_UI_DYNAMIC_GRID_SIZE, 0));
String state = "";
switch (gridSize) {
case Comfortable:
state = mLauncher.getResources().getString(R.string.grid_size_comfortable);
break;
case Cozy:
state = mLauncher.getResources().getString(R.string.grid_size_cozy);
break;
case Condensed:
state = mLauncher.getResources().getString(R.string.grid_size_condensed);
break;
case Custom:
int rows = SettingsProvider.getIntCustomDefault(mLauncher,
SettingsProvider.SETTINGS_UI_HOMESCREEN_ROWS, 0);
int columns = SettingsProvider.getIntCustomDefault(mLauncher,
SettingsProvider.SETTINGS_UI_HOMESCREEN_COLUMNS, 0);
state = rows + " " + "\u00d7" + " " + columns;
break;
}
setStateText(stateView, settingSwitch, state);
}
示例4: WidgetItem
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
public WidgetItem(LauncherAppWidgetProviderInfo info, AppWidgetManagerCompat widgetManager) {
super(info.provider, widgetManager.getUser(info));
label = Utilities.trim(widgetManager.loadLabel(info));
widgetInfo = info;
activityInfo = null;
InvariantDeviceProfile idv = LauncherAppState.getInstance().getInvariantDeviceProfile();
spanX = Math.min(info.spanX, idv.numColumns);
spanY = Math.min(info.spanY, idv.numRows);
}
示例5: LossyScreenMigrationTask
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
protected LossyScreenMigrationTask(
Context context, InvariantDeviceProfile idp, SQLiteDatabase db) {
// Decrease the rows count by 1
super(context, idp, getValidPackages(context),
new Point(idp.numColumns, idp.numRows + 1),
new Point(idp.numColumns, idp.numRows));
mDb = db;
mOriginalItems = new LongArrayMap<>();
mUpdates = new LongArrayMap<>();
}
示例6: setUp
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
mValidPackages = new HashSet<>();
mValidPackages.add(TEST_PACKAGE);
mIdp = new InvariantDeviceProfile();
}
示例7: applyFromAppWidgetProviderInfo
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
/**
* Apply the widget provider info to the view.
*/
public void applyFromAppWidgetProviderInfo(LauncherAppWidgetProviderInfo info,
WidgetPreviewLoader loader) {
InvariantDeviceProfile profile =
LauncherAppState.getInstance().getInvariantDeviceProfile();
mInfo = info;
// TODO(hyunyoungs): setup a cache for these labels.
mWidgetName.setText(AppWidgetManagerCompat.getInstance(getContext()).loadLabel(info));
int hSpan = Math.min(info.spanX, profile.numColumns);
int vSpan = Math.min(info.spanY, profile.numRows);
mWidgetDims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
mWidgetPreviewLoader = loader;
}
示例8: migrateGridIfNeeded
import com.android.launcher3.InvariantDeviceProfile; //导入依赖的package包/类
/**
* Migrates the workspace and hotseat in case their sizes changed.
* @return false if the migration failed.
*/
public static boolean migrateGridIfNeeded(Context context) {
SharedPreferences prefs = Utilities.getPrefs(context);
InvariantDeviceProfile idp = LauncherAppState.getInstance().getInvariantDeviceProfile();
String gridSizeString = getPointString(idp.numColumns, idp.numRows);
if (gridSizeString.equals(prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, "")) &&
idp.numHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons)) {
// Skip if workspace and hotseat sizes have not changed.
return true;
}
long migrationStartTime = System.currentTimeMillis();
try {
boolean dbChanged = false;
HashSet validPackages = getValidPackages(context);
// Hotseat
int srcHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons);
if (srcHotseatCount != idp.numHotseatIcons) {
// Migrate hotseat.
dbChanged = new GridSizeMigrationTask(context,
LauncherAppState.getInstance().getInvariantDeviceProfile(),
validPackages, srcHotseatCount, idp.numHotseatIcons).migrateHotseat();
}
// Grid size
Point targetSize = new Point(idp.numColumns, idp.numRows);
Point sourceSize = parsePoint(prefs.getString(
KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString));
if (new MultiStepMigrationTask(validPackages, context).migrate(sourceSize, targetSize)) {
dbChanged = true;
}
if (dbChanged) {
// Make sure we haven't removed everything.
final Cursor c = context.getContentResolver().query(
LauncherSettings.Favorites.CONTENT_URI, null, null, null, null);
boolean hasData = c.moveToNext();
c.close();
if (!hasData) {
throw new Exception("Removed every thing during grid resize");
}
}
return true;
} catch (Exception e) {
Log.e(TAG, "Error during grid migration", e);
return false;
} finally {
Log.v(TAG, "Workspace migration completed in "
+ (System.currentTimeMillis() - migrationStartTime));
// Save current configuration, so that the migration does not run again.
prefs.edit()
.putString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString)
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons)
.apply();
}
}