NekoX/TMessagesProj/src/main/java/org/telegram/ui/Cells/LocationDirectionCell.java

48 lines
2.2 KiB
Java

package org.telegram.ui.Cells;
import android.content.Context;
import android.view.Gravity;
import android.widget.FrameLayout;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.SimpleTextView;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.LayoutHelper;
@SuppressWarnings("FieldCanBeLocal")
public class LocationDirectionCell extends FrameLayout {
private SimpleTextView buttonTextView;
private FrameLayout frameLayout;
public LocationDirectionCell(Context context) {
super(context);
frameLayout = new FrameLayout(context);
frameLayout.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.TOP, 16, 10, 16, 0));
buttonTextView = new SimpleTextView(context);
buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0);
buttonTextView.setGravity(Gravity.CENTER);
buttonTextView.setDrawablePadding(AndroidUtilities.dp(8));
buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
buttonTextView.setTextSize(14);
buttonTextView.setText(LocaleController.getString("Directions", R.string.Directions));
buttonTextView.setLeftDrawable(R.drawable.navigate);
buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
frameLayout.addView(buttonTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(73), MeasureSpec.EXACTLY));
}
public void setOnButtonClick(OnClickListener onButtonClick) {
frameLayout.setOnClickListener(onButtonClick);
}
}