-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c1ea4e
commit aff107c
Showing
13 changed files
with
317 additions
and
25 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/mauriciotogneri/fileexplorer/adapters/StorageAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.mauriciotogneri.fileexplorer.adapters; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
|
||
import com.mauriciotogneri.fileexplorer.R; | ||
import com.mauriciotogneri.fileexplorer.adapters.StorageAdapter.ViewHolder; | ||
import com.mauriciotogneri.fileexplorer.base.BaseListAdapter; | ||
|
||
public class StorageAdapter extends BaseListAdapter<String, ViewHolder> | ||
{ | ||
public StorageAdapter(Context context) | ||
{ | ||
super(context, R.layout.row_storage); | ||
} | ||
|
||
@Override | ||
protected ViewHolder getViewHolder(View view) | ||
{ | ||
return new ViewHolder(view); | ||
} | ||
|
||
@Override | ||
protected void fillView(View rowView, ViewHolder viewHolder, String item) | ||
{ | ||
viewHolder.name.setText(item); | ||
} | ||
|
||
protected static class ViewHolder | ||
{ | ||
public final TextView name; | ||
|
||
public ViewHolder(View view) | ||
{ | ||
this.name = (TextView) view.findViewById(R.id.name); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
app/src/main/java/com/mauriciotogneri/fileexplorer/fragments/StorageFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.mauriciotogneri.fileexplorer.fragments; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.AdapterView; | ||
import android.widget.AdapterView.OnItemClickListener; | ||
import android.widget.ListView; | ||
|
||
import com.mauriciotogneri.fileexplorer.R; | ||
import com.mauriciotogneri.fileexplorer.adapters.StorageAdapter; | ||
import com.mauriciotogneri.fileexplorer.app.MainActivity; | ||
|
||
import java.util.Arrays; | ||
|
||
public class StorageFragment extends Fragment | ||
{ | ||
private static final String PARAMETER_STORAGES_PATH = "storages.path"; | ||
|
||
private MainActivity mainActivity; | ||
private ListView listView; | ||
|
||
public static StorageFragment newInstance(String[] storagesPath) | ||
{ | ||
StorageFragment fragment = new StorageFragment(); | ||
Bundle parameters = new Bundle(); | ||
parameters.putStringArray(PARAMETER_STORAGES_PATH, storagesPath); | ||
fragment.setArguments(parameters); | ||
|
||
return fragment; | ||
} | ||
|
||
@Override | ||
public void onAttach(Context context) | ||
{ | ||
super.onAttach(context); | ||
|
||
mainActivity = (MainActivity) context; | ||
} | ||
|
||
@Override | ||
public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | ||
{ | ||
View view = inflater.inflate(R.layout.screen_storage, container, false); | ||
|
||
listView = (ListView) view.findViewById(R.id.list); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public final void onActivityCreated(Bundle savedInstanceState) | ||
{ | ||
super.onActivityCreated(savedInstanceState); | ||
|
||
StorageAdapter adapter = new StorageAdapter(mainActivity); | ||
adapter.update(Arrays.asList(storages())); | ||
|
||
listView.setAdapter(adapter); | ||
listView.setOnItemClickListener(new OnItemClickListener() | ||
{ | ||
@Override | ||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) | ||
{ | ||
String storagePath = (String) parent.getItemAtPosition(position); | ||
openStorage(storagePath); | ||
} | ||
}); | ||
} | ||
|
||
private String[] storages() | ||
{ | ||
Bundle extras = getArguments(); | ||
|
||
return extras.getStringArray(PARAMETER_STORAGES_PATH); | ||
} | ||
|
||
private void openStorage(String storagePath) | ||
{ | ||
FolderFragment folderFragment = FolderFragment.newInstance(storagePath); | ||
|
||
mainActivity.addFragment(folderFragment, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
<vector android:height="24dp" android:viewportHeight="512.0" | ||
android:viewportWidth="512.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillAlpha="1" android:fillColor="#ffffff" | ||
<vector android:height="24dp" | ||
android:viewportHeight="512.0" | ||
android:viewportWidth="512.0" | ||
android:width="24dp" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#ffffff" | ||
android:pathData="M236.5,121.8A15.3,15.3 0,0 0,234.4 122L98.8,122A15.3,15.3 0,0 0,83.4 137.3L83.4,451.6A15.3,15.3 86.1,0 0,98.8 466.9L336.4,466.9A15.3,15.3 0,0 0,351.7 451.6L351.7,239.4A15.3,15.3 0,0 0,345.9 224.8L248.8,127.7A15.3,15.3 94.1,0 0,236.5 121.8ZM114.1,152.6 L221.4,152.6 221.4,234.5A15.3,15.3 94.1,0 0,225.8 247.9,15.3 15.3,0 0,0 225.9,248 15.3,15.3 94.1,0 0,226.2 248.2,15.3 15.3,0 0,0 239.3,252.3L321.1,252.3 321.1,436.2 114.1,436.2 114.1,152.6ZM252.1,174.3 L299.4,221.6 252.1,221.6 252.1,174.3Z" | ||
android:strokeColor="#00000000" android:strokeWidth="40"/> | ||
<path android:fillAlpha="1" android:fillColor="#ffffff" | ||
android:strokeColor="#00000000" | ||
android:strokeWidth="40"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#ffffff" | ||
android:pathData="M313.2,45.1C312.4,45.1 311.7,45.2 311,45.3L175.4,45.3C171.4,45.3 167.4,47 164.6,49.8 161.7,52.7 160.1,56.7 160.1,60.7L160.1,102.8 190.8,102.8 190.8,76 298.1,76 298.1,138.6 335.1,175.6 397.7,175.6 397.7,359.6 370.9,359.6 370.9,390.3 413,390.3C417,390.3 421,388.6 423.9,385.8 426.7,382.9 428.4,378.9 428.4,374.9L428.4,162.8C429.3,157.4 427,151.5 422.6,148.2L325.5,51C322.6,47.3 317.9,45 313.2,45.1ZM328.7,97.7 L376,145 328.7,145Z" | ||
android:strokeColor="#00000000" android:strokeWidth="40"/> | ||
android:strokeColor="#00000000" | ||
android:strokeWidth="40"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
<vector android:height="24dp" android:viewportHeight="23.0" | ||
android:viewportWidth="23.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillAlpha="1" android:fillColor="#ffffff" | ||
<vector android:height="24dp" | ||
android:viewportHeight="23.0" | ||
android:viewportWidth="23.0" | ||
android:width="24dp" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#ffffff" | ||
android:pathData="M9.258,6.12C9.258,4.147 7.644,2.533 5.672,2.533 3.699,2.533 2.085,4.147 2.085,6.12 2.085,8.093 3.699,9.707 5.672,9.707 6.21,9.707 6.658,9.617 7.106,9.348L9.258,11.5 7.106,13.652C6.658,13.383 6.21,13.293 5.672,13.293 3.699,13.293 2.085,14.907 2.085,16.88 2.085,18.853 3.699,20.467 5.672,20.467 7.644,20.467 9.258,18.853 9.258,16.88 9.258,16.342 9.169,15.894 8.9,15.445L11.052,13.293 17.328,19.57 20.915,19.57 8.9,7.555C9.169,7.106 9.258,6.658 9.258,6.12L9.258,6.12ZM5.672,7.913C4.685,7.913 3.878,7.106 3.878,6.12 3.878,5.133 4.685,4.326 5.672,4.326 6.658,4.326 7.465,5.133 7.465,6.12 7.465,7.106 6.658,7.913 5.672,7.913L5.672,7.913ZM5.672,18.674C4.685,18.674 3.878,17.867 3.878,16.88 3.878,15.894 4.685,15.087 5.672,15.087 6.658,15.087 7.465,15.894 7.465,16.88 7.465,17.867 6.658,18.674 5.672,18.674L5.672,18.674ZM11.052,11.052C11.321,11.052 11.5,11.231 11.5,11.5 11.5,11.769 11.321,11.948 11.052,11.948 10.783,11.948 10.603,11.769 10.603,11.5 10.603,11.231 10.783,11.052 11.052,11.052L11.052,11.052ZM20.915,3.43 L17.328,3.43 11.948,8.81 13.742,10.603 20.915,3.43 20.915,3.43Z" | ||
android:strokeColor="#00000000" android:strokeWidth="1"/> | ||
android:strokeColor="#00000000" | ||
android:strokeWidth="1"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
<vector android:height="24dp" android:viewportHeight="22.0" | ||
android:viewportWidth="22.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillAlpha="1" android:fillColor="#ffffff" | ||
<vector android:height="24dp" | ||
android:viewportHeight="22.0" | ||
android:viewportWidth="22.0" | ||
android:width="24dp" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#ffffff" | ||
android:pathData="M16.547,3.869 L13.219,3.869C12.902,2.918 12.03,2.284 11,2.284 9.97,2.284 9.098,2.918 8.781,3.869L5.453,3.869C4.582,3.869 3.869,4.582 3.869,5.453L3.869,18.131C3.869,19.003 4.582,19.716 5.453,19.716L16.547,19.716C17.418,19.716 18.131,19.003 18.131,18.131L18.131,5.453C18.131,4.582 17.418,3.869 16.547,3.869L16.547,3.869ZM11,3.869C11.475,3.869 11.792,4.186 11.792,4.661 11.792,5.136 11.475,5.453 11,5.453 10.525,5.453 10.208,5.136 10.208,4.661 10.208,4.186 10.525,3.869 11,3.869L11,3.869ZM16.547,18.131 L5.453,18.131 5.453,5.453 7.038,5.453 7.038,7.831 14.962,7.831 14.962,5.453 16.547,5.453 16.547,18.131 16.547,18.131Z" | ||
android:strokeColor="#00000000" android:strokeWidth="1"/> | ||
android:strokeColor="#00000000" | ||
android:strokeWidth="1"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<vector android:height="24dp" | ||
android:viewportHeight="399.917" | ||
android:viewportWidth="399.917" | ||
android:width="24dp" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M66.8,95 L137.7,24.1C139,22.8 140.8,22 142.7,22L306.8,22C322.5,22 335.2,34.8 335.2,50.5L335.2,349.4C335.2,365.1 322.5,377.9 306.8,377.9L93.2,377.9C77.5,377.9 64.7,365.1 64.7,349.4L64.7,100C64.7,98.1 65.4,96.3 66.8,95ZM78.9,349.4C78.9,357.3 85.3,363.7 93.2,363.7L306.8,363.7C314.6,363.7 321,357.3 321,349.4L321,50.5C321,42.6 314.6,36.2 306.8,36.2L145.7,36.2 78.9,103 78.9,349.4Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M292.1,92.9C288.1,92.9 285,89.7 285,85.8L285,57.7C285,53.8 288.1,50.6 292.1,50.6 296,50.6 299.2,53.8 299.2,57.7L299.2,85.8C299.2,89.7 296,92.9 292.1,92.9Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M256.5,92.9C252.6,92.9 249.4,89.7 249.4,85.8L249.4,57.7C249.4,53.8 252.6,50.6 256.5,50.6 260.4,50.6 263.6,53.8 263.6,57.7L263.6,85.8C263.6,89.7 260.4,92.9 256.5,92.9Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M220.9,92.9C217,92.9 213.8,89.7 213.8,85.8L213.8,57.7C213.8,53.8 217,50.6 220.9,50.6 224.9,50.6 228,53.8 228,57.7L228,85.8C228,89.7 224.9,92.9 220.9,92.9Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M185.4,92.9C181.4,92.9 178.2,89.7 178.2,85.8L178.2,57.7C178.2,53.8 181.4,50.6 185.4,50.6 189.3,50.6 192.5,53.8 192.5,57.7L192.5,85.8C192.5,89.7 189.3,92.9 185.4,92.9Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M156.9,57.7 L156.9,85.8C156.9,89.7 153.7,92.9 149.8,92.9 145.9,92.9 142.7,89.7 142.7,85.8L142.7,57.7C142.7,53.8 145.9,50.6 149.8,50.6 153.7,50.6 156.9,53.8 156.9,57.7Z"/> | ||
<path | ||
android:fillAlpha="1" | ||
android:fillColor="#646464" | ||
android:pathData="M164.1,185.5 L278.3,185.5C290.1,185.5 299.6,195 299.6,206.8L299.6,313.6C299.6,325.4 290.1,335 278.3,335L121.6,335C109.9,335 100.3,325.4 100.3,313.6L100.3,206.8C100.3,195 109.9,185.5 121.6,185.5L135.9,185.5M164.1,185.5C174.6,187.1 171.8,199.5 164.1,199.7L121.6,199.7C117.7,199.7 114.5,202.9 114.5,206.8L114.5,313.6C114.5,317.5 117.7,320.7 121.6,320.7L278.3,320.7C282.2,320.7 285.4,317.5 285.4,313.6L285.4,206.8C285.4,202.9 282.2,199.7 278.3,199.7L164.1,199.7C153.7,198.1 156.5,185.7 164.1,185.5"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.