Settings Menu. Please help me find someone who can do this better
This commit is contained in:
@@ -11,8 +11,12 @@ import icyllis.modernui.widget.TextView;
|
||||
|
||||
public abstract class BaseTabFragment extends Fragment {
|
||||
|
||||
protected static final int COLOR_CARD = 0xFF1A1A22;
|
||||
protected static final int COLOR_ACCENT = 0xFF00E5FF;
|
||||
protected static final int COLOR_CARD = 0xFF23232D;
|
||||
protected static final int COLOR_ACCENT = 0xFF5CF392;
|
||||
protected static final int COLOR_ACCENT_DIM = 0xFF3E8E5A;
|
||||
protected static final int COLOR_TEXT_MAIN = 0xFFF0F0F0;
|
||||
protected static final int COLOR_TEXT_SEC = 0xFF9EA3AF;
|
||||
protected static final int COLOR_CARD_BORDER = 0x265CF392;
|
||||
|
||||
protected int dp(float dp) {
|
||||
return (int) (dp * getContext().getResources().getDisplayMetrics().density);
|
||||
@@ -22,7 +26,7 @@ public abstract class BaseTabFragment extends Fragment {
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setText(text);
|
||||
tv.setTextSize(14);
|
||||
tv.setTextColor(0xFFEEEEEE);
|
||||
tv.setTextColor(COLOR_TEXT_MAIN);
|
||||
var p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
p.topMargin = dp(12);
|
||||
p.bottomMargin = dp(4);
|
||||
@@ -37,20 +41,45 @@ public abstract class BaseTabFragment extends Fragment {
|
||||
tv.setTextColor(COLOR_ACCENT);
|
||||
var p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
p.topMargin = dp(24);
|
||||
p.bottomMargin = dp(8);
|
||||
p.bottomMargin = dp(10);
|
||||
p.leftMargin = dp(4);
|
||||
parent.addView(tv, p);
|
||||
}
|
||||
|
||||
protected void addTabHeader(LinearLayout parent, String title, String description) {
|
||||
TextView titleView = new TextView(getContext());
|
||||
titleView.setText(title);
|
||||
titleView.setTextSize(24);
|
||||
titleView.setTextColor(0xFFFFFFFF);
|
||||
titleView.setPadding(0, 0, 0, dp(2));
|
||||
parent.addView(titleView);
|
||||
|
||||
if (description != null) {
|
||||
TextView descView = new TextView(getContext());
|
||||
descView.setText(description);
|
||||
descView.setTextSize(13);
|
||||
descView.setTextColor(COLOR_TEXT_SEC);
|
||||
descView.setPadding(0, 0, 0, dp(16));
|
||||
parent.addView(descView);
|
||||
}
|
||||
|
||||
View divider = new View(getContext());
|
||||
var divParams = new LinearLayout.LayoutParams(dp(40), dp(3));
|
||||
divParams.bottomMargin = dp(16);
|
||||
divider.setLayoutParams(divParams);
|
||||
divider.setBackground(makeRoundedBg(COLOR_ACCENT, 2));
|
||||
parent.addView(divider);
|
||||
}
|
||||
|
||||
protected LinearLayout createSettingCard(String title, String description) {
|
||||
LinearLayout card = new LinearLayout(getContext());
|
||||
card.setOrientation(LinearLayout.HORIZONTAL);
|
||||
card.setGravity(Gravity.CENTER_VERTICAL);
|
||||
card.setPadding(dp(16), dp(12), dp(16), dp(12));
|
||||
card.setBackground(makeRoundedBg(COLOR_CARD, 12));
|
||||
card.setPadding(dp(18), dp(14), dp(18), dp(14));
|
||||
card.setBackground(makeBorderedBg(COLOR_CARD, COLOR_CARD_BORDER, 10, 1));
|
||||
|
||||
var cardParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
cardParams.bottomMargin = dp(8);
|
||||
cardParams.bottomMargin = dp(10);
|
||||
card.setLayoutParams(cardParams);
|
||||
|
||||
LinearLayout textLayout = new LinearLayout(getContext());
|
||||
@@ -60,15 +89,15 @@ public abstract class BaseTabFragment extends Fragment {
|
||||
|
||||
TextView titleView = new TextView(getContext());
|
||||
titleView.setText(title);
|
||||
titleView.setTextSize(15);
|
||||
titleView.setTextColor(0xFFFFFFFF);
|
||||
titleView.setTextSize(15.5f);
|
||||
titleView.setTextColor(COLOR_TEXT_MAIN);
|
||||
textLayout.addView(titleView);
|
||||
|
||||
if (description != null) {
|
||||
TextView descView = new TextView(getContext());
|
||||
descView.setText(description);
|
||||
descView.setTextSize(12);
|
||||
descView.setTextColor(0xFF888888);
|
||||
descView.setTextSize(12.5f);
|
||||
descView.setTextColor(COLOR_TEXT_SEC);
|
||||
textLayout.addView(descView);
|
||||
}
|
||||
|
||||
@@ -82,6 +111,14 @@ public abstract class BaseTabFragment extends Fragment {
|
||||
return d;
|
||||
}
|
||||
|
||||
protected ShapeDrawable makeBorderedBg(int color, int strokeColor, float radius, float strokeWidth) {
|
||||
ShapeDrawable d = new ShapeDrawable();
|
||||
d.setCornerRadius(dp(radius));
|
||||
d.setColor(color);
|
||||
d.setStroke(dp(strokeWidth), strokeColor);
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, icyllis.modernui.util.DataSet savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
Reference in New Issue
Block a user