Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A solution for issue #151 #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -587,6 +587,14 @@ public boolean onLongClick(View view) {
return true;
}

public void addAppSpacing() {
mHomeLayout.addletterSpacingRate();
}

public void minusAppSpacint() {
mHomeLayout.minusletterSpacingRate();
}

private void showPopup(String activityName, AppTextView view) {

Context context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ private void setFonts() {

}

private void addAppSpacing() {
cancel();
launcherActivity.addAppSpacing();
}

private void minuAppSpacing() {
cancel();
launcherActivity.minusAppSpacint();
}

private void fontSelection(View view) {

Context context;
Expand All @@ -384,6 +394,14 @@ private void fontSelection(View view) {

popupMenu.setOnMenuItemClickListener(menuItem -> {
switch (menuItem.getItemId()) {
case R.id.menu_add_spacing:
addAppSpacing();
launcherActivity.loadApps();
break;
case R.id.menu_minus_spacing:
minuAppSpacing();
launcherActivity.loadApps();
break;
case R.id.menu_choose_fonts:
setFonts();
break;
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/menu/font_selection_popup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
<item
android:id="@+id/menu_choose_fonts"
android:title="@string/select_fonts" />
<item
android:id="@+id/menu_add_spacing"
android:title="@string/add_app_spacing" />
<item
android:id="@+id/menu_minus_spacing"
android:title="@string/minus_app_spacing" />
</menu>
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
<string name="color_for_this_entry">颜色&amp;尺寸</string>
<string name="action_settings">设置</string>
<string name="restart_launcher">重启启动器</string>
<string name="add_app_spacing">增大应用间距</string>
<string name="minus_app_spacing">减小应用间距</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@
<!--Sort Apps IN : RECENTLY USED FIRST ORDER -->
<string name="recently_first">Recently first</string>
<string name="restart_launcher">Restart Launcher</string>
<string name="add_app_spacing">Add app spacing</string>
<string name="minus_app_spacing">Minus app spacing</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public class FlowLayout extends ViewGroup {
List<LineDefinition> lines = new ArrayList<>();
List<ViewDefinition> views = new ArrayList<>();

private double letterSpacingRate = 0;

public void addletterSpacingRate() {
letterSpacingRate += 0.1;
}

public void minusletterSpacingRate() {
if (letterSpacingRate>0) {
letterSpacingRate -= 0.1;
}
}

public FlowLayout(Context context) {
super(context);
this.config = new ConfigDefinition();
Expand Down Expand Up @@ -86,7 +98,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
);

ViewDefinition view = new ViewDefinition(this.config, child);
view.setWidth(child.getMeasuredWidth());
view.setWidth((int)(child.getMeasuredWidth()*(1+letterSpacingRate)));
view.setHeight(child.getMeasuredHeight());
view.setNewLine(lp.isNewLine());
view.setGravity(lp.getGravity());
Expand Down