Skip to content

Commit

Permalink
Adjust the size of service icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Chipppppppppp committed Jun 21, 2024
1 parent e796fe1 commit 84e8aba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
24 changes: 15 additions & 9 deletions app/src/main/java/io/github/chipppppppppp/lime/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,25 @@ public void handleLoadPackage(@NonNull XC_LoadPackage.LoadPackageParam loadPacka

@Override
public void handleInitPackageResources(@NonNull XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals(Constants.PACKAGE_NAME) || !limeOptions.removeIconLabels.checked)
if (!resparam.packageName.equals(Constants.PACKAGE_NAME))
return;

XModuleResources xModuleResources = XModuleResources.createInstance(modulePath, resparam.res);

resparam.res.setReplacement(Constants.PACKAGE_NAME, "dimen", "main_bnb_button_height", xModuleResources.fwd(R.dimen.main_bnb_button_height));
resparam.res.setReplacement(Constants.PACKAGE_NAME, "dimen", "main_bnb_button_width", xModuleResources.fwd(R.dimen.main_bnb_button_width));
resparam.res.hookLayout(Constants.PACKAGE_NAME, "layout", "app_main_bottom_navigation_bar_button", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable {
liparam.view.setTranslationY(xModuleResources.getDimensionPixelSize(R.dimen.gnav_icon_offset));
}
});
if (limeOptions.removeIconLabels.checked) {
resparam.res.setReplacement(Constants.PACKAGE_NAME, "dimen", "main_bnb_button_height", xModuleResources.fwd(R.dimen.main_bnb_button_height));
resparam.res.setReplacement(Constants.PACKAGE_NAME, "dimen", "main_bnb_button_width", xModuleResources.fwd(R.dimen.main_bnb_button_width));
resparam.res.hookLayout(Constants.PACKAGE_NAME, "layout", "app_main_bottom_navigation_bar_button", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable {
liparam.view.setTranslationY(xModuleResources.getDimensionPixelSize(R.dimen.gnav_icon_offset));
}
});
}

if (limeOptions.removeServiceLabels.checked) {
resparam.res.setReplacement(Constants.PACKAGE_NAME, "dimen", "home_tab_v3_service_icon_size", xModuleResources.fwd(R.dimen.home_tab_v3_service_icon_size));
}
}

@Override
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="main_bnb_button_height">102dp</dimen>
<dimen name="main_bnb_button_width">77dp</dimen>
<dimen name="gnav_icon_offset">14dp</dimen>
<dimen name="main_bnb_button_height">106dp</dimen>
<dimen name="main_bnb_button_width">80dp</dimen>
<dimen name="gnav_icon_offset">21dp</dimen>
<dimen name="home_tab_v3_service_icon_size">45dp</dimen>
</resources>

0 comments on commit 84e8aba

Please sign in to comment.