第三个Sprint ------第七天
APP.java代码
package com.app.senior_calculator; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast; public class APP extends Activity { // 偏好设置
//private SharedPreferences sp;
//private SharedPreferences.Editor editor; /** level and mode (index) **/
int selectedLevelIndex = 0;
int selectedModeIndex = 0;
int chioceItems;
Bundle bundle = new Bundle(); /** choices **/
private String iconName1 = "选择难度";
private String[] arrayLevel = new String[] { "加减", "乘除", "四则运算(无括号)",
"四则运算(含括号)" };
private String iconName2 = "选择模式";
private String[] arrayModel = new String[] { "Practice", "Examination" };
/** 题目库 **/
private List<Question> source = new ArrayList<Question>(); public void onclick(View v) {
switch (v.getId()) {
case R.id.StartTest:
DialogDifficulty(arrayLevel, iconName1).show();
break;
case R.id.Medol:
DialogDifficulty(arrayModel, iconName2).show();
break;
case R.id.Help:
Toast.makeText(APP.this, " Dont know what to do……",
Toast.LENGTH_SHORT).show();
break;
case R.id.Exit:
Toast.makeText(APP.this, " Closing…………", Toast.LENGTH_SHORT).show();
finish();
break;
}
} /** 定义一个Dialog 展示 level选择 后者为标题 **/
public Dialog DialogDifficulty(final String[] array_data,
final String dialogtitle) {
chioceItems = selectedLevelIndex;
if (dialogtitle.equals("选择难度"))
chioceItems = selectedLevelIndex;
else if (dialogtitle.equals("选择模式"))
chioceItems = selectedModeIndex; Dialog alertDialog;
alertDialog = new AlertDialog.Builder(this, R.style.dialog)
.setTitle(dialogtitle)
.setIcon(R.drawable.diologicon)
.setSingleChoiceItems(array_data, chioceItems,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
if (dialogtitle.equals("选择难度"))
selectedLevelIndex = which;
else if (dialogtitle.equals("选择模式"))
selectedModeIndex = which;
/** 模式传递过去TestView根据模式来设置时间长度. */
bundle.putString("difficulty",
arrayModel[selectedModeIndex]);
}
})
.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
bundle.putString("difficulty",
arrayModel[selectedModeIndex]);
/*
// 确定后保存数据模式跟难度的下标数据..
if (dialogtitle.equals("选择难度"))
editor.putInt("selectedLevelIndex", which); if (dialogtitle.equals("选择模式"))
editor.putInt("selectedModeIndex", which); editor.commit();// 提交修改
*/
/** 在确定难度后跳转出题目 设置模式到时候不跳转. **/
if (dialogtitle.equals("选择难度"))
createexercise();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 实现函数- 。- 调用.
Toast.makeText(APP.this, " canceling ",
Toast.LENGTH_SHORT).show();
}
}).create();
return alertDialog;
} /** 出题模块 根据选择的模式出先不同数量的题目. **/
public void createexercise() {
int totalNumber = 50;
if (arrayModel[selectedModeIndex].equals("Examination"))
totalNumber = 25;
switch (selectedLevelIndex) {
case 0:
source = new ArrayList<Question>();
Toast.makeText(APP.this, String.valueOf(selectedLevelIndex), Toast.LENGTH_LONG)
.show();
new SimpleCreate().simpleExerciseInitation(0, totalNumber, source);
for (int i = 0; i < source.size(); i++)
Log.i("info", source.get(i).getExercise() + "="
+ source.get(i).getAnswer());
bundle.putSerializable("resource", (Serializable) source);
Intent MAintent = new Intent(APP.this, TestView.class);
MAintent.putExtras(bundle);
startActivity(MAintent);
break;
case 1:
source = new ArrayList<Question>();
new SimpleCreate().simpleExerciseInitation(1, totalNumber, source);
for (int i = 0; i < source.size(); i++)
Log.i("info", source.get(i).getExercise() + "="
+ source.get(i).getAnswer());
bundle.putSerializable("resource", (Serializable) source);
Intent intent1 = new Intent(APP.this, TestView.class);
intent1.putExtras(bundle);
startActivity(intent1);
break; case 2:
source = new ArrayList<Question>();
new MidiumCreate().midiumCreateInitation(totalNumber, source);
for (int i = 0; i < source.size(); i++)
Log.i("info", source.get(i).getExercise() + "="
+ source.get(i).getAnswer());
bundle.putSerializable("resource", (Serializable) source);
Intent intent2 = new Intent(APP.this, TestView.class);
intent2.putExtras(bundle);
startActivity(intent2);
break;
case 3:
source = new ArrayList<Question>();
// 出题目验证.
new CreateEFraction().createYouExercisess(totalNumber, source);
for (int i = 0; i < source.size(); i++)
Log.i("info", source.get(i).getExercise() + "="
+ source.get(i).getAnswer());
bundle.putSerializable("resource", (Serializable) source);
Intent intent3 = new Intent(APP.this, TestView.class);
intent3.putExtras(bundle);
startActivity(intent3);
break;
default:
Toast.makeText(APP.this, "errors happend ", Toast.LENGTH_LONG)
.show();
break;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.app);
/*// 获取偏好设置实例
sp = getSharedPreferences("MySP", MODE_PRIVATE);
editor = sp.edit();
editor.putInt("selectedLevelIndex",0);
editor.putInt("selectedModeIndex", 0);
editor.commit();// 提交修改
*/ } }
第三个Sprint ------第七天的更多相关文章
- “数学口袋精灵”App的第三个Sprint计划----开发日记(第一天12.7~第十天12.16)
“数学口袋精灵”第三个Sprint计划----第一天 项目进度: 基本完成一个小游戏,游戏具有:随机产生算式,判断对错功能.通过轻快的背景音乐,音效,给玩家提供一个良好的氛围. 任务分配: 冯美欣: ...
- Lucene.Net 2.3.1开发介绍 —— 三、索引(七)
原文:Lucene.Net 2.3.1开发介绍 -- 三.索引(七) 5.IndexWriter 索引这部分最后讲的是IndexWriter.如果说前面提到的都是数据的结构,那么IndexWriter ...
- “数学口袋精灵”App的第三个Sprint计划(总结与团队感悟)----开发日记
第三阶段Sprint完成情况: 我们的"数学口袋精灵"App已经完成了,该app能随机产生多种形式的算式,比如带括号的,分数四则运算,混合运算,阶乘等,通过游戏形式让用户乐在其中. ...
- “数学口袋精灵”App的第三个Sprint计划----开发日记(第十一天12.17)
项目进度: 基本完成一个小游戏,游戏具有:随机产生算式,判断对错功能.通过轻快的背景音乐,音效,给玩家提供一个良好的氛围. 任务分配: 冯美欣:设计"数学口袋精灵"App图标.整 ...
- 第三个Sprint冲刺总结
第三个Sprint冲刺总结 1.燃尽图 2.本阶段总结: 本阶段主要是对产品进行完善和美化,所以工作量不是很多.但要做精,做好并非是一件简单的事情.我们各组员都安排了各自的任务,如参考各行业的优秀ap ...
- 第三个Sprint冲刺第七天
讨论地点:宿舍 讨论成员:邵家文.李新.朱浩龙.陈俊金 讨论问题:做最后的工作
- 第三个Sprint冲刺第七天(燃尽图)
- 数据结构(三) 用java实现七种排序算法。
很多时候,听别人在讨论快速排序,选择排序,冒泡排序等,都觉得很牛逼,心想,卧槽,排序也分那么多种,就觉得别人很牛逼呀,其实不然,当我们自己去了解学习后发现,并没有想象中那么难,今天就一起总结一下各种排 ...
- 第三个Sprint ------第十一天
四则运算APP推广: 1通过微信公众平台推广APP,写一片软文,然后推送出去.分享朋友圈.QQ空间. 2通过微博推广APP,@各微博大户. 3让之前内侧的同学转发给自己的小弟小妹或者侄女侄子! 总结: ...
随机推荐
- Alpha冲刺! Day7 - 砍柴
Alpha冲刺! Day7 - 砍柴 今日已完成 晨瑶:列了各模块目前的进度情况:确定了纯多媒体流星预览页的显示方式:给工具包函数列表新增了与服务器端的交互:玩华为软件云发现刚好可以试试它的测试,于是 ...
- Android中长度单位和边距
Android表示单位长度的方式通常有三种表示方式. 距离单位☞px:表示屏幕实际的象素.例如,320*480的屏幕在横向有320个象素,在纵向有480个象素 距离单位☞dp:dp = dpi ...
- 转://Oracle补丁及opatch工具介绍
一. CPU(Critical Patch Update) 一个CPU内包含了对多个安全漏洞的修复,并且也包括相应必需的非安全漏洞的补丁.CPU是累积型的,只要安装最新发布的CPU即可,其中包括之前发 ...
- (4)top详解 (每周一个linux命令系列)
(4)top详解 (每周一个linux命令系列) linux命令 top详解 引言:今天的命令是用来看cpu信息的top top 我们先看man top top - display Linux pro ...
- Qt 编程指南 2 Hello Designer
2 Hello Designer ①编辑窗口部件:为窗口拖拽控件(即部件),编辑控件布局等. ②编辑信号/槽:用户在图形界面的一些动作会触发窗口或控件的信号,信号对应的处理函数就是槽函数,这种模式实 ...
- gitlab--ci文件
1.when: manual 手动执行(加到哪个脚本中,哪个就会变成手动执行)
- HashMap的扩容机制---resize()
虽然在hashmap的原理里面有这段,但是这个单独拿出来讲rehash或者resize()也是极好的. 什么时候扩容:当向容器添加元素的时候,会判断当前容器的元素个数,如果大于等于阈值---即当前数组 ...
- PAT A1153 Decode Registration Card of PAT (25 分)——多种情况排序
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...
- Omi框架学习之旅 - 组件通讯(data-*通讯) 及原理说明
上一篇文章说了omi中的组件,以及组件如何使用及嵌套. 那omi中的组件是怎么通讯的呢? 其实omi提供的通讯方式比较丰富,各有千秋,各有各的场景用途.所以按需使用即可. 老规矩:先上demo代码, ...
- MFC入门(一)-- 第一个简单的windows图形化界面小程序(打开计算器,记事本,查IP)
////////////////////////////////序//////////////////////////////// 大约三年前,学过一些简单的编程语言之后其实一直挺苦恼于所写的程序总是 ...