Loading src/com/android/launcher3/AlphabeticalAppsList.java +2 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,7 @@ class AppNameComparator { mAppNameComparator = new Comparator<AppInfo>() { public final int compare(AppInfo a, AppInfo b) { // Order by the title int result = collator.compare(a.title.toString().trim(), b.title.toString().trim()); int result = collator.compare(a.title.toString(), b.title.toString()); if (result == 0) { // If two apps have the same title, then order by the component name result = a.componentName.compareTo(b.componentName); Loading Loading @@ -349,7 +348,7 @@ public class AlphabeticalAppsList { int appIndex = 0; int numApps = mApps.size(); for (AppInfo info : mApps) { String sectionName = mIndexer.computeSectionName(info.title.toString().trim()); String sectionName = mIndexer.computeSectionName(info.title); // Check if we want to retain this app if (mFilter != null && !mFilter.retainApp(info, sectionName)) { Loading src/com/android/launcher3/AppInfo.java +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class AppInfo extends ItemInfo { public AppInfo(AppInfo info) { super(info); componentName = info.componentName; title = info.title.toString(); title = Utilities.trim(info.title); intent = new Intent(info.intent); flags = info.flags; firstInstallTime = info.firstInstallTime; Loading @@ -114,7 +114,7 @@ public class AppInfo extends ItemInfo { @Override public String toString() { return "ApplicationInfo(title=" + title.toString() + " id=" + this.id return "ApplicationInfo(title=" + title + " id=" + this.id + " type=" + this.itemType + " container=" + this.container + " screen=" + screenId + " cellX=" + cellX + " cellY=" + cellY + " spanX=" + spanX + " spanY=" + spanY + " dropPos=" + Arrays.toString(dropPos) Loading src/com/android/launcher3/AppsContainerView.java +11 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.widget.TextView; import com.android.launcher3.util.Thunk; import java.util.List; import java.util.regex.Pattern; /** Loading @@ -56,6 +57,8 @@ public class AppsContainerView extends BaseContainerView implements DragSource, private static final int FADE_OUT_DURATION = 100; private static final int SEARCH_TRANSLATION_X_DP = 18; private static final Pattern SPLIT_PATTERN = Pattern.compile("[\\s|\\p{javaSpaceChar}]+"); @Thunk Launcher mLauncher; @Thunk AlphabeticalAppsList mApps; private AppsGridAdapter mAdapter; Loading Loading @@ -430,23 +433,24 @@ public class AppsContainerView extends BaseContainerView implements DragSource, @Override public void afterTextChanged(final Editable s) { if (s.toString().isEmpty()) { String queryText = s.toString(); if (queryText.isEmpty()) { mApps.setFilter(null); } else { String formatStr = getResources().getString(R.string.apps_view_no_search_results); mAdapter.setEmptySearchText(String.format(formatStr, s.toString())); mAdapter.setEmptySearchText(String.format(formatStr, queryText)); final String filterText = s.toString().toLowerCase().replaceAll("\\s+", ""); final String queryTextLower = queryText.toLowerCase(); mApps.setFilter(new AlphabeticalAppsList.Filter() { @Override public boolean retainApp(AppInfo info, String sectionName) { String title = info.title.toString(); if (sectionName.toLowerCase().contains(filterText)) { if (sectionName.toLowerCase().contains(queryTextLower)) { return true; } String[] words = title.toLowerCase().split("\\s+"); String title = info.title.toString(); String[] words = SPLIT_PATTERN.split(title.toLowerCase()); for (int i = 0; i < words.length; i++) { if (words[i].startsWith(filterText)) { if (words[i].startsWith(queryTextLower)) { return true; } } Loading src/com/android/launcher3/Folder.java +3 −2 Original line number Diff line number Diff line Loading @@ -309,13 +309,14 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mFolderName.setHint(sHintText); // Convert to a string here to ensure that no other state associated with the text field // gets saved. String newTitle = mFolderName.getText().toString(); CharSequence newTitle = mFolderName.getText(); mInfo.setTitle(newTitle); LauncherModel.updateItemInDatabase(mLauncher, mInfo); if (commit) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_renamed), newTitle)); String.format(getContext().getString(R.string.folder_renamed), newTitle.toString())); } // In order to clear the focus from the text field, we set the focus on ourself. This // ensures that every time the field is clicked, focus is gained, giving reliable behavior. Loading src/com/android/launcher3/FolderIcon.java +1 −1 Original line number Diff line number Diff line Loading @@ -710,7 +710,7 @@ public class FolderIcon extends FrameLayout implements FolderListener { } public void onTitleChanged(CharSequence title) { mFolderName.setText(title.toString()); mFolderName.setText(title); setContentDescription(String.format(getContext().getString(R.string.folder_name_format), title)); } Loading Loading
src/com/android/launcher3/AlphabeticalAppsList.java +2 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,7 @@ class AppNameComparator { mAppNameComparator = new Comparator<AppInfo>() { public final int compare(AppInfo a, AppInfo b) { // Order by the title int result = collator.compare(a.title.toString().trim(), b.title.toString().trim()); int result = collator.compare(a.title.toString(), b.title.toString()); if (result == 0) { // If two apps have the same title, then order by the component name result = a.componentName.compareTo(b.componentName); Loading Loading @@ -349,7 +348,7 @@ public class AlphabeticalAppsList { int appIndex = 0; int numApps = mApps.size(); for (AppInfo info : mApps) { String sectionName = mIndexer.computeSectionName(info.title.toString().trim()); String sectionName = mIndexer.computeSectionName(info.title); // Check if we want to retain this app if (mFilter != null && !mFilter.retainApp(info, sectionName)) { Loading
src/com/android/launcher3/AppInfo.java +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class AppInfo extends ItemInfo { public AppInfo(AppInfo info) { super(info); componentName = info.componentName; title = info.title.toString(); title = Utilities.trim(info.title); intent = new Intent(info.intent); flags = info.flags; firstInstallTime = info.firstInstallTime; Loading @@ -114,7 +114,7 @@ public class AppInfo extends ItemInfo { @Override public String toString() { return "ApplicationInfo(title=" + title.toString() + " id=" + this.id return "ApplicationInfo(title=" + title + " id=" + this.id + " type=" + this.itemType + " container=" + this.container + " screen=" + screenId + " cellX=" + cellX + " cellY=" + cellY + " spanX=" + spanX + " spanY=" + spanY + " dropPos=" + Arrays.toString(dropPos) Loading
src/com/android/launcher3/AppsContainerView.java +11 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.widget.TextView; import com.android.launcher3.util.Thunk; import java.util.List; import java.util.regex.Pattern; /** Loading @@ -56,6 +57,8 @@ public class AppsContainerView extends BaseContainerView implements DragSource, private static final int FADE_OUT_DURATION = 100; private static final int SEARCH_TRANSLATION_X_DP = 18; private static final Pattern SPLIT_PATTERN = Pattern.compile("[\\s|\\p{javaSpaceChar}]+"); @Thunk Launcher mLauncher; @Thunk AlphabeticalAppsList mApps; private AppsGridAdapter mAdapter; Loading Loading @@ -430,23 +433,24 @@ public class AppsContainerView extends BaseContainerView implements DragSource, @Override public void afterTextChanged(final Editable s) { if (s.toString().isEmpty()) { String queryText = s.toString(); if (queryText.isEmpty()) { mApps.setFilter(null); } else { String formatStr = getResources().getString(R.string.apps_view_no_search_results); mAdapter.setEmptySearchText(String.format(formatStr, s.toString())); mAdapter.setEmptySearchText(String.format(formatStr, queryText)); final String filterText = s.toString().toLowerCase().replaceAll("\\s+", ""); final String queryTextLower = queryText.toLowerCase(); mApps.setFilter(new AlphabeticalAppsList.Filter() { @Override public boolean retainApp(AppInfo info, String sectionName) { String title = info.title.toString(); if (sectionName.toLowerCase().contains(filterText)) { if (sectionName.toLowerCase().contains(queryTextLower)) { return true; } String[] words = title.toLowerCase().split("\\s+"); String title = info.title.toString(); String[] words = SPLIT_PATTERN.split(title.toLowerCase()); for (int i = 0; i < words.length; i++) { if (words[i].startsWith(filterText)) { if (words[i].startsWith(queryTextLower)) { return true; } } Loading
src/com/android/launcher3/Folder.java +3 −2 Original line number Diff line number Diff line Loading @@ -309,13 +309,14 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mFolderName.setHint(sHintText); // Convert to a string here to ensure that no other state associated with the text field // gets saved. String newTitle = mFolderName.getText().toString(); CharSequence newTitle = mFolderName.getText(); mInfo.setTitle(newTitle); LauncherModel.updateItemInDatabase(mLauncher, mInfo); if (commit) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_renamed), newTitle)); String.format(getContext().getString(R.string.folder_renamed), newTitle.toString())); } // In order to clear the focus from the text field, we set the focus on ourself. This // ensures that every time the field is clicked, focus is gained, giving reliable behavior. Loading
src/com/android/launcher3/FolderIcon.java +1 −1 Original line number Diff line number Diff line Loading @@ -710,7 +710,7 @@ public class FolderIcon extends FrameLayout implements FolderListener { } public void onTitleChanged(CharSequence title) { mFolderName.setText(title.toString()); mFolderName.setText(title); setContentDescription(String.format(getContext().getString(R.string.folder_name_format), title)); } Loading