Skip to content

Commit

Permalink
hzuapps#2 hzuapps#30 第二次作业
Browse files Browse the repository at this point in the history
  • Loading branch information
mokulai committed Apr 16, 2017
1 parent a70d111 commit 289017e
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package edu.hzuapps.androidlabs.homeworks.net1414080903240;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

Expand All @@ -14,18 +10,8 @@ public class Net1414080903240Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
setContentView(R.layout.newaccount);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package edu.hzuapps.androidlabs.homeworks.net1414080903240;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

import com.google.android.gms.common.api.GoogleApiClient;

public class NewAccount extends AppCompatActivity {
private Spinner spinner1;
private EditText value;
private Button btn_send;
private GoogleApiClient client;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newaccount);
value = (EditText) findViewById(R.id.et_value);
spinner1 = (Spinner) findViewById(R.id.spinner1);
btn_send = (Button) findViewById(R.id.button);
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

Intent intent = new Intent(NewAccount.this,OrderRecord.class);
intent.putExtra("value",value.getText().toString().trim());
intent.putExtra("spinner1",spinner1.getSelectedItem().toString().trim());
startActivity(intent);
}
});


}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.hzuapps.androidlabs.homeworks.net1414080903240;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class OrderRecord extends AppCompatActivity {
private TextView tv_value,tv_cla;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.orderrecord);
Intent intent=getIntent();
String value=intent.getStringExtra("value");
String cla=intent.getStringExtra("spinner1");
tv_value=(TextView)findViewById(R.id.tt_value);
switch(cla){
case "娱乐":
tv_cla=(TextView)findViewById(R.id.cheer_value);
break;
case "饮食":
tv_cla=(TextView)findViewById(R.id.food_value);
break;
case "车费":
tv_cla=(TextView)findViewById(R.id.car_value);
break;
case "服装":
tv_cla=(TextView)findViewById(R.id.dress_value);
break;
case "礼品":
tv_cla=(TextView)findViewById(R.id.gift_value);
break;
}
tv_value.setText(value);
tv_cla.setText(value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.hzuapps.androidlabs.homeworks.net1414080903240;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class mainActivity extends AppCompatActivity {
private Button btn_send1;
private Button btn_send2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


btn_send1 = (Button) findViewById(R.id.button1);
btn_send2 = (Button) findViewById(R.id.button2);
btn_send1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mainActivity.this,NewAccount.class);
startActivity(intent);
}
});

btn_send2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mainActivity.this,OrderRecord.class);
startActivity(intent);
}
});
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>

<Button
android:id="@+id/button1"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginTop="143dp"
android:text="新增账目"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />

<Button
android:id="@+id/button2"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginTop="63dp"
android:text="查看当前账目"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true" />

</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>

<LinearLayout
android:id="@+id/regist_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"

android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
>
<TextView

android:layout_width="80dp"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="5dp"
android:text="消费金额:"

/>

<EditText
android:inputType="number"
android:id="@+id/et_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入您的本次的消费金额"
android:textSize="14dp"
/>

</LinearLayout>
<LinearLayout
android:id="@+id/regist_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/regist_username"

android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:orientation="horizontal"

>
<TextView

android:layout_width="120dp"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="7dp"
android:text="选择消费类型:"

/>



</LinearLayout>
<Spinner
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/languages"
android:layout_marginTop="11dp"
android:layout_below="@+id/regist_password"
android:layout_alignLeft="@+id/regist_password"
android:layout_alignStart="@+id/regist_password" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:text="提交消费记录"
android:layout_below="@+id/regist_password"
android:layout_centerHorizontal="true" />

</RelativeLayout>
Loading

0 comments on commit 289017e

Please sign in to comment.