/*
* 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
没有合适的资源?快使用搜索试试~ 我知道了~
小程序 源码小米系列之小米便签(源码+截图).rar
共358个文件
png:145个
class:110个
java:41个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 69 浏览量
2023-03-19
20:07:03
上传
评论
收藏 7.75MB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序 源码小米系列之小米便签(源码+截图).rar (358个子文件)
resources.ap_ 879KB
Notes.apk 969KB
NoteEditActivity.class 26KB
NotesListActivity.class 24KB
GTaskManager.class 19KB
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_4x.class 1KB
NoteWidgetProvider_2x.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
NotesListAdapter$AppWidgetAttribute.class 489B
共 358 条
- 1
- 2
- 3
- 4
资源评论
荣华富贵8
- 粉丝: 217
- 资源: 7653
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Delphi12 控件之dotConnect-for-SQL-Server-v5.1.104-Professional.rar
- JAVA的SpringBoot低代码快速开发平台源码带教程数据库 MySQL源码类型 WebForm
- Java实现俄罗斯方块小游戏.zip学习资料
- Delphi 12 控件之dotConnect-for-MySQL-v9.3.104-Professional.rar
- Delphi 12 控件之openssl-1.0.2q-x64-86-win64.rar
- JAVA的SpringBoot基于若依项目工时统计成本核算管理源码带教程数据库 MySQL源码类型 WebForm
- Delphi 12 控件之易语言百度网盘一刻相册上传文件+下载文件例子.rar
- 安然chuxing-12.01
- Android程序员向导(全面、基础型的Android编程教程)chm版最新版本
- PHP客户关系CRM管理系统源码带文字搭建教程数据库 MySQL源码类型 WebForm
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功