forked from hzuapps/android-labs-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
412 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903240/java/NewAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...pp/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903240/java/OrderRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...p/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903240/java/mainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}); | ||
} | ||
|
||
|
||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...Labs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903240/layout/main.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
82 changes: 82 additions & 0 deletions
82
...pp/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903240/layout/newaccount.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.