Search in sources :

Example 6 with Phrase

use of com.xabber.android.data.message.phrase.Phrase in project xabber-android by redsolution.

the class PhraseListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view;
    if (convertView == null) {
        view = getActivity().getLayoutInflater().inflate(R.layout.preference, parent, false);
    } else {
        view = convertView;
    }
    Phrase phrase = PhraseManager.getInstance().getPhrase(getItem(position));
    String title = phrase.getText();
    if ("".equals(title))
        title = getActivity().getString(R.string.phrase_empty);
    String message = "";
    if (!"".equals(phrase.getUser()))
        message = append(message, getActivity().getString(R.string.phrase_user) + ": " + phrase.getUser());
    if (!"".equals(phrase.getGroup()))
        message = append(message, getActivity().getString(R.string.phrase_group) + ": " + phrase.getGroup());
    if (phrase.isRegexp())
        message = append(message, getActivity().getString(R.string.phrase_regexp));
    ((TextView) view.findViewById(android.R.id.title)).setText(title);
    ((TextView) view.findViewById(android.R.id.summary)).setText(message);
    return view;
}
Also used : TextView(android.widget.TextView) Phrase(com.xabber.android.data.message.phrase.Phrase) TextView(android.widget.TextView) View(android.view.View)

Aggregations

Phrase (com.xabber.android.data.message.phrase.Phrase)6 Preference (android.preference.Preference)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 TextView (android.widget.TextView)1 Toolbar (androidx.appcompat.widget.Toolbar)1 BarPainter (com.xabber.android.ui.color.BarPainter)1 HashMap (java.util.HashMap)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1