1313 */
1414package de .troido .resigner .ui ;
1515
16- import java .awt .Color ;
17- import java .awt .Graphics ;
18- import java .awt .Graphics2D ;
16+ import java .awt .*;
1917import java .awt .datatransfer .DataFlavor ;
2018import java .awt .datatransfer .UnsupportedFlavorException ;
2119import java .awt .dnd .DnDConstants ;
3533import com .apkfuns .apkresign .BrowserUtil ;
3634import com .apkfuns .apkresign .Global ;
3735import de .troido .resigner .controll .ReSignerLogic ;
38- import de .troido .resigner .utils .PropertiesUtil ;
3936
4037public class MainWindow extends JPanel implements DropTargetListener , ActionListener {
4138 private BufferedImage img ;
4239 public static PathSettingWindow pathSetting ;
40+ public JLabel progressLabel ;
4341
4442 @ Override
4543 protected void paintComponent (Graphics g ) {
@@ -59,6 +57,10 @@ public MainWindow() throws Exception {
5957 DropTarget dt = new DropTarget (f , this );
6058 this .setDropTarget (dt );
6159 f .setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
60+ progressLabel = new JLabel ("正在重签名中,请稍等..." );
61+ progressLabel .setFont (new Font ("Dialog" , 1 , 16 ));
62+ setProgressLabel (false );
63+ add (progressLabel );
6264 f .getContentPane ().add (this );
6365 f .setSize (318 , 335 );
6466 f .setResizable (false );
@@ -79,6 +81,15 @@ public MainWindow() throws Exception {
7981 checkEnvironment ();
8082 }
8183
84+ /**
85+ * 设置进度提示是否显示
86+ *
87+ * @param show
88+ */
89+ public void setProgressLabel (boolean show ) {
90+ progressLabel .setVisible (show );
91+ }
92+
8293 private boolean checkEnvironment () {
8394 try {
8495 ReSignerLogic .checkEnvironment ();
@@ -131,6 +142,7 @@ public void drop(DropTargetDropEvent dtde) {
131142 if (!checkEnvironment ()) {
132143 return ;
133144 }
145+ setProgressLabel (true );
134146 String inFileName = "" ;
135147 try {
136148 java .util .List files = (java .util .List ) dtde .getTransferable ()
@@ -148,7 +160,6 @@ public void drop(DropTargetDropEvent dtde) {
148160 fc .setSelectedFile (outFile );
149161 // In response to a button click:
150162 int returnVal = fc .showSaveDialog (this );
151-
152163 if (returnVal != JFileChooser .APPROVE_OPTION )
153164 return ;
154165 outFile = fc .getSelectedFile ();
@@ -157,13 +168,15 @@ public void drop(DropTargetDropEvent dtde) {
157168 outFileName = outFileName + ".apk" ;
158169 String result [] = ReSignerLogic .resign (inFileName , outFileName );
159170 if (result != null ) {
160- /* JOptionPane.showMessageDialog(this,
171+ JOptionPane .showMessageDialog (this ,
161172 "apk successfully re-signed\n \n Package name: "
162- + result[0] + "\nMain activity: " + result[1]);*/
163- new ShowCodeWindow (result [0 ], result [1 ]);
173+ + result [0 ] + "\n Main activity: " + result [1 ]);
174+ // new ShowCodeWindow(result[0], result[1]);
164175 }
165176 } catch (Exception e ) {
166177 JOptionPane .showMessageDialog (this , "ERROR: " + e .getMessage ());
178+ } finally {
179+ setProgressLabel (false );
167180 }
168181
169182 }
0 commit comments