当前位置: 首页>>代码示例>>Java>>正文


Java ContextMenu.ContextMenuInfo方法代码示例

本文整理汇总了Java中android.view.ContextMenu.ContextMenuInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ContextMenu.ContextMenuInfo方法的具体用法?Java ContextMenu.ContextMenuInfo怎么用?Java ContextMenu.ContextMenuInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ContextMenu的用法示例。


在下文中一共展示了ContextMenu.ContextMenuInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    KRFAM.log("MainActivity.java > onCreateContextMenu");
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    Account contextAccount = ACCOUNT_LIST_DATA.get(info.position);
    if (contextAccount.isFolder) {
        menu.setHeaderTitle(contextAccount.name);
        super.onCreateContextMenu(menu, v, menuInfo);
        getMenuInflater().inflate(R.menu.menu_context_folder, menu);
        menu.setHeaderIcon(R.drawable.ic_folder_black_24dp);
    } else {
        menu.setHeaderTitle(contextAccount.name);
        super.onCreateContextMenu(menu, v, menuInfo);
        if (contextAccount.locked) {
            getMenuInflater().inflate(R.menu.menu_context_account_locked, menu);
            menu.setHeaderIcon(R.drawable.ic_lock_outline_black_24dp);
        } else {
            getMenuInflater().inflate(R.menu.menu_context_account, menu);
        }
    }
}
 
开发者ID:iebb,项目名称:Kasumi,代码行数:21,代码来源:MainActivity.java

示例2: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    // Check if the current file requires a context menu
    AdapterView.AdapterContextMenuInfo info;
    try {
        info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    } catch (ClassCastException e) {
        Log.e(TAG, "bad menuInfo", e);
        return;
    }
    // This can be null sometimes, don't crash...
    if (info == null) {
        Log.e(TAG, "bad menuInfo");
        return;
    }
    Object item = mFilesAdapter.getItem(info.position);
    if (item instanceof MetaFile2) {
        menu.setHeaderTitle(((MetaFile2) item).getName());
        if (((MetaFile2) item).canWrite())
            menu.add(0, R.string.delete, 0, R.string.delete);
        return;
    }
    super.onCreateContextMenu(menu,v, menuInfo);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:25,代码来源:BrowserByFolder.java

示例3: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
    Cursor c = (Cursor) adapter.getItem(info.position);

    // first item!!
    int flagVal = c.getInt(c.getColumnIndex(FeedContract.Feeds.COLUMN_Flag));
    if (flagVal == FeedContract.Flag.FAVORITE) {
        menu.add(R.string.nofavorite);
    } else {
        menu.add(R.string.favorite);
    }
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.item_context, menu);
}
 
开发者ID:no-go,项目名称:AnotherRSS,代码行数:18,代码来源:FeedListFragment.java

示例4: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

    if(v.getTag() instanceof FtpShortcutAdapter.FtpShortcutViewHolder){
        mSelectedUri =((FtpShortcutAdapter.FtpShortcutViewHolder) v.getTag()).getUri();
        mSelectedName =((FtpShortcutAdapter.FtpShortcutViewHolder) v.getTag()).getName();
        menu.add(0, R.string.remove_from_shortcuts, 0, R.string.remove_from_shortcuts);
        menu.add(0, R.string.open_indexed_folder, 0, R.string.open_indexed_folder);
        if(ShortcutDbAdapter.VIDEO.isShortcut(getActivity(), mSelectedUri.toString())<0)
            menu.add(0, R.string.add_to_library, 0, R.string.add_to_library);
    }
    else super.onCreateContextMenu(menu, v, menuInfo);

}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:15,代码来源:FtpRootFragment.java

示例5: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (v.getId() == android.R.id.list) {
        menu.setHeaderTitle(getResources().getText(R.string.note_context_menu));
        getMenuInflater().inflate(R.menu.context_menu, menu);
    }
}
 
开发者ID:coffeeplanter,项目名称:SimpleNotes,代码行数:9,代码来源:MainActivity.java

示例6: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo
        menuInfo) {
    if (v.getId() == mFileAttach.getId()) {
        menu.add(0, TAKE_PHOTO, 0, R.string.take_photo);
        menu.add(0, FILE_EXPLORER, 0, R.string.file_explorer);
    }
}
 
开发者ID:metarhia,项目名称:metacom-android,代码行数:9,代码来源:ChatFragment.java

示例7: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Select action");
    menu.add(0, 1, 1, "Edit");
    menu.add(0, 2, 2, "Delete");
}
 
开发者ID:CMPUT301F17T29,项目名称:HabitUp,代码行数:8,代码来源:ViewHabitActivity.java

示例8: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
	WebView.HitTestResult result = webView.getHitTestResult();
	if (result != null) {
		int type = result.getType();

		if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
			showLongPressedImageMenu(menu, result.getExtra());
		}
	}
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:12,代码来源:ShortcutActivity.java

