Android生日礼物(含拼图游戏,背景音乐,自动拨号等功能实现)--根据代码规范修改注释以及定义
公司培训了编码规范,回头过来看看我以前写过的代码,着实比较烂,缺少必要的注释,以及对于变量名的定义也不甚规范,故借着此次学习,我重新整理下一篇安卓项目的文章,规范下代码,可以用doxygen生成html文件,以便方便别人阅读源码以及以后自己回顾自己的成果,并且希望能够慢慢培养成规范的习惯。
源文章的地址是:http://blog.csdn.net/jjzhoujun2010/article/details/7976858



整个项目的主要思想和步骤是:
1.个性化安装图标的定制。
2.进入程序,播放背景音乐。
3.进行拼图游戏。
4.游戏过关后进入下一个界面,有两个按钮,点击即可实现给指定号码拨号功能。
由于源码我注释得也比较清楚了,直接上源码给大家看吧~
第一个界面的实现代码,Main.java
/** * @file PictureLayout.java * @brief 重新布置打乱后的拼图 * @author zhoujun * @version V1.0.00 * @date 2012/09/12 * Blog: http://blog.csdn.net/jjzhoujun2010*/package com.example.zhangbeta2;import android.content.Context;import android.widget.ImageView;import android.widget.LinearLayout;/** * brief 重新布置打乱后的拼图 * */public class PictureLayout extends LinearLayout{public PictureLayout(Context context, ImageView[][] images) { super(context); setLayout(context, images); setBackgroundColor(0xffff7777);//为了和照片边缘区分开,我添加了背景颜色 }/** * @brief 重新布置打乱后的拼图 * @param view 当前被拆分打乱的照片 * */ private void setLayout(Context context, ImageView[][] view) { LinearLayout linralayout = new LinearLayout(context);linralayout.setOrientation(LinearLayout.VERTICAL);linralayout.setPadding(0, 0, 0, 0);for (int i = 0; i < view.length; i++) { LinearLayout liner = new LinearLayout(context); liner.setOrientation(LinearLayout.HORIZONTAL); int leng = view[i].length; for (int j = 0; j < leng; j++) {ImageView img = (ImageView) view[i][j];liner.addView(img); } linralayout.addView(liner); liner = null;}this.addView(linralayout); }}游戏原图显示,SourceImageAct.java
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.zhangbeta2" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".Main" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SePintu" android:label="@string/label_pintu1"/> <activity android:name=".Method" android:label="@string/method_label"/> <activity android:name=".TheEnd" android:label="@string/label_theEnd"/> <activity android:name=".SourceImageAty" android:label="@string/source_back_label"/> <service android:name=".MusicServer"><intent-filter><action android:name="com.angel.Android.MUSIC"/><category android:name="android.intent.category.default" /></intent-filter></service> </application> <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> </manifest>
应用程序APK下载地址:http://download.csdn.net/detail/jjzhoujun2010/4568777
源码下载地址:http://download.csdn.net/detail/jjzhoujun2010/4635304
参考文章: - - 不好意思,综合看得太多了,记不得那个了,其中拼图的打乱算法我是参考别人的,若有人看到此文章,请告诉我链接,多谢。
原创文章,欢迎转载,转载请注明:blog.csdn.net/jjzhoujun2010
作者:Dream Fly 新浪微博:周军Dream_Fly