Skip to content

Commit

Permalink
Merge pull request #16 from tink-expo/master_zealot
Browse files Browse the repository at this point in the history
Apply UI theme
  • Loading branch information
zealotzealot authored Dec 1, 2019
2 parents 5488451 + 46594ec commit dd37f4f
Show file tree
Hide file tree
Showing 21 changed files with 405 additions and 119 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme.NoActionBar">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;

public class CameraActivity extends AppCompatActivity {
private SurfaceView surfaceView;
Expand All @@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
surfaceView = findViewById(R.id.cameraSurfaceView);
cameraPreview = new CameraPreview(this, this, Camera.CameraInfo.CAMERA_FACING_BACK, surfaceView);

Button button = findViewById(R.id.cameraButton);
ImageButton button = findViewById(R.id.cameraButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

public class MainActivity extends AppCompatActivity {

Expand All @@ -14,8 +14,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button button = (Button) findViewById(R.id.mainButton);
button.setOnClickListener(new Button.OnClickListener() {
ImageButton button = (ImageButton) findViewById(R.id.mainButton);
button.setOnClickListener(new ImageButton.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, CameraActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.hsh0908y.auto_wifi.common.SsidPw;
import com.example.hsh0908y.auto_wifi.common.TextBlock;
Expand All @@ -28,6 +28,7 @@
public class ProcessingActivity extends AppCompatActivity {

final static String TAG = "ProcessingActivity";
final static int IMAGE_ANIMATE_PERIOD = 2000;

private boolean hasTriedWifiConnect = false;
private String selectedSsid;
Expand Down Expand Up @@ -56,14 +57,23 @@ protected void onCreate(Bundle savedInstanceState) {

selectedSsid = intent.getStringExtra("selectedSsid");

// Temporary: show image and hasId
ImageView imageView = (ImageView) findViewById(R.id.processingImageView);
imageView.setImageBitmap(unscaledBitmap);
TextView textView = (TextView) findViewById(R.id.processingTextView);
textView.setText("hasId : " + String.valueOf(selectedSsid == null));

wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
Log.d(TAG, String.valueOf(wifiManager.getConnectionInfo() == null));

// Animate loading image
final ImageView imageView = (ImageView) findViewById(R.id.processingImageView);
final Handler handler = new Handler();
final int[] images = new int[] {R.drawable.icon_wifi_1, R.drawable.icon_wifi_2, R.drawable.icon_wifi_3};
final int[] currentIdx = new int[] {0};
Runnable imageAnimateRunnable = new Runnable() {
@Override
public void run() {
imageView.setImageResource(images[currentIdx[0]]);
currentIdx[0] = (currentIdx[0] + 1) % images.length;
handler.postDelayed(this, IMAGE_ANIMATE_PERIOD);
}
};
handler.postDelayed(imageAnimateRunnable, IMAGE_ANIMATE_PERIOD);
}

@Override
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable/icon_wifi_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable/icon_wifi_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable/icon_wifi_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/app/src/main/res/drawable/rectangle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rectangle">
<corners android:radius="10dp" />
<solid android:color="#ffffffff" />
</shape>
5 changes: 5 additions & 0 deletions android/app/src/main/res/drawable/rectangle_opaque.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rectangle">
<corners android:radius="10dp" />
<solid android:color="#e0ffffff" />
</shape>
48 changes: 37 additions & 11 deletions android/app/src/main/res/layout/activity_camera.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<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/colorWhite"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hsh0908y.auto_wifi.CameraActivity">
Expand All @@ -10,32 +11,42 @@
android:id="@+id/cameraSurfaceView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/cameraMenusLayout"
app:layout_constraintDimensionRatio="3:4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
app:layout_constraintTop_toTopOf="parent" />

<android.support.constraint.ConstraintLayout
android:id="@+id/cameraMenusLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/cameraSurfaceView">
app:layout_constraintTop_toTopOf="parent">

<View
android:id="@+id/rectangleView4"
android:layout_width="0dp"
android:layout_height="72dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="45dp"
android:layout_marginStart="45dp"
android:background="@drawable/rectangle_opaque"
app:layout_constraintBottom_toTopOf="@+id/cameraButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<RadioGroup
android:layout_width="wrap_content"
android:id="@+id/radioGroup"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="8dp"
android:checkedButton="@+id/cameraRadioButtonIdpw"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/cameraButton"
tools:layout_editor_absoluteY="363dp">
app:layout_constraintBottom_toBottomOf="@id/rectangleView4">

<RadioButton
android:id="@+id/cameraRadioButtonIdpw"
Expand All @@ -52,17 +63,32 @@
android:text="Only PW" />
</RadioGroup>

<Button
<ImageButton
android:id="@+id/cameraButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:text="Button"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/icon_camera_btn" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Take a photo with Wi-Fi information"
android:textColor="@color/colorBlack"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/rectangleView4" />
</android.support.constraint.ConstraintLayout>

</android.support.constraint.ConstraintLayout>
Loading

0 comments on commit dd37f4f

Please sign in to comment.