Skip to content

Commit

Permalink
fix #52: add alway on top feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxincode committed May 19, 2024
1 parent 75c217f commit 83d02fe
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package edu.jiangxin.apktoolbox.help.settings;

import edu.jiangxin.apktoolbox.swing.extend.EasyChildTabbedPanel;
import edu.jiangxin.apktoolbox.utils.Constants;

import javax.swing.*;

public class AlwaysOnTopPanel extends EasyChildTabbedPanel {
private JPanel optionPanel;

@Override
public void createUI() {
BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
setLayout(boxLayout);

createOptionPanel();
add(optionPanel);

add(Box.createVerticalStrut(15 * Constants.DEFAULT_Y_BORDER));
}

private void createOptionPanel() {
optionPanel = new JPanel();
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));

JLabel typeLabel = new JLabel("Always on top:");
JCheckBox alwaysOnTopCheckBox = new JCheckBox();
alwaysOnTopCheckBox.setSelected(conf.getBoolean("always.on.top", false));
alwaysOnTopCheckBox.addActionListener(e -> {
conf.setProperty("always.on.top", alwaysOnTopCheckBox.isSelected());
getFrame().setAlwaysOnTop(alwaysOnTopCheckBox.isSelected());
SwingUtilities.updateComponentTreeUI(getFrame());
getFrame().refreshSizeAndLocation();
});

optionPanel.add(typeLabel);
optionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
optionPanel.add(alwaysOnTopCheckBox);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public void initUI() {
String localeTitle = bundle.getString("help.settings.locale.title");
tabbedPane.addTab(localeTitle, null, localePanel, localeTitle);

EasyChildTabbedPanel alwaysOnTopPanel = new AlwaysOnTopPanel();
String alwaysOnTopTitle = bundle.getString("help.settings.always.on.top.title");
tabbedPane.addTab(alwaysOnTopTitle, null, alwaysOnTopPanel, alwaysOnTopTitle);

EasyChildTabbedPanel dependencyPathPanel = new DependencyPathPanel();
String dependencyPathTitle = bundle.getString("help.settings.dependency.path");
tabbedPane.addTab(dependencyPathTitle, null, dependencyPathPanel, dependencyPathTitle);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/edu/jiangxin/apktoolbox/main/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public static void main(String[] args) {
Locale.setDefault(new Locale(currentLocaleLanguage));

MainFrame frame = new MainFrame();

boolean isAlwaysOnTop = conf.getBoolean("always.on.top", false);
conf.setProperty("always.on.top", isAlwaysOnTop);
frame.setAlwaysOnTop(isAlwaysOnTop);

frame.setVisible(true);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/apktoolbox.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ help.settings.title = Settings
help.settings.dependency.path = Dependency Path
help.settings.locale.title = Set Display Language
help.settings.look.and.feel.title = Set Look and Feel
help.settings.always.on.top.title = Set Always On Top
help.feedback.title = Feedback
help.checkupdate.title = Check for Updates
help.contribute.title = Contribute
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/apktoolbox_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ help.settings.title = \u8bbe\u7f6e
help.settings.dependency.path = \u4f9d\u8d56\u8def\u5f84
help.settings.locale.title = \u8bbe\u7f6e\u663e\u793a\u8bed\u8a00
help.settings.look.and.feel.title = \u8bbe\u7f6e\u5916\u89c2
help.settings.always.on.top.title = \u6c38\u8fdc\u5728\u6700\u4e0a\u65b9
help.feedback.title = \u610f\u89c1\u53cd\u9988
help.checkupdate.title = \u68c0\u67e5\u66f4\u65b0
help.contribute.title = \u8d21\u732e
Expand Down

This file was deleted.

This file was deleted.

18 changes: 18 additions & 0 deletions src/site/markdown/getting_started_guide/settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Settings

### How To Change Language

You can change language by:

* `Help->Settings->Set Display Language`
* Restart the software

However, There are many pages which is not translated. I have less time on it, so any pull request is very welcomed. I will merge them as long as I check them.

## How To Change Look And Feel

* `Help->Settings->Set Look and Feel`

## How To Set Always On Top

* `Help->Settings->Set Always On Top`
3 changes: 1 addition & 2 deletions src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
</breadcrumbs>
<menu name="Getting Started Guide">
<item name="Getting Started Guide" href="getting_started_guide/getting_started_guide.html"/>
<item name="How To Change Language" href="getting_started_guide/how_to_change_language.html"/>
<item name="How To Change Look And Feel" href="getting_started_guide/how_to_change_look_and_feel.html"/>
<item name="Settings" href="getting_started_guide/settings.html"/>
</menu>
<menu name="Features">
<item name="Recovery File Password" href="features/recovery_file_password.html"/>
Expand Down

0 comments on commit 83d02fe

Please sign in to comment.