diff --git a/build.gradle b/build.gradle index c53f3525f5..ba28cf3b83 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,6 @@ dependencies { compile 'com.pkmmte.view:circularimageview:1.1' compile fileTree(dir: 'libs', include: '*.jar') compile files('libs/RootTools') - compile files('libs/FloatingActionButton') compile files('nineoldandroids-2.4.0') } diff --git a/libs/FloatingActionButton.jar b/libs/FloatingActionButton.jar deleted file mode 100644 index d0a0fb09e5..0000000000 Binary files a/libs/FloatingActionButton.jar and /dev/null differ diff --git a/res/layout/authors.xml b/res/layout/authors.xml new file mode 100644 index 0000000000..fb7b025e9e --- /dev/null +++ b/res/layout/authors.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + diff --git a/res/layout/copy_dialog.xml b/res/layout/copy_dialog.xml new file mode 100644 index 0000000000..5ab17972a8 --- /dev/null +++ b/res/layout/copy_dialog.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + diff --git a/res/layout/main.xml b/res/layout/main.xml index ca8a20bb4d..2e99e2182e 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -142,19 +142,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> - + diff --git a/res/layout/rowlayout.xml b/res/layout/rowlayout.xml index 5015473305..65e768b436 100644 --- a/res/layout/rowlayout.xml +++ b/res/layout/rowlayout.xml @@ -94,7 +94,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" - android:layout_marginRight="3dip" + android:layout_marginRight="5dip" android:textSize="12sp" android:textColor="?android:attr/textColorTertiary" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 73528dbb8a..fa20700890 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -31,6 +31,7 @@ Settings Select Item Press again to exit + Open Backup Uninstall Play store diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 4069d71f6b..9792bb1fc4 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -100,6 +100,9 @@ + diff --git a/src/com/amaze/filemanager/activities/MainActivity.java b/src/com/amaze/filemanager/activities/MainActivity.java index fb1d8d6553..478c5ad61a 100644 --- a/src/com/amaze/filemanager/activities/MainActivity.java +++ b/src/com/amaze/filemanager/activities/MainActivity.java @@ -38,10 +38,12 @@ import android.support.v4.widget.DrawerLayout; import android.text.TextUtils; import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; +import android.widget.CheckBox; import android.widget.FrameLayout; import android.widget.HorizontalScrollView; import android.widget.ImageButton; @@ -63,13 +65,13 @@ import com.amaze.filemanager.fragments.Main; import com.amaze.filemanager.fragments.ProcessViewer; import com.amaze.filemanager.services.CopyService; +import com.amaze.filemanager.services.asynctasks.MoveFiles; import com.amaze.filemanager.utils.Futils; import com.amaze.filemanager.utils.IconUtils; import com.amaze.filemanager.utils.Shortcuts; import com.readystatesoftware.systembartint.SystemBarTintManager; import java.io.File; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -143,7 +145,7 @@ public void onClick(View view) { new CheckForFiles(ma, path, false).execute(arrayList); } else if (MOVE_PATH != null) { arrayList = MOVE_PATH; - new CheckForFiles(ma, path, false).execute(arrayList); + new CheckForFiles(ma, path, true).execute(arrayList); } COPY_PATH = null; MOVE_PATH = null; @@ -653,97 +655,120 @@ public void onProgressUpdate(String... message) { @Override // Actual download method, run in the task thread protected ArrayList doInBackground(ArrayList... params) { + ab = params[0]; - if (!move) { - long totalBytes = 0; - for (int i = 0; i < params[0].size(); i++) { + long totalBytes = 0; - File f1 = new File(params[0].get(i)); - if (f1.isDirectory()) { - totalBytes = totalBytes + new Futils().folderSize(f1, false); - } else { - totalBytes = totalBytes + f1.length(); - } + for (int i = 0; i < params[0].size(); i++) { + + File f1 = new File(params[0].get(i)); + + if (f1.isDirectory()) { + + totalBytes = totalBytes + new Futils().folderSize(f1, false); + } else { + + totalBytes = totalBytes + f1.length(); } - if (new File(ma.current).getUsableSpace() > totalBytes) { + } - File f = new File(path); - for (File k : f.listFiles()) { - for (String j : ab) { - if (k.getName().equals(new File(j).getName())) { - a.add(j);} - } - } - } else publishProgress("Insufficient space"); - } else { + if (new File(path).getUsableSpace() > totalBytes) { - long totalBytes = 0; - for (int i = 0; i < MOVE_PATH.size(); i++) { + File f = new File(path); - File f1 = new File(MOVE_PATH.get(i)); - if (f1.isDirectory()) { - totalBytes = totalBytes + new Futils().folderSize(f1, false); - } else { - totalBytes = totalBytes + f1.length(); + for (File k : f.listFiles()) { + + for (String j : ab) { + + if (k.getName().equals(new File(j).getName())) { + + a.add(j);} } } - if (new File(path).getUsableSpace() > totalBytes) { - File f = new File(path); - for (File k : f.listFiles()) { - for (String j : params[0]) { - if (k.getName().equals(new File(j).getName())) { - a.add(j); - } else { - b.add(j); - } - } - } - } else publishProgress("Insufficient space"); + } else publishProgress("Insufficient space"); - } return a; } public void showDialog() { - if (counter == a.size() || a.size()==0) { + if (ab != null && ab.size()!=0) { - Intent intent = new Intent(con, CopyService.class); - intent.putExtra("FILE_PATHS", ab); - intent.putExtra("COPY_DIRECTORY", ma.current); - startService(intent); + + if(!move){ + + Intent intent = new Intent(con, CopyService.class); + intent.putExtra("FILE_PATHS", ab); + intent.putExtra("COPY_DIRECTORY", path); + startService(intent); + } else{ + + new MoveFiles(utils.toFileArray(ab), ma).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, path); + } } else { + Toast.makeText(MainActivity.this, "No file was overwritten", Toast.LENGTH_SHORT).show(); } } else { AlertDialog.Builder x = new AlertDialog.Builder(MainActivity.this); - x.setMessage("File with same name already exists " + new File(a.get(counter)).getName()); + LayoutInflater layoutInflater = (LayoutInflater) MainActivity.this.getSystemService(LAYOUT_INFLATER_SERVICE); + View view = layoutInflater.inflate(R.layout.copy_dialog, null); + x.setView(view); + + // textView + TextView textView = (TextView) view.findViewById(R.id.textView); + textView.setText("File with same name already exists " + new File(a.get(counter)).getName()); + // checkBox + final CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkBox); + + x.setTitle("Paste"); x.setPositiveButton("Skip", new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialogInterface, int i) { if (counter < a.size()) { - ab.remove(a.get(counter)); - counter++; + + if (!checkBox.isChecked()) { + + ab.remove(a.get(counter)); + counter++; + + } else { + for (int j = counter; j strings) { super.onPostExecute(strings); - if (!move) { - - showDialog(); - - } else { - // yet to be implemented - } + showDialog(); } } } diff --git a/src/com/amaze/filemanager/adapters/AppsAdapter.java b/src/com/amaze/filemanager/adapters/AppsAdapter.java index 99008d06ab..f5f807926a 100644 --- a/src/com/amaze/filemanager/adapters/AppsAdapter.java +++ b/src/com/amaze/filemanager/adapters/AppsAdapter.java @@ -20,11 +20,14 @@ package com.amaze.filemanager.adapters; import android.app.Activity; +import android.app.AlertDialog; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; -import android.graphics.Bitmap; +import android.content.pm.ApplicationInfo; import android.graphics.Color; -import android.graphics.drawable.BitmapDrawable; +import android.net.Uri; +import android.os.Environment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -36,6 +39,8 @@ import com.amaze.filemanager.R; import com.amaze.filemanager.fragments.AppsList; +import com.amaze.filemanager.services.CopyService; +import com.amaze.filemanager.utils.Futils; import com.amaze.filemanager.utils.Layoutelements; import java.io.File; @@ -48,13 +53,15 @@ public class AppsAdapter extends ArrayAdapter { List items; public HashMap myChecked = new HashMap(); AppsList app; + ArrayList c = new ArrayList(); public AppsAdapter(Context context, int resourceId, - List items, AppsList app) { + List items, AppsList app, ArrayList c) { super(context, resourceId, items); this.context = context; this.items = items; this.app = app; + this.c = c; for (int i = 0; i < items.size(); i++) { myChecked.put(i, false); } @@ -110,7 +117,7 @@ private class ViewHolder { } - public View getView(int position, View convertView, ViewGroup parent) { + public View getView(final int position, View convertView, ViewGroup parent) { final Layoutelements rowItem = getItem(position); @@ -146,11 +153,60 @@ public void onClick(View p1) { toggleChecked(p); app.mActionMode.invalidate(); } else { - Intent i = app.getActivity().getPackageManager().getLaunchIntentForPackage(app.c.get(p).packageName); - if (i != null) - app.startActivity(i); - else - Toast.makeText(app.getActivity(), "Not Allowed", Toast.LENGTH_LONG).show(); + + AlertDialog.Builder d = new AlertDialog.Builder(context); + final Futils utils = new Futils(); + final AppsList appsList = new AppsList(); + ArrayAdapter adapter1 = new ArrayAdapter( + context, android.R.layout.select_dialog_item); + adapter1.add(utils.getString(context, R.string.open)); + adapter1.add(utils.getString(context, R.string.backup)); + adapter1.add(utils.getString(context, R.string.uninstall)); + adapter1.add(utils.getString(context, R.string.properties)); + adapter1.add(utils.getString(context, R.string.play)); + d.setAdapter(adapter1, new DialogInterface.OnClickListener() { + + public void onClick(DialogInterface p1, int p2) { + switch (p2) { + case 0: + Intent i = app.getActivity().getPackageManager().getLaunchIntentForPackage(app.c.get(p).packageName); + if (i != null) + app.startActivity(i); + else + Toast.makeText(app.getActivity(), "Not Allowed", Toast.LENGTH_LONG).show(); + break; + + case 1: + Toast.makeText(context, utils.getString(context, R.string.copyingapk) + Environment.getExternalStorageDirectory().getPath() + "/app_backup", Toast.LENGTH_LONG).show(); + ApplicationInfo info = c.get(p); + File f = new File(info.publicSourceDir); + ArrayList a = new ArrayList(); + a.add(info.publicSourceDir); + File dst = new File(Environment.getExternalStorageDirectory().getPath() + "/app_backup"); + if(!dst.exists() || !dst.isDirectory())dst.mkdirs(); + Intent intent = new Intent(context, CopyService.class); + intent.putExtra("FILE_PATHS", a); + intent.putExtra("COPY_DIRECTORY", dst.getPath()); + context.startService(intent); + break; + case 2: + unin(c.get(p).packageName); + break; + case 3: + context.startActivity(new Intent( + android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, + Uri.parse("package:" + c.get(p).packageName))); + break; + case 4: + Intent intent1 = new Intent(Intent.ACTION_VIEW); + intent1.setData(Uri.parse("market://details?id=" + c.get(p).packageName)); + context.startActivity(intent1); + break; + } + // TODO: Implement this method + } + }); + d.show(); } // TODO: Implement this method } @@ -180,4 +236,17 @@ public boolean onLongClick(View p1) { } return view; } + + public void unin(String pkg) { + + try { + Intent intent = new Intent(Intent.ACTION_DELETE); + intent.setData(Uri.parse("package:" + pkg)); + context.startActivity(intent); + } catch (Exception e) { + Toast.makeText(context, "" + e, Toast.LENGTH_SHORT).show(); + e.printStackTrace(); + } + + } } diff --git a/src/com/amaze/filemanager/adapters/TabSpinnerAdapter.java b/src/com/amaze/filemanager/adapters/TabSpinnerAdapter.java index d715d01221..d0913c4237 100644 --- a/src/com/amaze/filemanager/adapters/TabSpinnerAdapter.java +++ b/src/com/amaze/filemanager/adapters/TabSpinnerAdapter.java @@ -53,6 +53,7 @@ public class TabSpinnerAdapter extends ArrayAdapter { Context context; android.support.v4.app.FragmentManager fragmentTransaction; Spinner spinner; + Main ma; public TabSpinnerAdapter(Context context, int resource, ArrayList items, android.support.v4.app.FragmentManager fragmentTransaction, Spinner spin) { super(context, resource, items); @@ -80,6 +81,7 @@ public View getDropDownView(final int position, View convertView, ViewGroup pare LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.spinner_dropdown_layout, parent, false); + ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame)); final TextView textView = (TextView) row.findViewById(R.id.spinnerText); final SharedPreferences sharedPreferences1 = PreferenceManager.getDefaultSharedPreferences(context); String skin = sharedPreferences1.getString("skin_color", "#673ab7"); @@ -180,7 +182,8 @@ public void onClick(View view) { } else if (position == spinner_current) { if (tabHandler.getTabsCount() == 1) { - Toast.makeText(getContext(), "exits the app", Toast.LENGTH_SHORT).show(); + // Toast.makeText(getContext(), "exits the app", Toast.LENGTH_SHORT).show(); + ma.home(); } else if (tabHandler.getTabsCount()-1 > position) { items.remove(position); @@ -196,7 +199,6 @@ public void onClick(View view) { } tabHandler.deleteTab(tabHandler.getTabsCount()-1); Tab tab1 = tabHandler.findTab(spinner_current); - Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame)); ma.loadlist(new File(tab1.getPath()),false); } else if (tabHandler.getTabsCount()-1 == position) { diff --git a/src/com/amaze/filemanager/fragments/AppsList.java b/src/com/amaze/filemanager/fragments/AppsList.java index 5a81d6f8a1..16550ed585 100644 --- a/src/com/amaze/filemanager/fragments/AppsList.java +++ b/src/com/amaze/filemanager/fragments/AppsList.java @@ -25,21 +25,15 @@ import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; import android.support.v4.app.ListFragment; -import android.support.v4.util.LruCache; import android.view.ActionMode; import android.view.View; import android.widget.ArrayAdapter; -import android.widget.ImageView; import android.widget.ListView; import android.widget.Toast; @@ -52,8 +46,6 @@ import com.amaze.filemanager.utils.Layoutelements; import java.io.File; -import java.lang.ref.WeakReference; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -82,7 +74,7 @@ public void onActivityCreated(Bundle savedInstanceState) { getActivity().findViewById(R.id.bookadd).setVisibility(View.GONE); getActivity().findViewById(R.id.action_overflow).setVisibility(View.GONE); getActivity().findViewById(R.id.search).setVisibility(View.GONE); - getActivity().findViewById(R.id.paste).setVisibility(View.GONE); + getActivity().findViewById(R.id.paste).setVisibility(View.INVISIBLE); final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); getActivity().findViewById(R.id.buttonbarframe).setVisibility(View.GONE); vl=getListView(); @@ -101,7 +93,7 @@ public void onActivityCreated(Bundle savedInstanceState) { else{ c=savedInstanceState.getParcelableArrayList("c"); a=savedInstanceState.getParcelableArrayList("list"); - adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, a, app); + adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, a, app, c); setListAdapter(adapter); vl.setSelectionFromTop(savedInstanceState.getInt("index"), savedInstanceState.getInt("top")); @@ -112,6 +104,7 @@ public void onLongItemClick(final int position) { AlertDialog.Builder d = new AlertDialog.Builder(getActivity()); ArrayAdapter adapter1 = new ArrayAdapter( getActivity(), android.R.layout.select_dialog_item); + adapter1.add(utils.getString(getActivity(), R.string.open)); adapter1.add(utils.getString(getActivity(), R.string.backup)); adapter1.add(utils.getString(getActivity(), R.string.uninstall)); adapter1.add(utils.getString(getActivity(), R.string.properties)); @@ -121,6 +114,14 @@ public void onLongItemClick(final int position) { public void onClick(DialogInterface p1, int p2) { switch (p2) { case 0: + Intent i = app.getActivity().getPackageManager().getLaunchIntentForPackage(c.get(position).packageName); + if (i != null) + app.startActivity(i); + else + Toast.makeText(app.getActivity(), "Not Allowed", Toast.LENGTH_LONG).show(); + break; + + case 1: Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.copyingapk) + Environment.getExternalStorageDirectory().getPath() + "/app_backup", Toast.LENGTH_LONG).show(); ApplicationInfo info = c.get(position); File f = new File(info.publicSourceDir); @@ -133,15 +134,15 @@ public void onClick(DialogInterface p1, int p2) { intent.putExtra("COPY_DIRECTORY", dst.getPath()); getActivity().startService(intent); break; - case 1: + case 2: unin(c.get(position).packageName); break; - case 2: + case 3: startActivity(new Intent( android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + c.get(position).packageName))); break; - case 3: + case 4: Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=" + c.get(position).packageName)); startActivity(intent1); @@ -214,7 +215,7 @@ protected void onPostExecute(ArrayList bitmap) { if (bitmap != null) { - adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, bitmap, app); + adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, bitmap, app, c); setListAdapter(adapter); } diff --git a/src/com/amaze/filemanager/fragments/Main.java b/src/com/amaze/filemanager/fragments/Main.java index 10a949e6b0..5dcb1fb88c 100644 --- a/src/com/amaze/filemanager/fragments/Main.java +++ b/src/com/amaze/filemanager/fragments/Main.java @@ -54,7 +54,6 @@ import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.AdapterView; -import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.GridView; @@ -84,10 +83,7 @@ import com.amaze.filemanager.utils.Icons; import com.amaze.filemanager.utils.Layoutelements; import com.amaze.filemanager.utils.Shortcuts; -import com.faizmalkani.floatingactionbutton.FloatingActionButton; -import com.fourmob.poppyview.PoppyViewHelper; -import com.nineoldandroids.animation.AnimatorSet; -import com.nineoldandroids.animation.ObjectAnimator; +import com.getbase.floatingactionbutton.FloatingActionsMenu; import java.io.File; import java.io.IOException; @@ -197,6 +193,7 @@ public void onActivityCreated(Bundle savedInstanceState) { content = tabHandler.getAllTabs(); list1 = new ArrayList(); + FloatingActionsMenu floatingActionsMenu = (FloatingActionsMenu) getActivity().findViewById(R.id.pink_icon); ImageButton imageView = ((ImageButton)getActivity().findViewById(R.id.action_overflow)); showPopup(imageView); (getActivity().findViewById(R.id.search)).setOnClickListener(new View.OnClickListener() { @@ -215,13 +212,13 @@ public void onClick(View view) { getActivity().findViewById(R.id.fab1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - add(0); + add(1); } }); getActivity().findViewById(R.id.fab2).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - add(1); + add(0); } }); getActivity().findViewById(R.id.fab3).setOnClickListener(new View.OnClickListener() { @@ -435,6 +432,9 @@ public void onClick(DialogInterface p1, int p2) { listView.setAnimation(animation); gridView.setAnimation(animation); + FloatingActionsMenu floatingActionMenu = (FloatingActionsMenu) getActivity().findViewById(R.id.pink_icon); + floatingActionMenu.collapse(); + floatingActionMenu.setAnimation(animation1); } } @@ -448,7 +448,7 @@ public void home() { public void search() { final String fpath = ma.current; - Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.searchpath) + fpath, Toast.LENGTH_LONG).show(); + //Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.searchpath) + fpath, Toast.LENGTH_LONG).show(); AlertDialog.Builder a = new AlertDialog.Builder(getActivity()); a.setTitle(utils.getString(getActivity(), R.string.search)); View v = getActivity().getLayoutInflater().inflate(R.layout.dialog, null); @@ -980,7 +980,12 @@ public void onClick(View p1) { } } File f=new File(text); - ((TextView)pathbar.findViewById(R.id.pathname)).setText(f.getName()); + + TextView textView = (TextView)pathbar.findViewById(R.id.pathname); + String used = utils.readableFileSize(f.getTotalSpace()-f.getFreeSpace()); + String free = utils.readableFileSize(f.getFreeSpace()); + textView.setText("Used : " + used + ", Free : " + free); + TextView bapath=(TextView)pathbar.findViewById(R.id.fullpath); bapath.setAllCaps(true); bapath.setText(f.getPath()); diff --git a/src/com/amaze/filemanager/fragments/Preffrag.java b/src/com/amaze/filemanager/fragments/Preffrag.java index 6f85410708..96d47221f4 100644 --- a/src/com/amaze/filemanager/fragments/Preffrag.java +++ b/src/com/amaze/filemanager/fragments/Preffrag.java @@ -22,6 +22,7 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; @@ -179,6 +180,27 @@ public boolean onPreferenceClick(Preference preference) { } }); + // Authors + Preference preference4 = (Preference) findPreference("authors"); + preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); + LayoutInflater layoutInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view = layoutInflater.inflate(R.layout.authors, null); + alertDialog.setView(view); + alertDialog.setTitle("Authors"); + alertDialog.setNegativeButton("Close", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.cancel(); + } + }); + alertDialog.show(); + return false; + } + }); + // Changelog Preference preference1 = (Preference) findPreference("changelog"); preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @@ -222,32 +244,6 @@ public void onClick(DialogInterface dialogInterface, int i) { @Override public boolean onPreferenceClick(Preference arg0) { String oss_dialog = "" + - "

