Skip to content

Commit

Permalink
Implement selecting ssid
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotzealot committed Dec 1, 2019
1 parent 46594ec commit 946a98f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
</activity>
<activity android:name=".SelectIdActivity">
</activity>
<activity
android:name=".ProcessingPreActivity"
android:noHistory="true">
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,20 @@ protected Void doInBackground(byte[]... data) {
getContext().sendBroadcast(mediaScanIntent);


Intent intent = new Intent(mContext, ProcessingActivity.class);
intent.putExtra("imageFile", outputFile.getAbsolutePath());
RadioButton IdpwRadioButton = (RadioButton) mActivity.findViewById(R.id.cameraRadioButtonIdpw);
intent.putExtra("hasId", IdpwRadioButton.isChecked());
mContext.startActivity(intent);
boolean hasId = IdpwRadioButton.isChecked();
if (hasId) {
Intent intent = new Intent(mContext, ProcessingActivity.class);
intent.putExtra("imageFile", outputFile.getAbsolutePath());
intent.putExtra("hasId", hasId);
mContext.startActivity(intent);
}
else {
Intent intent = new Intent(mContext, ProcessingPreActivity.class);
intent.putExtra("imageFile", outputFile.getAbsolutePath());
intent.putExtra("hasId", hasId);
mContext.startActivity(intent);
}



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example.hsh0908y.auto_wifi;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class ProcessingPreActivity extends AppCompatActivity {
static final int REQUEST_CODE = 0;

private boolean hasId;
private String imageFile;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_processing_pre);

Intent intent = getIntent();
hasId = intent.getBooleanExtra("hasId", false);
imageFile = intent.getStringExtra("imageFile");


Intent selectIdIntent = new Intent(this, SelectIdActivity.class);
startActivityForResult(selectIdIntent, REQUEST_CODE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (!(requestCode == REQUEST_CODE && resultCode == RESULT_OK)) {
return;
}

String selectedSsid = intent.getStringExtra("id");

Intent processingIntent = new Intent(this, ProcessingActivity.class);
processingIntent.putExtra("imageFile", imageFile);
processingIntent.putExtra("hasId", hasId);
processingIntent.putExtra("selectedSsid", selectedSsid);
this.startActivity(processingIntent);
}
}
10 changes: 10 additions & 0 deletions android/app/src/main/res/layout/activity_processing_pre.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hsh0908y.auto_wifi.ProcessingPreActivity">

</android.support.constraint.ConstraintLayout>

0 comments on commit 946a98f

Please sign in to comment.