mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-01 00:02:55 +01:00
Merge remote-tracking branch 'origin/ryd-integration' into ryd-integration
This commit is contained in:
commit
3960dcad6e
@ -20,6 +20,7 @@ public abstract class SlimButton implements View.OnClickListener {
|
||||
private final ViewGroup container;
|
||||
protected final ImageView button_icon;
|
||||
protected final TextView button_text;
|
||||
private boolean viewAdded = false;
|
||||
|
||||
static {
|
||||
SLIM_METADATA_BUTTON_ID = VancedUtils.getIdentifier("slim_metadata_button", "layout");
|
||||
@ -36,14 +37,25 @@ public abstract class SlimButton implements View.OnClickListener {
|
||||
button_text = (TextView)view.findViewById(VancedUtils.getIdentifier("button_text", "id"));
|
||||
|
||||
view.setOnClickListener(this);
|
||||
setVisible(visible);
|
||||
|
||||
container.addView(view);
|
||||
setVisible(visible);
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
view.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
setContainerVisibility();
|
||||
try {
|
||||
if (!viewAdded && visible) {
|
||||
container.addView(view);
|
||||
viewAdded = true;
|
||||
}
|
||||
else if (viewAdded && !visible) {
|
||||
container.removeView(view);
|
||||
viewAdded = false;
|
||||
}
|
||||
setContainerVisibility();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.e(TAG, "Error while changing button visibility", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void setContainerVisibility() {
|
||||
|
Loading…
Reference in New Issue
Block a user