Skip to content

Commit

Permalink
hzuapps#4 实验四代码
Browse files Browse the repository at this point in the history
  • Loading branch information
halolol committed Mar 27, 2019
1 parent ab5a8bd commit e0e954f
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aishop">

<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=".DetailActivity"
android:label="更多详情"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".ShowActivity"
android:label="商品详情"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.aishop;

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;

public class DetailActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = 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();
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.aishop;

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;

public class MainActivity extends AppCompatActivity {
private EditText et_name;
private Button btn_send;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_name=(EditText)findViewById(R.id.et_name);
btn_send=(Button)findViewById(R.id.btn_send);
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
passDate();
}
});
}

private void passDate() {
Intent intent=new Intent(this,ShowActivity.class);
intent.putExtra("the moon and sixpence",et_name.getText().toString().trim());
startActivity(intent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.aishop;

import android.content.Intent;
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.widget.TextView;
import org.w3c.dom.Text;

public class ShowActivity extends AppCompatActivity {

private TextView tv_name;
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show);
Intent intent=getIntent();
String name=intent.getStringExtra("the moon and sixpence");
tv_name=(TextView)findViewById(R.id.tv_name);
tv_name.setText("bookname:"+name);
textView=(TextView)findViewById(R.id.sp);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(ShowActivity.this,DetailActivity.class);
startActivity(intent);
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:background="@color/mycolor2"
tools:context=".DetailActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_detail" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="@color/mycolor"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Welcome to AiShop"
android:gravity="center"
android:textSize="40dp"
/>

<LinearLayout
android:id="@+id/regist_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="46dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Please enter"
android:textSize="20dp" />

<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
android:hint="请输入你要搜索的商品名"
android:textSize="20dp" />
</LinearLayout>
<Button
android:id="@+id/btn_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:text="搜索"
/>

<TextView
android:id="@+id/shop"
android:layout_width="600dp"
android:layout_height="600dp"
android:layout_alignTop="@+id/btn_send"
android:layout_marginTop="34dp"
android:drawableTop="@drawable/shop" />
</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/mycolor2"
tools:context=".ShowActivity"
android:orientation="vertical"
>

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:textSize="20dp"
tools:ignore="MissingConstraints" />

<TextView
android:id="@+id/sp"
android:layout_width="394dp"
android:layout_height="621dp"
android:drawableTop="@drawable/sp"
android:text="¥24.80"
android:textColor="@color/red"
android:textSize="30dp"
tools:ignore="MissingConstraints" />
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".DetailActivity"
tools:showIn="@layout/activity_detail">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="商品名称:月亮与六便士
作者:毛姆 著
ISBN号:9787533936020
出版社:浙江文艺出版社
版次:1
开本:32开
定价:39.80
出版时间:2017-01-10
印刷时间:2017-10-01
印次:7"
android:textSize="30dp"
tools:ignore="MissingConstraints" />
<ImageView
android:id="@+id/xq"
android:layout_width="600dp"
android:layout_height="150dp"
android:layout_marginTop="370dp"
android:layout_marginBottom="50dp"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/xq" />
</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ShowActivity"
tools:showIn="@layout/activity_show">


</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="mycolor">#87ceeb</color>
<color name="mycolor2">#deb887</color>
<color name="red">#FF0000</color>
<color name="black">#000000</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<string name="app_name">Aishop</string>
<string name="title_activity_show">ShowActivity</string>
<string name="title_activity_detail">DetailActivity</string>
</resources>

0 comments on commit e0e954f

Please sign in to comment.