Add new folder icon to directory chooser menu

This commit is contained in:
Martin Fietz 2016-02-02 09:53:40 +01:00
parent eba11a9fe5
commit b8f725c843
14 changed files with 19 additions and 12 deletions

View File

@ -6,8 +6,8 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.FileObserver;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@ -34,7 +34,8 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
* Let's the user choose a directory on the storage device. The selected folder
* will be sent back to the starting activity as an activity result.
*/
public class DirectoryChooserActivity extends ActionBarActivity {
public class DirectoryChooserActivity extends AppCompatActivity {
private static final String TAG = "DirectoryChooserActivit";
private static final String CREATE_DIRECTORY_NAME = "AntennaPod";
@ -250,8 +251,7 @@ public class DirectoryChooserActivity extends ActionBarActivity {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.new_folder_item)
.setVisible(isValidFile(selectedDir));
menu.findItem(R.id.new_folder_item).setVisible(isValidFile(selectedDir));
return true;
}
@ -333,4 +333,5 @@ public class DirectoryChooserActivity extends ActionBarActivity {
private boolean isValidFile(File file) {
return file != null && file.isDirectory() && file.canRead() && file.canWrite();
}
}

View File

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/new_folder_item"
android:title="@string/create_folder_label"
custom:showAsAction="ifRoom|withText"/>
android:icon="?attr/ic_create_new_folder"
custom:showAsAction="ifRoom|withText" />
<item
android:id="@+id/set_to_default_folder_item"
custom:showAsAction="collapseActionView"
android:title="@string/set_to_default_folder"/>
android:title="@string/set_to_default_folder"
custom:showAsAction="collapseActionView" />
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

View File

@ -51,6 +51,7 @@
<attr name="ic_indeterminate_check_box" format="reference"/>
<attr name="ic_sort" format="reference"/>
<attr name="ic_sd_storage" format="reference"/>
<attr name="ic_create_new_folder" format="reference"/>
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference"/>

View File

@ -58,6 +58,7 @@
<item name="attr/ic_indeterminate_check_box">@drawable/ic_indeterminate_check_box_grey600_24dp</item>
<item name="attr/ic_sort">@drawable/ic_sort_grey600_24dp</item>
<item name="attr/ic_sd_storage">@drawable/ic_sd_storage_grey600_36dp</item>
<item name="attr/ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
@ -116,7 +117,7 @@
<item name="attr/ic_indeterminate_check_box">@drawable/ic_indeterminate_check_box_white_24dp</item>
<item name="attr/ic_sort">@drawable/ic_sort_white_24dp</item>
<item name="attr/ic_sd_storage">@drawable/ic_sd_storage_white_36dp</item>
<item name="attr/ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item>
</style>
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AppCompat.Light.NoActionBar">
@ -177,6 +178,7 @@
<item name="attr/ic_indeterminate_check_box">@drawable/ic_indeterminate_check_box_grey600_24dp</item>
<item name="attr/ic_sort">@drawable/ic_sort_grey600_24dp</item>
<item name="attr/ic_sd_storage">@drawable/ic_sd_storage_grey600_36dp</item>
<item name="attr/ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item>
</style>
<style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar">
@ -236,6 +238,7 @@
<item name="attr/ic_indeterminate_check_box">@drawable/ic_indeterminate_check_box_white_24dp</item>
<item name="attr/ic_sort">@drawable/ic_sort_white_24dp</item>
<item name="attr/ic_sd_storage">@drawable/ic_sd_storage_white_36dp</item>
<item name="attr/ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item>
</style>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">