Prechádzať zdrojové kódy

Delete context menu in UploadListFragment

masensio 9 rokov pred
rodič
commit
573d94453b

+ 0 - 10
res/menu/upload_actions_menu.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu 	xmlns:android="http://schemas.android.com/apk/res/android">
-    
-    <item 	android:id="@+id/action_open_file_with"		android:title="@string/actionbar_open_with"			android:icon="@android:drawable/ic_menu_set_as"					android:orderInCategory="1" /> 
-	<item 	android:id="@+id/action_cancel_upload" 		android:title="@string/common_cancel_upload"		android:icon="@android:drawable/ic_menu_close_clear_cancel"		android:orderInCategory="1" />
-	<item 	android:id="@+id/action_remove_upload" 		android:title="@string/common_remove_upload"		android:icon="@android:drawable/ic_menu_close_clear_cancel"		android:orderInCategory="1" />
-	<item 	android:id="@+id/action_retry_upload" 		android:title="@string/common_retry_upload"			android:icon="@android:drawable/ic_menu_close_clear_cancel"		android:orderInCategory="1" />
-	<item 	android:id="@+id/action_see_details"		android:title="@string/actionbar_see_details"		android:icon="@android:drawable/ic_menu_info_details"			android:orderInCategory="1" />
-
-</menu>

+ 0 - 39
src/com/owncloud/android/ui/fragment/UploadListFragment.java

@@ -21,15 +21,10 @@ package com.owncloud.android.ui.fragment;
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
 import android.view.LayoutInflater;
-import android.view.MenuInflater;
-import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ExpandableListView;
-import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
 import android.widget.ListView;
 
 import com.owncloud.android.R;
@@ -98,8 +93,6 @@ public class UploadListFragment extends ExpandableListFragment {
         Log_OC.d(TAG, "onActivityCreated() start");
         super.onActivityCreated(savedInstanceState);
 
-        registerForContextMenu(getListView());
-        getListView().setOnCreateContextMenuListener(this);
     }
 
     @Override
@@ -123,38 +116,6 @@ public class UploadListFragment extends ExpandableListFragment {
         return handled;
     }
 
-    @Override
-    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
-        super.onCreateContextMenu(menu, v, menuInfo);
-        MenuInflater inflater = getActivity().getMenuInflater();
-        inflater.inflate(R.menu.upload_actions_menu, menu);
-        
-        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;  
-        int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
-        int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
-        OCUpload uploadFile = (OCUpload) mAdapter.getChild(groupPosition, childPosition);
-        if (uploadFile.userCanCancelUpload()) {
-            MenuItem item = menu.findItem(R.id.action_remove_upload);
-            if (item != null) {
-                item.setVisible(false);
-                item.setEnabled(false);
-            }
-        } else {
-            MenuItem item = menu.findItem(R.id.action_cancel_upload);
-            if (item != null) {
-                item.setVisible(false);
-                item.setEnabled(false);
-            }
-        }
-        if (!uploadFile.userCanRetryUpload()) {
-            MenuItem item = menu.findItem(R.id.action_retry_upload);
-            if (item != null) {
-                item.setVisible(false);
-                item.setEnabled(false);
-            }
-        }
-    }
-
     /**
      * Interface to implement by any Activity that includes some instance of
      * UploadListFragment