Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

worked on issue #233 and made changes in showPasswordDialog() #318

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.odk.share.views.ui.settings;

import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
Expand All @@ -10,7 +11,9 @@
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -53,6 +56,8 @@ protected void onCreate(Bundle savedInstanceState) {
addPreferences();
}



@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
Expand Down Expand Up @@ -183,13 +188,22 @@ private void showPasswordDialog() {
View dialogView = factory.inflate(R.layout.dialog_password_til, null);
TextInputLayout tlPassword = dialogView.findViewById(R.id.et_password_layout);
tlPassword.getEditText().setText(prefs.getString(PreferenceKeys.KEY_HOTSPOT_PASSWORD, getString(R.string.default_hotspot_password)));

builder.setTitle(getString(R.string.title_hotspot_password));
builder.setView(dialogView);

builder.setPositiveButton(getString(R.string.ok), (dialog, which) -> {
String password = tlPassword.getEditText().getText().toString();
prefs.edit().putString(PreferenceKeys.KEY_HOTSPOT_PASSWORD, password).apply();

if(password.length()<8)
devanshi7799 marked this conversation as resolved.
Show resolved Hide resolved
{
Toast.makeText(this, "Password length must be atleast 8 characters long", Toast.LENGTH_SHORT).show();
}
else {
prefs.edit().putString(PreferenceKeys.KEY_HOTSPOT_PASSWORD, password).apply();
}
});


builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> dialog.dismiss());

builder.setCancelable(false);
Expand Down