Notices for files:

" + - "
  • CircularImageView
" + //CircularImageView - "

" + - "
/*
" + - " * The MIT License (MIT)
" + - " *
" + - " * Copyright (c) 2014 Pkmmte Xeleon
" + - " *
" + - " * Permission is hereby granted, free of charge, to any person obtaining a copy
" + - " * of this software and associated documentation files (the \"Software\"), to deal
" + - " * in the Software without restriction, including without limitation the rights
" + - " * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
" + - " * copies of the Software, and to permit persons to whom the Software is
" + - " * furnished to do so, subject to the following conditions:" + - " *
" + - " * The above copyright notice and this permission notice shall be included in
" + - " * all copies or substantial portions of the Software.
" + - " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" + - " * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" + - " * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" + - " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" + - " * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
" + - " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" + - " * THE SOFTWARE.
" + - " */ " + - "

" + "

Notices for files:

" + "
  • nineoldandroids-2.4.0.jar
" + //nineoldandroids "

" + @@ -268,12 +264,37 @@ public boolean onPreferenceClick(Preference arg0) { " */ " + "

" + "

Notices for files:

" + - "
  • FloatingActionButton
" + //Floating Action Button + "
  • RootTools.jar
" + //RootTools + "

" + + "
/*
" + + " * This file is part of the RootTools Project: http://code.google.com/p/roottools/
" + + " *
" + + " * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
" + + " *
" + + " * This code is dual-licensed under the terms of the Apache License Version 2.0 and
" + + " * the terms of the General Public License (GPL) Version 2.
" + + " * You may use this code according to either of these licenses as is most appropriate
" + + " * for your project on a case-by-case basis.
" + + " *
" + + " * The terms of each license can be found in the root directory of this project's repository as well as at:
" + + " *
" + + " *    http://www.apache.org/licenses/LICENSE-2.0
" + + " *    http://www.gnu.org/licenses/gpl-2.0.txt
" + + " *
" + + " * Unless required by applicable law or agreed to in writing, software
" + + " * distributed under these Licenses is distributed on an \"AS IS\" BASIS,
" + + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" + + " * See each License for the specific language governing permissions and
" + + " * limitations under that License.
" + + " */ " + + "

