亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? noteeditor.java

?? android 例子中的NotePad。很有代表意義
?? JAVA
字號:
/* * Copyright (C) 2007 The Android Open Source Project * * 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 * *      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 com.example.android.notepad;import com.example.android.notepad.NotePad.Notes;import android.app.Activity;import android.content.ComponentName;import android.content.ContentValues;import android.content.Context;import android.content.Intent;import android.database.Cursor;import android.graphics.Canvas;import android.graphics.Paint;import android.graphics.Rect;import android.net.Uri;import android.os.Bundle;import android.util.AttributeSet;import android.util.Log;import android.view.Menu;import android.view.MenuItem;import android.widget.EditText;/** * A generic activity for editing a note in a database.  This can be used * either to simply view a note {@link Intent#ACTION_VIEW}, view and edit a note * {@link Intent#ACTION_EDIT}, or create a new note {@link Intent#ACTION_INSERT}.   */public class NoteEditor extends Activity {    private static final String TAG = "Notes";    /**     * Standard projection for the interesting columns of a normal note.     */    private static final String[] PROJECTION = new String[] {            Notes._ID, // 0            Notes.NOTE, // 1    };    /** The index of the note column */    private static final int COLUMN_INDEX_NOTE = 1;        // This is our state data that is stored when freezing.    private static final String ORIGINAL_CONTENT = "origContent";    // Identifiers for our menu items.    private static final int REVERT_ID = Menu.FIRST;    private static final int DISCARD_ID = Menu.FIRST + 1;    private static final int DELETE_ID = Menu.FIRST + 2;    // The different distinct states the activity can be run in.    private static final int STATE_EDIT = 0;    private static final int STATE_INSERT = 1;    private int mState;    private boolean mNoteOnly = false;    private Uri mUri;    private Cursor mCursor;    private EditText mText;    private String mOriginalContent;    /**     * A custom EditText that draws lines between each line of text that is displayed.     */    public static class LinedEditText extends EditText {        private Rect mRect;        private Paint mPaint;        // we need this constructor for LayoutInflater        public LinedEditText(Context context, AttributeSet attrs) {            super(context, attrs);                        mRect = new Rect();            mPaint = new Paint();            mPaint.setStyle(Paint.Style.STROKE);            mPaint.setColor(0x800000FF);        }                @Override        protected void onDraw(Canvas canvas) {            int count = getLineCount();            Rect r = mRect;            Paint paint = mPaint;            for (int i = 0; i < count; i++) {                int baseline = getLineBounds(i, r);                canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);            }            super.onDraw(canvas);        }    }    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        final Intent intent = getIntent();        // Do some setup based on the action being performed.        final String action = intent.getAction();        if (Intent.ACTION_EDIT.equals(action)) {            // Requested to edit: set that state, and the data being edited.            mState = STATE_EDIT;            mUri = intent.getData();        } else if (Intent.ACTION_INSERT.equals(action)) {            // Requested to insert: set that state, and create a new entry            // in the container.            mState = STATE_INSERT;            mUri = getContentResolver().insert(intent.getData(), null);            // If we were unable to create a new note, then just finish            // this activity.  A RESULT_CANCELED will be sent back to the            // original activity if they requested a result.            if (mUri == null) {                Log.e(TAG, "Failed to insert new note into " + getIntent().getData());                finish();                return;            }            // The new entry was created, so assume all will end well and            // set the result to be returned.            setResult(RESULT_OK, (new Intent()).setAction(mUri.toString()));        } else {            // Whoops, unknown action!  Bail.            Log.e(TAG, "Unknown action, exiting");            finish();            return;        }        // Set the layout for this activity.  You can find it in res/layout/note_editor.xml        setContentView(R.layout.note_editor);                // The text view for our note, identified by its ID in the XML file.        mText = (EditText) findViewById(R.id.note);        // Get the note!        mCursor = managedQuery(mUri, PROJECTION, null, null, null);        // If an instance of this activity had previously stopped, we can        // get the original text it started with.        if (savedInstanceState != null) {            mOriginalContent = savedInstanceState.getString(ORIGINAL_CONTENT);        }    }    @Override    protected void onResume() {        super.onResume();        // If we didn't have any trouble retrieving the data, it is now        // time to get at the stuff.        if (mCursor != null) {            // Make sure we are at the one and only row in the cursor.            mCursor.moveToFirst();            // Modify our overall title depending on the mode we are running in.            if (mState == STATE_EDIT) {                setTitle(getText(R.string.title_edit));            } else if (mState == STATE_INSERT) {                setTitle(getText(R.string.title_create));            }            // This is a little tricky: we may be resumed after previously being            // paused/stopped.  We want to put the new text in the text view,            // but leave the user where they were (retain the cursor position            // etc).  This version of setText does that for us.            String note = mCursor.getString(COLUMN_INDEX_NOTE);            mText.setTextKeepState(note);                        // If we hadn't previously retrieved the original text, do so            // now.  This allows the user to revert their changes.            if (mOriginalContent == null) {                mOriginalContent = note;            }        } else {            setTitle(getText(R.string.error_title));            mText.setText(getText(R.string.error_message));        }    }    @Override    protected void onSaveInstanceState(Bundle outState) {        // Save away the original text, so we still have it if the activity        // needs to be killed while paused.        outState.putString(ORIGINAL_CONTENT, mOriginalContent);    }    @Override    protected void onPause() {        super.onPause();        // The user is going somewhere else, so make sure their current        // changes are safely saved away in the provider.  We don't need        // to do this if only editing.        if (mCursor != null) {            String text = mText.getText().toString();            int length = text.length();            // If this activity is finished, and there is no text, then we            // do something a little special: simply delete the note entry.            // Note that we do this both for editing and inserting...  it            // would be reasonable to only do it when inserting.            if (isFinishing() && (length == 0) && !mNoteOnly) {                setResult(RESULT_CANCELED);                deleteNote();            // Get out updates into the provider.            } else {                ContentValues values = new ContentValues();                // This stuff is only done when working with a full-fledged note.                if (!mNoteOnly) {                    // Bump the modification time to now.                    values.put(Notes.MODIFIED_DATE, System.currentTimeMillis());                    // If we are creating a new note, then we want to also create                    // an initial title for it.                    if (mState == STATE_INSERT) {                        String title = text.substring(0, Math.min(30, length));                        if (length > 30) {                            int lastSpace = title.lastIndexOf(' ');                            if (lastSpace > 0) {                                title = title.substring(0, lastSpace);                            }                        }                        values.put(Notes.TITLE, title);                    }                }                // Write our text back into the provider.                values.put(Notes.NOTE, text);                // Commit all of our changes to persistent storage. When the update completes                // the content provider will notify the cursor of the change, which will                // cause the UI to be updated.                getContentResolver().update(mUri, values, null, null);            }        }    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        super.onCreateOptionsMenu(menu);        // Build the menus that are shown when editing.        if (mState == STATE_EDIT) {            menu.add(0, REVERT_ID, 0, R.string.menu_revert)                    .setShortcut('0', 'r')                    .setIcon(android.R.drawable.ic_menu_revert);            if (!mNoteOnly) {                menu.add(0, DELETE_ID, 0, R.string.menu_delete)                        .setShortcut('1', 'd')                        .setIcon(android.R.drawable.ic_menu_delete);            }        // Build the menus that are shown when inserting.        } else {            menu.add(0, DISCARD_ID, 0, R.string.menu_discard)                    .setShortcut('0', 'd')                    .setIcon(android.R.drawable.ic_menu_delete);        }        // If we are working on a full note, then append to the        // menu items for any other activities that can do stuff with it        // as well.  This does a query on the system for any activities that        // implement the ALTERNATIVE_ACTION for our data, adding a menu item        // for each one that is found.        if (!mNoteOnly) {            Intent intent = new Intent(null, getIntent().getData());            intent.addCategory(Intent.CATEGORY_ALTERNATIVE);            menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,                    new ComponentName(this, NoteEditor.class), null, intent, 0, null);        }        return true;    }    @Override    public boolean onOptionsItemSelected(MenuItem item) {        // Handle all of the possible menu actions.        switch (item.getItemId()) {        case DELETE_ID:            deleteNote();            finish();            break;        case DISCARD_ID:            cancelNote();            break;        case REVERT_ID:            cancelNote();            break;        }        return super.onOptionsItemSelected(item);    }    /**     * Take care of canceling work on a note.  Deletes the note if we     * had created it, otherwise reverts to the original text.     */    private final void cancelNote() {        if (mCursor != null) {            if (mState == STATE_EDIT) {                // Put the original note text back into the database                mCursor.close();                mCursor = null;                ContentValues values = new ContentValues();                values.put(Notes.NOTE, mOriginalContent);                getContentResolver().update(mUri, values, null, null);            } else if (mState == STATE_INSERT) {                // We inserted an empty note, make sure to delete it                deleteNote();            }        }        setResult(RESULT_CANCELED);        finish();    }    /**     * Take care of deleting a note.  Simply deletes the entry.     */    private final void deleteNote() {        if (mCursor != null) {            mCursor.close();            mCursor = null;            getContentResolver().delete(mUri, null, null);            mText.setText("");        }    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区在线观看视频| 中文字幕亚洲成人| 日韩女优制服丝袜电影| 在线不卡一区二区| 久久久久久免费毛片精品| 国产色产综合产在线视频| 久久精品视频免费观看| 久久天堂av综合合色蜜桃网| 欧美国产精品中文字幕| 亚洲电影你懂得| 精品一二三四区| 成人免费视频视频在线观看免费| proumb性欧美在线观看| 欧美日韩精品欧美日韩精品| 久久蜜臀中文字幕| 婷婷丁香久久五月婷婷| 91色在线porny| 国产午夜亚洲精品不卡 | 一区二区三区精品在线观看| 日本成人在线视频网站| 成人黄色小视频| 精品国产免费一区二区三区香蕉 | 精彩视频一区二区三区| 欧美视频在线观看一区二区| 国产精品视频第一区| 久久国产生活片100| 欧美日韩国产影片| 日韩毛片视频在线看| 国产成人三级在线观看| 欧美xxxx在线观看| 国内精品视频666| 日韩欧美一级二级| 国内精品伊人久久久久影院对白| 欧美久久久久久久久中文字幕| 中文字幕亚洲欧美在线不卡| 99re这里都是精品| 亚洲欧洲精品一区二区三区| av一区二区三区在线| 中文字幕日本乱码精品影院| gogo大胆日本视频一区| 国产精品传媒视频| 色婷婷久久久亚洲一区二区三区| 亚洲欧洲在线观看av| 一本高清dvd不卡在线观看| 亚洲啪啪综合av一区二区三区| 色婷婷精品久久二区二区蜜臀av| 亚洲一级电影视频| 精品欧美乱码久久久久久1区2区 | 欧美日韩一区精品| 久久精品72免费观看| 久久久久久久久岛国免费| 成人亚洲一区二区一| 亚洲最新在线观看| 欧美不卡视频一区| 97se狠狠狠综合亚洲狠狠| 蜜芽一区二区三区| 一区二区三区在线播| 欧美变态tickling挠脚心| 成人av影院在线| 日韩国产精品久久久| 国产精品丝袜黑色高跟| 日韩女同互慰一区二区| 欧美私模裸体表演在线观看| 国产一区二区三区免费观看 | 国产成人av在线影院| 日本一区中文字幕| 亚洲精品视频在线| 日本一区二区三级电影在线观看 | 国产成人午夜精品5599| 婷婷六月综合网| 亚洲一区二区偷拍精品| 国产寡妇亲子伦一区二区| 最新热久久免费视频| 综合在线观看色| 亚洲成人av一区二区三区| 久久99精品视频| 亚洲国产美女搞黄色| 欧美国产国产综合| 久久精品视频在线免费观看| 欧美一区二区日韩| 91福利区一区二区三区| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 69堂成人精品免费视频| 欧美日韩亚洲高清一区二区| 91免费视频大全| 欧美日韩中文字幕精品| 欧美肥妇bbw| 久久久久97国产精华液好用吗| 中文字幕亚洲一区二区av在线| 亚洲色图一区二区三区| 亚洲综合免费观看高清完整版在线 | 日韩免费看的电影| 国产精品高清亚洲| 日韩国产一区二| 粉嫩蜜臀av国产精品网站| 日韩欧美激情四射| 亚洲大尺度视频在线观看| 国产精品午夜电影| 国产精品女人毛片| 日本sm残虐另类| 成人午夜av在线| 久久福利资源站| 国产传媒欧美日韩成人| 91视频免费观看| 中文字幕五月欧美| 国产精品一区二区免费不卡| 欧美xxxx老人做受| 久久er99热精品一区二区| 欧美大尺度电影在线| 久久久久久久综合日本| 亚洲视频综合在线| 国产白丝精品91爽爽久久| www.欧美日韩国产在线| 欧美日韩精品综合在线| 欧美视频一区二区三区| 欧美亚洲愉拍一区二区| 久久久久久久久久久黄色| 亚洲国产电影在线观看| 一区二区三区中文在线观看| 色婷婷av一区二区三区软件| 欧美一区二区三区免费大片| 日韩精品一区二区三区蜜臀| 精品国产乱码久久久久久图片| 欧美成人午夜电影| 亚洲3atv精品一区二区三区| 日韩黄色免费网站| 国产91精品久久久久久久网曝门 | 国产精品网站在线观看| 日韩欧美一区在线观看| 中文一区一区三区高中清不卡| 国产精品不卡在线观看| 天天综合网 天天综合色| 亚洲电影一级黄| 亚洲成人福利片| 99re成人精品视频| 日韩欧美在线观看一区二区三区| 欧美国产在线观看| 色婷婷激情综合| 国产美女精品在线| 亚洲电影第三页| 国产目拍亚洲精品99久久精品 | 91精品国模一区二区三区| 成人免费视频一区| 91蜜桃免费观看视频| 亚洲午夜成aⅴ人片| 日韩欧美的一区二区| 成人免费高清在线| 亚州成人在线电影| 久久精品综合网| 欧美视频在线播放| 国产成人综合自拍| 人人狠狠综合久久亚洲| 欧美经典一区二区三区| 欧美精品丝袜中出| 成人免费毛片嘿嘿连载视频| 国产成人午夜视频| 国产精品福利影院| 色婷婷综合视频在线观看| 亚洲同性同志一二三专区| 欧美日韩中文字幕一区| 裸体一区二区三区| 91精品综合久久久久久| 久久国产人妖系列| 亚洲图片激情小说| 精品国产91久久久久久久妲己 | 欧美综合一区二区| 国产成人综合精品三级| 日韩av一区二区在线影视| 日本一区二区三区电影| 久久久久久电影| 欧美大片一区二区| 欧美一级片在线| 9191精品国产综合久久久久久| 91激情五月电影| 欧美性色欧美a在线播放| 91网站黄www| 色婷婷久久久亚洲一区二区三区 | 亚洲一区在线观看视频| 亚洲成人手机在线| 午夜精品免费在线| 视频在线观看一区| 激情深爱一区二区| 91免费在线播放| 欧美日韩成人一区二区| 激情综合网av| 日本伊人色综合网| 精品影视av免费| 亚洲国产综合人成综合网站| 国产婷婷色一区二区三区| 久久亚洲精品小早川怜子| 成人一级黄色片| 国产成人午夜电影网| av中文字幕一区| 欧美日韩国产三级| 2021久久国产精品不只是精品| 久久综合资源网| 亚洲一区二区三区免费视频| 韩国中文字幕2020精品| 色综合激情五月| 日韩精品一区二区三区三区免费|