<!--
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
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() {
- return mDrawerLayout.isDrawerOpen(GravityCompat.START);
+ if(mDrawerLayout != null) {
+ return mDrawerLayout.isDrawerOpen(GravityCompat.START);
+ } else {
+ return false;
+ }
}
+ /**
+ * closes the navigation drawer.
+ */
public void closeNavDrawer() {
- mDrawerLayout.closeDrawer(GravityCompat.START);
+ if(mDrawerLayout != null) {
+ mDrawerLayout.closeDrawer(GravityCompat.START);
+ }
}
protected void initDrawer(){
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;
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(),
@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);
}
/**
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 =
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(menuItemId);
+ dest.writeInt(mMenuItemId);
}
}
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>() {
@Override
public void writeToParcel(Parcel outParcel, int flags) {
- outParcel.writeTypedList(menuItems);
+ outParcel.writeTypedList(mMenuItems);
}
}
+/**
+ * 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;
* 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
@Override
public MenuItem setTitle(CharSequence title) {
- this.title = title;
+ this.mTitle = title;
return this;
}
@Override
public CharSequence getTitle() {
- return this.title;
+ return this.mTitle;
}
@Override