Skip to content

Commit

Permalink
hzuapps#7 hzuapps#473 #提交第七次实验
Browse files Browse the repository at this point in the history
  • Loading branch information
wyj-2019 committed May 11, 2019
1 parent bfaaf19 commit f9d0450
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import android.support.annotation.NonNull;
import android.util.Log;

import org.w3c.dom.Text;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
Expand All @@ -47,15 +49,15 @@
public class Com1714080901238Activity03 extends AppCompatActivity implements View.OnClickListener {
public static final String TAG = Com1714080901238Activity03.class.getSimpleName();
public static final String IMAGE_URL_PREFIX = "http://p0.qhimg.com/t01893928db69d75161.png";
public static final String imageUri=" /data/user/0/edu.hzuapps.androi/files/images/t01893928db69d75161.png ";
public static final String imageUri="/data/user/0/edu.hzuapps.androidlabs/files/images/t01893928db69d75161.png";

private Button mCheckButton;
private Button mDownloadImageButton;
private TextView mNetworkText;
private ImageView mResultView;
private TextView mShakeView;
int ringValue = 40;
boolean isOpen = false;
int ringValue = 20;


private boolean mConnected;

Expand All @@ -74,7 +76,7 @@ protected void onCreate(Bundle saveInstanceState) {
mDownloadImageButton = (Button) findViewById(R.id.button_download_image);
mNetworkText = (TextView) findViewById(R.id.text_network);
mResultView = (ImageView) findViewById(R.id.text_result);
// mShakeView = (TextView) findViewById(R.id.text_s);
mShakeView = (TextView) findViewById(R.id.text_s);

mCheckButton.setOnClickListener(this);
mDownloadImageButton.setOnClickListener(this);
Expand Down Expand Up @@ -106,10 +108,10 @@ public void onSensorChanged(SensorEvent sensorEvent) {
float z = sensorEvent.values[2];

if (Math.abs(x) + Math.abs(y) + Math.abs(z) >= ringValue) {
if(isOpen) isOpen=false;
else isOpen=true;
if(isOpen)mShakeView.setText("摇动!!"+"\nX = "+x+"\nY = "+y+"\nZ = "+z+"\n提醒已开启");
else mShakeView.setText("摇动!!"+"\nX = "+x+"\nY = "+y+"\nZ = "+z+"\n提醒已关闭");
String string="您的余额为0...";
mShakeView.setText(string);


}
}

Expand Down Expand Up @@ -180,7 +182,7 @@ public void onComplete(Bitmap bitmap, String imageUrl) {
@Override
public void onBitmapSaved() {
Toast.makeText(Com1714080901238Activity03.this, "文件已保存: " + imageFile.getAbsolutePath(), Toast.LENGTH_LONG).show();
Log.d("is2", "run ! uri=" + imageFile.getPath());

mResultView.setImageURI(Uri.fromFile(imageFile));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
android:layout_width="match_parent"
android:layout_height="128dp"
android:onClick="money"
android:text="Button" />
android:text="进入小程序" />


</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@
android:id="@+id/text_network"
android:layout_width="match_parent"
android:layout_height="44dp"
android:textSize="25dp"
android:background="#A6FFFF"
android:text="TextView"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="85dp" />
android:text="网络状态未检测" />

<ImageView
android:id="@+id/text_result"
android:layout_width="match_parent"
android:layout_height="384dp"
android:background="#A6FFFF"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="129dp" />
android:layout_height="wrap_content"
android:background="#A6FFFF"/>
<TextView
android:id="@+id/text_s"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text=" 摇一摇显示余额 "
android:textSize="30dp"
android:background="#A6FFFF" />
</LinearLayout>

0 comments on commit f9d0450

Please sign in to comment.