示例9: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    BreventActivity activity = (BreventActivity) mFragment.getActivity();
    menu.setHeaderTitle(label);
    menu.add(Menu.NONE, R.string.context_menu_select, Menu.NONE,
            activity.getString(R.string.context_menu_select));
    menu.add(Menu.NONE, R.string.context_menu_package_name, Menu.NONE,
            activity.getString(R.string.context_menu_package_name));
    menu.add(Menu.NONE, R.string.context_menu_app_info, Menu.NONE,
            activity.getString(R.string.context_menu_app_info));
    PackageManager packageManager = mFragment.getActivity().getPackageManager();
    if (BuildConfig.APPLICATION_ID.equals(packageName)) {
        menu.add(Menu.NONE, R.string.context_menu_brevent_server_info, Menu.NONE,
                activity.getString(R.string.context_menu_brevent_server_info));
    } else if (packageManager.getLaunchIntentForPackage(packageName) != null) {
        menu.add(Menu.NONE, R.string.context_menu_open, Menu.NONE,
                activity.getString(R.string.context_menu_open));
    }
    if (activity.isBrevent(packageName)) {
        if (activity.isPriority(packageName)) {
            menu.add(Menu.NONE, R.string.context_menu_unset_priority, Menu.NONE,
                    activity.getString(R.string.context_menu_unset_priority));
        } else {
            menu.add(Menu.NONE, R.string.context_menu_set_priority, Menu.NONE,
                    activity.getString(R.string.context_menu_set_priority));
        }
    }
    if (activity.hasOps(packageName)) {
        menu.add(Menu.NONE, R.string.context_menu_appops, Menu.NONE,
                activity.getString(R.string.context_menu_appops));
    }
    int size = menu.size();
    for (int i = 0; i < size; ++i) {
        menu.getItem(i).setOnMenuItemClickListener(this);
    }
    String important = activity.getLabel("", packageName);
    if (!TextUtils.isEmpty(important)) {
        menu.add(AppsLabelLoader.trim(important));
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:41,代码来源:AppsItemViewHolder.java

示例10: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
    contextMenu.setHeaderTitle(dataList.get(contextMenuActiveItemPos).getLabel());
    contextMenu.add(Menu.NONE, 0, Menu.NONE, R.string.menu_request_icon);
    contextMenu.add(Menu.NONE, 1, Menu.NONE, R.string.menu_copy_code);
    contextMenu.add(Menu.NONE, 2, Menu.NONE, R.string.menu_save_icon);
    contextMenu.getItem(0).setOnMenuItemClickListener(this);
    contextMenu.getItem(1).setOnMenuItemClickListener(this);
    contextMenu.getItem(2).setOnMenuItemClickListener(this);

    contextMenu.getItem(0).setVisible(enableStatsModule);
}
 
开发者ID:homeii,项目名称:GxIconDIY,代码行数:13,代码来源:AppAdapter.java

示例11: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.hosts_listview) {
        String[] menuItems = getResources().getStringArray(R.array.list_hosts_actions);
        for (int i = 0; i < menuItems.length; i++) {
            menu.add(Menu.NONE, i, i, menuItems[i]);
        }
    }
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:10,代码来源:MainHostsFragment.java

示例12: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
    menu.setHeaderTitle((String) ((Object[])btnMore.getTag())[0]);
    Intent data = new Intent();
    data.putExtra(GroupFragment.CONTEXT_MENU_KEY_INTENT_DATA_POS, (Integer) ((Object[])btnMore.getTag())[1]);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_EDIT, Menu.NONE, "Edit group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_DELETE, Menu.NONE, "Delete group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_LEAVE, Menu.NONE, "Leave group").setIntent(data);
}
 
开发者ID:ansarisufiyan777,项目名称:Show_Chat,代码行数:10,代码来源:GroupFragment.java

示例13: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    MenuItem.OnMenuItemClickListener listener = new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            String name = item.getTitle().toString();
            mEtLocation.setText(name);
            return true;
        }
    };
    //clear menu
    if (menu.size() != 0) {
        menu.clear();
    }

    int id_view = v.getId();

    switch (id_view) {
        case R.id.arrow:
            try {
                mLocationList = mDbHelper.getLocationList();
            } catch (NullObjectException e) {
                Log.d(TAG, e.toString());
            }

            if (mLocationList == null || mLocationList.size() == 0) {
                FunctionHelper.makeSToast(mActivity, mResources.getString(R.string.no_data_available));
            } else {
                int i = 0;
                for (Location l : mLocationList) {
                    //Add menu item with groupId
                    menu.add(ID_GROUP_LOCATION, l.getLocation_id(), l.getLocation_id(), l.getLocation_name());

                    menu.getItem(i).setOnMenuItemClickListener(listener);
                    i++;
                }
                menu.setHeaderTitle(R.string.choose_a_location);
            }
            break;
    }


}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:46,代码来源:AddEditWeekLessonDialogFragment.java

示例14: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(0, ConstantValues.CONTEXT_MENU_EDIT_ID, 0, mResource.getString(R.string.gen_edit));
    menu.add(0, ConstantValues.CONTEXT_MENU_DELETE_ID, 0, mResource.getString(R.string.gen_delete));
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:7,代码来源:TaskEditFragment.java

示例15: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.imagemenu, menu);
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:7,代码来源:ActEditAircraft.java


注:本文中的android.view.ContextMenu.ContextMenuInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。