forked from hzuapps/android-labs-2018
-
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
10 changed files
with
397 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.jeremy.soft1613071002205"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name="com.example.jeremy.soft1613071002205.主界面"> | ||
|
||
</activity> | ||
|
||
<activity | ||
android:name="com.example.jeremy.soft1613071002205.User"> | ||
|
||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
25 changes: 25 additions & 0 deletions
25
Soft1613071002205/app5/src/main/java/com/example/jeremy/soft1613071002205/Main2Activity.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,25 @@ | ||
package com.example.jeremy.soft1613071002205; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.TextView; | ||
|
||
public class Main2Activity extends AppCompatActivity { | ||
private TextView mTextViewGetUserName; | ||
private TextView mTextViewGetPassword; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.mynews); | ||
mTextViewGetUserName = (TextView) findViewById(R.id.textView2); | ||
mTextViewGetPassword = (TextView) findViewById(R.id.textView3); | ||
Bundle b = getIntent().getBundleExtra("data"); | ||
String getStringUserName = b.getString("username"); | ||
mTextViewGetUserName.setText(getStringUserName); | ||
String getStringPassword = b.getString("password"); | ||
mTextViewGetPassword.setText(getStringPassword); | ||
|
||
|
||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
Soft1613071002205/app5/src/main/java/com/example/jeremy/soft1613071002205/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,57 @@ | ||
package com.example.jeremy.soft1613071002205; | ||
|
||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private Button 登录; | ||
private EditText 用户名; | ||
private EditText 密码; | ||
private SharedPreferences mSharePreferences; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
mSharePreferences = getSharedPreferences("data", MODE_PRIVATE); | ||
|
||
用户名 = (EditText) findViewById(R.id.editText); | ||
密码 = (EditText) findViewById(R.id.editText2); | ||
//取出数据并渲染 | ||
|
||
登录 = (Button) findViewById(R.id.login); | ||
登录.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
String stringUsername = 用户名.getText().toString(); | ||
String stringPassword = 密码.getText().toString(); | ||
// 2. 调用SharedPreferences.edit()方法,返回SharedPreferences.Editor对象,用于写入数据; | ||
SharedPreferences.Editor editor = mSharePreferences.edit(); | ||
//3. 调用SharedPreferences.Editor.putXxx(String key, xxx Value)方法以键值对的形式保存数据; | ||
editor.putString("user", stringUsername); | ||
editor.putString("password", stringPassword); | ||
// 4. 调用SharedPreferences.Editor.commit()方法提交数据。 | ||
editor.commit(); | ||
|
||
Intent intent = new Intent(MainActivity.this, User.class); | ||
Bundle bundle = new Bundle(); | ||
bundle.putString("username", stringUsername); | ||
bundle.putString("password", stringPassword); | ||
intent.putExtra("data", bundle); | ||
|
||
startActivity(intent); | ||
} | ||
|
||
}); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Soft1613071002205/app5/src/main/java/com/example/jeremy/soft1613071002205/User.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,28 @@ | ||
package com.example.jeremy.soft1613071002205; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import java.util.Map; | ||
|
||
public class User extends AppCompatActivity { | ||
|
||
private Button mReturnButton; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.mynews); | ||
mReturnButton = (Button)findViewById(R.id.returnback); | ||
} | ||
public void back_to_login(View view) { | ||
Intent intent3 = new Intent(User.this,MainActivity.class) ; | ||
startActivity(intent3); | ||
finish(); | ||
} | ||
|
||
|
||
} |
13 changes: 13 additions & 0 deletions
13
Soft1613071002205/app5/src/main/java/com/example/jeremy/soft1613071002205/主界面.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,13 @@ | ||
package com.example.jeremy.soft1613071002205; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class 主界面 extends AppCompatActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.home); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
Soft1613071002205/app5/src/main/java/com/example/jeremy/soft1613071002205/信息发布.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,32 @@ | ||
package com.example.jeremy.soft1613071002205; | ||
|
||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
public class 信息发布 extends AppCompatActivity { | ||
|
||
private Button 信息发布; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.home); | ||
|
||
|
||
信息发布 = (Button) findViewById(R.id.button); | ||
信息发布.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(信息发布.this,主界面.class); | ||
startActivity(intent); | ||
} | ||
|
||
}); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
Soft1613071002205/app5/src/main/res/layout/activity_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,70 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/linearLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/homepage" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/textView2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="13dp" | ||
android:layout_marginRight="13dp" | ||
android:layout_marginTop="195dp" | ||
android:text="welcome the part-time life!" | ||
android:textSize="30sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<EditText | ||
android:id="@+id/editText" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="48dp" | ||
android:layout_marginStart="48dp" | ||
android:hint="用户名" | ||
android:textColorHint="#ff00ff" | ||
android:textSize="20sp" | ||
app:layout_constraintBaseline_toBaselineOf="@+id/editText2" | ||
app:layout_constraintStart_toStartOf="@+id/textView" /> | ||
|
||
<EditText | ||
android:id="@+id/editText2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="196dp" | ||
android:layout_marginStart="196dp" | ||
android:layout_marginTop="288dp" | ||
android:hint="密码" | ||
android:inputType="numberPassword" | ||
android:textColorHint="#ff00ff" | ||
android:textSize="20sp" | ||
app:layout_constraintStart_toStartOf="@+id/textView" | ||
app:layout_constraintTop_toTopOf="@+id/textView" /> | ||
|
||
<Button | ||
android:id="@+id/login" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="216dp" | ||
android:layout_marginStart="216dp" | ||
android:layout_marginTop="356dp" | ||
android:text="登录" | ||
app:layout_constraintStart_toStartOf="@+id/textView" | ||
app:layout_constraintTop_toTopOf="@+id/textView" /> | ||
|
||
|
||
|
||
|
||
</android.support.constraint.ConstraintLayout> |
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,64 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/textView3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/homepage" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_input_content" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_marginBottom="9dp" | ||
android:layout_marginEnd="35dp" | ||
android:layout_marginLeft="31dp" | ||
android:layout_marginRight="35dp" | ||
android:layout_marginStart="31dp" | ||
android:layout_marginTop="223dp" | ||
android:text="请输入兼职信息" | ||
android:textColor="#333333" | ||
android:textSize="65px" | ||
app:layout_constraintBottom_toTopOf="@+id/et_content" | ||
app:layout_constraintEnd_toEndOf="@+id/et_content" | ||
app:layout_constraintHorizontal_bias="0.0" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<EditText | ||
android:id="@+id/et_content" | ||
android:layout_width="302dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="34dp" | ||
android:layout_marginLeft="31dp" | ||
android:layout_marginStart="31dp" | ||
android:inputType="textMultiLine" | ||
android:lines="5" | ||
android:singleLine="true" | ||
app:layout_constraintBottom_toTopOf="@+id/bt_send" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/tv_input_content" /> | ||
|
||
<Button | ||
android:id="@+id/bt_send" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="28dp" | ||
android:layout_marginLeft="132dp" | ||
android:layout_marginStart="132dp" | ||
android:height="30px" | ||
android:text="send" | ||
android:textColor="#ff3333" | ||
android:textSize="20px" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/et_content" /> | ||
|
||
</android.support.constraint.ConstraintLayout> |
Oops, something went wrong.