Android examples for Phone:Phone Information
get Spannable Span Flag
/*/*from w w w . j a va 2s . c om*/ * Copyright (C) 2014 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. */ import android.text.Spannable; import android.text.style.LocaleSpan; import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Locale; public class Main{ private static int getSpanFlag(final int originalFlag, final boolean isStartExclusive, final boolean isEndExclusive) { return (originalFlag & ~Spannable.SPAN_POINT_MARK_MASK) | getSpanPointMarkFlag(isStartExclusive, isEndExclusive); } private static int getSpanPointMarkFlag(final boolean isStartExclusive, final boolean isEndExclusive) { if (isStartExclusive) { if (isEndExclusive) { return Spannable.SPAN_EXCLUSIVE_EXCLUSIVE; } else { return Spannable.SPAN_EXCLUSIVE_INCLUSIVE; } } else { if (isEndExclusive) { return Spannable.SPAN_INCLUSIVE_EXCLUSIVE; } else { return Spannable.SPAN_INCLUSIVE_INCLUSIVE; } } } }