基于Android的记事本APP设计与实现有源码加论文

                                                       摘要

         随着智能手机发展越来越迅猛,手持智能手机的人越来越多,尤其是价格合理的android手机。人们已经习惯用手机来处理一些事情,尤其用手机的记事本或者标签来记录日常工作的事物,在这种情况下,开发一款基于android平台的简单实用的记事本很有必要,可以在很大程度上方便人们的生活。此次课题研究的目标是在android系统上,实现一款能够流畅运行记事本应用,并支持多种记事方式。目前来说,利用android 强大的SDK工具包以及eclipse完善的开发功能,可以比较容易的实现这样一款应用。论文主要论述了这款应用的需求场景以及系统设计和实现,其中这款应用具有两大特色:第一个特色是可以添加闹钟提醒,并且可以设置闹钟提醒次数和提醒次数;第二个特色是同时支持音频记事和图片记事,并且图片记事灵活,可以添加多张图片。论文中最终实现了一款基于android系统的记事本应用YYnote,此应用的主要功能有添加文本,添加多张图片,录制音频以及为记事添加闹钟提醒,同时还可以分享记事,整个应用在android4.0上运行流畅。关键词:安卓系统,记事本,闹钟提醒,图片记事,音频记事

        AbstractWith the rapid development of smart phones increasingly, more and more people handdle smart phones, especially affordable android phone, People have become accustomed to using a mobile phone to deal with some things, especially with the phone's notepad or tag to record their daily work things, develop a simple and practical Notepad that based on android platform is necessary.The research goal is achieve a smooth running notepad application that run on android system and supports a variety of ways Notepad. Currently, use of the powerful android SDK toolkit and the complete development eclipse,it will be easy to achieve such an application. This paper discusses the application requirements and the system design and implementation.This application has two characteristics: The first feature is it can add a alarm for reminder,and you can set the reminder times and reminder interval.The second feature is it supports both audio notes and pictures notes, and the pictures notes is very flexible, you can add multiple pictures.Paper finally realized a notepad application named YYnote,which is based on android system. The main function of this application is to add text, add multiple pictures, record audio as well as add alarm reminders, also it can share the notes. The entire application runs smoothly on android4. 0 system.Keywords: android, Notepad, alarm reminders, picture notes,audio notes

        目的和意义目前移动设备发展的越来越迅速,每天的设备激活数目就达到了50万台,手机平板的使用越来越普遍,而Android[1]软件的开发也变得越来越行。互联网行业的巨头基本都有关于Android的开发项目,同时像Motorola移动、HTC、华为更是开发基于Android操作系统的手机设备。可以看出Android的市场份额越来越大,发展前景很广阔。在现代社会生活中,人们的工作越来越忙,生活琐事也越来越多,每天要做的事情总是很多,人们需要用一种方式来安排自己每天的生活,在移动设备发展之前,一些人选择用一个小本子或者便签贴来记录事情,或者安排自己的日常活动。但是,用小本子或者便签贴有很多不方便之处,例如,我们可能随时随地都需要记一些东西,这就需要我们随身携带一个本子,很不方便;再者,它们是死的,没有提醒功能,虽然我们可以把要做的事情写下来,但是到了一定的时间点,没有提醒,我们仍然可能会忘记。现在,人们可以利用智能手机[2]做很多事情,发微薄,聊微信等等。在这种情况下,开发一款智能手机上的记事本,不仅实用,而且还克服了用传统方式记事的缺点,可以随时随地的记录任何信息,在生活工作中,一些重要的事情设置提醒,时间到了,手机自然会提醒我们该做什么,不用担心会忘记事情,这将大大方便人们的生活。此外,根据现在人们的生活习惯爱好,还将增加更多更实用的功能,例如分享功能,拍照功能等。此次课题就是希望开发一款基于Android手机设备的记事本应用,方便人们的生活。另外,作为即将投身互联网[3]行业的我们,学习最新的互联网技术是必须的。Android记事本是Android系统的基本功能,对于我们而言,开发Android记事本,可作为我们学习Android开发的入门实战,帮助我们更好的了解Android开发,掌握Android开发的基本技能,对我们将来从事相关方面的研究有很大的帮助。国内外基本研究情况Android系统的发展市场研究机构IDC[4]发布2012年第三季度智能手机系统数据,谷歌Android系统市场占有率依然高居榜首,Q3全球智能手机出货量达1.811亿台,Android占比为75%,苹果iOS的市场份额仅为Android的1/5,Q3为14.9%。Android系统的发展,已经由最初的1.1更新到4.1,而在最新的4.1版本中,更多更新的功能被加进来。其中一个就是“眨眼开锁[5]”,即需要对着手机眨眼以证明其为“真人”,避免被照片等静止图像解锁。这项新功能无疑比以前的解锁方式更加的先进和方便,当它检测到人脸的存在后,会在屏幕上显示“Blink now”,这时对着屏幕眨眼,手机就自动解锁了。另外一个功能是“无障碍操作[6]”,在无障碍操作方面,果冻豆的API[7]将会更加完整,让视力不佳用户能够更好的操作自己的手机;开发者也可根据新的API来实现更完善的辅助功能,延展Android的功能。Android 4.1还加入了强悍的Gesture Mode[8]功能(手势模式),这个功能让使用者可以进行对系统的导航[9],同时结合触摸与滑动等手势进行操作,且支持语音输出。Android 4.1还专门为残疾人设计了插件,通过这个插件消费者可以利用USB或者蓝牙外接[10]盲人输入输出设备,令操作变得更加简单容易。国内外记事本的研究对于记事本的研究,目前国内外有4款比较优秀的记事本应用。分别是Evernote,小米便签,NoteEverything,麦库记事。 Evernote 应用界面清爽,交互人性化,功能强大丰富。具有登陆注册功能,在登录后可以使用;既可以作为日常生活中的记事也可以作为学习笔记使用;可以建立多个笔记本,分别记录不同方面的笔记(比如学习笔记,生活笔记,日记);笔记方面除了编写内容外,还可以支持上传图片、音频、视频、文件等附件以及对文字内容的简单编辑圈点;支持添加标签分类,方便管理;最具特色功能是搜索笔记和发送笔记、地理位置定位[11]和同步[12]功能(在多个设备之间同步笔记,如PC、安卓移动终端、平板、OS设备);缺点是内存占用比较多,而且自带的编辑功能不好用,不仅功能单一,而且对于从其他地方复制来的内容,格式编辑起来更困难。小米便签是MIUI系统自带的应用,相当于简单记事本。界面美观大方,功能简单,可查看和新建便签;设置闹钟提醒(闹钟功能比较单一);除了支持文字内容的便签外,还可以添加图片;交互功能比较丰富,可以选择便签的颜色、字体大小,支持拖动[13]等;另外也支持同步功能;资源占用比较少,但是功能比较单一,没有分类标签、音频[14]等功能,适合做一些简单的记事。Note Everything称为万能笔记本,界面简单;新建记事功能丰富,支持文本记事、绘图记事、语音记事、条形码[15]记事、google文档记事;可以设置多个文件夹;可以发送记事(发送到日历,发送到google文档[16]等);支持搜索[17]功能;另外可以更改外观主题,字体大小颜色等;但是它界面不够美观,用户体验不是很好,没有闹钟功能。麦库记事界面简单,功能比较多,类似于evernote,但有很多不同。支持分类、添加标签、搜索功能;支持上传附件;支持拍照和实时录音笔记;具有同步功能,需要注册。最有特色的功能是可以将语音[18]输入转化成文字。缺点同样是界面不够精美,用户体验不好,而且CPU占用多。论文安排本论文一共分为七个大的章节,为了使文章有明显的条理及结构,余下各个章节的内容如下:第二章对本次毕业设计的课题进行需求分析,得出用户的需求并且根据用户的需求设计出基本的功能点。第三章是根据前面的需求分析,对基本的功能进行概要设计以及原型图的绘制。第四章将会详细描述每个功能点的设计方案并且给出流程图设计。第五章是对整个应用系统框架设计的描述以及主要功能点的具体实现方案的详细描述。第六章是对最终实现的系统实例的效果展示。第七章是对此次毕业设计进行总结,分析探讨不足之处,并展望未来的改进和完善工作。在文章最后会对在毕业设计过程中帮助过自己的老师、同学们表达自己最诚挚的谢意及感激。

