68 lines
1.9 KiB
Java
68 lines
1.9 KiB
Java
/*
|
|
* Created by Julian Mutter on 7/10/18 3:58 PM
|
|
* Copyright (c) 2018. All rights reserved.
|
|
* Last modified 7/10/18 3:54 PM
|
|
*
|
|
*/
|
|
|
|
package de.frajul.endlessroll.views;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Typeface;
|
|
import androidx.annotation.DrawableRes;
|
|
import androidx.annotation.StringRes;
|
|
import android.view.View;
|
|
import android.view.animation.Animation;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
|
|
import de.frajul.endlessroll.R;
|
|
|
|
/**
|
|
* Created by Julian on 01.08.2016.
|
|
*/
|
|
public class PriceButton {
|
|
|
|
private Context context;
|
|
|
|
private View layout;
|
|
private TextView title;
|
|
private TextView price;
|
|
private ImageView currencyView;
|
|
|
|
public PriceButton(Context context, Typeface typeface, View layout, View.OnClickListener onClickListener) {
|
|
this.context = context;
|
|
this.layout = layout;
|
|
layout.setOnClickListener(onClickListener);
|
|
|
|
title = layout.findViewById(R.id.price_button_title);
|
|
title.setTypeface(typeface);
|
|
price = layout.findViewById(R.id.price_button_price);
|
|
price.setTypeface(typeface);
|
|
currencyView = layout.findViewById(R.id.price_button_currency);
|
|
}
|
|
|
|
public void init(@StringRes int title, int price, @DrawableRes int currencyDrawable) {
|
|
this.title.setText(title);
|
|
this.price.setText(price + "");
|
|
this.currencyView.setImageDrawable(context.getResources().getDrawable(currencyDrawable));
|
|
}
|
|
|
|
public void setLayoutEnabled(boolean enabled) {
|
|
layout.setEnabled(enabled);
|
|
}
|
|
|
|
public void setLayoutVisible(int visibility) {
|
|
layout.setVisibility(visibility);
|
|
}
|
|
|
|
public void startAnimation(Animation animation) {
|
|
layout.startAnimation(animation);
|
|
}
|
|
|
|
public void clearAnimation() {
|
|
layout.clearAnimation();
|
|
}
|
|
|
|
}
|