|
1 | 1 | package tomikaa.greeremote;
|
2 | 2 |
|
| 3 | +import android.content.DialogInterface; |
3 | 4 | import android.content.Intent;
|
4 | 5 | import android.os.Bundle;
|
5 |
| -import android.support.v4.content.res.ResourcesCompat; |
6 |
| -import android.support.v7.app.AppCompatActivity; |
7 | 6 | import android.util.Log;
|
| 7 | +import android.view.LayoutInflater; |
8 | 8 | import android.view.Menu;
|
| 9 | +import android.view.MenuItem; |
9 | 10 | import android.view.View;
|
10 | 11 | import android.widget.ImageButton;
|
11 | 12 | import android.widget.SeekBar;
|
12 | 13 | import android.widget.Switch;
|
13 | 14 | import android.widget.TextView;
|
14 | 15 |
|
| 16 | +import androidx.annotation.NonNull; |
| 17 | +import androidx.appcompat.app.AlertDialog; |
| 18 | +import androidx.appcompat.app.AppCompatActivity; |
| 19 | +import androidx.core.content.res.ResourcesCompat; |
| 20 | + |
| 21 | +import com.google.android.material.textfield.TextInputEditText; |
| 22 | + |
15 | 23 | import tomikaa.greeremote.Gree.Device.Device;
|
16 | 24 | import tomikaa.greeremote.Gree.Device.DeviceManager;
|
17 | 25 | import tomikaa.greeremote.Gree.Device.DeviceManagerEventListener;
|
@@ -238,6 +246,25 @@ private boolean isSwitchChecked(int id) {
|
238 | 246 | return false;
|
239 | 247 | }
|
240 | 248 |
|
| 249 | + @Override |
| 250 | + public boolean onOptionsItemSelected(@NonNull MenuItem item) { |
| 251 | + if(item.getItemId() == R.id.wifi_settings){ |
| 252 | + final View usernamePasswordView = LayoutInflater.from(this).inflate(R.layout.username_password_dialog, null); |
| 253 | + new AlertDialog.Builder(this).setView(usernamePasswordView) |
| 254 | + .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { |
| 255 | + @Override |
| 256 | + public void onClick(DialogInterface dialog, int which) { |
| 257 | + TextInputEditText name = usernamePasswordView.findViewById(R.id.name); |
| 258 | + TextInputEditText password = usernamePasswordView.findViewById(R.id.password); |
| 259 | + Log.d("uriel",name.getText().toString() + " " + password.getText().toString()); |
| 260 | + mDevice.setWifiSsidPassword(name.getText().toString(),password.getText().toString()); |
| 261 | + } |
| 262 | + }).create().show(); |
| 263 | + |
| 264 | + } |
| 265 | + return true; |
| 266 | + } |
| 267 | + |
241 | 268 | private void setupFanSpeedSeekBarChangeListener() {
|
242 | 269 | ((SeekBar) findViewById(R.id.fanSpeedSeekBar)).setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
243 | 270 | @Override
|
|
0 commit comments