Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a16f922 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Using ListView for Suggestion popup window"

parents 8b5a8b5b 0eea6681
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -20702,7 +20702,6 @@ package android.text.style {
  public class EasyEditSpan implements android.text.ParcelableSpan {
    ctor public EasyEditSpan();
    ctor public EasyEditSpan(android.os.Parcel);
    method public int describeContents();
    method public int getSpanTypeId();
    method public void writeToParcel(android.os.Parcel, int);
+3 −3
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ import android.text.style.AlignmentSpan;
import android.text.style.BackgroundColorSpan;
import android.text.style.BulletSpan;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.EasyEditSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.LeadingMarginSpan;
import android.text.style.MetricAffectingSpan;
import android.text.style.QuoteSpan;
@@ -748,11 +748,11 @@ public class TextUtils {
                    break;

                case SUGGESTION_RANGE_SPAN:
                    readSpan(p, sp, new SuggestionRangeSpan());
                    readSpan(p, sp, new SuggestionRangeSpan(p));
                    break;
                    
                case EASY_EDIT_SPAN:
                    readSpan(p, sp, new EasyEditSpan(p));
                    readSpan(p, sp, new EasyEditSpan());
                    break;

                default:
+0 −4
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@ public class EasyEditSpan implements ParcelableSpan {
        // Empty
    }

    public EasyEditSpan(Parcel src) {
        this();
    }

    @Override
    public int describeContents() {
        return 0;
+13 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.text.style;

import android.graphics.Color;
import android.os.Parcel;
import android.text.ParcelableSpan;
import android.text.TextPaint;
@@ -29,12 +28,20 @@ import android.text.TextUtils;
 * @hide
 */
public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpan {
    private final int mBackgroundColor;

    @Override
    public void updateDrawState(TextPaint tp) {
        tp.setColor(Color.GREEN);            
        tp.bgColor = mBackgroundColor;
    }

    public SuggestionRangeSpan() { /* Nothing to do*/ }
    public SuggestionRangeSpan(int color) {
        mBackgroundColor = color;
    }

    public SuggestionRangeSpan(Parcel src) {
        mBackgroundColor = src.readInt();
    }

    @Override
    public int describeContents() {
@@ -42,7 +49,9 @@ public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpa
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) { /* Nothing to do*/ }
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mBackgroundColor);
    }

    @Override
    public int getSpanTypeId() {
+19 −5
Original line number Diff line number Diff line
// Copyright 2011 Google Inc. All Rights Reserved.
/*
 * Copyright (C) 2011 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.
 */

package android.widget;

@@ -32,7 +46,7 @@ public class SpellChecker implements SpellCheckerSessionListener {

    private final TextView mTextView;

    final SpellCheckerSession spellCheckerSession;
    final SpellCheckerSession mSpellCheckerSession;
    final int mCookie;

    // Paired arrays for the (id, spellCheckSpan) pair. mIndex is the next available position
@@ -49,7 +63,7 @@ public class SpellChecker implements SpellCheckerSessionListener {

        final TextServicesManager textServicesManager = (TextServicesManager) textView.getContext().
                getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
        spellCheckerSession = textServicesManager.newSpellCheckerSession(
        mSpellCheckerSession = textServicesManager.newSpellCheckerSession(
                null /* not currently used by the textServicesManager */, Locale.getDefault(),
                this, true /* means use the languages defined in Settings */);
        mCookie = hashCode();
@@ -112,7 +126,7 @@ public class SpellChecker implements SpellCheckerSessionListener {

    private void scheduleSpellCheck() {
        if (mLength == 0) return;
        if (spellCheckerSession == null) return;
        if (mSpellCheckerSession == null) return;

        if (mChecker != null) {
            mTextView.removeCallbacks(mChecker);
@@ -157,7 +171,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
                System.arraycopy(textInfos, 0, textInfosCopy, 0, textInfosCount);
                textInfos = textInfosCopy;
            }
            spellCheckerSession.getSuggestions(textInfos, SuggestionSpan.SUGGESTIONS_MAX_SIZE,
            mSpellCheckerSession.getSuggestions(textInfos, SuggestionSpan.SUGGESTIONS_MAX_SIZE,
                    false /* TODO Set sequentialWords to true for initial spell check */);
        }
    }
Loading