2014-11-10 12:05:22 +01:00
|
|
|
/*
|
2019-01-23 18:03:33 +01:00
|
|
|
* This is the source code of Telegram for Android v. 5.x.x.
|
2014-11-10 12:05:22 +01:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2019-01-23 18:03:33 +01:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2018.
|
2014-11-10 12:05:22 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui.Cells;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
2015-05-03 13:48:36 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2014-11-10 12:05:22 +01:00
|
|
|
|
|
|
|
public class LetterSectionCell extends FrameLayout {
|
|
|
|
|
|
|
|
private TextView textView;
|
|
|
|
|
|
|
|
public LetterSectionCell(Context context) {
|
|
|
|
super(context);
|
|
|
|
setLayoutParams(new ViewGroup.LayoutParams(AndroidUtilities.dp(54), AndroidUtilities.dp(64)));
|
|
|
|
|
|
|
|
textView = new TextView(getContext());
|
|
|
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 22);
|
|
|
|
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
2017-03-31 01:58:05 +02:00
|
|
|
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
|
2014-11-10 12:05:22 +01:00
|
|
|
textView.setGravity(Gravity.CENTER);
|
2015-05-21 23:27:27 +02:00
|
|
|
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setLetter(String letter) {
|
|
|
|
textView.setText(letter.toUpperCase());
|
|
|
|
}
|
2014-11-13 21:10:14 +01:00
|
|
|
|
|
|
|
public void setCellHeight(int height) {
|
|
|
|
setLayoutParams(new ViewGroup.LayoutParams(AndroidUtilities.dp(54), height));
|
|
|
|
}
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|