第三个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让之前内侧的同学转发给自己的小弟小妹或者侄女侄子! 总结: ...
随机推荐
- Java-栈的学习(字符串的反转)
StackX类 public class StackX{ private int maxSize; private char StackArray[]; private int top; public ...
- 【Ansible 文档】【译文】模版(Jinja2)
Templating (Jinja2) 正如在 variables 部分描述的那样, Ansible 使用Jinja2模版来启用动态表达式和访问变量. Ansible 扩展了许多 filtes 和 t ...
- Android Activity.startActivity流程简介
http://blog.csdn.net/myarrow/article/details/14224273 1. 基本概念 1.1 Instrumentation是什么? 顾名思义,仪器仪表,用于在应 ...
- mini2440裸机试炼之—RTC闹钟中断,节拍中断
版权声明:博客地址:http://blog.csdn.net/muyang_ren.源代码能够在我的github上找看看 https://blog.csdn.net/muyang_ren/articl ...
- 【SpringMVC】关于classpath和contextConfigLocation
[SpringMVC]关于classpath和contextConfigLocation 2017年11月16日 12:05:47 yongh701 阅读数:3624 版权声明:本文为博主原创文 ...
- (转)yum提示Another app is currently holding the yum lock; waiting for it to exit...
文章转自 yum 下载东西突然卡主了,我直接ctrl+c退出,然后再次下载时候出现 Another app is currently holding the yum lock; waiting for ...
- OnlineJudgeServer运行
我在这如下这两篇文章都说过青岛OJ相关的 OnlineJudgeFE之前端二次开发 青岛大学开源OJ平台搭建 今天我还是要来讲讲关于这个青岛OJ. 青岛OJ采用的是完全的前后端分离架构. Online ...
- Python虚拟环境和包管理工具Pipenv的使用详解--看完这一篇就够了
前言 Python虚拟环境是一个虚拟化,从电脑独立开辟出来的环境.在这个虚拟环境中,我们可以pip安装各个项目不同的依赖包,从全局中隔离出来,利于管理. 传统的Python虚拟环境有virtualen ...
- PAT A1145 Hashing - Average Search Time (25 分)——hash 散列的平方探查法
The task of this problem is simple: insert a sequence of distinct positive integers into a hash tabl ...
- 计算机网络协议OSI TCP/IP协议--001
网桥:连接同构的LAN的网络互联设备,(同构的LAN 网是,应用层到逻辑层) 实 现的功能是:MAC子层和物理层.1.帧的发送与接收.2.缓冲的管理.3.协议转换. 路由器:在网络层实现互联,他 ...