Merge branch 'material_toolbar' of https://github.com/owncloud/android into material_buttons

This commit is contained in:
Andy Scherzinger 2015-08-20 13:50:44 +02:00
commit d24b396d54
6 changed files with 67 additions and 37 deletions

View file

@ -2,7 +2,6 @@
<!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2015 ownCloud Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -315,13 +315,27 @@ public class FileActivity extends AppCompatActivity
super.onBackPressed();
}
/**
* checks if the drawer exists and is opened.
*
* @return <code>true</code> if the drawer is open, else <code>false</code>
*/
public boolean isDrawerOpen() {
if(mDrawerLayout != null) {
return mDrawerLayout.isDrawerOpen(GravityCompat.START);
} else {
return false;
}
}
/**
* closes the navigation drawer.
*/
public void closeNavDrawer() {
if(mDrawerLayout != null) {
mDrawerLayout.closeDrawer(GravityCompat.START);
}
}
protected void initDrawer(){
// constant settings for action bar when navigation drawer is inited

View file

@ -29,9 +29,9 @@ public class AccountActionsDialogFragment extends DialogFragment implements
private static final String ARG_FILE_POSITION = "FILE_POSITION";
public static final String FTAG_FILE_ACTIONS = "FILE_ACTIONS_FRAGMENT";
private List<MenuItemParcelable> menuItems;
private List<MenuItemParcelable> mMenuItems;
private int filePosition;
private int mFilePosition;
private ListView mListView;
@ -92,13 +92,13 @@ public class AccountActionsDialogFragment extends DialogFragment implements
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
filePosition = getArguments().getInt(ARG_FILE_POSITION);
mFilePosition = getArguments().getInt(ARG_FILE_POSITION);
MenuParcelable menu = getArguments().getParcelable(ARG_ITEM_LIST);
menuItems = menu.getMenuItems();
mMenuItems = menu.getMenuItems();
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < menuItems.size(); i++) {
stringList.add(menuItems.get(i).getMenuText());
for (int i = 0; i < mMenuItems.size(); i++) {
stringList.add(mMenuItems.get(i).getMenuText());
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
@ -115,7 +115,7 @@ public class AccountActionsDialogFragment extends DialogFragment implements
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
dismiss();
((FileActionsDialogFragmentListener) getTargetFragment()).onFileActionChosen(menuItems.get(position).getMenuItemId(), filePosition);
((FileActionsDialogFragmentListener) getTargetFragment()).onFileActionChosen(mMenuItems.get(position).getMenuItemId(), mFilePosition);
}
/**

View file

@ -5,37 +5,34 @@ import android.os.Parcelable;
import android.view.MenuItem;
public class MenuItemParcelable implements Parcelable {
int menuItemId;
int mMenuItemId;
String mMenuText;
String menuText;
public MenuItemParcelable() {
}
public MenuItemParcelable() {}
public MenuItemParcelable(MenuItem menuItem) {
menuItemId = menuItem.getItemId();
menuText = menuItem.getTitle().toString();
menuItem.getMenuInfo();
mMenuItemId = menuItem.getItemId();
mMenuText = menuItem.getTitle().toString();
}
public MenuItemParcelable(Parcel read) {
menuItemId = read.readInt();
mMenuItemId = read.readInt();
}
public void setMenuItemId(int id) {
menuItemId = id;
mMenuItemId = id;
}
public int getMenuItemId() {
return menuItemId;
return mMenuItemId;
}
public String getMenuText() {
return menuText;
return mMenuText;
}
public void setMenuText(String menuText) {
this.menuText = menuText;
public void setMenuText(String mMenuText) {
this.mMenuText = mMenuText;
}
public static final Parcelable.Creator<MenuItemParcelable> CREATOR =
@ -59,6 +56,6 @@ public class MenuItemParcelable implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(menuItemId);
dest.writeInt(mMenuItemId);
}
}

View file

@ -8,22 +8,22 @@ import java.util.List;
public class MenuParcelable implements Parcelable {
private List<MenuItemParcelable> menuItems = new ArrayList<MenuItemParcelable>();
private List<MenuItemParcelable> mMenuItems = new ArrayList<MenuItemParcelable>();
public List<MenuItemParcelable> getMenuItems() {
return menuItems;
return mMenuItems;
}
public void setMenuItems(List<MenuItemParcelable> menuItems) {
this.menuItems = menuItems;
this.mMenuItems = menuItems;
}
public MenuParcelable() {
menuItems = new ArrayList<MenuItemParcelable>();
mMenuItems = new ArrayList<MenuItemParcelable>();
}
public MenuParcelable(Parcel in) {
in.readTypedList(menuItems, MenuItemParcelable.CREATOR);
in.readTypedList(mMenuItems, MenuItemParcelable.CREATOR);
}
public static final Parcelable.Creator<MenuParcelable> CREATOR = new Parcelable.Creator<MenuParcelable>() {
@ -46,6 +46,6 @@ public class MenuParcelable implements Parcelable {
@Override
public void writeToParcel(Parcel outParcel, int flags) {
outParcel.writeTypedList(menuItems);
outParcel.writeTypedList(mMenuItems);
}
}

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author Andy Scherzinger
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.utils;
import android.content.Intent;
@ -12,16 +32,16 @@ import android.view.View;
* Created by scherzia on 17.08.2015.
*/
public class DialogMenuItem implements MenuItem {
int itemId;
CharSequence title;
int mItemId;
CharSequence mTitle;
public DialogMenuItem(int itemId) {
this.itemId = itemId;
this.mItemId = itemId;
}
@Override
public int getItemId() {
return itemId;
return mItemId;
}
@Override
@ -36,7 +56,7 @@ public class DialogMenuItem implements MenuItem {
@Override
public MenuItem setTitle(CharSequence title) {
this.title = title;
this.mTitle = title;
return this;
}
@ -47,7 +67,7 @@ public class DialogMenuItem implements MenuItem {
@Override
public CharSequence getTitle() {
return this.title;
return this.mTitle;
}
@Override