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
1 parent
28863a7
commit a1366b7
Showing
7 changed files
with
152 additions
and
204 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
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
84 changes: 76 additions & 8 deletions
84
soft1614080902220/app/src/main/java/com/example/administrator/soft1614080902220/jinru.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 |
---|---|---|
@@ -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(); | ||
} | ||
}; | ||
}; | ||
} |
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
179 changes: 10 additions & 169 deletions
179
soft1614080902220/app/src/main/res/drawable/ic_launcher_background.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 |
---|---|---|
@@ -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> |
Oops, something went wrong.