Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,15 @@ private void styleNavTab(@Nullable View view, boolean active) {
int accent = pm.getAccentColor(dark);
float density = getResources().getDisplayMetrics().density;
if (navbar) {
int text = ContextCompat.getColor(this, R.color.text_primary);
// As in v1.6.1: no pill behind the active tab; it is bold in the primary text color and
// the other tabs use the secondary text color.
int text = ContextCompat.getColor(this, active ? R.color.text_primary : R.color.text_secondary);
tab.setTextColor(text);
tab.setTypeface(tab.getTypeface(), active ? Typeface.BOLD : Typeface.NORMAL);
tab.setTypeface(Typeface.create(tab.getTypeface(), active ? Typeface.BOLD : Typeface.NORMAL));
TextViewCompat.setCompoundDrawableTintList(tab, ColorStateList.valueOf(text));
if (active) {
GradientDrawable bg = new GradientDrawable();
bg.setCornerRadius(12 * density);
bg.setColor(ContextCompat.getColor(this, R.color.surface_variant));
tab.setBackground(bg);
} else {
tab.setBackgroundResource(R.drawable.bg_shell_icon_button);
}
android.util.TypedValue ripple = new android.util.TypedValue();
getTheme().resolveAttribute(android.R.attr.selectableItemBackground, ripple, true);
tab.setBackgroundResource(ripple.resourceId);
} else {
int icon = active ? ThemePalette.foreground(accent, dark) : ContextCompat.getColor(this, R.color.ui_muted);
TextViewCompat.setCompoundDrawableTintList(tab, ColorStateList.valueOf(icon));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import androidx.appcompat.widget.PopupMenu;
import androidx.core.widget.CompoundButtonCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.button.MaterialButton;
Expand Down Expand Up @@ -124,7 +124,9 @@ private void bindViews() {
}

private void setupRecycler() {
recycler.setLayoutManager(new LinearLayoutManager(this));
// v1.6.1 grid: about 3 cards across on a landscape phone, at least one.
int spans = Math.max(1, getResources().getConfiguration().screenWidthDp / 280);
recycler.setLayoutManager(new GridLayoutManager(this, spans));
adapter = new ExternalModsAdapter(minecraftVersion, this::handleModAction);
recycler.setAdapter(adapter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface OnSegmentSelectedListener {
private int selected = -1;
private boolean equalWidth = true;
private boolean vertical;
private float textSizeSp = 14f;
private float textSizeSp = 13f;
@Nullable
private Typeface baseTypeface;
@Nullable
Expand All @@ -53,11 +53,10 @@ public SegmentedControl(Context context) {
public SegmentedControl(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setOrientation(HORIZONTAL);
setBackgroundResource(R.drawable.bg_ui_segment_track);
int pad = dp(4);
setPadding(pad, pad, pad, pad);
setMinimumHeight(dp(48));
// Horizontal (the default, stacked pages): v1.6.1 tab pills, separate 32dp pills with 8dp gaps
// and no track. Vertical (two-pane side panel) keeps the track.
setGravity(Gravity.CENTER_VERTICAL);
applyTrack();
}

/** True (default): segments share the width. False: each segment wraps its label (scrollable rows). */
Expand All @@ -74,11 +73,14 @@ public void setVertical(boolean vertical) {
this.vertical = vertical;
setOrientation(vertical ? VERTICAL : HORIZONTAL);
setGravity(vertical ? Gravity.NO_GRAVITY : Gravity.CENTER_VERTICAL);
applyTrack();
for (TextView t : segments) {
t.setGravity(vertical ? Gravity.CENTER_VERTICAL | Gravity.START : Gravity.CENTER);
t.setMinHeight(dp(vertical ? 44 : 40));
t.setMinHeight(dp(vertical ? 44 : 32));
t.setPadding(dp(vertical ? 14 : 16), 0, dp(vertical ? 14 : 16), 0);
t.setLayoutParams(segmentParams());
}
applyState();
}

public void setTextSizeSp(float sp) {
Expand All @@ -103,8 +105,8 @@ public int addSegment(CharSequence label, int iconRes) {
t.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSizeSp);
if (baseTypeface == null) baseTypeface = ResourcesCompat.getFont(getContext(), R.font.misans);
t.setTypeface(baseTypeface);
t.setMinHeight(dp(vertical ? 44 : 40));
t.setPadding(dp(14), 0, dp(14), 0);
t.setMinHeight(dp(vertical ? 44 : 32));
t.setPadding(dp(vertical ? 14 : 16), 0, dp(vertical ? 14 : 16), 0);
if (iconRes != 0) {
Drawable d = ContextCompat.getDrawable(getContext(), iconRes);
if (d != null) {
Expand All @@ -125,9 +127,23 @@ public int addSegment(CharSequence label, int iconRes) {

private LayoutParams segmentParams() {
if (vertical) return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
return equalWidth
? new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f)
: new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// v1.6.1 tab pills size to their label, 8dp apart.
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMarginEnd(dp(8));
return lp;
}

private void applyTrack() {
if (vertical) {
setBackgroundResource(R.drawable.bg_ui_segment_track);
int pad = dp(4);
setPadding(pad, pad, pad, pad);
setMinimumHeight(dp(48));
} else {
setBackground(null);
setPadding(0, 0, 0, 0);
setMinimumHeight(0);
}
}

public void setOnSegmentSelectedListener(@Nullable OnSegmentSelectedListener listener) {
Expand Down Expand Up @@ -159,7 +175,8 @@ private void applyState() {
for (int i = 0; i < segments.size(); i++) {
TextView t = segments.get(i);
boolean on = i == selected;
t.setBackgroundResource(on ? R.drawable.bg_ui_segment_selected : 0);
t.setBackgroundResource(on ? R.drawable.bg_ui_segment_selected
: vertical ? 0 : R.drawable.bg_ui_segment_track);
t.setElevation(on ? dp(1) : 0);
t.setTextColor(on ? active : inactive);
t.setTypeface(Typeface.create(baseTypeface, on ? Typeface.BOLD : Typeface.NORMAL));
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/levimc/launcher/util/UiSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static int getLayoutGeneration() {
// ---- Layout and motion ----

public static String getLayoutMode(Context context) {
String mode = prefs(context).getString(KEY_LAYOUT_MODE, LAYOUT_SIDEBAR);
String mode = prefs(context).getString(KEY_LAYOUT_MODE, LAYOUT_NAVBAR);
return LAYOUT_NAVBAR.equals(mode) ? LAYOUT_NAVBAR : LAYOUT_SIDEBAR;
}

Expand All @@ -72,7 +72,7 @@ public static void setLayoutMode(Context context, String mode) {
* header card on top.
*/
public static boolean useTwoPane(Context context) {
return prefs(context).getBoolean(KEY_TWO_PANE, true);
return prefs(context).getBoolean(KEY_TWO_PANE, false);
}

public static void setTwoPane(Context context, boolean twoPane) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_shell_icon_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#FFFFFFFF" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
</shape>
</item>
</ripple>
3 changes: 1 addition & 2 deletions app/src/main/res/drawable/bg_ui_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
<!-- Card surface (Windows glass card: surface fill, faint 1dp border). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/surface" />
<corners android:radius="20dp" />
<stroke android:width="1dp" android:color="@color/ui_card_stroke" />
<corners android:radius="8dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_card_inner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<!-- Nested card or list row inside a card (Windows listItem): surface fill with a border. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/surface" />
<corners android:radius="16dp" />
<corners android:radius="12dp" />
<stroke android:width="1dp" android:color="@color/ui_border" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_icon_chip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<!-- Colored square behind an icon. UiKit.tintIconChip sets the color. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_default" />
<corners android:radius="10dp" />
<corners android:radius="8dp" />
</shape>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/bg_ui_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="@color/ui_input" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
<stroke android:width="1.5dp" android:color="@color/primary" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/ui_input" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
<stroke android:width="1dp" android:color="@color/ui_card_stroke" />
</shape>
</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#FFFFFFFF" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
</shape>
</item>
</ripple>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_segment_selected.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_segment" />
<corners android:radius="12dp" />
<corners android:radius="16dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_strip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<!-- Info strip under a page title (Windows metadata pill box). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_strip" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
<stroke android:width="1dp" android:color="@color/ui_card_stroke" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_tag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<!-- Small value tag / chip. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_default" />
<corners android:radius="7dp" />
<corners android:radius="4dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/bg_ui_tag_accent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<!-- Accent tag (soft brand fill). UiKit.tintSoftAccent re-colors it for the chosen theme color. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/primary_container" />
<corners android:radius="7dp" />
<corners android:radius="4dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/content_bg_icon_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<item>
<shape android:shape="rectangle">
<solid android:color="@color/ui_default" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
</shape>
</item>
</ripple>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/content_bg_item_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true">
<shape android:shape="rectangle">
<corners android:radius="18dp" />
<corners android:radius="12dp" />
<solid android:color="@color/primary_container" />
<stroke android:width="1.5dp" android:color="@color/primary" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="18dp" />
<corners android:radius="12dp" />
<solid android:color="@color/surface" />
<stroke android:width="1dp" android:color="@color/ui_card_stroke" />
</shape>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/content_bg_thumb.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_default" />
<corners android:radius="12dp" />
<corners android:radius="8dp" />
</shape>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/v161_home_launch_group.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Fill of the split launch button with the v1.6.1 launch button shape (8dp corners).
MainActivity re-colors it with the chosen theme color. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/primary" />
<corners android:radius="8dp" />
</shape>
17 changes: 17 additions & 0 deletions app/src/main/res/drawable/v161_instances_bg_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- v1.6.1 search/text field metrics (8dp corners, 1dp focus stroke), current colors. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="@color/ui_input" />
<corners android:radius="8dp" />
<stroke android:width="1dp" android:color="@color/primary" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/ui_input" />
<corners android:radius="8dp" />
</shape>
</item>
</selector>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/v161_misc_news_important.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- v1.6.1 news important pill shape (12dp radius), current danger fill. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_danger_soft" />
<corners android:radius="12dp" />
</shape>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/v161_misc_news_tag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- v1.6.1 news category pill shape (12dp radius), current tag fill. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ui_default" />
<corners android:radius="12dp" />
</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/v161r2_misc_quick_launch_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Quick Launch action as a standalone v1.6.1 card: surface fill, 12dp corners, row touch feedback. -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#1F808080">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/surface" />
<corners android:radius="12dp" />
</shape>
</item>
</ripple>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/v161r2_mods_external_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- v1.6.1 external mod grid card: surface fill, 10dp corners, 1dp outline. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/surface" />
<corners android:radius="10dp" />
<stroke android:width="1dp" android:color="@color/outline" />
</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/v161r2_mods_row_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- v1.6.1 mod list row: borderless surface card (8dp corners) with touch ripple. -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#1F808080">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/surface" />
<corners android:radius="8dp" />
</shape>
</item>
</ripple>
Loading
Loading