Prefix resources
And add an overridable toolbar theme. Fixes #31 Signed-off-by: Jonas Kalderstam <jonas@kalderstam.se>
|
|
@ -1,7 +1,7 @@
|
|||
# Project-wide Gradle settings.
|
||||
|
||||
VERSION_NAME=2.1
|
||||
VERSION_CODE=16
|
||||
VERSION_NAME=2.2
|
||||
VERSION_CODE=17
|
||||
GROUP=com.nononsenseapps
|
||||
|
||||
PROJECT_NAME=com.nononsenseapps:filepicker
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
>
|
||||
|
||||
</application>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_filepicker);
|
||||
setContentView(R.layout.nnf_activity_filepicker);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_filepicker, container, false);
|
||||
View view = inflater.inflate(R.layout.nnf_fragment_filepicker, container, false);
|
||||
|
||||
Toolbar mToolbar = (Toolbar) view.findViewById(R.id.picker_toolbar);
|
||||
((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
|
||||
|
|
@ -162,7 +162,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
// Some invalid cases first
|
||||
if ((allowMultiple || mode == MODE_FILE) && checkedItems.isEmpty()) {
|
||||
Toast.makeText(getActivity(),
|
||||
R.string.select_something_first,
|
||||
R.string.nnf_select_something_first,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
|
@ -289,13 +289,13 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.picker_actions, menu);
|
||||
|
||||
MenuItem item = menu.findItem(R.id.action_createdir);
|
||||
MenuItem item = menu.findItem(R.id.nnf_action_createdir);
|
||||
item.setVisible(allowCreateDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
if (R.id.action_createdir == menuItem.getItemId()) {
|
||||
if (R.id.nnf_action_createdir == menuItem.getItemId()) {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof AppCompatActivity) {
|
||||
NewFolderFragment.showDialog(((AppCompatActivity) activity).getSupportFragmentManager(),
|
||||
|
|
@ -420,16 +420,16 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
View v;
|
||||
switch (viewType) {
|
||||
case LogicHandler.VIEWTYPE_HEADER:
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.filepicker_listitem_dir,
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.nnf_filepicker_listitem_dir,
|
||||
parent, false);
|
||||
return new HeaderViewHolder(v);
|
||||
case LogicHandler.VIEWTYPE_CHECKABLE:
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.filepicker_listitem_checkable,
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.nnf_filepicker_listitem_checkable,
|
||||
parent, false);
|
||||
return new CheckableViewHolder(v);
|
||||
case LogicHandler.VIEWTYPE_DIR:
|
||||
default:
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.filepicker_listitem_dir,
|
||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.nnf_filepicker_listitem_dir,
|
||||
parent, false);
|
||||
return new DirViewHolder(v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package com.nononsenseapps.filepicker;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.os.FileObserver;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
|
|
@ -227,7 +226,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
|||
currentPath = folder;
|
||||
refresh();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), R.string.create_folder_error,
|
||||
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public abstract class NewItemFragment extends DialogFragment {
|
|||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setView(R.layout.dialog_folder_name)
|
||||
.setTitle(R.string.new_folder)
|
||||
builder.setView(R.layout.nnf_dialog_folder_name)
|
||||
.setTitle(R.string.nnf_new_folder)
|
||||
.setNegativeButton(android.R.string.cancel,
|
||||
null)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
|
|
@ -28,7 +28,7 @@
|
|||
android:padding="4dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:hint="@string/name"
|
||||
android:hint="@string/nnf_name"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1"
|
||||
android:gravity="center_vertical"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
android:layout_height="?android:listPreferredItemHeight"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_file_folder"
|
||||
android:src="@drawable/nnf_ic_file_folder"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:visibility="visible"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
android:maxLines="1"
|
||||
android:padding="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/name"/>
|
||||
android:text="@string/nnf_name"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkbox"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
android:layout_height="?android:listPreferredItemHeight"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_file_folder"
|
||||
android:src="@drawable/nnf_ic_file_folder"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:visibility="visible"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
|
@ -48,5 +48,5 @@
|
|||
android:maxLines="1"
|
||||
android:padding="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/name"/>
|
||||
android:text="@string/nnf_name"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
android:layout_alignParentTop="true"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
android:theme="?nnf_toolbarTheme">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_dir"
|
||||
|
|
@ -38,7 +38,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="start"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" />
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/action_createdir"
|
||||
android:title="@string/new_folder"
|
||||
<item android:id="@+id/nnf_action_createdir"
|
||||
android:title="@string/nnf_new_folder"
|
||||
app:showAsAction="always"
|
||||
android:orderInCategory="1"
|
||||
android:icon="@drawable/ic_collections_add_collection"
|
||||
android:icon="@drawable/nnf_ic_collections_add_collection"
|
||||
/>
|
||||
</menu>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 Jonas Kalderstam
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU Lesser General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU Lesser General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Specifies theme to apply to the toolbar -->
|
||||
<attr name="nnf_toolbarTheme" format="reference"/>
|
||||
</resources>
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">NoNonsense File Picker</string>
|
||||
<string name="new_folder">New folder</string>
|
||||
<string name="create_folder_error">Failed to create folder</string>
|
||||
<string name="name">Name</string>
|
||||
<string name="select_something_first">Please select something first</string>
|
||||
<string name="nnf_app_name">NoNonsense File Picker</string>
|
||||
<string name="nnf_new_folder">New folder</string>
|
||||
<string name="nnf_create_folder_error">Failed to create folder</string>
|
||||
<string name="nnf_name">Name</string>
|
||||
<string name="nnf_select_something_first">Please select something first</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 Jonas Kalderstam
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU Lesser General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU Lesser General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<style name="NNF_BaseTheme" parent="Theme.AppCompat.DialogWhenLarge">
|
||||
<!-- You can override this in your sub theme -->
|
||||
<item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||
|
||||
<!-- These are important. Handled by toolbar. -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="NNF_BaseTheme.Light" parent="Theme.AppCompat.Light.DialogWhenLarge">
|
||||
<!-- You can override this in your sub theme -->
|
||||
<item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||
|
||||
<!-- These are important. Handled by toolbar. -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
# 2.2
|
||||
- All library resources are now prefixed with "nnf_" to avoid conflicts.
|
||||
- Added two base themes for convenience.
|
||||
- Now possible to specify a specific Toolbar-theme separate from the rest
|
||||
of your theme.
|
||||
|
||||
# 2.1
|
||||
|
||||
- Now easier to override sort-order and filtering in built in SD-card picker
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleTheme" >
|
||||
|
||||
<!-- Sample app -->
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
<!-- SD-card pickers -->
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.sample.FilePickerActivity2"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleThemeLight">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.sample.ImagePickerActivity"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.sample.ImagePickerActivity2"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleThemeLight">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
|
@ -84,12 +84,12 @@
|
|||
<!-- Dropbox pickers -->
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.sample.dropbox.DropboxFilePickerActivity"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleTheme">
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.sample.dropbox.DropboxFilePickerActivity2"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nnf_app_name"
|
||||
android:theme="@style/SampleThemeLight">
|
||||
</activity>
|
||||
<!-- Dropbox authenticator -->
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class DropboxFilePickerFragment
|
|||
currentPath = dbApi.metadata(path, 1, null, false, null);
|
||||
refresh();
|
||||
} catch (DropboxException e) {
|
||||
Toast.makeText(getActivity(), R.string.create_folder_error,
|
||||
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,28 +17,23 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<style name="SampleTheme" parent="Theme.AppCompat.DialogWhenLarge">
|
||||
<style name="SampleTheme" parent="NNF_BaseTheme">
|
||||
<item name="colorPrimary">@color/primary2</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark2</item>
|
||||
<item name="colorAccent">@color/accent2</item>
|
||||
|
||||
<item name="alertDialogTheme">@style/SampleAlertDialogTheme</item>
|
||||
|
||||
<!-- These are important. Handled by toolbar -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="SampleThemeLight" parent="Theme.AppCompat.Light.DialogWhenLarge">
|
||||
<style name="SampleThemeLight" parent="NNF_BaseTheme.Light">
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
|
||||
<item name="alertDialogTheme">@style/SampleAlertDialogThemeLight</item>
|
||||
|
||||
<!-- These are important. Handled by toolbar -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!-- Make sure toolbar title is white -->
|
||||
<item name="nnf_toolbarTheme">@style/SampleToolbarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="SampleAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
|
||||
|
|
@ -53,4 +48,8 @@
|
|||
<item name="colorAccent">@color/accent</item>
|
||||
</style>
|
||||
|
||||
<style name="SampleToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||