Skip to content

Commit

Permalink
hzuapps#5 实验5
Browse files Browse the repository at this point in the history
  • Loading branch information
chinesehope committed Jun 2, 2018
1 parent de52a93 commit 7eb64eb
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 11 deletions.
12 changes: 10 additions & 2 deletions soft1614080902345/App/Java/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,28 @@
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
private Button runbutton;
private Button runbutton,run2button;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
runbutton=(Button) findViewById(R.id.button);
runbutton=(Button) findViewById(R.id.button1);
run2button=(Button) findViewById(R.id.button2);
runbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent =new Intent(MainActivity.this,RunActivity.class);
startActivity(intent);
}
});
run2button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent =new Intent(MainActivity.this,Run2.class);
startActivity(intent);
}
});

}
}
51 changes: 51 additions & 0 deletions soft1614080902345/App/Java/Run2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.administrator;

import android.app.Activity;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ShareActionProvider;
import android.widget.Toast;

public class Run2 extends Activity{
private Button send;
private EditText name,message,phone;
private SharedPreferences pref;
private SharedPreferences.Editor editor;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.run2);
name=(EditText)findViewById(R.id.name);
message=(EditText)findViewById(R.id.message);
phone=(EditText)findViewById(R.id.phone);
send=(Button)findViewById(R.id.send);
pref=getSharedPreferences("JZmessage",MODE_PRIVATE);
editor=pref.edit();

}
public void fabu(View v){
switch (v.getId()){
case R.id.send:
String Name=name.getText().toString();
String Message=message.getText().toString();
String Phone=phone.getText().toString();
editor.putString("发布人姓名",Name);
editor.putString("发布人电话",Phone);
editor.putString("兼职信息",Message);
editor.commit();
Toast.makeText(Run2.this,"登记成功",Toast.LENGTH_LONG).show();


}
}
}
7 changes: 7 additions & 0 deletions soft1614080902345/App/Main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
android:label="@string/run_name">

</activity>
<activity
android:name=".Run2"
android:screenOrientation="portrait"
android:label="兼职页面">

</activity>

</application>

</manifest>
42 changes: 33 additions & 9 deletions soft1614080902345/App/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,38 @@
android:label="@string/app_name"
>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="81dp">


<Button
android:layout_marginTop="100dp"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="接受兼职"
android:textSize="16sp"

tools:layout_editor_absoluteX="169dp"
tools:layout_editor_absoluteY="272dp" />
<Button
android:layout_marginTop="100dp"
android:layout_marginLeft="30dp"
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发布兼职"
android:textSize="16sp"

tools:layout_editor_absoluteX="169dp"
tools:layout_editor_absoluteY="272dp" />
</LinearLayout>



<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进入兼职"
android:textSize="16sp"
tools:layout_editor_absoluteX="159dp"
tools:layout_editor_absoluteY="284dp"
tools:ignore="MissingConstraints" />
</android.support.constraint.ConstraintLayout>
86 changes: 86 additions & 0 deletions soft1614080902345/App/res/layout/run2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="兼职信息:"
android:layout_gravity="center"
android:textSize="25sp"
android:textColor="#000000"/>

<EditText
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="200dp"
android:ems="500"
android:inputType="text"
android:hint="@string/put_hint" />

</LinearLayout>
<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"

android:text="姓 名:"
android:textSize="25sp"
android:textColor="#000000"/>
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />

</LinearLayout>
<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="电话号码:"
android:textSize="25sp"
android:textColor="#000000"/>
<EditText
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone" />
</LinearLayout>


<Button
android:id="@+id/send"
android:onClick="fabu"
android:layout_marginTop="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="发 布"
android:textSize="30sp"/>
</LinearLayout>
</LinearLayout>
1 change: 1 addition & 0 deletions soft1614080902345/App/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<string name="app_name">小兼职</string>
<string name="run_name">兼职页面</string>
<string name="search_hint">请输入搜索的兼职信息</string>
<string name="put_hint">请输入发布的兼职信息(简要概述)</string>
</resources>
Binary file added soft1614080902345/实验5截图1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added soft1614080902345/实验5截图2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added soft1614080902345/实验5截图3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added soft1614080902345/实验5截图4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added soft1614080902345/实验5截图5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7eb64eb

Please sign in to comment.