Mood Diary App summary data storage + Service + broadcast +listview+ layout +fragment+intent+imagebutton+tabactivity+ artwork

Source: Internet
Author: User
Tags md5 encryption

---restore content starts---

The results are as follows:

The first diagram is the main program interface, which is mainly to show a list of events. Next to the side of the frame is the landing of their own use. You can set a password. You can view feedback and information about such.

Click the icon below the first image to display different content, as follows:

These four pictures are add mood, statistics mood record, set alarm, turn on music. Corresponding to add mood module, statistical mood recording module, ringtone alarm module, music player module

In my opinion, this app is mainly used to record mood, and can play music while writing logs. You can also use the alarm to remind us to write a log. In addition, we can also statistics our recent mood state, for the timely adjustment of work status to provide reference basis.

Of course, there are some other small features of the app, such as deleting logs, editing them, and so on. Don't say it anymore.

Below I say the disadvantage:

After testing I found:

1, in the fourth function module, that is, the music player, the pause button can not be used, the logic is not good implementation, because the bottom is the service to do, so, not very good implementation.

2, music player module, now is simply loading the music in the phone, not to achieve online music playback.

3, in the side-pull interface, because of the time problem, did not share the friend this feature integration up, according to my ideas, can borrow friends of the social components integration, but this need to different platform application Appkey, feel very troublesome, did not do, if later have time, this is necessary to develop.

4, for the third function module----ringtone Reminder module, did not do ringtone selection function, supposedly, the bell can be set by the user, feel the main function of this app is not in this, so did not do.

5, for the second function module----statistical Mood Recording module, we can view the mood trajectory, but did not add the corresponding suggestions, such as when you one months in the majority of bad, did not add some inspirational words.

6, for the first function module----Add Mood module, this module may be added to the smiley face and other icons too little, not given a lot. Some other funny dots may be added later in the icon.

Shortcomings said, I now pull a bit, can achieve the function:

Primarily, the app consists of 5 interfaces: the main interface + 4 functional interfaces.

Main interface: Mainly used to display the mood records of some information, the left side of the box can set a password, exit and other small functions.

Add Mood module: Mainly used to record the mood state of the day, the following smiley can increase or decrease, of course, you can add expression.

Statistical Mood Recording module: Mainly used for statistical mood trajectory, one is the histogram display, one is a line chart display.

Ringtone Reminder module: Mainly used to remind users when to record mood, of course, can also be used as an alarm clock.

Music player: Mainly used for the side write log, listening to music. Music is played in the background.

Interface design:

Just give an example to make an introduction:

Take the main interface to do the introduction:

The entire interface has a large linearlayout linear layout + an include (in fact, this is a nested layout, is to achieve the above title effect) + a listview+ nested a linearlayout ( The reason for this linear layout is because it can be used to achieve the alignment of the four small icons below) + four ImageButton.

So much for that. The code is as follows: (the collapse button can be opened)

<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:background= "@drawable/background"android:orientation= "vertical" >    <includeLayout= "@layout/common_title_bg" />   <ListViewAndroid:id= "@+id/mood_note_list"Android:layout_width= "Fill_parent"Android:layout_height= "400DP"Android:cachecolorhint= "#00000000"Android:divider= "@drawable/line"Android:dividerheight= "1DP"Android:drawselectorontop= "false"Android:fadingedge= "None"android:fastscrollenabled= "true"Android:scrollbars= "vertical"         >    </ListView>    <LinearLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"android:orientation= "Horizontal" >        <ImageButtonAndroid:id= "@+id/addmoodbutton"Android:layout_width= "Match_parent"Android:layout_weight= "1"Android:layout_height= "Wrap_content"Android:layout_alignparentbottom= "true"android:src= "@drawable/write" />        <ImageButtonAndroid:id= "@+id/mood_tendency"Android:layout_width= "Match_parent"Android:layout_weight= "1"Android:layout_height= "Wrap_content"Android:layout_alignparentbottom= "true"android:src= "@drawable/tongji" />        <ImageButtonAndroid:id= "@+id/clock"Android:layout_width= "Match_parent"Android:layout_weight= "1"Android:layout_height= "Wrap_content"Android:layout_alignparentbottom= "true"android:src= "@drawable/clock" />        <ImageButtonAndroid:id= "@+id/music"Android:layout_width= "Match_parent"Android:layout_weight= "1"Android:layout_height= "Wrap_content"Android:layout_alignparentbottom= "true"android:src= "@drawable/music" />    </LinearLayout></LinearLayout>
View Code


The interface does not speak much, I have limited aesthetic ability, no way.

For the interface design this piece, summed up is the utilization of the background, as well as the relationship between the various components, preferably more nested, convenient layout. The general principle is that it looks intuitive and flexible. Focus on the relationship between the group and the group.

Work realization, characteristics and difficulties analysis:

Below I selectively explain some of the features of the implementation mechanism, space is limited. I donuts the other not introduced.

