/*
* 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
*
* 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.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.appwidget.AppWidgetManager;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnTouchListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.remote.GTaskSyncService;
import net.micode.notes.model.WorkingNote;
import net.micode.notes.tool.BackupUtils;
import net.micode.notes.tool.DataUtils;
import net.micode.notes.tool.ResourceParser;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1;
private static final int MENU_FOLDER_DELETE = 0;
private static final int MENU_FOLDER_VIEW = 1;
private static final int MENU_FOLDER_CHANGE_NAME = 2;
private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction";
private enum ListEditState {
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
};
private ListEditState mState;
private BackgroundQueryHandler mBackgroundQueryHandler;
private NotesListAdapter mNotesListAdapter;
private ListView mNotesListView;
private Button mAddNewNote;
private boolean mDispatch;
private int mOriginY;
private int mDispatchY;
private TextView mTitleBar;
private long mCurrentFolderId;
private ContentResolver mContentResolver;
private ModeCallback mModeCallBack;
private static final String TAG = "NotesListActivity";
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
private NoteItemData mFocusNoteDataItem;
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
private static final String ROOT_FOLDER_SELECTION = "(" + NoteColumns.TYPE + "<>"
+ Notes.TYPE_SYSTEM + " AND " + NoteColumns.PARENT_ID + "=?)" + " OR ("
+ NoteColumns.ID + "=" + Notes.ID_CALL_RECORD_FOLDER + " AND "
+ NoteColumns.NOTES_COUNT + ">0)";
private final static int REQUEST_CODE_OPEN_NODE = 102;
private final static int REQUEST_CODE_NEW_NODE = 103;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note_list);
initResources();
/**
* Insert an introduction when user firstly use this application
*/
setAppInfoFromRawRes();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK
&& (requestCode == REQUEST_CODE_OPEN_NODE || requestCode == REQUEST_CODE_NEW_NODE)) {
mNotesListAdapter.changeCursor(null);
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
private void setAppInfoFromRawRes() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (!sp.getBoolean(PREFERENCE_ADD_INTRODUCTION, false)) {
StringBuilder sb = new StringBuilder();
InputStream in = null;
try {
in = getResources().openRawResource(R.raw.introduction);
if (in != null) {
InputStreamReader isr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(isr);
char [] buf = new char[1024];
int len = 0;
while ((len = br.read(buf)) > 0) {
sb.append(buf, 0, len);
}
} else {
Log.e(TAG, "Read introduction file error");
return;
}
} catch (IOException e) {
e.printStackTrace();
return;
} finally {
if(in != null) {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
WorkingNote note = WorkingNote.createEmptyNote(this, Notes.ID_ROOT_FOLDER,
AppWidgetManager.INVALID_APPWIDGET_ID, Notes.TYPE_WIDGET_INVALIDE,
ResourceParser.RED);
note.setWorkingText(sb.toString());
if (note.saveNote()) {
sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit();
} else {
Log.e(TAG, "Save introduction note error");
return;
}
}
}
@Override
protected void onStart() {
super.onStart();
startAsyncNotesListQuery();
}
private void initResources() {
mContentResolver = this.getContentResolver();
mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver());
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
mNotesListView = (ListView) findViewById(R.id.notes_list);
mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null),
null, false);
mNotesListView.setOnItemClickListener(new OnListItemClickListener());
mNotesListView.setOnItemLongClickListener(this);
mNotesListAdapter = new NotesListAdapter(this);
mNotesListView.setAdapter(mNotesListAdapter);
mAddNewNote = (Button) findViewById(R.id.btn_new_note);
mAdd
没有合适的资源?快使用搜索试试~ 我知道了~
Android应用源码之MIUI便签.zip项目安卓应用源码下载
共344个文件
png:130个
class:110个
java:41个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 146 浏览量
2022-03-08
03:38:31
上传
评论
收藏 6.79MB ZIP 举报
温馨提示
Android应用源码之MIUI便签.zip项目安卓应用源码下载Android应用源码之MIUI便签.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
资源推荐
资源详情
资源评论
收起资源包目录
Android应用源码之MIUI便签.zip项目安卓应用源码下载 (344个子文件)
resources.ap_ 879KB
Notes.apk 968KB
jarlist.cache 120B
NoteEditActivity.class 26KB
NotesListActivity.class 23KB
GTaskManager.class 18KB
GTaskClient.class 17KB
SqlNote.class 12KB
NotesPreferenceActivity.class 12KB
DataUtils.class 9KB
NotesProvider.class 9KB
WorkingNote.class 9KB
DateTimePicker.class 9KB
NotesDatabaseHelper.class 8KB
TaskList.class 8KB
Task.class 7KB
NotesListActivity$ModeCallback.class 7KB
NoteEditText.class 6KB
BackupUtils$TextExport.class 6KB
NotesListAdapter.class 6KB
AlarmAlertActivity.class 6KB
SqlData.class 6KB
NoteItemData.class 6KB
Note$NoteData.class 6KB
NoteWidgetProvider.class 5KB
GTaskASyncTask.class 5KB
R$string.class 5KB
Note.class 4KB
GTaskSyncService.class 4KB
NotesListItem.class 4KB
NotesListActivity$OnListItemClickListener.class 4KB
NotesListActivity$3.class 3KB
DateTimePickerDialog.class 3KB
NotesListActivity$NewNoteOnTouchListener.class 3KB
BackupUtils.class 3KB
NotesListActivity$5.class 3KB
GTaskStringUtils.class 3KB
Contact.class 3KB
R$drawable.class 3KB
R$id.class 3KB
NotesListActivity$8.class 3KB
AlarmInitReceiver.class 2KB
MetaData.class 2KB
NotesListActivity$2.class 2KB
DropdownMenu.class 2KB
DateTimePicker$2.class 2KB
FoldersListAdapter.class 2KB
Node.class 2KB
Notes.class 2KB
DateTimePicker$3.class 2KB
ResourceParser.class 2KB
NotesListActivity$BackgroundQueryHandler.class 2KB
NotesListActivity$6.class 2KB
NotesListActivity$1.class 1KB
NotesPreferenceActivity$1.class 1KB
NotesPreferenceActivity$5.class 1KB
NotesListActivity$ModeCallback$1.class 1KB
NotesPreferenceActivity$GTaskReceiver.class 1KB
ResourceParser$NoteItemBgResources.class 1KB
NotesPreferenceActivity$7.class 1KB
DateTimePickerDialog$1.class 1KB
NotesPreferenceActivity$8.class 1KB
NotesListActivity$ListEditState.class 1KB
NotesPreferenceActivity$4.class 1KB
DateTimePicker$4.class 1KB
NotesListActivity$ModeCallback$2.class 1KB
NoteEditActivity$3.class 1KB
NotesListActivity$7.class 1KB
FoldersListAdapter$FolderListItem.class 1KB
NoteWidgetProvider_2x.class 1KB
NoteWidgetProvider_4x.class 1KB
NotesListActivity$4.class 1KB
NotesPreferenceActivity$6.class 1KB
NoteEditActivity$2.class 1KB
DateTimePicker$1.class 1KB
NoteEditText$1.class 1KB
GTaskSyncService$1.class 1008B
ResourceParser$NoteBgResources.class 1000B
Notes$NoteColumns.class 998B
GTaskASyncTask$1.class 986B
NoteEditActivity$1.class 961B
Notes$CallNote.class 943B
DropdownMenu$1.class 940B
Notes$TextNote.class 939B
NotesPreferenceActivity$2.class 938B
NotesPreferenceActivity$3.class 934B
ResourceParser$WidgetBgResources.class 931B
R$layout.class 897B
R.class 879B
AlarmReceiver.class 876B
R$style.class 867B
ResourceParser$TextAppearanceResources.class 860B
NoteEditActivity$HeadViewHolder.class 854B
ActionFailureException.class 763B
NetworkFailureException.class 759B
Notes$DataColumns.class 666B
R$menu.class 617B
R$dimen.class 579B
Notes$DataConstants.class 558B
R$xml.class 496B
共 344 条
- 1
- 2
- 3
- 4
资源评论
yxkfw
- 粉丝: 82
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功