Don't show toast on new user login, fixed keyboard bug on new user login

pull/14/head
Sam Bosley 13 years ago
parent 4caf719e88
commit 04f0b617b0

@ -38,6 +38,7 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView; import android.widget.TextView;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
@ -668,4 +669,16 @@ public class AndroidUtilities {
return string.substring(0, 1).toUpperCase() + string.substring(1); return string.substring(0, 1).toUpperCase() + string.substring(1);
} }
/**
* Dismiss the keyboard if it is displayed by any of the listed views
* @param context
* @param views - a list of views that might potentially be displaying the keyboard
*/
public static void hideSoftInputForViews(Context context, View...views) {
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
for (View v : views) {
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
} }

@ -65,6 +65,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
@ -101,6 +102,9 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
private TextView errors; private TextView errors;
protected boolean noSync = false; protected boolean noSync = false;
public static final String SHOW_TOAST = "show_toast";
private boolean showToast;
// --- ui initialization // --- ui initialization
private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1; private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1;
@ -137,6 +141,8 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
rand = new Random(DateUtilities.now()); rand = new Random(DateUtilities.now());
noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false); noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false);
showToast = getIntent().getBooleanExtra(SHOW_TOAST, true);
facebook = new Facebook(APP_ID); facebook = new Facebook(APP_ID);
facebookRunner = new AsyncFacebookRunner(facebook); facebookRunner = new AsyncFacebookRunner(facebook);
@ -287,6 +293,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
public void onClick(DialogInterface dlg, int which) { public void onClick(DialogInterface dlg, int which) {
String nameString = isNew.get() ? name.getText().toString() String nameString = isNew.get() ? name.getText().toString()
: null; : null;
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, name, email, password);
authenticate(email.getText().toString(), authenticate(email.getText().toString(),
nameString, ActFmInvoker.PROVIDER_PASSWORD, nameString, ActFmInvoker.PROVIDER_PASSWORD,
password.getText().toString()); password.getText().toString());
@ -296,7 +303,12 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
else else
StatisticsService.reportEvent(StatisticsConstants.ACTFM_SIGNUP_PW); StatisticsService.reportEvent(StatisticsConstants.ACTFM_SIGNUP_PW);
} }
}).setNegativeButton(android.R.string.cancel, null).show()); }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dlg, int which) {
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, name, email, password);
}
}).show());
dialog.get().setOwnerActivity(ActFmLoginActivity.this); dialog.get().setOwnerActivity(ActFmLoginActivity.this);
} }
@ -471,7 +483,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
finish(); finish();
if (!noSync) { if (!noSync) {
new ActFmSyncProvider().synchronize(ActFmLoginActivity.this); new ActFmSyncProvider().synchronize(ActFmLoginActivity.this, showToast);
} }
try { try {

@ -72,6 +72,7 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.widget.GestureService; import com.todoroo.andlib.widget.GestureService;
import com.todoroo.andlib.widget.GestureService.GestureInterface; import com.todoroo.andlib.widget.GestureService.GestureInterface;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncProvider; import com.todoroo.astrid.actfm.sync.ActFmSyncProvider;
import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener; import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener;
@ -583,6 +584,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
if (!Preferences.getBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, false)) { if (!Preferences.getBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, false)) {
Intent showWelcomeLogin = new Intent(this, WelcomeLogin.class); Intent showWelcomeLogin = new Intent(this, WelcomeLogin.class);
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
startActivity(showWelcomeLogin); startActivity(showWelcomeLogin);
Preferences.setBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, true); Preferences.setBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, true);
return; return;

Loading…
Cancel
Save