Skip to content

Commit

Permalink
hzuapps#6 第六次实验
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrwuwu12138 committed May 24, 2018
1 parent 28863a7 commit a1366b7
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 204 deletions.
6 changes: 4 additions & 2 deletions soft1614080902220/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.soft1614080902220">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -11,11 +12,12 @@
<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=".laile" />
<activity android:name=".jinru"></activity>
<activity android:name=".Laile" />
<activity android:name=".Jinru" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ protected void onCreate(Bundle savedInstanceState) {
btnOpen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(thisActivity, laile.class);
Intent intent = new Intent(thisActivity, Laile.class);
thisActivity.startActivity(intent);
//thisActivity.startActivityForResult(intent, 2016);
}
});

}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,94 @@
package com.example.administrator.soft1614080902220;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class jinru extends AppCompatActivity {
@Override
public class Jinru extends Activity {
private EditText EditText;
private Button button;
private ImageView imageView;
private Bitmap bitmap;
Handler handler=new Handler(){
public void handleMessage(Message msg) {
if(msg.what==8){
imageView.setImageBitmap(bitmap);
}
};
};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jinru);
final Activity thisActivity = this;
Button btnOpen = (Button) findViewById(R.id.button_open);
btnOpen.setOnClickListener(new View.OnClickListener() {
Button btnclose = (Button) findViewById(R.id.button_close);
btnclose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(thisActivity,MainActivity.class);
thisActivity.startActivity(intent);
//thisActivity.startActivityForResult(intent, 2016);
}
});

}}
Button btnclose1 = (Button) findViewById(R.id.button_close1);
btnclose1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(thisActivity,Laile.class);
thisActivity.startActivity(intent);
}
});
EditText=(EditText) findViewById(R.id.imagepath);
button=(Button) findViewById(R.id.upload);
imageView=(ImageView) findViewById(R.id.imageView);
//给下载按钮添加一个监听
button.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
new Thread(t).start();
}
});
}
//为了下载图片资源,添加一个新的子线程
Thread t=new Thread(){
public void run() {
//下载图片的路径
String iPath=EditText.getText().toString();
try {
//对资源链接
URL url=new URL(iPath);
InputStream inputStream=url.openStream();
//对网上资源进行下载转换位图图片
bitmap=BitmapFactory.decodeStream(inputStream);
handler.sendEmptyMessage(8);
inputStream.close();
inputStream=url.openStream();
File file=new File(Environment.getExternalStorageDirectory()+"/DCIM/");
FileOutputStream fileOutputStream=new FileOutputStream(file);
int hasRead=0;
while((hasRead=inputStream.read())!=-1){
fileOutputStream.write(hasRead);
}
fileOutputStream.close();
inputStream.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class laile extends Activity {
public class Laile extends Activity {
private Button button_open1;
private Button button_open2;
private Button button_close;
Expand All @@ -21,16 +21,16 @@ protected void onCreate(Bundle savedInstanceState) {
button_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent= new Intent(laile.this, MainActivity.class);
laile.this.startActivity(intent);
Intent intent= new Intent(Laile.this, MainActivity.class);
Laile.this.startActivity(intent);
}
});
button_open2= (Button) findViewById(R.id.button_open2);
button_open2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(laile.this, jinru.class);
laile.this.startActivity(intent);
Intent intent = new Intent(Laile.this, Jinru.class);
Laile.this.startActivity(intent);
}
});
button_open1=(Button)findViewById(R.id.button_open);
Expand Down Expand Up @@ -80,7 +80,7 @@ public String read() {
public void write(String msg){
if(msg == null) return;
try { msg =msg+read();
FileOutputStream fos = openFileOutput("txt", MODE_APPEND);
FileOutputStream fos = openFileOutput("storage.txt", MODE_APPEND);
fos.write(msg.getBytes());
fos.close();
} catch (Exception e) {
Expand Down
179 changes: 10 additions & 169 deletions soft1614080902220/app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -1,170 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360">
<shape android:shape="ring" android:innerRadiusRatio="20"
android:thicknessRatio="75" android:useLevel="false">
<gradient android:type="sweep" android:useLevel="false"
android:startColor="#ffffff" android:centerColor="#FFDC35"
android:centerY="0.50" android:endColor="#CE0000" />
</shape>
</rotate>
Loading

0 comments on commit a1366b7

Please sign in to comment.