summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/user_folder.xml15
-rw-r--r--res/values/cm_strings.xml1
-rw-r--r--src/com/cyanogenmod/trebuchet/Folder.java31
3 files changed, 46 insertions, 1 deletions
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index 9aae1acc1..40c8fd827 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -37,6 +37,21 @@
launcher:cellWidth="@dimen/folder_cell_width"
launcher:cellHeight="@dimen/folder_cell_height" />
+ <TextView
+ android:id="@+id/empty_content"
+ android:text="@string/folder_empty_contents_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:paddingTop="@dimen/folder_name_padding"
+ android:paddingBottom="@dimen/folder_name_padding"
+ android:background="#00000000"
+ android:textSize="14sp"
+ android:textColor="#ff33b5e5"
+ android:textColorHighlight="#ff333333"
+ android:gravity="center_horizontal"
+ android:singleLine="true" />
+
<com.cyanogenmod.trebuchet.FolderEditText
android:id="@+id/folder_name"
android:layout_width="match_parent"
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 774ba61c2..9f61fdf4d 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -161,6 +161,7 @@
<string name="preferences_interface_general_lock_workspace_summary">Lock shortcuts and folders positions in the homescreen, dock and apps and widgets drawer</string>
<string name="preferences_interface_general_fullscreen_title">Fullscreen mode</string>
<string name="preferences_interface_general_fullscreen_summary">Hide the status bar to extend the homescreen</string>
+ <string name="folder_empty_contents_title">No items found</string>
<!-- Effects -->
<string name="effects_standard">Standard</string>
diff --git a/src/com/cyanogenmod/trebuchet/Folder.java b/src/com/cyanogenmod/trebuchet/Folder.java
index d55338b4d..1ce8ba2d3 100644
--- a/src/com/cyanogenmod/trebuchet/Folder.java
+++ b/src/com/cyanogenmod/trebuchet/Folder.java
@@ -93,7 +93,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private int[] mEmptyCell = new int[2];
private Alarm mReorderAlarm = new Alarm();
private Alarm mOnExitAlarm = new Alarm();
- private int mFolderNameHeight;
+ private int mFolderNameHeight, mFolderNameWidth;
private Rect mTempRect = new Rect();
private boolean mDragInProgress = false;
private boolean mDeleteFolderOnDropCompleted = false;
@@ -112,6 +112,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private boolean mDestroyed;
+ // Empty folder filler
+ private TextView mEmptyTitle;
+ private int mEmptyTitleWidth, mEmptyTitleHeight;
+
/**
* Used to inflate the Workspace from XML.
*
@@ -172,6 +176,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
int measureSpec = MeasureSpec.UNSPECIFIED;
mFolderName.measure(measureSpec, measureSpec);
mFolderNameHeight = mFolderName.getMeasuredHeight();
+ mFolderNameWidth = mFolderName.getMeasuredWidth();
// We disable action mode for now since it messes up the view on phones
mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
@@ -180,6 +185,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderName.setInputType(mFolderName.getInputType() |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
+ mEmptyTitle = (TextView) findViewById(R.id.empty_content);
+ mEmptyTitle.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
+ mEmptyTitleWidth = mEmptyTitle.getMeasuredWidth();
+ mEmptyTitleHeight = mEmptyTitle.getMeasuredHeight();
+
if (PreferencesProvider.Interface.Homescreen.getHideIconLabels()){
mFolderName.setVisibility(View.GONE);
mFolderNameHeight = getPaddingBottom();
@@ -837,6 +847,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
int height = getPaddingTop() + getPaddingBottom() + mContent.getDesiredHeight()
+ mFolderNameHeight;
+
+ if (mContent.getDesiredWidth() == 0) {
+ width += Math.min(mEmptyTitleWidth, mFolderNameWidth);
+ height += mEmptyTitle.getMeasuredHeight();
+ mEmptyTitle.setVisibility(View.VISIBLE);
+ } else {
+ mEmptyTitle.setVisibility(View.GONE);
+ }
+
DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
@@ -916,8 +935,18 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
MeasureSpec.EXACTLY);
mContent.measure(contentWidthSpec, contentHeightSpec);
+ if (mContent.getDesiredWidth() == 0) {
+ width += Math.min(mEmptyTitleWidth, mFolderNameWidth);
+ contentWidthSpec = MeasureSpec.makeMeasureSpec(
+ Math.min(mEmptyTitleWidth, mFolderNameWidth), MeasureSpec.EXACTLY);
+ }
+
mFolderName.measure(contentWidthSpec,
MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
+
+ mEmptyTitle.measure(contentWidthSpec,
+ MeasureSpec.makeMeasureSpec(mEmptyTitleHeight, MeasureSpec.EXACTLY));
+
setMeasuredDimension(width, height);
}