Open the app and show the 3s delay first, then go to the main screen. The main interface is a fragementactivity, the diary display part, mainly uses the database query operation, then will query to the content, through the adapter displays in the ListView. Of course, pressing and holding a column does not move, and the menu options such as delete, view, and so on will appear. Mainly is the database additions and deletions to check the operation. For setting the initial password, it is implemented by Alertdialog. If you do not have a password set, clicking on the menu options launches the dialog box. Two times the password input is consistent, and the input string is stored in sharedpreference after MD5 encryption, and the password is added successfully. The left side pull menu is also a fragment, and the rest is implemented in XML, not much.

Click the First ImageButton button on the main interface, this module function is to add a new mood record. User input mood content, choose mood picture and score for mood. Through activity, of course, this activity is also the activity of viewing notes, if you turn from the view notes, then directly display the corresponding notes. In this case, it involves some operations of the database, implemented through cursor cursors.

The following is the design of the database:

The implementation of this database is implemented in the Moodlogprovider class in the Com.hlb.app package. The name of the database is moodlogdb.db, a total of one table: The fields are as follows:

_ID: Indicates the first few mood record data type int

Mooditem: Mood content String

TIMESTAMP: Time stamp of mood record long

icon_id: Picture of mood column name int

RATING: The mood of the score column name float

For the second function module, is also an activity, the name is Charttabactivity, the function is statistical analysis of the mood of the main activity, inherited the Tabactivity, and add linechartactivity and barchartactivity. Among them, the main function of the linechartactivity is to map the scores of all mood records stored in the database into graphs, showing the mood trend of the month to the user. The chart is drawn primarily through classes such as Graphicalview.

For the third function module, the main interface is an activity, the setting of the alarm clock is used in the system's own Alarmmanager class implementation. It can be used specifically to set a time to complete a specified action or event. Stand-alone "custom Alarm" button, call Timepickerdialog to set the time, and then prompt the user settings to complete, when the alarm to set the point in time, the user is prompted to time. Of course, the Broadcastreceive service is used here, the system is the issuer of the broadcast, the app is the broadcast recipient, and when the time is up, the app starts responding to this event. Then complete the response action. Thought at that time, should use the ringtone to prompt the user, so when the time came, began to play music, 10s stopped. The code is as follows:

 PackageCom.hlb.alarm;ImportCOM.HLB.R;ImportAndroid.content.BroadcastReceiver;ImportAndroid.content.Context;Importandroid.content.Intent;ImportAndroid.media.MediaPlayer;ImportAndroid.widget.Toast; Public classTimereceiveextendsBroadcastreceiver {@Override Public voidOnReceive (Context context, Intent Intent) {MediaPlayer alarmmusic=mediaplayer.create (context,r.raw.test);        Alarmmusic.start (); Toast.maketext (Context,"Your time is up!!!" ", 10). Show (); Try{Thread.CurrentThread (). Sleep (10000);//Delay 10s}Catch(interruptedexception e) {e.printstacktrace ();      } alarmmusic.stop (); }}
View Code

For the fourth function module, is also an activity, the idea is to first pass through the user database, load the music resource file information into a list collection, each element is an instantiation of a Mp3info class, and then customize the Mymusicadapter adapter, Load the data in the list into the ListView. For each element in the ListView, just click to play, of course, can also be achieved through the play button below. Click the Stop button to stop playback.

For features:

Personally feel:

1, can realize the custom mood record

2, can draw mood trajectory, statistics one months or in recent months mood. This will make it easier for us to work in the needs of life.

3, we can listen to music while writing a diary.

4, privacy work done well, we can set the password to prevent others from peeking at your diary.

5, we can also regularly remind themselves to write diaries, beware of forgetting.

6, the third and the fourth function module, can be used alone. Simple, convenient, fast.

For a lot of difficulties, here are just a few small difficulties:

1, drawing. Before, this piece did not how contact, later, slowly look at other people's small demo, slowly realize.

2, how to play music backstage. The first version of the program did not implement this function, to find out, and then through the service finally realized.

3, Bell. How to choose their own personality of the bell, until now, can only play a kind of I pre-set a good bell.

4, custom adapter. Previously used by the system to provide the adapter, in this app, the music player module does not seem to be good.

5, background. How to choose a good background picture, natural, coordinated, creative, this is a difficult point.

6, transduction. Picture selection is not very good, the pictures on the web are not too conform to the specifications, and then distortion after narrowing, this is a problem.

Finally, the basic situation of this project is introduced, and no third-party code base is used, it is the library inside Android.

Reference Document: http://158067568.iteye.com/blog/941338 tabactivity for multi-page display effects

http://www.eoeandroid.com/forum.php?mod=viewthread&tid=205314 uses Android Lint checks to make your app more robust

Http://www.cnblogs.com/angeldevil/p/3725358.html remove unused resources from Android projects

http://blog.csdn.net/a7a9a68/article/details/7778752 TextView Font Color settings

http://blog.csdn.net/sutaizi/article/details/6537330 Android Learning Note (iii) Develop your own simple MP3 player

Http://www.it165.net/pro/html/201404/12667.html android Music player (2) Read music from SD card

http://www.apkbus.com/forum.php?mod=viewthread&tid=42937&highlight=%E9%9F%B3%E4%B9%90%E6%92%AD%E6%94% Be%e5%99%a8 android Music player Resources

Mood Diary App summary data storage + Service + broadcast +listview+ layout +fragment+intent+imagebutton+tabactivity+ artwork

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.