CollatorStringMatcher.java fix

This commit is contained in:
denys 2016-08-04 12:15:31 +03:00
parent 68a0d72cce
commit f855eec6f9
11 changed files with 117 additions and 18 deletions

View file

@ -66,19 +66,34 @@ public class CollatorStringMatcher implements StringMatcher {
* @return true if part is contained in base * @return true if part is contained in base
*/ */
public static boolean ccontains(Collator collator, String base, String part) { public static boolean ccontains(Collator collator, String base, String part) {
int pos = 0; // int pos = 0;
if (part.length() > 3) { // if (part.length() > 3) {
// improve searching by searching first 3 characters // // improve searching by searching first 3 characters
pos = cindexOf(collator, pos, part.substring(0, 3), base); // pos = cindexOf(collator, pos, part.substring(0, 3), base);
if (pos == -1) { // if (pos == -1) {
return false; // return false;
// }
// }
// pos = cindexOf(collator, pos, part, base);
// if (pos == -1) {
// return false;
// }
// return true;
if (base.length() <= part.length())
return collator.equals(base, part);
for (int pos = 0; pos <= base.length() - part.length() + 1; pos++) {
String temp = base.substring(pos, base.length());
for (int length = temp.length(); length >= 0; length--) {
String temp2 = temp.substring(0, length);
if (collator.equals(temp2, part))
return true;
} }
} }
pos = cindexOf(collator, pos, part, base);
if (pos == -1) { return false;
return false;
}
return true;
} }
private static int cindexOf(Collator collator, int start, String part, String base) { private static int cindexOf(Collator collator, int start, String part, String base) {

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.gridlayout">
<uses-sdk android:minSdkVersion="7"/>
<application />
</manifest>

View file

@ -0,0 +1,56 @@
int attr alignmentMode 0x7f010004
int attr columnCount 0x7f010002
int attr columnOrderPreserved 0x7f010006
int attr layout_column 0x7f01000a
int attr layout_columnSpan 0x7f01000b
int attr layout_columnWeight 0x7f01000c
int attr layout_gravity 0x7f01000d
int attr layout_row 0x7f010007
int attr layout_rowSpan 0x7f010008
int attr layout_rowWeight 0x7f010009
int attr orientation 0x7f010000
int attr rowCount 0x7f010001
int attr rowOrderPreserved 0x7f010005
int attr useDefaultMargins 0x7f010003
int dimen default_gap 0x7f020000
int id alignBounds 0x7f030002
int id alignMargins 0x7f030003
int id bottom 0x7f030004
int id center 0x7f030005
int id center_horizontal 0x7f030006
int id center_vertical 0x7f030007
int id clip_horizontal 0x7f030008
int id clip_vertical 0x7f030009
int id end 0x7f03000a
int id fill 0x7f03000b
int id fill_horizontal 0x7f03000c
int id fill_vertical 0x7f03000d
int id horizontal 0x7f030000
int id left 0x7f03000e
int id right 0x7f03000f
int id start 0x7f030010
int id top 0x7f030011
int id vertical 0x7f030001
int[] styleable GridLayout { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }
int styleable GridLayout_alignmentMode 4
int styleable GridLayout_columnCount 2
int styleable GridLayout_columnOrderPreserved 6
int styleable GridLayout_orientation 0
int styleable GridLayout_rowCount 1
int styleable GridLayout_rowOrderPreserved 5
int styleable GridLayout_useDefaultMargins 3
int[] styleable GridLayout_Layout { 0x010100f4, 0x010100f5, 0x010100f6, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d }
int styleable GridLayout_Layout_android_layout_height 1
int styleable GridLayout_Layout_android_layout_margin 2
int styleable GridLayout_Layout_android_layout_marginBottom 6
int styleable GridLayout_Layout_android_layout_marginLeft 3
int styleable GridLayout_Layout_android_layout_marginRight 5
int styleable GridLayout_Layout_android_layout_marginTop 4
int styleable GridLayout_Layout_android_layout_width 0
int styleable GridLayout_Layout_layout_column 10
int styleable GridLayout_Layout_layout_columnSpan 11
int styleable GridLayout_Layout_layout_columnWeight 12
int styleable GridLayout_Layout_layout_gravity 13
int styleable GridLayout_Layout_layout_row 7
int styleable GridLayout_Layout_layout_rowSpan 8
int styleable GridLayout_Layout_layout_rowWeight 9

View file

@ -0,0 +1,2 @@
This hidden file is there to ensure there is an src folder.
Once we support binary library this will go away.

View file

@ -0,0 +1,3 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8

View file

@ -12,4 +12,4 @@
# Project target. # Project target.
target=android-23 target=android-23
android.library=true android.library=true