Skip to content

Commit

Permalink
dialog for pirateship hotspot (fixes #68) (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemathias authored and dogi committed Apr 4, 2018
1 parent 8bd9967 commit 154fd4f
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "io.treehouses.remote"
minSdkVersion 15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;

/**
* Created by Terrence on 3/12/2018.
Expand All @@ -36,7 +37,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

// Build the dialog and set up the button click handlers
LayoutInflater inflater = getActivity().getLayoutInflater();
View mView = inflater.inflate(R.layout.dialog_design,null);
View mView = inflater.inflate(R.layout.hotspot_dialog,null);
initLayoutView(mView);

final AlertDialog mDialog = getAlertDialog(mView);
Expand All @@ -48,6 +49,20 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

return mDialog;
}

@NonNull
@Override
protected void getListener(final AlertDialog mDialog) {
mDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
dialogButtonTrueOrFalse(mDialog, false);
mSSIDEditText.setError("Name your Hotspot");
}
});

}

}


Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void afterTextChanged(Editable s) {}
});
}

private void dialogButtonTrueOrFalse(AlertDialog mDialog, Boolean button){
public void dialogButtonTrueOrFalse(AlertDialog mDialog, Boolean button){
if (button){
mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setClickable(true);
mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
Expand Down
40 changes: 40 additions & 0 deletions app/src/main/res/layout-large-land/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout-large/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout-small-land/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout-small/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout-xlarge-land/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout-xlarge/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
40 changes: 40 additions & 0 deletions app/src/main/res/layout/hotspot_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/SSID"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="Hotspot Name" />

<EditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/password"/>
<EditText
android:id="@+id/confirmPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="@string/confirm_password"/>
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<string name="dialog_message">Configure RPi\'s Wi-Fi setting</string>
<string name="ssid">SSID</string>
<string name="password">Password</string>
<string name="confirm_password">Confirm Password</string>
<string name="error_ssid_empty">Type in the name of the network \nyou want to use </string>
<string name="error_pwd_length">Password must have at least \neight characters.</string>
<string name="config_configuring">Start configuring...</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 08 22:57:09 EST 2018
#Mon Apr 02 14:47:19 CDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 comments on commit 154fd4f

Please sign in to comment.