summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2023-10-30 18:27:28 +0100
committercyBerta <cyberta@riseup.net>2023-10-31 18:53:25 +0100
commit751cae19707c9970b03edd14008c28b2045028ce (patch)
tree8a05f807e7eac3bda01043d6b1316162e92d7651 /app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java
parent2274d71a7942d5a89a27918b28041dae5be3816a (diff)
Remove old Provider setup flow. In order to update to Gradle 8, we finally say goodbye to Butterknife.
Since the old setup flow UI depends on it (and other dependencies we want to get rid of) it gets removed.
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java109
1 files changed, 0 insertions, 109 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java b/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java
deleted file mode 100644
index 811a54a2..00000000
--- a/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package se.leap.bitmaskclient.base.views;
-
-import android.content.Context;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.RequiresApi;
-import androidx.annotation.StringRes;
-import androidx.appcompat.widget.AppCompatImageView;
-import androidx.appcompat.widget.AppCompatTextView;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.RelativeLayout;
-
-import se.leap.bitmaskclient.R;
-
-import static se.leap.bitmaskclient.base.utils.ViewHelper.convertDimensionToPx;
-
-/**
- * Created by cyberta on 29.06.18.
- */
-
-public class ProviderHeaderView extends RelativeLayout {
- private int stdPadding;
- private int compactPadding;
- private int stdImageSize;
- private int compactImageSize;
-
- AppCompatImageView providerHeaderLogo;
- AppCompatTextView providerHeaderText;
-
- public ProviderHeaderView(Context context) {
- super(context);
- initLayout(context);
- }
-
- public ProviderHeaderView(Context context, AttributeSet attrs) {
- super(context, attrs);
- initLayout(context);
- }
-
- public ProviderHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- initLayout(context);
- }
-
- @RequiresApi(21)
- public ProviderHeaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- initLayout(context);
- }
-
-
- void initLayout(Context context) {
- LayoutInflater inflater = (LayoutInflater) context
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View rootview = inflater.inflate(R.layout.v_provider_header, this, true);
- providerHeaderLogo = rootview.findViewById(R.id.provider_header_logo);
- providerHeaderText = rootview.findViewById(R.id.provider_header_text);
-
- stdPadding = convertDimensionToPx(context, R.dimen.stdpadding);
- compactPadding = convertDimensionToPx(context, R.dimen.compact_padding);
- stdImageSize = convertDimensionToPx(context, R.dimen.bitmask_logo);
- compactImageSize = convertDimensionToPx(context, R.dimen.bitmask_logo_compact);
- }
-
- public void setTitle(String title) {
- providerHeaderText.setText(title);
- }
-
- public void setTitle(@StringRes int stringRes) {
- providerHeaderText.setText(stringRes);
- }
-
- public void setLogo(@DrawableRes int drawableRes) {
- providerHeaderLogo.setImageResource(drawableRes);
- }
-
- public void showCompactLayout() {
- LayoutParams logoLayoutParams = (LayoutParams) providerHeaderLogo.getLayoutParams();
- logoLayoutParams.width = compactImageSize;
- logoLayoutParams.height = compactImageSize;
- providerHeaderLogo.setLayoutParams(logoLayoutParams);
-
- LayoutParams textLayoutParams = (LayoutParams) providerHeaderText.getLayoutParams();
- textLayoutParams.addRule(RIGHT_OF, R.id.provider_header_logo);
- textLayoutParams.addRule(BELOW, 0);
- textLayoutParams.addRule(ALIGN_TOP, R.id.provider_header_logo);
- textLayoutParams.setMargins(compactPadding, compactPadding, compactPadding, compactPadding);
-
- providerHeaderText.setLayoutParams(textLayoutParams);
- providerHeaderText.setMaxLines(2);
- }
-
- public void showStandardLayout() {
- LayoutParams logoLayoutParams = (LayoutParams) providerHeaderLogo.getLayoutParams();
- logoLayoutParams.width = stdImageSize;
- logoLayoutParams.height = stdImageSize;
- providerHeaderLogo.setLayoutParams(logoLayoutParams);
-
- LayoutParams textLayoutParams = (LayoutParams) providerHeaderText.getLayoutParams();
- textLayoutParams.addRule(RIGHT_OF, 0);
- textLayoutParams.addRule(BELOW, R.id.provider_header_logo);
- textLayoutParams.addRule(ALIGN_TOP, 0);
- textLayoutParams.setMargins(stdPadding, stdPadding, stdPadding, stdPadding);
- providerHeaderText.setLayoutParams(textLayoutParams);
- providerHeaderText.setMaxLines(1);
- }
-
-}