• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jiangxincode / ApkToolBoxGUI / #734

19 May 2024 01:23PM UTC coverage: 3.151%. Remained the same
#734

push

jiangxincode
merge some menu to settings menu

0 of 127 new or added lines in 11 files covered. (0.0%)

229 existing lines in 9 files now uncovered.

236 of 7489 relevant lines covered (3.15%)

0.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/edu/jiangxin/apktoolbox/file/checksum/panel/VerifyChecksumPanel.java
1
package edu.jiangxin.apktoolbox.file.checksum.panel;
2

3
import edu.jiangxin.apktoolbox.swing.extend.EasyChildTabbedPanel;
4
import edu.jiangxin.apktoolbox.utils.Constants;
5
import org.apache.commons.lang3.StringUtils;
6

7
import javax.swing.*;
8
import java.awt.*;
9

10
public class VerifyChecksumPanel extends EasyChildTabbedPanel {
×
11
    private JPanel fileSumPanel;
12
    private JTextArea fileSumTextArea;
13

14
    private JPanel compareSumPanel;
15
    private JTextArea compareSumTextArea;
16

17
    private JPanel operationPanel;
18

19
    private JTextField resultTextField;
20

21

22
    @Override
23
    public void createUI() {
NEW
24
        BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
×
NEW
25
        setLayout(boxLayout);
×
26

NEW
27
        add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
28

UNCOV
29
        createFileSumPanel();
×
NEW
30
        add(fileSumPanel);
×
31

NEW
32
        add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
33

UNCOV
34
        createCompareSumPanel();
×
NEW
35
        add(compareSumPanel);
×
36

NEW
37
        add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
38

UNCOV
39
        createOperationPanel();
×
NEW
40
        add(operationPanel);
×
41
    }
×
42

43
    private void createFileSumPanel() {
44
        fileSumPanel = new JPanel();
×
45
        BoxLayout boxLayout = new BoxLayout(fileSumPanel, BoxLayout.Y_AXIS);
×
46
        fileSumPanel.setLayout(boxLayout);
×
47

UNCOV
48
        JLabel fileSumLabel = new JLabel("Paste calculated file summary from \"File Checksum\" tabbed panel here:");
×
49
        fileSumTextArea = new JTextArea(5, 4);
×
50
        fileSumTextArea.setLineWrap(true);
×
51
        JScrollPane fileSumScrollPanel = new JScrollPane(fileSumTextArea);
×
52

UNCOV
53
        fileSumPanel.add(fileSumLabel);
×
UNCOV
54
        fileSumPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
55
        fileSumPanel.add(fileSumScrollPanel);
×
56
    }
×
57

58
    private void createCompareSumPanel() {
59
        compareSumPanel = new JPanel();
×
60
        BoxLayout boxLayout = new BoxLayout(compareSumPanel, BoxLayout.Y_AXIS);
×
61
        compareSumPanel.setLayout(boxLayout);
×
62

UNCOV
63
        JLabel compareSumLabel = new JLabel("Paste your compared file summary here:");
×
64
        compareSumTextArea = new JTextArea(5, 4);
×
65
        compareSumTextArea.setLineWrap(true);
×
66
        JScrollPane compareSumScrollPanel = new JScrollPane(compareSumTextArea);
×
67

UNCOV
68
        compareSumPanel.add(compareSumLabel);
×
UNCOV
69
        compareSumPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
70
        compareSumPanel.add(compareSumScrollPanel);
×
UNCOV
71
    }
×
72

73
    private void createOperationPanel() {
74
        operationPanel = new JPanel();
×
75

76
        JButton compareButton = new JButton("Compare");
×
77
        compareButton.setFocusPainted(false);
×
78
        compareButton.addActionListener(event -> {
×
79
            String fileSum = fileSumTextArea.getText();
×
UNCOV
80
            if (!isValidSummary(fileSum)) {
×
UNCOV
81
                resultTextField.setText("File summary is not valid");
×
82
                resultTextField.setForeground(Color.YELLOW);
×
83
                return;
×
84
            }
85

86
            String compareSum = compareSumTextArea.getText();
×
UNCOV
87
            if (!isValidSummary(compareSum)) {
×
UNCOV
88
                resultTextField.setText("Compared summary is not valid");
×
89
                resultTextField.setForeground(Color.YELLOW);
×
90
                return;
×
91
            }
92

UNCOV
93
            if (StringUtils.equalsIgnoreCase(fileSum, compareSum)) {
×
UNCOV
94
                resultTextField.setText("File summary is same with compared summary");
×
95
                resultTextField.setForeground(Color.GREEN);
×
96
                return;
×
97
            }
98

99
            resultTextField.setText("File summary is different from compared summary");
×
100
            resultTextField.setForeground(Color.RED);
×
101
        });
×
102

103
        resultTextField = new JTextField("To be comparing");
×
104
        resultTextField.setPreferredSize(new Dimension(100, 25));
×
105
        resultTextField.setEditable(false);
×
UNCOV
106
        resultTextField.setBorder(null);
×
107
        Font font = new Font(null, Font.BOLD, 16);
×
108
        resultTextField.setFont(font);
×
109
        resultTextField.setForeground(Color.YELLOW);
×
110

111
        operationPanel.setLayout(new BoxLayout(operationPanel, BoxLayout.X_AXIS));
×
112
        operationPanel.add(compareButton);
×
UNCOV
113
        operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
×
UNCOV
114
        operationPanel.add(resultTextField);
×
115
        operationPanel.add(Box.createHorizontalGlue());
×
116
    }
×
117

118
    private boolean isValidSummary(String summary) {
UNCOV
119
        if (StringUtils.isEmpty(summary)) {
×
UNCOV
120
            return false;
×
121
        }
UNCOV
122
        return StringUtils.containsOnly(summary, "0123456789ABCDEFabcdef");
×
123
    }
124
}
125

126

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc