Merge "Initial changes to support smaller landscape layouts." into jb-ub-now-jetsonic

This commit is contained in:
Winson Chung
2013-10-29 01:33:59 +00:00
committed by Android (Google) Code Review
15 changed files with 174 additions and 80 deletions
+4 -1
View File
@@ -30,5 +30,8 @@
android:src="@drawable/portal_ring_inner_holo"/>
<com.android.launcher3.BubbleTextView
style="@style/WorkspaceIcon"
android:id="@+id/folder_icon_name" />
android:id="@+id/folder_icon_name"
android:layout_gravity="top"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.android.launcher3.FolderIcon>
+1
View File
@@ -20,6 +20,7 @@
<dimen name="dynamic_grid_search_bar_max_width">500dp</dimen>
<dimen name="dynamic_grid_search_bar_height">48dp</dimen>
<dimen name="dynamic_grid_page_indicator_height">24dp</dimen>
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
<!-- Wallpaper picker -->
<dimen name="wallpaperThumbnailWidth">106.5dp</dimen>
+1 -1
View File
@@ -98,7 +98,7 @@
<style name="WorkspaceIcon.AppsCustomize">
<item name="android:background">@null</item>
<item name="android:textColor">@color/apps_customize_icon_text_color</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:drawablePadding">@dimen/dynamic_grid_icon_drawable_padding</item>
<item name="android:shadowRadius">4.0</item>
<item name="android:shadowColor">#FF000000</item>
</style>
@@ -87,7 +87,7 @@ public class BubbleTextView extends TextView {
// Ensure we are using the right text size
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
setTextColor(getResources().getColor(R.color.workspace_icon_text_color));
}
@@ -111,7 +111,7 @@ public class BubbleTextView extends TextView {
setCompoundDrawables(null,
Utilities.createIconDrawable(b), null, null);
setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f));
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
setText(info.title);
setTag(info);
}
+1 -1
View File
@@ -214,7 +214,7 @@ public class CellLayout extends ViewGroup {
setAlwaysDrawnWithCacheEnabled(false);
final Resources res = getResources();
mHotseatScale = (float) grid.hotseatIconSize / grid.iconSize;
mHotseatScale = (float) grid.hotseatIconSizePx / grid.iconSizePx;
mNormalBackground = res.getDrawable(R.drawable.screenpanel);
mActiveGlowBackground = res.getDrawable(R.drawable.screenpanel_hover);
+1 -1
View File
@@ -147,7 +147,7 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
pos.left + Utilities.sIconTextureWidth,
pos.top + Utilities.sIconTextureHeight);
Utilities.scaleRectAboutCenter(mFocusedHotseatAppBounds,
(grid.hotseatIconSize / grid.iconSize));
((float) grid.hotseatIconSizePx / grid.iconSizePx));
// Set the title
TextView v = (TextView) findViewById(R.id.focused_hotseat_app_title);
+132 -49
View File
@@ -23,13 +23,17 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Paint;
import android.graphics.Paint.FontMetrics;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.Gravity;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.FrameLayout;
import java.util.ArrayList;
@@ -52,15 +56,20 @@ class DeviceProfileQuery {
}
class DeviceProfile {
public static interface DeviceProfileCallbacks {
public void onAvailableSizeChanged(DeviceProfile grid);
}
String name;
float minWidthDps;
float minHeightDps;
float numRows;
float numColumns;
float iconSize;
float iconTextSize;
float numHotseatIcons;
float hotseatIconSize;
private float iconSize;
private float iconTextSize;
private int iconDrawablePaddingOriginalPx;
private float hotseatIconSize;
boolean isLandscape;
boolean isTablet;
@@ -75,8 +84,10 @@ class DeviceProfile {
int heightPx;
int availableWidthPx;
int availableHeightPx;
int iconSizePx;
int iconTextSizePx;
int iconDrawablePaddingPx;
int cellWidthPx;
int cellHeightPx;
int folderBackgroundOffset;
@@ -96,6 +107,8 @@ class DeviceProfile {
int searchBarHeightPx;
int pageIndicatorHeightPx;
private ArrayList<DeviceProfileCallbacks> mCallbacks = new ArrayList<DeviceProfileCallbacks>();
DeviceProfile(String n, float w, float h, float r, float c,
float is, float its, float hs, float his) {
// Ensure that we have an odd number of hotseat items (since we need to place all apps)
@@ -146,13 +159,20 @@ class DeviceProfile {
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numColumns));
}
numColumns = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
// Interpolate the hotseat length
points.clear();
for (DeviceProfile p : profiles) {
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numHotseatIcons));
}
numHotseatIcons = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
hotseatAllAppsRank = (int) (numHotseatIcons / 2);
// Interpolate the icon size
points.clear();
for (DeviceProfile p : profiles) {
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconSize));
}
iconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
iconSizePx = DynamicGrid.pxFromDp(iconSize, dm);
// Interpolate the icon text size
points.clear();
@@ -160,14 +180,8 @@ class DeviceProfile {
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconTextSize));
}
iconTextSize = invDistWeightedInterpolate(minWidth, minHeight, points);
iconTextSizePx = DynamicGrid.pxFromSp(iconTextSize, dm);
iconDrawablePaddingOriginalPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
// Interpolate the hotseat size
points.clear();
for (DeviceProfile p : profiles) {
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numHotseatIcons));
}
numHotseatIcons = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
// Interpolate the hotseat icon size
points.clear();
for (DeviceProfile p : profiles) {
@@ -175,11 +189,91 @@ class DeviceProfile {
}
// Hotseat
hotseatIconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
hotseatIconSizePx = DynamicGrid.pxFromDp(hotseatIconSize, dm);
hotseatAllAppsRank = (int) (numColumns / 2);
// Calculate other vars based on Configuration
updateFromConfiguration(resources, wPx, hPx, awPx, ahPx);
// Calculate the remaining vars
updateFromConfiguration(context, resources, wPx, hPx, awPx, ahPx);
updateAvailableDimensions(context);
}
void addCallback(DeviceProfileCallbacks cb) {
mCallbacks.add(cb);
cb.onAvailableSizeChanged(this);
}
void removeCallback(DeviceProfileCallbacks cb) {
mCallbacks.remove(cb);
}
private int getDeviceOrientation(Context context) {
WindowManager windowManager = (WindowManager)
context.getSystemService(Context.WINDOW_SERVICE);
Resources resources = context.getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
Configuration config = resources.getConfiguration();
int rotation = windowManager.getDefaultDisplay().getRotation();
boolean isLandscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE) &&
(rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180);
boolean isRotatedPortrait = (config.orientation == Configuration.ORIENTATION_PORTRAIT) &&
(rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270);
if (isLandscape || isRotatedPortrait) {
return CellLayout.LANDSCAPE;
} else {
return CellLayout.PORTRAIT;
}
}
private void updateAvailableDimensions(Context context) {
WindowManager windowManager = (WindowManager)
context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Resources resources = context.getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
Configuration config = resources.getConfiguration();
// There are three possible configurations that the dynamic grid accounts for, portrait,
// landscape with the nav bar at the bottom, and landscape with the nav bar at the side.
// To prevent waiting for fitSystemWindows(), we make the observation that in landscape,
// the height is the smallest height (either with the nav bar at the bottom or to the
// side) and otherwise, the height is simply the largest possible height for a portrait
// device.
Point size = new Point();
Point smallestSize = new Point();
Point largestSize = new Point();
display.getSize(size);
display.getCurrentSizeRange(smallestSize, largestSize);
availableWidthPx = size.x;
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
availableHeightPx = smallestSize.y;
} else {
availableHeightPx = largestSize.y;
}
// Check to see if the icons fit in the new available height. If not, then we need to
// shrink the icon size.
Rect workspacePadding = getWorkspacePadding();
float scale = 1f;
int drawablePadding = iconDrawablePaddingOriginalPx;
updateIconSize(1f, drawablePadding, resources, dm);
float usedHeight = (cellHeightPx * numRows);
int maxHeight = (availableHeightPx - workspacePadding.top - workspacePadding.bottom);
if (usedHeight > maxHeight) {
scale = maxHeight / usedHeight;
drawablePadding = 0;
}
updateIconSize(scale, drawablePadding, resources, dm);
// Make the callbacks
for (DeviceProfileCallbacks cb : mCallbacks) {
cb.onAvailableSizeChanged(this);
}
}
private void updateIconSize(float scale, int drawablePadding, Resources resources,
DisplayMetrics dm) {
iconSizePx = (int) (DynamicGrid.pxFromDp(iconSize, dm) * scale);
iconTextSizePx = (int) (DynamicGrid.pxFromSp(iconTextSize, dm) * scale);
iconDrawablePaddingPx = drawablePadding;
hotseatIconSizePx = (int) (DynamicGrid.pxFromDp(hotseatIconSize, dm) * scale);
// Search Bar
searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width);
@@ -192,23 +286,7 @@ class DeviceProfile {
textPaint.setTextSize(iconTextSizePx);
FontMetrics fm = textPaint.getFontMetrics();
cellWidthPx = iconSizePx;
cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
// At this point, if the cells do not fit into the available height, then we need
// to shrink the icon size
/*
Rect padding = getWorkspacePadding(isLandscape ?
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
int h = (int) (numRows * cellHeightPx) + padding.top + padding.bottom;
if (h > availableHeightPx) {
float delta = h - availableHeightPx;
int deltaPx = (int) Math.ceil(delta / numRows);
iconSizePx -= deltaPx;
iconSize = DynamicGrid.dpiFromPx(iconSizePx, dm);
cellWidthPx = iconSizePx;
cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
}
*/
cellHeightPx = iconSizePx + iconDrawablePaddingPx + (int) Math.ceil(fm.bottom - fm.top);
// Hotseat
hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx;
@@ -217,12 +295,26 @@ class DeviceProfile {
// Folder
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
folderCellHeightPx = cellHeightPx + (int) ((3f/2f) * edgeMarginPx);
folderCellHeightPx = cellHeightPx + edgeMarginPx;
folderBackgroundOffset = -edgeMarginPx;
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
// All Apps
Rect padding = getWorkspacePadding(isLandscape ?
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
int pageIndicatorOffset =
resources.getDimensionPixelSize(R.dimen.apps_customize_page_indicator_offset);
if (isLandscape) {
allAppsNumRows = (availableHeightPx - pageIndicatorOffset - 4 * edgeMarginPx) /
(iconSizePx + iconTextSizePx + 2 * edgeMarginPx);
} else {
allAppsNumRows = (int) numRows + 1;
}
allAppsNumCols = (availableWidthPx - padding.left - padding.right - 2 * edgeMarginPx) /
(iconSizePx + 2 * edgeMarginPx);
}
void updateFromConfiguration(Resources resources, int wPx, int hPx,
void updateFromConfiguration(Context context, Resources resources, int wPx, int hPx,
int awPx, int ahPx) {
isLandscape = (resources.getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE);
@@ -233,18 +325,7 @@ class DeviceProfile {
availableWidthPx = awPx;
availableHeightPx = ahPx;
Rect padding = getWorkspacePadding(isLandscape ?
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
int pageIndicatorOffset =
resources.getDimensionPixelSize(R.dimen.apps_customize_page_indicator_offset);
if (isLandscape) {
allAppsNumRows = (availableHeightPx - pageIndicatorOffset - 4 * edgeMarginPx) /
(iconSizePx + iconTextSizePx + 2 * edgeMarginPx);
} else {
allAppsNumRows = (int) numRows + 1;
}
allAppsNumCols = (availableWidthPx - padding.left - padding.right - 2 * edgeMarginPx) /
(iconSizePx + 2 * edgeMarginPx);
updateAvailableDimensions(context);
}
private float dist(PointF p0, PointF p1) {
@@ -298,6 +379,9 @@ class DeviceProfile {
return sum;
}
Rect getWorkspacePadding() {
return getWorkspacePadding(isLandscape ? CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
}
Rect getWorkspacePadding(int orientation) {
Rect padding = new Rect();
if (orientation == CellLayout.LANDSCAPE &&
@@ -431,8 +515,7 @@ class DeviceProfile {
lp.gravity = Gravity.RIGHT;
lp.width = hotseatBarHeightPx;
lp.height = LayoutParams.MATCH_PARENT;
hotseat.setPadding(0, 2 * edgeMarginPx,
2 * edgeMarginPx, 2 * edgeMarginPx);
hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx);
} else if (isTablet()) {
// Pad the hotseat with the grid gap calculated above
int gridGap = (int) ((widthPx - 2 * edgeMarginPx -
@@ -553,7 +636,7 @@ public class DynamicGrid {
"Wd: " + mProfile.minWidthDps + ", Hd: " + mProfile.minHeightDps +
", W: " + mProfile.widthPx + ", H: " + mProfile.heightPx +
" [r: " + mProfile.numRows + ", c: " + mProfile.numColumns +
", is: " + mProfile.iconSizePx + ", its: " + mProfile.iconTextSize +
", is: " + mProfile.iconSizePx + ", its: " + mProfile.iconTextSizePx +
", cw: " + mProfile.cellWidthPx + ", ch: " + mProfile.cellHeightPx +
", hc: " + mProfile.numHotseatIcons + ", his: " + mProfile.hotseatIconSizePx + "]";
}
@@ -67,6 +67,7 @@ class FastBitmapDrawable extends Drawable {
public void setFilterBitmap(boolean filterBitmap) {
mPaint.setFilterBitmap(filterBitmap);
mPaint.setAntiAlias(filterBitmap);
}
public int getAlpha() {
-2
View File
@@ -957,9 +957,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Rect workspacePadding = grid.getWorkspacePadding(grid.isLandscape ?
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
int maxContentAreaHeight = grid.availableHeightPx -
4 * grid.edgeMarginPx -
workspacePadding.top - workspacePadding.bottom -
getPaddingTop() - getPaddingBottom() -
mFolderNameHeight;
return Math.min(maxContentAreaHeight,
mContent.getDesiredHeight());
+10 -9
View File
@@ -37,7 +37,7 @@ import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.R;
@@ -49,7 +49,7 @@ import java.util.ArrayList;
/**
* An icon that can appear on in the workspace representing an {@link UserFolder}.
*/
public class FolderIcon extends LinearLayout implements FolderListener {
public class FolderIcon extends FrameLayout implements FolderListener {
private Launcher mLauncher;
private Folder mFolder;
private FolderInfo mInfo;
@@ -134,17 +134,20 @@ public class FolderIcon extends LinearLayout implements FolderListener {
"INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
"is dependent on this");
}
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);
icon.setClipToPadding(false);
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
icon.mFolderName.setText(folderInfo.title);
icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background);
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
icon.mFolderName.setCompoundDrawablePadding(0);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams();
lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx;
// Offset the preview background to center this view accordingly
LinearLayout.LayoutParams lp =
(LinearLayout.LayoutParams) icon.mPreviewBackground.getLayoutParams();
icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background);
lp = (FrameLayout.LayoutParams) icon.mPreviewBackground.getLayoutParams();
lp.topMargin = grid.folderBackgroundOffset;
lp.width = grid.folderIconSizePx;
lp.height = grid.folderIconSizePx;
@@ -537,12 +540,10 @@ public class FolderIcon extends LinearLayout implements FolderListener {
if (d != null) {
mOldBounds.set(d.getBounds());
d.setBounds(0, 0, mIntrinsicIconSize, mIntrinsicIconSize);
d.setFilterBitmap(true);
d.setColorFilter(Color.argb(params.overlayAlpha, 255, 255, 255),
PorterDuff.Mode.SRC_ATOP);
d.draw(canvas);
d.clearColorFilter();
d.setFilterBitmap(false);
d.setBounds(mOldBounds);
}
canvas.restore();
+1 -1
View File
@@ -156,7 +156,7 @@ public class IconCache {
Iterator<Entry<ComponentName, CacheEntry>> it = mCache.entrySet().iterator();
while (it.hasNext()) {
final CacheEntry e = it.next().getValue();
if (e.icon.getWidth() != grid.iconSizePx || e.icon.getHeight() != grid.iconSizePx) {
if (e.icon.getWidth() < grid.iconSizePx || e.icon.getHeight() < grid.iconSizePx) {
it.remove();
}
}
+5 -7
View File
@@ -305,6 +305,7 @@ public class Launcher extends Activity
private Drawable mWorkspaceBackgroundDrawable;
private final ArrayList<Integer> mSynchronouslyBoundPages = new ArrayList<Integer>();
private static final boolean DISABLE_SYNCHRONOUS_BINDING_CURRENT_PAGE = false;
static final ArrayList<String> sDumpLogs = new ArrayList<String>();
static Date sDateStamp = new Date();
@@ -390,6 +391,7 @@ public class Launcher extends Activity
display.getRealSize(realSize);
DisplayMetrics dm = new DisplayMetrics();
display.getMetrics(dm);
// Lazy-initialize the dynamic grid
DeviceProfile grid = app.initDynamicGrid(this,
Math.min(smallestSize.x, smallestSize.y),
@@ -437,18 +439,12 @@ public class Launcher extends Activity
mSavedState = savedInstanceState;
restoreState(mSavedState);
// Update customization drawer _after_ restoring the states
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.onPackagesUpdated(
LauncherModel.getSortedWidgetsAndShortcuts(this));
}
if (PROFILE_STARTUP) {
android.os.Debug.stopMethodTracing();
}
if (!mRestoring) {
if (sPausedFromUserAction) {
if (DISABLE_SYNCHRONOUS_BINDING_CURRENT_PAGE || sPausedFromUserAction) {
// If the user leaves launcher, then we should just load items asynchronously when
// they return.
mModel.startLoader(true, -1);
@@ -3962,6 +3958,8 @@ public class Launcher extends Activity
} else {
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.setApps(apps);
mAppsCustomizeContent.onPackagesUpdated(
LauncherModel.getSortedWidgetsAndShortcuts(this));
}
}
}
@@ -28,7 +28,7 @@ import android.view.Display;
import java.lang.ref.WeakReference;
public class LauncherAppState {
public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
private static final String TAG = "LauncherAppState";
private static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
@@ -182,12 +182,12 @@ public class LauncherAppState {
context.getResources(),
minWidth, minHeight, width, height,
availableWidth, availableHeight);
mDynamicGrid.getDeviceProfile().addCallback(this);
}
// Update the icon size
DeviceProfile grid = mDynamicGrid.getDeviceProfile();
Utilities.setIconSize(grid.iconSizePx);
grid.updateFromConfiguration(context.getResources(), width, height,
grid.updateFromConfiguration(context, context.getResources(), width, height,
availableWidth, availableHeight);
return grid;
}
@@ -216,4 +216,9 @@ public class LauncherAppState {
public int getLongPressTimeout() {
return mLongPressTimeout;
}
@Override
public void onAvailableSizeChanged(DeviceProfile grid) {
Utilities.setIconSize(grid.iconSizePx);
}
}
+5 -1
View File
@@ -62,15 +62,19 @@ public class PagedViewIcon extends TextView {
// Ensure we are using the right text size
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
}
public void applyFromApplicationInfo(AppInfo info, boolean scaleUp,
PagedViewIcon.PressedCallback cb) {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
mIcon = info.iconBitmap;
mPressedCallback = cb;
setCompoundDrawables(null, Utilities.createIconDrawable(mIcon),
null, null);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
setText(info.title);
setTag(info);
}
@@ -84,11 +84,11 @@ public class PagedViewWidget extends LinearLayout {
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
TextView name = (TextView) findViewById(R.id.widget_name);
if (name != null) {
name.setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
name.setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
}
TextView dims = (TextView) findViewById(R.id.widget_dims);
if (dims != null) {
dims.setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
dims.setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
}
}