此次记事本应用的功能主要分为四个模块:记事模块,闹钟模块,分享模块,云端备份模块,主要功能点包括文本记事,图片记事,语音记事,闹钟提醒,分享信息,数据备份。此次记事本开发希望能够开发一款符合用户生活工作习惯的应用,能够满足用户的各方面需求,要求功能完善丰富,具有良好的用户界面和交互体验。功能总体设计如图所示。

部分源码如下:

package com.xue.yynote.activity;

import java.io.IOException;

import com.xue.yynote.R;
import com.xue.yynote.model.ClockModel;
import com.xue.yynote.model.NoteItemModel;
import com.xue.yynote.tools.DBHelper;
import com.xue.yynote.activity.NoteEditActivity;

import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;

public class ClockAlertActivity extends Activity implements OnClickListener,
        OnDismissListener {
    private int mNoteId;
    private String mSnippet;
    private static final int SNIPPET_PREW_MAX_LEN = 60;
    MediaPlayer mPlayer;
    private Vibrator mVibrator;
    private NoteItemModel mNoteModel;
    private ClockModel mClockModel;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        final Window win = getWindow();
        win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

        if (!isScreenOn()) {
            win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                    | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
                    | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
        }

        Intent intent = this.getIntent();

        try {
            mNoteId = Integer.valueOf(intent.getData().getPathSegments().get(1));
            Log.d("ClockAlert", "note_id: " + mNoteId);
            mNoteModel = new NoteItemModel(this, mNoteId);
            mClockModel = this.mNoteModel.getClockModel();

            mSnippet = this.mNoteModel.getContentForItem();
            mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet
                    .substring(0, SNIPPET_PREW_MAX_LEN)
                    + getResources().getString(R.string.note_snippet_info)
                    : mSnippet;
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            return;
        }

        mPlayer = new MediaPlayer();
        this.mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
        this.showActionDialog();
        this.playAlarmSound();

        this.mVibrator.vibrate(new long[] { 1000L, 1000L, 1000L, 1000L }, 0);

    }

    private boolean isScreenOn() {
        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        return pm.isScreenOn();
    }

    private void playAlarmSound() {
        Uri url = RingtoneManager.getActualDefaultRingtoneUri(this,
                RingtoneManager.TYPE_ALARM);

        int silentModeStreams = Settings.System.getInt(getContentResolver(),
                Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);

        if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
            mPlayer.setAudioStreamType(silentModeStreams);
        } else {
            mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
        }
        try {
            mPlayer.setDataSource(this, url);
            mPlayer.prepare();
            mPlayer.setLooping(true);
            mPlayer.start();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private void showActionDialog() {
        AlertDialog.Builder dialog = new AlertDialog.Builder(this);
        dialog.setTitle(R.string.app_name);
        dialog.setMessage(mSnippet);

        dialog.setPositiveButton(R.string.clock_dialog_go, this);
        if (!this.mClockModel.isClockFinished()) {
            dialog.setNeutralButton(R.string.clock_dialog_delete, this);
        }
        if (isScreenOn()) {
            dialog.setNegativeButton(R.string.clock_dialog_known, null);
        }
        dialog.show().setOnDismissListener(this);
    
    }

    public void onClick(DialogInterface dialog, int which) {
        switch (which) {
        case DialogInterface.BUTTON_POSITIVE:
            Intent intent = new Intent(this, NoteEditActivity.class);
            intent.setAction(Intent.ACTION_VIEW);
            intent.putExtra("ID", mNoteId);
            startActivity(intent);
            break;
        case DialogInterface.BUTTON_NEUTRAL:
            // TODO Auto-generated method stub
            this.deleteClock();
            break;
        default:
            break;
        }
    }

    public void deleteClock() {
        Intent intent = new Intent(this, ClockReceiver.class);
        intent.setData(ContentUris.withAppendedId(Uri.parse("content://xue_yynote/note"), this.mNoteModel.getId()));
        //Bundle bundle = new Bundle();
        //bundle.putInt("com.xuewish.xnotes.NOTE_ID", this.mNoteModel.getId());
        //intent.putExtras(bundle);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
                intent, 0);
        // 获取系统进程
        AlarmManager am = (AlarmManager) this
                .getSystemService(Context.ALARM_SERVICE);
        // cancel
        am.cancel(pendingIntent);
        DBHelper dbHelper = DBHelper.getInstance(this);
        dbHelper.delete(DBHelper.TABLE.ALERTS, ClockModel.ID + " = "
                + this.mNoteModel.getClockId(), null);

        this.mNoteModel.setClockId(-1);
        dbHelper.update(DBHelper.TABLE.NOTES,
                this.mNoteModel.formatContentValuesWithoutId(),
                NoteItemModel.ID + " = " + this.mNoteModel.getId(), null);
    }

    public void onDismiss(DialogInterface dialog) {
        stopAlarmSound();
        this.mVibrator.cancel();            
        if (this.mClockModel.isClockFinished()){
            this.deleteClock();
        }else this.mClockModel.addAlertCount();
        
        finish();
    }

    private void stopAlarmSound() {
        if (mPlayer != null) {
            mPlayer.stop();
            mPlayer.release();
            mPlayer = null;
        }
    }

}
更多论文代码咨询可以扫码加我私聊

 

  • 23
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值