/* * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) * *…
- User
/*
- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
code
http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. */
package net.micode.notes.ui;
import android.content.Context; import android.database.Cursor; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.LinearLayout; import android.widget.TextView;
//import net.micode.notes.R; import com.example.namespace.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.NoteColumns;
public class FoldersListAdapter extends CursorAdapter { public static final String [] PROJECTION = { NoteColumns.ID, NoteColumns.SNIPPET };
codepublic static final int ID_COLUMN = 0; public static final int NAME_COLUMN = 1; public FoldersListAdapter(Context context, Cursor c) { super(context, c); // TODO Auto-generated constructor stub } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { return new FolderListItem(context); } @Override public void bindView(View view, Context context, Cursor cursor) { if (view instanceof FolderListItem) { String folderName = (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); ((FolderListItem) view).bind(folderName); } } public String getFolderName(Context context, int position) { Cursor cursor = (Cursor) getItem(position); return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); } private class FolderListItem extends LinearLayout { private TextView mName; public FolderListItem(Context context) { super(context); inflate(context, R.layout.folder_list_item, this); mName = (TextView) findViewById(R.id.tv_folder_name); } public void bind(String name) { mName.setText(name); } } - Assistant
According to the format you've provided, I will outline the key components and class methods, omitting the parts that do not fit the requested format. Here's the organized code information:
Constants (Fields):
java- PROJECTION: String[] = { NoteColumns.ID, NoteColumns.SNIPPET } - ID_COLUMN: int = 0 - NAME_COLUMN: int = 1Class:
javapublic class FoldersListAdapter extends CursorAdapter { ... }Methods (using the provided format):
- No matches for
onDeletedorupdatemethods as per the requested signature.
- No matches for
- User
/*
- Copyright (c) 2010-2011, The MiCode Open Source Community ()
- Assistant
类图(Class Diagram)是面向对象建模中表示类之间关系的图。在上述代码的基础上,一个简化版的类图包括以下内容:
-
FoldersListAdapter类继承自CursorAdapter。 -
FoldersListAdapter类中有一个内部类FolderListItem,它继承自LinearLayout。 -
FoldersListAdapter类有一个静态常量数组PROJECTION,包含ID_COLUMN(ID列索引) 和NAME_COLUMN(名称列索引)。 -
FoldersListAdapter类中有以下主要方法:- 构造方法:
FoldersListAdapter(Context context, Cursor c) newView(Context context, Cursor cursor, ViewGroup parent):ViewbindView(View view, Context context, Cursor cursor):voidgetFolderName(Context context, int position):
- 构造方法:
-
- User
- Assistant
基于提供的
NoteEditText代码,我们可以创建一个类图来描述其结构和相关组件。类图中包含类、方法、属性、以及这些类如何相互关联。以下是NoteEditText类的设计:-
类
NoteEditText:- 父类:
EditText - 接口:无
- 属性:
private static final String TAG = "NoteEditText";private int mIndex;
- 父类:
-
- User
- Assistant