Skip to content

Commit

Permalink
Improved properties
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitkh96 committed Jul 31, 2015
1 parent 71fecc5 commit 8d9ebca
Show file tree
Hide file tree
Showing 19 changed files with 319 additions and 111 deletions.
Binary file added AmazeFileManager-play-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
applicationId "com.amaze.filemanager"
minSdkVersion 14
targetSdkVersion 21
versionCode 28
versionName "3.0.0"
versionCode 29
versionName "3.0.1"
}

signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
Expand All @@ -58,7 +54,6 @@
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -1261,7 +1256,7 @@ public void onNegative(MaterialDialog materialDialog) {
final String path1 = ma.current;
final MaterialDialog.Builder ba2 = new MaterialDialog.Builder(this);
ba2.title((R.string.newfile));
View v1 = getLayoutInflater().inflate(R.layout.dialog, null);
View v1 = getLayoutInflater().inflate(R.layout.dialog_rename, null);
final EditText edir1 = (EditText) v1.findViewById(R.id.newname);
utils.setTint(edir1,Color.parseColor(fabskin));
edir1.setHint(utils.getString(this, R.string.entername));
Expand Down
4 changes: 2 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<data android:mimeType="*/*" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!--<intent-filter>
</intent-filter><!--
<intent-filter>
<action android:name="android.intent.action.RINGTONE_PICKER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
writeTextFile(mFile.getPath(), mInput.getText().toString());
return true;
} else if (item.getItemId() == R.id.details) {
utils.showProps(mFile, c, theme1);
utils.showProps(mFile, this, theme1);
return true;
} else if (item.getItemId() == R.id.openwith) {
utils.openunknown(mFile, c, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ public View getView(int position, View convertView, ViewGroup parent) {
@Override
public void onClick(View view) {
hidden.removePath(items.get(p).getPath());
if(items.get(p).isDirectory()){ArrayList<File> a=new ArrayList<File>();a.add(new File(items.get(p).getPath()+"/.nomedia"));
new DeleteTask(context.getActivity().getContentResolver(),c).execute(new Futils().toStringArray(a));}
if(items.get(p).isDirectory())
{
ArrayList<File> a=new ArrayList<File>();
a.add(new File(items.get(p).getPath()+"/.nomedia"));
new DeleteTask(context.getActivity().getContentResolver(),c).execute(new Futils().toStringArray(a));
}
items.remove(items.get(p));
context.updatehiddenfiles();
notifyDataSetChanged();
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/amaze/filemanager/database/TabHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public Tab findTab(int tabNo) {
Tab tab = new Tab();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
tab.setTab((cursor.getInt(cursor.getColumnIndex(COLUMN_TAB_NO))));
tab.setPath(cursor.getString(cursor.getColumnIndex(COLUMN_PATH)));
tab.setHome(cursor.getString(cursor.getColumnIndex(COLUMN_HOME)));
tab.setTab((cursor.getInt(0)));
tab.setPath(cursor.getString(1));
tab.setHome(cursor.getString(2));
cursor.close();
} else {
tab = null;
Expand All @@ -107,12 +107,12 @@ public List<Tab> getAllTabs() {
SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery(query, null);
// Looping through all rows and adding them to list
if (cursor.moveToFirst()) {
if (cursor.getCount()>0 && cursor.moveToFirst()) {
do {
Tab tab = new Tab();
tab.setTab((cursor.getInt(cursor.getColumnIndex(COLUMN_TAB_NO))));
tab.setPath(cursor.getString(cursor.getColumnIndex(COLUMN_PATH)));
tab.setHome(cursor.getString(cursor.getColumnIndex(COLUMN_HOME)));
tab.setTab((cursor.getInt(0)));
tab.setPath(cursor.getString(1));
tab.setHome(cursor.getString(2));
//Adding them to list
tabList.add(tab);
} while (cursor.moveToNext());
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/amaze/filemanager/fragments/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
Expand All @@ -40,6 +42,7 @@
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
Expand Down Expand Up @@ -535,11 +538,9 @@ private void returnIntentResults(File file) {

Intent intent = new Intent();
if (mainActivity.mRingtonePickerIntent) {

Log.d("pickup", "ringtone");
Uri uri = MediaStore.Audio.Media.getContentUriForPath(file.getAbsolutePath());

intent.putExtra(android.media.RingtoneManager.EXTRA_RINGTONE_PICKED_URI, uri);
Uri uri=MediaStore.Audio.Media.getContentUriForPath(file.getAbsolutePath());
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI, uri);
intent.setType("audio/mp3");
getActivity().setResult(getActivity().RESULT_OK, intent);
getActivity().finish();
} else {
Expand Down Expand Up @@ -571,7 +572,6 @@ public void loadCustomList(String path,boolean back){
}


@SuppressWarnings("unchecked")
void initNoFileLayout(){
nofilesview=rootView.findViewById(R.id.nofilelayout);
if(theme1==0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ public void addTab(Tab text,int pos,String path) {
mViewPager.setOffscreenPageLimit(4);
}
public Fragment getTab() {
if(fragments.size()==2)
return fragments.get(mViewPager.getCurrentItem());
else return null;
}
void updateSpinner(){
mainActivity.tabsSpinner.setSelection(mViewPager.getCurrentItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.amaze.filemanager.R;
import com.amaze.filemanager.ui.CircleAnimation;
import com.amaze.filemanager.ui.views.SizeDrawable;
import com.amaze.filemanager.utils.Futils;
import com.amaze.filemanager.utils.HFile;

Expand All @@ -26,50 +29,103 @@ public class GenerateMD5Task extends AsyncTask<String, String, String> {
private String name, parent, size, items, date;
private HFile f;
Context c;
String md5="";
String md5 = "";
TextView textView, textView1;
SizeDrawable sizeDrawable;
GenerateMD5Task g = this;

public GenerateMD5Task(MaterialDialog a, HFile f, String name, String parent,
String size, String items, String date,Context c) {
String size, String items, String date, Context c, TextView textView) {

this.a = a;
this.c = c;
this.f = f;
this.name = name;
this.parent = parent;
this.size = size;
this.items = items;
this.date = date;
this.textView = textView;
}

public GenerateMD5Task(MaterialDialog a, HFile f, String name, String parent,
String size, String items, String date, Context c, TextView textView,
SizeDrawable sizeDrawable, TextView textView1) {
this.a = a;
this.c=c;
this.c = c;
this.f = f;
this.name = name;
this.parent = parent;
this.size = size;
this.items = items;
this.date = date;
this.textView = textView;
this.textView1 = textView1;
this.sizeDrawable = sizeDrawable;
new AsyncTask<Void, Void, long[]>() {
@Override
protected long[] doInBackground(Void... voids) {
Futils futils = new Futils();
long[] longs = futils.getSpaces(g.f.getPath());
return longs;
}

@Override
protected void onPostExecute(long[] longs) {
super.onPostExecute(longs);
Futils futils = new Futils();
if (longs[0] != -1 && longs[0]!=0 && g.textView1 != null) {
float r1 = (longs[0] - longs[1]) * 360 / longs[0];
float r2=(longs[2]) * 360 / longs[0];
g.textView1.setText("Total "+futils.readableFileSize(longs[0]) + "\n" +"Free "+
futils
.readableFileSize
(longs[1]) + "\n" +"Used "+ futils.readableFileSize(longs[0] -
longs[1])+"\n"+"Folder Size "+futils.readableFileSize
(longs[2]));

CircleAnimation animation = new CircleAnimation(g.sizeDrawable, r1,r2);
animation.setDuration(Math.round(r1 * 5));
g.sizeDrawable.startAnimation(animation);
} else {
g.sizeDrawable.setVisibility(View.GONE);
g.textView1.setVisibility(View.GONE);
}

}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

@Override
public void onProgressUpdate(String... ab){
if(a!=null && a.isShowing()){
a.setContent(name + "\n" + parent + "\n" + size + "\n" + items + "\n"
+ date + "\n" + "md5: generating..");
public void onProgressUpdate(String... ab) {
if (a != null && a.isShowing()) {
textView.setText(name + "\n" + parent + "\n" + size +"\n" + date);
}
}

@Override
protected void onPreExecute() {
super.onPreExecute();
a.setContent(name + "\n" + parent + "\n" + size + "\n" + items + "\n"
+ date + "\n" + "md5: generating..");
Log.d("test", "testing onPreExecute");
textView.setText(name + "\n" + parent + "\n" + size + "\n"
+ date);
a.getActionButton(DialogAction.NEGATIVE).setEnabled(false);

}

@Override
protected String doInBackground(String... params) {
String param = params[0];
Futils futils=new Futils();
Futils futils = new Futils();
if (f.isDirectory()) {
size = futils.getString(c, R.string.size) + futils.readableFileSize((f.folderSize()));
items = futils.getString(c, R.string.totalitems) + f.listFiles(false).size();
} else {
items = futils.getString(c, R.string.totalitems) + f.listFiles(false).size();
} else {
items = "";
size =futils. getString(c, R.string.size) + futils.readableFileSize(f.length());
}publishProgress("");
size = futils.getString(c, R.string.size) + futils.readableFileSize(f.length());
}
publishProgress("");
String md5 = "";
try {
if(!f.isDirectory())md5 = getMD5Checksum(param);
if (!f.isDirectory()) md5 = getMD5Checksum(param);
} catch (Exception e) {
e.printStackTrace();
}
Expand All @@ -80,30 +136,30 @@ protected String doInBackground(String... params) {
protected void onPostExecute(String aVoid) {
super.onPostExecute(aVoid);
if (a.isShowing()) {

md5 = aVoid;
if (f.isDirectory())
textView.setText(name + "\n" + parent + "\n" + items + "\n"
+ date );
else
textView.setText(name + "\n" + parent + "\n" + size + "\n"
+ date + "\n" + "md5:" + aVoid);
if (f.isDirectory())
aVoid = " null";
md5=aVoid;
a.setContent(name + "\n" + parent + "\n" + size + "\n" + items + "\n"
+ date + "\n" + "md5:" + aVoid);
if(f.isDirectory())
a.getActionButton(DialogAction.NEGATIVE).setEnabled(false);
else{a.getActionButton(DialogAction.NEGATIVE).setEnabled(true);
else {
a.getActionButton(DialogAction.NEGATIVE).setEnabled(true);
a.getActionButton(DialogAction.NEGATIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
new Futils().copyToClipboard(c,md5);
new Futils().copyToClipboard(c, md5);
Toast.makeText(c, c.getResources().getString(R.string.pathcopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
// a.show();
}
Log.d("test", "testing onPostExecute");
}

// see this How-to for a faster way to convert
Expand All @@ -112,14 +168,14 @@ public static String getMD5Checksum(String filename) throws Exception {
byte[] b = createChecksum(filename);
String result = "";

for (int i=0; i < b.length; i++) {
result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1);
}
return result;
}

public static byte[] createChecksum(String filename) throws Exception {
InputStream fis = new FileInputStream(filename);
InputStream fis = new FileInputStream(filename);

byte[] buffer = new byte[8192];
MessageDigest complete = MessageDigest.getInstance("MD5");
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/com/amaze/filemanager/ui/CircleAnimation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.amaze.filemanager.ui;

import android.view.animation.Animation;
import android.view.animation.Transformation;

import com.amaze.filemanager.ui.views.SizeDrawable;

/**
* Created by Arpit on 30-07-2015.
*/
public class CircleAnimation extends Animation {

private SizeDrawable circle;

private float oldAngle;
private float newAngle;
private float oldAngle1;
private float newAngle1;

public CircleAnimation(SizeDrawable circle, float newAngle,Float secondAngle) {
this.oldAngle = circle.getAngle();
this.newAngle = newAngle;
this.oldAngle1 = circle.getAngle1();
this.newAngle1 = secondAngle;
this.circle = circle;
}

@Override
protected void applyTransformation(float interpolatedTime, Transformation transformation) {
float angle = oldAngle + ((newAngle - oldAngle) * interpolatedTime);
circle.setAngle(angle);
float angle1 = oldAngle1 + ((newAngle1 - oldAngle1) * interpolatedTime);
circle.setAngle1(angle1);
circle.requestLayout();
}
}

0 comments on commit 8d9ebca

Please sign in to comment.