mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
AuthenticationDialog -> AuthenticationActivity (in progress)
This commit is contained in:
parent
405a7d40bb
commit
cee53e148b
4 changed files with 31 additions and 9 deletions
|
@ -71,7 +71,6 @@
|
|||
android:id="@+id/authentication_signup_box"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
|
@ -98,16 +97,20 @@
|
|||
<Button
|
||||
android:id="@+id/authentication_ok_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/authentication_cancel_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AuthenticationActivity extends Activity {
|
|||
final static String USERNAME_KEY = "username";
|
||||
final static String PASSWORD_KEY = "password";
|
||||
final static String ERROR_KEY = "error";
|
||||
final static String SIGNUP_URL_KEY = "signupUrl";
|
||||
final static String SHOW_SIGNUP_LINK_KEY = "showSignupLink";
|
||||
|
||||
private ZLResource myResource;
|
||||
|
||||
|
@ -52,13 +52,13 @@ public class AuthenticationActivity extends Activity {
|
|||
final String area = intent.getStringExtra(AREA_KEY);
|
||||
final String username = intent.getStringExtra(USERNAME_KEY);
|
||||
final String error = intent.getStringExtra(ERROR_KEY);
|
||||
final String signupUrl = intent.getStringExtra(SIGNUP_URL_KEY);
|
||||
|
||||
setTitle(host);
|
||||
final boolean showSignupLink = intent.getBooleanExtra(SHOW_SIGNUP_LINK_KEY, false);
|
||||
|
||||
myResource = ZLResource.resource("dialog").getResource("AuthenticationDialog");
|
||||
|
||||
if (area != null || !"".equals(area)) {
|
||||
setTitle(host != null ? host : myResource.getResource("title").getValue());
|
||||
|
||||
if (area != null && !"".equals(area)) {
|
||||
findTextView(R.id.authentication_subtitle).setText(area);
|
||||
} else {
|
||||
findTextView(R.id.authentication_subtitle).setVisibility(View.GONE);
|
||||
|
@ -87,8 +87,17 @@ public class AuthenticationActivity extends Activity {
|
|||
errorView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (signupUrl != null) {
|
||||
// TODO
|
||||
if (showSignupLink) {
|
||||
findViewById(R.id.authentication_signup_box).setVisibility(View.VISIBLE);
|
||||
final TextView signupView = (TextView)findViewById(R.id.authentication_signup);
|
||||
signupView.setText(myResource.getResource("register").getValue());
|
||||
signupView.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
// TODO
|
||||
//setResult();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
findViewById(R.id.authentication_signup_box).setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.app.Activity;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
|
@ -82,7 +83,15 @@ class AuthenticationDialog {
|
|||
private final DialogHandler myHandler = new DialogHandler();
|
||||
|
||||
public static void show(Activity activity, INetworkLink link, Runnable onSuccessRunnable) {
|
||||
getDialog().showInternal(activity, link, onSuccessRunnable);
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
|
||||
final Intent intent = new Intent(activity, AuthenticationActivity.class);
|
||||
intent.putExtra(AuthenticationActivity.USERNAME_KEY, mgr.UserNameOption.getValue());
|
||||
if (Util.isRegistrationSupported(activity, link)) {
|
||||
intent.putExtra(AuthenticationActivity.SHOW_SIGNUP_LINK_KEY, true);
|
||||
}
|
||||
//getDialog().showInternal(activity, link, onSuccessRunnable);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
private void showInternal(Activity activity, INetworkLink link, Runnable onSuccessRunnable) {
|
||||
|
|
|
@ -68,6 +68,7 @@ public abstract class PackageUtil {
|
|||
}
|
||||
|
||||
public static boolean canBeStarted(Context context, Intent intent, boolean checkSignature) {
|
||||
System.err.println("canBeStarted " + intent.getData());
|
||||
final PackageManager manager = context.getApplicationContext().getPackageManager();
|
||||
final ResolveInfo info =
|
||||
manager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue