Skip to content

Commit 1667789

Browse files
committed
changed download directory
1 parent c16cdaf commit 1667789

File tree

8 files changed

+12
-51
lines changed

8 files changed

+12
-51
lines changed

app-release.apk

-352 Bytes
Binary file not shown.

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/build
2+
.apk

app/src/main/java/any/audio/Activity/Home.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ public boolean checkForExistingFile(String fileNameToCheck) {
567567

568568
// fileNameToCheck = FileNameReformatter.getInstance(this).getFormattedName(fileNameToCheck) + ".m4a";
569569

570-
File dir = new File(Constants.FILES_DIR);
570+
File dir = new File(Constants.DOWNLOAD_FILE_DIR);
571571
File[] _files = dir.listFiles();
572572

573573
for (File f : _files) {

app/src/main/java/any/audio/Config/AppConfig.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ public static void configureDevice() {
6565
PermissionManager.getInstance(context).seek();
6666
}
6767

68-
File root = Environment.getExternalStorageDirectory();
69-
File dir = new File(Constants.FILES_DIR);
70-
68+
File dir = new File(Constants.DOWNLOAD_FILE_DIR);
7169
boolean s = false;
7270
if (dir.exists() == false) {
7371
s = dir.mkdirs();
@@ -77,40 +75,4 @@ public static void configureDevice() {
7775

7876
}
7977

80-
public void checkUpdates(final Handler mRefHandler) {
81-
final String url = URLS.URL_LATEST_APP_VERSION;
82-
83-
StringRequest updateCheckReq = new StringRequest(
84-
Request.Method.GET,
85-
url,
86-
new Response.Listener<String>() {
87-
@Override
88-
public void onResponse(String s) {
89-
90-
double currentVersion = Double.parseDouble(s);
91-
92-
if (currentVersion>getCurrentAppVersionCode()){
93-
// new version is available
94-
Message msg = Message.obtain();
95-
msg.arg1 = Constants.FLAG_NEW_VERSION;
96-
mRefHandler.sendMessage(msg);
97-
}
98-
99-
}
100-
},
101-
new Response.ErrorListener() {
102-
@Override
103-
public void onErrorResponse(VolleyError volleyError) {
104-
105-
}
106-
});
107-
108-
updateCheckReq.setRetryPolicy(new DefaultRetryPolicy(
109-
SERVER_TIMEOUT_LIMIT,
110-
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
111-
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
112-
113-
VolleyUtils.getInstance().addToRequestQueue(updateCheckReq, "checkUpdateReq", context);
114-
115-
}
11678
}

app/src/main/java/any/audio/Config/Constants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public class Constants {
1313
public static final String ACTION_DOWNLOAD_PROGRESS_UPDATE_BROADCAST = "action_progress_update";
1414
public static final String EXTRA_TASK_ID = "task_id";
1515
public static final String EXTRA_PROGRESS = "progress";
16-
public static final String FILES_DIR = Environment.getExternalStorageDirectory().getAbsolutePath()+"/AnyAudio/YourSongs";
16+
// public static final String FILES_DIR = Environment.getExternalStorageDirectory().getAbsolutePath()+"/AnyAudio/YourSongs";
17+
public static final String DOWNLOAD_FILE_DIR = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath()+"/AnyAudio";
1718
public static final String ACTION_NETWORK_CONNECTED = "android.net.conn.CONNECTIVITY_CHANGE";
1819
public static final int SCREEN_ORIENTATION_PORTRAIT = 0;
1920
public static final int SCREEN_ORIENTATION_LANDSCAPE = 1;

app/src/main/java/any/audio/Fragments/DownloadFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public DownloadFragment() {
3939
private static void setUpAdapter() {
4040

4141
ArrayList<String> files = new ArrayList<>();
42-
File dir = new File(Constants.FILES_DIR);
42+
File dir = new File(Constants.DOWNLOAD_FILE_DIR);
4343
File[] _files = dir.listFiles();
4444
for (File f : _files) {
4545
String path = f.toString();
@@ -125,7 +125,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
125125
private void deleteItem(int pos){
126126

127127
ArrayList<String> files = new ArrayList<>();
128-
File dir = new File(Constants.FILES_DIR);
128+
File dir = new File(Constants.DOWNLOAD_FILE_DIR);
129129
File[] _files = dir.listFiles();
130130
for (File f : _files) {
131131
String path = f.toString();
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version":4,
3-
"newInThisUpdate":"v0.0.4-alpha \n Better UI \n Greater Stability",
4-
"appDownloadUrl":"https://github.com/zeseeit/AnyAudio/releases/download/v0.0.4/anyaudio_build_20161203_3.apk"
2+
"version":5,
3+
"newInThisUpdate":"v0.0.5-alpha \n Your downloads will be in your Music Folder.",
4+
"appDownloadUrl":"https://github.com/zeseeit/AnyAudio/releases/download/v0.0.5/anyaudio_build20161203_4.apk"
55
}

app/src/main/java/any/audio/helpers/TaskHandler.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private void deleteFile(String taskID) {
192192
.getTaskTitle(taskID)
193193
);
194194

195-
File dest_file = new File(Constants.FILES_DIR + "/" + file_to_delete + ".m4a");
195+
File dest_file = new File(Constants.DOWNLOAD_FILE_DIR + "/" + file_to_delete + ".m4a");
196196
if (dest_file.exists()) {
197197
if (dest_file.delete()) {
198198
if (itemInvalidatedListener != null)
@@ -421,10 +421,9 @@ public void run() {
421421
PermissionManager.getInstance(context).seek();
422422
}
423423

424-
dest_dir = new File(Constants.FILES_DIR);
424+
dest_dir = new File(Constants.DOWNLOAD_FILE_DIR);
425425
String fileName = FileNameReformatter.getInstance(context).getFormattedName(t_file_name.trim());
426426
dest_file = new File(dest_dir, fileName + ".m4a");
427-
// log("writing to " + dest_file.toString());
428427
L.m("TaskHandler", "Writing to " + dest_file.toString());
429428
InputStream inputStream = new BufferedInputStream(url.openStream());
430429
OutputStream outputStream = new FileOutputStream(dest_file);
@@ -433,9 +432,7 @@ public void run() {
433432
int progressPercentage = 0;
434433
int progressSent = 0;
435434
while (!isCanceled && (count = inputStream.read(data)) != -1) {
436-
//L.m("TaskHandler","[Downloading.....] isCancelled "+isCanceled);
437435
total += count;
438-
// Log.d("Sending filelength", fileLength + "");
439436
progressPercentage = ((int) total * 100 / fileLength);//, fileLength;
440437

441438
if (progressSent < progressPercentage) {

0 commit comments

Comments
 (0)