Small fix/improvement

This commit is contained in:
M66B 2019-05-16 08:13:18 +02:00
parent 42f9193179
commit 98fe4c31f6
2 changed files with 15 additions and 6 deletions

View File

@ -60,7 +60,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
@ -410,12 +409,10 @@ public class FragmentAccount extends FragmentBase {
}
}
});
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ConstraintLayout.LayoutParams lparam = (ConstraintLayout.LayoutParams) cbNotify.getLayoutParams();
lparam.width = 0;
lparam.height = 0;
lparam.setMargins(0, 0, 0, 0);
cbNotify.setLayoutParams(lparam);
Helper.hide(cbNotify);
Helper.hide(view.findViewById(R.id.tvNotifyPro));
}
btnCheck.setOnClickListener(new View.OnClickListener() {

View File

@ -50,6 +50,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
@ -281,6 +282,17 @@ public class Helper {
}
}
static void hide(View view) {
view.setPadding(0, 0, 0, 0);
ViewGroup.LayoutParams lparam = view.getLayoutParams();
lparam.width = 0;
lparam.height = 0;
if (lparam instanceof ConstraintLayout.LayoutParams)
((ConstraintLayout.LayoutParams) lparam).setMargins(0, 0, 0, 0);
view.setLayoutParams(lparam);
}
static boolean isDarkTheme(Context context) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(R.attr.themeName, tv, true);