Add search bar & Magisk Hide option

This commit is contained in:
topjohnwu
2016-10-17 10:11:26 +08:00
parent a7da6cf172
commit 70500cf21e
12 changed files with 158 additions and 36 deletions

View File

@@ -200,7 +200,7 @@ public class Async {
InputStream in = mContext.getContentResolver().openInputStream(mUri);
mFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip");
mFile.delete();
Utils.removeFile(mFile.getPath());
Utils.removeItem(mFile.getPath());
createFileFromInputStream(in, mFile);
in.close();
} catch (FileNotFoundException e) {
@@ -273,7 +273,7 @@ public class Async {
}
}
if (mFile != null && mFile.exists() && !mFile.delete()) {
Utils.removeFile(mFile.getPath());
Utils.removeItem(mFile.getPath());
}
if (ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1))) {
return 1;

View File

@@ -7,13 +7,11 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
import android.util.Base64;
import android.view.View;
import android.widget.Toast;
import com.topjohnwu.magisk.MagiskFragment;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
@@ -68,8 +66,8 @@ public class Utils {
return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0));
}
public static boolean removeFile(String path) {
String command = "rm -f " + path + " 2>/dev/null; if [ -f " + path + " ]; then echo false; else echo true; fi";
public static boolean removeItem(String path) {
String command = "rm -rf " + path + " 2>/dev/null; if [ -e " + path + " ]; then echo false; else echo true; fi";
return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0));
}