private void initWorkspaceGridSize(View view) { // TextView final int x = mSharePrefManager.getWorkspaceCountCellX(); final int y = mSharePrefManager.getWorkspaceCountCellY(); if (mWorkspaceGridContainer != null) { int count = mWorkspaceGridContainer.getChildCount(); for (int i = 0; i < count; i++) { final View child = mWorkspaceGridContainer.getChildAt(i); child.setEnabled(true); child.setActivated(false); } String strSize = x + "x" + y; TextView checkView = (TextView) mWorkspaceGridContainer.findViewWithTag(strSize); if (checkView != null) { checkView.setActivated(true); final Drawable[] dr = checkView.getCompoundDrawables(); ((TextView) view).setCompoundDrawablesWithIntrinsicBounds(dr[0], dr[1], dr[2], dr[3]); } } // final IResConfigManager resources = mLauncher.getResConfigManager(); // final String[] strArrays = // resources.getStringArray(IResConfigManager.ARRAY_WORKSPACE_GRID_SIZE_VALUES); // int index = -1; // if(strArrays != null){ // // index = getSelectWorkspaceGridSize(strArrays, x, y); // if(index < 0) // index = strArrays.length-1; // //// android.util.Log.i("QsLog", "initWorkspaceGridSize=====" //// +"==index:"+index //// +"==x:"+x //// +"==y:"+y); // // Drawable icon = null; // final TypedArray array = // resources.obtainTypedArray(IResConfigManager.ARRAY_WORKSPACE_GRID_SIZE_PREVIEWS); // if(array != null){ // int n = array.length(); // if(index < n){ // icon = array.getDrawable(index); // } // array.recycle(); // } // // if(icon != null){ // ((TextView)view).setCompoundDrawablesWithIntrinsicBounds(null, icon, null, // null); // } // } }
protected void changeWorkspaceGridSize(int x, int y) { // android.util.Log.i("QsLog", "changeWorkspaceGridSize=====" // +"==x:"+mSharePrefManager.getWorkspaceCountCellX() // +"==y:"+mSharePrefManager.getWorkspaceCountCellY() // +"==x:"+x // +"==y:"+y); if (x > 0 && y > 0 && (x != mSharePrefManager.getWorkspaceCountCellX() || y != mSharePrefManager.getWorkspaceCountCellY())) { mLauncher.changeWorkspaceGridSize(mSharePrefManager, x, y, mUpdateGridComplete); int count = mWorkspaceGridContainer.getChildCount(); for (int i = 0; i < count; i++) { final View child = mWorkspaceGridContainer.getChildAt(i); child.setEnabled(false); } } }