Skip to content

Commit cf3e1bc

Browse files
committed
Code clean up
1 parent 6adc2cd commit cf3e1bc

17 files changed

Lines changed: 50 additions & 59 deletions

app/src/main/java/com/njlabs/showjava/processor/JarExtractor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@SuppressWarnings({"ResultOfMethodCallIgnored", "ConstantConditions"})
3232
public class JarExtractor extends ProcessServiceHelper {
3333

34-
private ArrayList<String> ignoredLibs;
34+
private final ArrayList<String> ignoredLibs;
3535

3636
public JarExtractor(ProcessService processService) {
3737
this.processService = processService;
@@ -64,7 +64,7 @@ public void run() {
6464
extractionThread.start();
6565
}
6666

67-
public void apkToDex() {
67+
private void apkToDex() {
6868
DexFile dexFile = null;
6969
try {
7070
dexFile = DexFileFactory.loadDexFile(packageFilePath, 19);
@@ -109,7 +109,7 @@ public void apkToDex() {
109109
//////
110110
}
111111

112-
public void dexToJar() {
112+
private void dexToJar() {
113113
Log.i("STATUS", "Jar Extraction Started");
114114

115115
broadcastStatus("dex2jar");
@@ -187,7 +187,7 @@ private boolean isIgnored(String className) {
187187
return false;
188188
}
189189

190-
class DexExceptionHandlerMod implements DexExceptionHandler {
190+
private class DexExceptionHandlerMod implements DexExceptionHandler {
191191
@Override
192192
public void handleFileException(Exception e) {
193193
Ln.d("Dex2Jar Exception " + e);

app/src/main/java/com/njlabs/showjava/processor/ProcessService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public class ProcessService extends Service {
4545

4646
public Handler UIHandler;
4747

48-
public Notify processNotify;
48+
private Notify processNotify;
4949
public ApkParser apkParser;
5050

5151
public String decompilerToUse = "cfr";
5252

53-
public int startID;
53+
private int startID;
5454

5555
public void onCreate() {
5656
super.onCreate();
@@ -106,7 +106,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
106106
return START_NOT_STICKY;
107107
}
108108

109-
protected void handleIntent(Intent workIntent) {
109+
private void handleIntent(Intent workIntent) {
110110

111111
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
112112
STACK_SIZE = Integer.valueOf(prefs.getString("thread_stack_size", String.valueOf(20 * 1024 * 1024)));
@@ -345,14 +345,14 @@ public IBinder onBind(Intent intent) {
345345
return null;
346346
}
347347

348-
public void kill() {
348+
private void kill() {
349349
stopForeground(true);
350350
stopSelf();
351351
}
352352

353353
private class ToastRunnable implements Runnable {
354354

355-
String mText;
355+
final String mText;
356356

357357
public ToastRunnable(String text) {
358358
mText = text;

app/src/main/java/com/njlabs/showjava/processor/ResourcesExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public class ResourcesExtractor extends ProcessServiceHelper {
2828

29-
ApkParser apkParser;
29+
private final ApkParser apkParser;
3030

3131
public ResourcesExtractor(ProcessService processService) {
3232
this.processService = processService;

app/src/main/java/com/njlabs/showjava/ui/AppListing.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838

3939
public class AppListing extends BaseActivity {
4040

41-
ProgressDialog packageLoadDialog;
42-
ListView listView = null;
41+
private ProgressDialog packageLoadDialog;
42+
private ListView listView = null;
4343
private boolean isDestroyed;
4444

4545
@Override
@@ -72,7 +72,7 @@ private void dismissProgressDialog() {
7272
}
7373
}
7474

75-
public void setupList(ArrayList<PackageInfoHolder> AllPackages) {
75+
private void setupList(ArrayList<PackageInfoHolder> AllPackages) {
7676
ArrayAdapter<PackageInfoHolder> aa = new ArrayAdapter<PackageInfoHolder>(getBaseContext(), R.layout.package_list_item, AllPackages) {
7777
@SuppressLint("InflateParams")
7878
@Override

app/src/main/java/com/njlabs/showjava/ui/AppProcessActivity.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,21 @@ protected void onCreate(Bundle savedInstanceState) {
5858
appNameView.setText(extras.getString("package_label"));
5959
packageFilePath = extras.getString("package_file_path");
6060

61-
try {
62-
ApkParser apkParser = new ApkParser(new File(packageFilePath));
63-
appNameView.setText(apkParser.getApkMeta().getLabel());
64-
} catch (Exception e) {
65-
Ln.e(e);
66-
exitWithError();
67-
}
61+
if(packageFilePath != null ){
62+
try {
63+
ApkParser apkParser = new ApkParser(new File(packageFilePath));
64+
appNameView.setText(apkParser.getApkMeta().getLabel());
65+
} catch (Exception e) {
66+
Ln.e(e);
67+
exitWithError();
68+
}
6869

69-
if(extras.containsKey("decompiler")){
70-
decompilerToUse = extras.getString("decompiler");
70+
if(extras.containsKey("decompiler")){
71+
decompilerToUse = extras.getString("decompiler");
72+
}
73+
} else {
74+
finish();
7175
}
72-
7376
} else {
7477
packageFilePath = (new File(URI.create(getIntent().getDataString()))).getAbsolutePath();
7578
if (FilenameUtils.isExtension(packageFilePath, "apk")) {

app/src/main/java/com/njlabs/showjava/ui/BaseActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void setupToolbar(String title) {
7979
getSupportActionBar().setTitle(title);
8080
} else {
8181
if(isPro()) {
82-
ActivityInfo activityInfo = null;
82+
ActivityInfo activityInfo;
8383
try {
8484
activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
8585
String currentTitle = activityInfo.loadLabel(getPackageManager()).toString();

app/src/main/java/com/njlabs/showjava/ui/FilePicker.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.support.v7.app.ActionBar;
77
import android.view.MenuItem;
88

9-
import com.njlabs.showjava.R;
109
import com.nononsenseapps.filepicker.AbstractFilePickerActivity;
1110
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
1211

@@ -16,7 +15,7 @@
1615

1716
public class FilePicker extends AbstractFilePickerActivity<File> {
1817

19-
FilePickerFragment currentFragment;
18+
private FilePickerFragment currentFragment;
2019

2120
@Override
2221
protected void attachBaseContext(Context newBase) {

app/src/main/java/com/njlabs/showjava/ui/FilePickerFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected boolean isItemVisible(final File file) {
3636
* For consistency, the top level the back button checks against should be the start path.
3737
* But it will fall back on /.
3838
*/
39-
public File getBackTop() {
39+
private File getBackTop() {
4040
if (getArguments().containsKey(KEY_START_PATH)) {
4141
String keyStartPath = getArguments().getString(KEY_START_PATH);
4242
return getPath((keyStartPath != null ? keyStartPath : "/"));

app/src/main/java/com/njlabs/showjava/ui/JavaExplorer.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
public class JavaExplorer extends BaseActivity {
3838

39-
ListView lv;
40-
String packageID;
41-
ActionBar actionBar;
39+
private ListView lv;
40+
private String packageID;
41+
private ActionBar actionBar;
4242
private File currentDir;
4343
private FileArrayAdapter adapter;
4444
private String sourceDir;
@@ -169,18 +169,14 @@ private void dismissProgressDialog() {
169169
}
170170
}
171171

172-
public class SourceArchiver extends AsyncTask<String, String, File> {
172+
private class SourceArchiver extends AsyncTask<String, String, File> {
173173

174174
@Override
175175
protected File doInBackground(String... params) {
176176
publishProgress("Compressing source files ...");
177177
return Utils.zipDir(new File(sourceDir), packageID);
178178
}
179179

180-
public void doProgress(String progress){
181-
publishProgress(progress);
182-
}
183-
184180
@Override
185181
protected void onPostExecute(File zipFilePath) {
186182
dismissProgressDialog();

app/src/main/java/com/njlabs/showjava/ui/PurchaseActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
public class PurchaseActivity extends BaseActivity implements BillingProcessor.IBillingHandler {
2222

23-
BillingProcessor bp;
24-
ProgressBar progressBar;
25-
LinearLayout mainLayout;
23+
private BillingProcessor bp;
24+
private ProgressBar progressBar;
25+
private LinearLayout mainLayout;
2626

2727
@Override
2828
protected void onCreate(Bundle savedInstanceState) {

0 commit comments

Comments
 (0)