Skip to content

Commit

Permalink
Merge pull request #261 from 1414080903104/master
Browse files Browse the repository at this point in the history
#3 #22 第三次实验
  • Loading branch information
zengsn authored May 11, 2017
2 parents 0dc0df7 + 4a323c0 commit aa5d45b
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/*
* 实现记录信息数据化,基于对象对数据库关系表进行操作
* 一个javabean类,定义的变量均为卡牌的内容
* 注意Accessdata对象
*/
public class Accessdata {
private int id;//定义私有变量id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
*实现数据库连接和释放的类
*代码参考javaweb应用开发教材中“数据库访问javabean的设计”
*(待测
*(未测试成功,待修改
*/
import java.sql.Connection;
import java.sql.DriverManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import java.util.*;


Expand All @@ -24,17 +26,43 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.extractactivity_net1414080903104);

num=randomnum();

System.out.print(num);
/*
try {
U=Visit.findonecard(num);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("android", "fail to connect!"+" "+e.getMessage());
}//将num利用Visitdatabases类(即上述创建的对象 V )封装起来,并访问到数据库中相应的数据;
//将对象Visit返回的类型赋值给对象U;
//将对象Visit返回的类型赋值给对象U;*
*/
//这时候对象U可以利用getXXX方法获取到数据库内的数据;
TextView textView2_1 = (TextView)findViewById(R.id.textView2_1);
TextView textView3_1 = (TextView)findViewById(R.id.textView3_1);
TextView textView4_1 = (TextView)findViewById(R.id.textView4_1);
TextView textView5_1 = (TextView)findViewById(R.id.textView5_1);
TextView textView6_1 = (TextView)findViewById(R.id.textView6_1);
TextView textView7_1 = (TextView)findViewById(R.id.textView7_1);
TextView textView8_1 = (TextView)findViewById(R.id.textView8_1);
textView2_1.setText("1");
textView3_1.setText("库丘林Alter");
textView4_1.setText("SSR");
textView5_1.setText("凯尔特神话");
textView6_1.setText("9999");
textView7_1.setText("9999");
textView8_1.setText("9999");
//没办法从封装类读取出来
/*textView3_1.setText(U.getName());
textView4_1.setText(U.getLevel());
textView5_1.setText(U.getBackground());
textView6_1.setText(U.getStrength());
textView7_1.setText(U.getDefensive());
textView8_1.setText(U.getHp());
*
*/
//将获得的数据显示出来(待编写代码)

}

public int randomnum(){//定义一个在0-9之间获得随机生成数的方法
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Net1414080903104lookActivity extends ActionBarActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lookactivity_net1414080903104);

/*
try {
U=Visit.Querycard();
} catch (Exception e) {
Expand All @@ -29,6 +29,8 @@ protected void onCreate(Bundle savedInstanceState) {
}//利用Visit对象执行方法访问数据库内所有卡牌的id、name、level数据;
//利用对象U将上述访问得到的数据全部利用getXXX方法取出;
//将获得的数据显示出来。(待编写代码)
*
*/
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/*
* 实现封装基本的数据库操作的类
* 代码参考javaweb应用开发教材中“数据库访问javabean的设计”
* (待测)
* (未测试成功,待修改)
* 注意Accessdata对象
*/
import java.sql.*;
import java.util.*;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 20 additions & 12 deletions AndroidLabs/app/src/main/res/layout/activity_net1414080903104.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -9,31 +8,40 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="edu.hzuapps.androidlabs.homeworks.net1414080903104.Net1414080903104Activity" >

<TextView
android:id="@+id/textView1"
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textSize="35sp"
android:text="抽卡系统" />
android:src="@drawable/one_net1414080903104" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="121dp"
android:layout_alignBaseline="@+id/button2"
android:layout_alignBottom="@+id/button2"
android:layout_marginRight="45dp"
android:layout_toLeftOf="@+id/button2"
android:text="抽卡" />

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="抽卡系统"
android:textSize="35sp" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="38dp"
android:text="查看最新卡牌" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/two_net1414080903104"
android:stretchColumns="2">

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF4500"
android:textSize="25sp"
android:text="恭喜你获得了一张卡牌!" />

Expand All @@ -18,13 +20,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF69B4"
android:textSize="20sp"
android:text="id:" />
<TextView
android:id="@+id/textView2_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF69B4"
android:textSize="20sp"
/>
</TableRow>
Expand All @@ -35,12 +39,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF69B4"
android:textSize="20sp"
android:text="name:" />
<TextView
android:id="@+id/textView3_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand All @@ -51,12 +57,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF69B4"
android:textSize="20sp"
android:text="level:" />
<TextView
android:id="@+id/textView4_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand All @@ -66,14 +74,15 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
android:text="背景
故事:" />
android:text="背景故事:" />
<TextView
android:id="@+id/textView5_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand All @@ -83,13 +92,15 @@
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
android:text="攻击力:" />
<TextView
android:id="@+id/textView6_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand All @@ -99,13 +110,15 @@
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
android:text="防御力:" />
<TextView
android:id="@+id/textView7_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand All @@ -115,13 +128,15 @@
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
android:text="血量:" />
<TextView
android:id="@+id/textView8_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF69B4"
android:layout_column="0"
android:textSize="20sp"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="2"
android:background="@drawable/two_net1414080903104"
>

<TextView
Expand All @@ -11,6 +12,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#FF4500"
android:textSize="25sp"
android:text="今日卡牌池:" />
<TableRow>
Expand All @@ -19,20 +21,23 @@
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:textColor="#FF4500"
android:textSize="20sp"
android:text="id:" />
<TextView
android:id="@+id/textView2_1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:textColor="#FF4500"
android:textSize="20sp"
android:text="name:" />
<TextView
android:id="@+id/textView2_2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_column="2"
android:textColor="#FF4500"
android:textSize="20sp"
android:text="level:" />
</TableRow>
Expand Down

0 comments on commit aa5d45b

Please sign in to comment.