mirror of
https://github.com/etesync/android
synced 2025-06-05 15:48:49 +00:00
Optimize soft keyboard handling, make resource detection dialog not cancelable
This commit is contained in:
parent
2414b42867
commit
0f0acd62a3
@ -17,8 +17,8 @@ android {
|
|||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
|
|
||||||
versionCode 83
|
versionCode 84
|
||||||
versionName "0.9.1-beta1"
|
versionName "0.9.1"
|
||||||
|
|
||||||
buildConfigField "java.util.Date", "buildTime", "new java.util.Date()"
|
buildConfigField "java.util.Date", "buildTime", "new java.util.Date()"
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.setup.AddAccountActivity"
|
android:name=".ui.setup.AddAccountActivity"
|
||||||
android:excludeFromRecents="true" >
|
android:excludeFromRecents="true">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.settings.SettingsActivity"
|
android:name=".ui.settings.SettingsActivity"
|
||||||
|
@ -9,6 +9,7 @@ package at.bitfire.davdroid.ui.setup;
|
|||||||
|
|
||||||
import android.app.DialogFragment;
|
import android.app.DialogFragment;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@ -18,6 +19,7 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@ -38,6 +40,7 @@ public class LoginEmailFragment extends Fragment implements TextWatcher {
|
|||||||
|
|
||||||
editEmail = (EditText)v.findViewById(R.id.email_address);
|
editEmail = (EditText)v.findViewById(R.id.email_address);
|
||||||
editEmail.addTextChangedListener(this);
|
editEmail.addTextChangedListener(this);
|
||||||
|
|
||||||
editPassword = (EditText)v.findViewById(R.id.password);
|
editPassword = (EditText)v.findViewById(R.id.password);
|
||||||
editPassword.addTextChangedListener(this);
|
editPassword.addTextChangedListener(this);
|
||||||
|
|
||||||
@ -67,7 +70,7 @@ public class LoginEmailFragment extends Fragment implements TextWatcher {
|
|||||||
DialogFragment dialog = new QueryServerDialogFragment();
|
DialogFragment dialog = new QueryServerDialogFragment();
|
||||||
dialog.setArguments(args);
|
dialog.setArguments(args);
|
||||||
dialog.show(getFragmentManager(), QueryServerDialogFragment.class.getName());
|
dialog.show(getFragmentManager(), QueryServerDialogFragment.class.getName());
|
||||||
} catch(URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
Constants.log.debug("Invalid email address", e);
|
Constants.log.debug("Invalid email address", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -77,6 +80,16 @@ public class LoginEmailFragment extends Fragment implements TextWatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// set focus and show soft keyboard
|
||||||
|
if (editEmail.requestFocus()) {
|
||||||
|
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(editEmail, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// input validation
|
// input validation
|
||||||
|
|
||||||
@ -91,7 +104,7 @@ public class LoginEmailFragment extends Fragment implements TextWatcher {
|
|||||||
if (uri.isOpaque()) {
|
if (uri.isOpaque()) {
|
||||||
int pos = email.lastIndexOf("@");
|
int pos = email.lastIndexOf("@");
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
emailOk = !email.substring(pos+1).isEmpty();
|
emailOk = !email.substring(pos + 1).isEmpty();
|
||||||
}
|
}
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
// invalid mailto: URI
|
// invalid mailto: URI
|
||||||
|
@ -9,6 +9,7 @@ package at.bitfire.davdroid.ui.setup;
|
|||||||
|
|
||||||
import android.app.DialogFragment;
|
import android.app.DialogFragment;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -19,6 +20,7 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
@ -72,7 +74,7 @@ public class LoginURLFragment extends Fragment implements TextWatcher {
|
|||||||
editPassword = (EditText)v.findViewById(R.id.password);
|
editPassword = (EditText)v.findViewById(R.id.password);
|
||||||
editPassword.addTextChangedListener(this);
|
editPassword.addTextChangedListener(this);
|
||||||
|
|
||||||
checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);
|
checkboxPreemptive = (CheckBox)v.findViewById(R.id.auth_preemptive);
|
||||||
|
|
||||||
// hook into action bar
|
// hook into action bar
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
@ -101,7 +103,7 @@ public class LoginURLFragment extends Fragment implements TextWatcher {
|
|||||||
DialogFragment dialog = new QueryServerDialogFragment();
|
DialogFragment dialog = new QueryServerDialogFragment();
|
||||||
dialog.setArguments(args);
|
dialog.setArguments(args);
|
||||||
dialog.show(getFragmentManager(), null);
|
dialog.show(getFragmentManager(), null);
|
||||||
} catch(URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
Constants.log.debug("Invalid URI", e);
|
Constants.log.debug("Invalid URI", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -111,6 +113,16 @@ public class LoginURLFragment extends Fragment implements TextWatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// set focus and show soft keyboard
|
||||||
|
if (editBaseURI.requestFocus()) {
|
||||||
|
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(editBaseURI, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private URI getBaseURI() throws URISyntaxException {
|
private URI getBaseURI() throws URISyntaxException {
|
||||||
String scheme = spnrScheme.getSelectedItem().toString(),
|
String scheme = spnrScheme.getSelectedItem().toString(),
|
||||||
|
@ -20,6 +20,8 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Loader;
|
import android.content.Loader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -48,15 +50,16 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
|
|||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
ProgressDialog dialog = new ProgressDialog(getActivity());
|
ProgressDialog dialog = new ProgressDialog(getActivity());
|
||||||
dialog.setCancelable(false);
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
setCancelable(false);
|
||||||
|
|
||||||
dialog.setTitle(R.string.setup_resource_detection);
|
dialog.setTitle(R.string.setup_resource_detection);
|
||||||
dialog.setIndeterminate(true);
|
dialog.setIndeterminate(true);
|
||||||
dialog.setMessage(getString(R.string.setup_querying_server));
|
dialog.setMessage(getString(R.string.setup_querying_server));
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
@ -78,7 +81,7 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
|
|||||||
.commitAllowingStateLoss();
|
.commitAllowingStateLoss();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((AddAccountActivity) getActivity()).serverInfo = serverInfo;
|
((AddAccountActivity)getActivity()).serverInfo = serverInfo;
|
||||||
|
|
||||||
// resource detection brought some results
|
// resource detection brought some results
|
||||||
Fragment nextFragment;
|
Fragment nextFragment;
|
||||||
|
@ -117,7 +117,7 @@ public class SelectCollectionsFragment extends ListFragment {
|
|||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
try {
|
try {
|
||||||
ok = getListView().getCheckedItemCount() > 0;
|
ok = getListView().getCheckedItemCount() > 0;
|
||||||
} catch(IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
}
|
}
|
||||||
MenuItem item = menu.findItem(R.id.next);
|
MenuItem item = menu.findItem(R.id.next);
|
||||||
item.setEnabled(ok);
|
item.setEnabled(ok);
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
android:id="@+id/password"
|
android:id="@+id/password"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionGo"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:scrollHorizontally="true"
|
android:scrollHorizontally="true"
|
||||||
android:scrollbars="horizontal"
|
android:scrollbars="horizontal"
|
||||||
|
@ -64,7 +64,6 @@
|
|||||||
android:id="@+id/userName"
|
android:id="@+id/userName"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:inputType="textNoSuggestions|textEmailAddress"
|
android:inputType="textNoSuggestions|textEmailAddress"
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:scrollHorizontally="true"
|
android:scrollHorizontally="true"
|
||||||
android:scrollbars="horizontal"
|
android:scrollbars="horizontal"
|
||||||
@ -78,7 +77,6 @@
|
|||||||
android:id="@+id/password"
|
android:id="@+id/password"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionGo"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:scrollHorizontally="true"
|
android:scrollHorizontally="true"
|
||||||
android:scrollbars="horizontal"
|
android:scrollbars="horizontal"
|
||||||
|
Loading…
Reference in New Issue
Block a user