" + + "

Notices for libraries:

" + + "
  • CircularImageView
" + //CircularImageView "

" + "
/*
" + " * The MIT License (MIT)
" + " *
" + - " * Copyright (c) 2014 Faiz Malkani
" + + " * Copyright (c) 2014 Pkmmte Xeleon
" + " *
" + " * Permission is hereby granted, free of charge, to any person obtaining a copy
" + " * of this software and associated documentation files (the \"Software\"), to deal
" + @@ -293,11 +314,11 @@ public boolean onPreferenceClick(Preference arg0) { " * THE SOFTWARE.
" + " */ " + "

" + - "

Notices for libraries:

" + - "
  • PoppyView
" + //PoppyView + "

Notices for libraries:

" + + "
  • FloatingActionButton
" + //FloatingActionBar "

" + "
/*
" + - " * Copyright 2013 Flavien Laurent
" + + " * Copyright 2014 Jerzy Chalupski
" + " *
" + " * Licensed under the Apache License, Version 2.0 (the \"License\");
" + " * you may not use this file except in compliance with the License.
" + diff --git a/src/com/fourmob/poppyview/NotifyingScrollView.java b/src/com/fourmob/poppyview/NotifyingScrollView.java deleted file mode 100644 index 46bbd8bec8..0000000000 --- a/src/com/fourmob/poppyview/NotifyingScrollView.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fourmob.poppyview; - -import android.content.Context; -import android.util.AttributeSet; -import android.widget.ScrollView; - -/** - * @author Cyril Mottier - */ -public class NotifyingScrollView extends ScrollView { - - /** - * @author Cyril Mottier - */ - public interface OnScrollChangedListener { - void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt); - } - - private OnScrollChangedListener mOnScrollChangedListener; - - public NotifyingScrollView(Context context) { - super(context); - } - - public NotifyingScrollView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void onScrollChanged(int l, int t, int oldl, int oldt) { - super.onScrollChanged(l, t, oldl, oldt); - if (mOnScrollChangedListener != null) { - mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt); - } - } - - public void setOnScrollChangedListener(OnScrollChangedListener listener) { - mOnScrollChangedListener = listener; - } - -} \ No newline at end of file diff --git a/src/com/fourmob/poppyview/PoppyViewHelper.java b/src/com/fourmob/poppyview/PoppyViewHelper.java deleted file mode 100644 index 783449d4fe..0000000000 --- a/src/com/fourmob/poppyview/PoppyViewHelper.java +++ /dev/null @@ -1,237 +0,0 @@ -package com.fourmob.poppyview; - -import android.app.Activity; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; -import android.view.ViewParent; -import android.widget.AbsListView; -import android.widget.AbsListView.OnScrollListener; -import android.widget.FrameLayout; -import android.widget.GridView; -import android.widget.ListView; -import android.widget.ScrollView; - -import com.nineoldandroids.view.ViewPropertyAnimator; - - -public class PoppyViewHelper { - - public enum PoppyViewPosition { - TOP, BOTTOM - }; - - private static final int SCROLL_TO_TOP = - 1; - - private static final int SCROLL_TO_BOTTOM = 1; - - private static final int SCROLL_DIRECTION_CHANGE_THRESHOLD = 5; - - private Activity mActivity; - - private LayoutInflater mLayoutInflater; - - private View mPoppyView; - - private int mScrollDirection = 0; - - private int mPoppyViewHeight = - 1; - - private PoppyViewPosition mPoppyViewPosition; - - public PoppyViewHelper(Activity activity, PoppyViewPosition position) { - mActivity = activity; - mLayoutInflater = LayoutInflater.from(activity); - mPoppyViewPosition = position; - } - - public PoppyViewHelper(Activity activity) { - this(activity, PoppyViewPosition.BOTTOM); - } - - // for scrollview - - public View createPoppyViewOnScrollView(int scrollViewId, int poppyViewResId) { - mPoppyView = mLayoutInflater.inflate(poppyViewResId, null); - final NotifyingScrollView scrollView = (NotifyingScrollView)mActivity.findViewById(scrollViewId); - initPoppyViewOnScrollView(scrollView); - return mPoppyView; - } - - - // for ListView - - public View createPoppyViewOnGridView(int listViewId, int poppyViewResId, OnScrollListener onScrollListener) { - final GridView listView = (GridView)mActivity.findViewById(listViewId); - - mPoppyView = mLayoutInflater.inflate(poppyViewResId, null); - initPoppyViewOnGridView(listView, onScrollListener); - return mPoppyView; - } - public View createPoppyViewOnListView(int listViewId, int poppyViewResId, OnScrollListener onScrollListener) { - final ListView listView = (ListView)mActivity.findViewById(listViewId); - if(listView.getHeaderViewsCount() != 0) { - throw new IllegalArgumentException("use createPoppyViewOnListView with headerResId parameter"); - } - if(listView.getFooterViewsCount() != 0) { - throw new IllegalArgumentException("poppyview library doesn't support listview with footer"); - } - mPoppyView = mLayoutInflater.inflate(poppyViewResId, null); - initPoppyViewOnListView(listView, onScrollListener); - return mPoppyView; - } - - public View createPoppyViewOnListView(int listViewId, int poppyViewResId) { - return createPoppyViewOnListView(listViewId, poppyViewResId, null); - } - - - // common - - private void setPoppyViewOnView(View view) { - LayoutParams lp = view.getLayoutParams(); - ViewParent parent = view.getParent(); - ViewGroup group = (ViewGroup)parent; - int index = group.indexOfChild(view); - final FrameLayout newContainer = new FrameLayout(mActivity); - group.removeView(view); - group.addView(newContainer, index, lp); - newContainer.addView(view); - final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - layoutParams.gravity = mPoppyViewPosition == PoppyViewPosition.BOTTOM ? Gravity.BOTTOM : Gravity.TOP; - newContainer.addView(mPoppyView, layoutParams); - group.invalidate(); - } - - private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) { - int newScrollDirection; - - // System.out.println(oldScrollPosition + " ->" + newScrollPosition); - - if(newScrollPosition < oldScrollPosition) { - newScrollDirection = SCROLL_TO_TOP; - } else { - newScrollDirection = SCROLL_TO_BOTTOM; - } - - if(newScrollDirection != mScrollDirection) { - mScrollDirection = newScrollDirection; - translateYPoppyView(); - } - } - - private void translateYPoppyView() { - mPoppyView.post(new Runnable() { - - @Override - public void run() { - if(mPoppyViewHeight <= 0) { - mPoppyViewHeight = mPoppyView.getHeight(); - } - - int translationY = 0; - switch (mPoppyViewPosition) { - case BOTTOM: - translationY = mScrollDirection == SCROLL_TO_TOP ? 0 : mPoppyViewHeight; - break; - case TOP: - translationY = mScrollDirection == SCROLL_TO_BOTTOM ? -mPoppyViewHeight : 0; - break; - } - - ViewPropertyAnimator.animate(mPoppyView).setDuration(300).translationY(translationY); - } - }); - } - - // for ScrollView - - private void initPoppyViewOnScrollView(NotifyingScrollView scrollView) { - setPoppyViewOnView(scrollView); - scrollView.setOnScrollChangedListener(new NotifyingScrollView.OnScrollChangedListener() { - - int mScrollPosition; - - public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) { - if(Math.abs(t - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) { - onScrollPositionChanged(mScrollPosition, t); - } - - mScrollPosition = t; - } - }); - } - - // for ListView - private void initPoppyViewOnGridView(GridView listView, final OnScrollListener onScrollListener) { - setPoppyViewOnView(listView); - listView.setOnScrollListener(new OnScrollListener() { - - int mScrollPosition; - - @Override - public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - if(onScrollListener != null) { - onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); - } - View topChild = view.getChildAt(0); - - int newScrollPosition = 0; - if(topChild == null) { - newScrollPosition = 0; - } else { - newScrollPosition = - topChild.getTop() + view.getFirstVisiblePosition() * topChild.getHeight(); - } - - if(Math.abs(newScrollPosition - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) { - onScrollPositionChanged(mScrollPosition, newScrollPosition); - } - - mScrollPosition = newScrollPosition; - } - @Override - public void onScrollStateChanged(AbsListView view, int scrollState) { - if(onScrollListener != null) { - onScrollListener.onScrollStateChanged(view, scrollState); - } - } - }); - } - private void initPoppyViewOnListView(ListView listView, final OnScrollListener onScrollListener) { - setPoppyViewOnView(listView); - listView.setOnScrollListener(new OnScrollListener() { - - int mScrollPosition; - - @Override - public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { - if(onScrollListener != null) { - onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); - } - View topChild = view.getChildAt(0); - - int newScrollPosition = 0; - if(topChild == null) { - newScrollPosition = 0; - } else { - newScrollPosition = - topChild.getTop() + view.getFirstVisiblePosition() * topChild.getHeight(); - } - - if(Math.abs(newScrollPosition - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) { - onScrollPositionChanged(mScrollPosition, newScrollPosition); - } - - mScrollPosition = newScrollPosition; - } - - @Override - public void onScrollStateChanged(AbsListView view, int scrollState) { - if(onScrollListener != null) { - onScrollListener.onScrollStateChanged(view, scrollState); - } - } - }); - } -}