cleanup & use AndroidHelper

This commit is contained in:
ligi 2013-08-23 03:39:42 +02:00
parent 14ca8e64d4
commit ae03d140da
5 changed files with 23 additions and 49 deletions

View file

@ -11,7 +11,7 @@ apply plugin: 'android'
repositories {
mavenCentral()
maven {
url "https://raw.github.com/ligi/ligis-mvn-repo/master"
url project.hasProperty('ligisMavenUrl') ? ligisMavenUrl : "https://raw.github.com/ligi/ligis-mvn-repo/master";
}
}
@ -19,9 +19,9 @@ android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
flavorGroups "maps","analytics"
flavorGroups "maps", "analytics"
productFlavors {
withMaps {
flavorGroup "maps"
}
@ -42,14 +42,15 @@ android {
dependencies {
compile 'com.google.zxing:core:2.1'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.googlecode.android-query:android-query:0.25.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.ligi:tracedroid:1.1'
compile 'com.google.zxing:core:2.1'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.googlecode.android-query:android-query:0.25.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.ligi:tracedroid:1.1'
compile 'org.ligi:AndroidHelper:0.20'
compile 'com.android.support:support-v4:18.0.0'
withAnalyticsCompile fileTree(dir: 'libs', include: 'libGoogleAnalyticsV2.jar')
withAnalyticsCompile fileTree(dir: 'libs', include: 'libGoogleAnalyticsV2.jar')
withMapsCompile 'com.google.android.gms:play-services:3.1.36'
}
}

View file

@ -164,8 +164,6 @@ public class PassbookParser {
Tracker.get().trackEvent("problem_event", "strange_type", type, null);
}
Log.i("got typee" + type);
if (type == null) {
try {
Tracker.get().trackEvent("problem_event", "pass", "without_type", null);

View file

@ -8,11 +8,13 @@ import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.androidquery.AQuery;
import org.ligi.ticketviewer.helper.FileHelper;
import org.ligi.androidhelper.AndroidHelper;
import org.ligi.ticketviewer.maps.PassbookMapsFacade;
import java.io.File;
@ -71,7 +73,7 @@ public class TicketViewActivityBase extends SherlockFragmentActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
FileHelper.DeleteRecursive(new File(path));
AndroidHelper.at(new File(path)).deleteRecursive();
finish();
}

View file

@ -4,10 +4,12 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import org.ligi.androidhelper.AndroidHelper;
import org.ligi.ticketviewer.helper.FileHelper;
import org.ligi.tracedroid.logging.Log;
import java.io.File;
import java.io.FileOutputStream;
@ -18,8 +20,6 @@ import java.util.zip.ZipInputStream;
public class UnzipPasscodeDialog {
public final static String TAG = "TicketViewer";
public static void DisplayError(final Activity ctx, final String title, final String err) {
ctx.runOnUiThread(new Runnable() {
@ -38,7 +38,6 @@ public class UnzipPasscodeDialog {
}
public interface FinishCallback {
public Void call(String path);
}
@ -67,7 +66,6 @@ public class UnzipPasscodeDialog {
if (!dir_file.exists()) {
DisplayError(activity, "Problem", "Problem creating the temp dir: " + path);
return;
}
@ -86,10 +84,11 @@ public class UnzipPasscodeDialog {
try {
String rename_str = TicketDefinitions.getPassesDir(activity) + "/" + manifest_json.getString("pass.json");
File rename_file = new File(rename_str);
Log.i("TicketView", "Renaming to " + rename_str + " " + rename_file);
Log.i("Renaming to " + rename_str + " " + rename_file);
if (rename_file.exists())
FileHelper.DeleteRecursive(rename_file);
if (rename_file.exists()) {
AndroidHelper.at(rename_file).deleteRecursive();
}
new File(path + "/").renameTo(rename_file);
path = rename_str;
@ -106,9 +105,6 @@ public class UnzipPasscodeDialog {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// activity.startActivity(intent_after_finish);
// activity.finish();
}
}
new Thread(new AlertDialogUpdater(activity, dialog, call_after_finish)).start();
@ -133,7 +129,7 @@ public class UnzipPasscodeDialog {
ZipEntry ze = null;
byte[] readData = new byte[1024];
while ((ze = zin.getNextEntry()) != null) {
Log.i(TAG, "Decompress" + "unzip" + _location + ze.getName());
Log.i("Decompress" + "unzip" + _location + ze.getName());
if (ze.isDirectory()) {
_dirChecker(ze.getName());
} else {
@ -153,7 +149,7 @@ public class UnzipPasscodeDialog {
}
zin.close();
} catch (Exception e) {
Log.e("Decompress", "unzip", e);
Log.e("unzip", e);
}
}

View file

@ -1,7 +1,5 @@
package org.ligi.ticketviewer.helper;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@ -55,25 +53,4 @@ public class FileHelper {
}
public static void DeleteRecursive(File dir) {
Log.d("DeleteRecursive", "DELETEPREVIOUS TOP" + dir.getPath());
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
File temp = new File(dir, children[i]);
if (temp.isDirectory()) {
Log.d("DeleteRecursive", "Recursive Call" + temp.getPath());
DeleteRecursive(temp);
} else {
Log.d("DeleteRecursive", "Delete File" + temp.getPath());
boolean b = temp.delete();
if (b == false) {
Log.d("DeleteRecursive", "DELETE FAIL");
}
}
}
dir.delete();
}
}
}