/*
* Copyright (C) 2015-present, osfans
* waxaca@163.com https://github.com/osfans
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.osfans.trime;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.text.Layout;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.AlignmentSpan;
import android.text.style.BackgroundColorSpan;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.UnderlineSpan;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
/** 編碼區,顯示已輸入的按鍵編碼,可使用方向鍵或觸屏移動光標位置 */
public class Composition extends TextView {
private int key_text_size, text_size, label_text_size, candidate_text_size, comment_text_size;
private int key_text_color, text_color, label_color, candidate_text_color, comment_text_color;
private int hilited_text_color, hilited_candidate_text_color, hilited_comment_text_color;
private int back_color, hilited_back_color, hilited_candidate_back_color;
private Integer key_back_color;
private Typeface tfText, tfLabel, tfCandidate, tfComment;
private int composition_pos[] = new int[2];
private int max_length, sticky_lines;
private int max_entries = Candidate.getMaxCandidateCount();
private boolean candidate_use_cursor, show_comment;
private int highlightIndex;
private List