Jave login dialog login dialog

60 Jave code examples are found related to " login dialog login dialog". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: UserLoginActivity.java    From v9porn with MIT License 6 votes vote down vote up
private void showNeedSetAddressFirstDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyDialogTheme);
    builder.setTitle("温馨提示");
    builder.setMessage("还未设置91porn视频地址,无法登录或注册,现在去设置?");
    builder.setPositiveButton("去设置", (dialog, which) -> {
        Intent intent = new Intent(context, SettingActivity.class);
        startActivityWithAnimation(intent);
        finish();
    });
    builder.setNegativeButton("退出", (dialog, which) -> {
        dialog.dismiss();
        onBackPressed();
    });
    builder.setCancelable(false);
    builder.show();
}
 
Example 2
Source File: LoginActivity.java    From RxEasyHttp with Apache License 2.0 6 votes vote down vote up
public void showMissingPermissionDialog() {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
    builder.setTitle(R.string.basic_help);
    builder.setMessage(R.string.basic_string_help_text);

    // 拒绝, 退出应用
    builder.setNegativeButton(R.string.basic_quit, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    builder.setPositiveButton(R.string.basic_settings, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            startAppSettings();
        }
    });

    builder.setCancelable(false);

    builder.show();
}
 
Example 3
Source File: LoginDialog.java    From jplag with GNU General Public License v3.0 6 votes vote down vote up
private void storeUsername()
{
	try {
		PersistenceService ps = (PersistenceService) ServiceManager.
			lookup("javax.jnlp.PersistenceService");
		BasicService bs = (BasicService) ServiceManager.
			lookup("javax.jnlp.BasicService");
		URL baseURL = bs.getCodeBase();
		URL admintoolURL = new URL(baseURL,"AdminTool.cfg");
		
		// delete file if already exists
		try { ps.delete(admintoolURL); } catch(Exception e) {}
		ps.create(admintoolURL,1024);
		FileContents fc=ps.get(admintoolURL);
		DataOutputStream os=new DataOutputStream(fc.getOutputStream(true));
		os.writeBytes(getJUsernameField().getText() + "\n");
		os.flush();
		os.close();
	}
	// if an exception is thrown, the username just can't be stored
	catch(UnavailableServiceException e) {}
	catch(Exception e) {}
}
 
Example 4
Source File: RepositoryLoginDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static AuthenticationData getDefaultData( final ReportDesignerContext designerContext ) {
  final GlobalAuthenticationStore authStore = designerContext.getGlobalAuthenticationStore();
  final String rurl = authStore.getMostRecentEntry();
  if ( rurl != null ) {
    final AuthenticationData loginData = getStoredLoginData( rurl, designerContext );
    if ( loginData != null ) {
      return loginData;
    }
  }

  final String user =
      ReportDesignerBoot.getInstance().getGlobalConfig().getConfigProperty(
          "org.pentaho.reporting.designer.extensions.pentaho.repository.ServerUser" );
  final String pass =
      ReportDesignerBoot.getInstance().getGlobalConfig().getConfigProperty(
          "org.pentaho.reporting.designer.extensions.pentaho.repository.ServerPassword" );
  final String url =
      ReportDesignerBoot.getInstance().getGlobalConfig().getConfigProperty(
          "org.pentaho.reporting.designer.extensions.pentaho.repository.PublishLocation" );

  if ( StringUtils.isEmpty( url ) ) {
    return null;
  }
  return new AuthenticationData( url, user, pass, WorkspaceSettings.getInstance().getConnectionTimeout() );
}
 
Example 5
Source File: LoginDialog.java    From android-auth with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mResultDelivered = false;

    mProgressDialog = new ProgressDialog(getContext());
    mProgressDialog.setMessage(getContext().getString(R.string.com_spotify_sdk_login_progress));
    mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mProgressDialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dismiss();
        }
    });

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    getWindow().setBackgroundDrawableResource(android.R.drawable.screen_background_dark_transparent);

    setContentView(R.layout.com_spotify_sdk_login_dialog);

    setLayoutSize();

    createWebView(mUri);
}
 
Example 6
Source File: LoginDialog.java    From jplag with GNU General Public License v3.0 6 votes vote down vote up
private String readUsername() {
	String str="";
	try {
		PersistenceService ps = (PersistenceService) ServiceManager.
			lookup("javax.jnlp.PersistenceService");
		BasicService bs = (BasicService) ServiceManager.
			lookup("javax.jnlp.BasicService");
		URL baseURL = bs.getCodeBase();
		URL admintoolURL = new URL(baseURL,"AdminTool.cfg");
		FileContents fc = ps.get(admintoolURL);
		BufferedReader reader = new BufferedReader(
				new InputStreamReader(fc.getInputStream()));
		str=reader.readLine();
		reader.close();
	}
	// if an exception is thrown, the username just can't be set
	catch(UnavailableServiceException e) {}
	catch(Exception e) {}
	
	return str;
}
 
Example 7
Source File: LoginDialog.java    From jplag with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes jPanel
 * 
 * @return javax.swing.JPanel
 */
private JPanel getJContentPane() {
	if (jContentPane == null) {
		jContentPane = new JPanel();
		jContentPane.setLayout(new FlowLayout(FlowLayout.CENTER,5,10));
		jContentPane.setBackground(JPlagCreator.SYSTEMCOLOR);
		jContentPane.setBorder(JPlagCreator.LINE);
		jContentPane.setPreferredSize(new java.awt.Dimension(400,135));
	
		jContentPane.add(JPlagCreator.createLabel(
			Messages.getString("LoginDialog.Username_label") + ":", //$NON-NLS-1$ //$NON-NLS-2$
			170, 20), null);
		jContentPane.add(getJUsernameField(), null);
		jContentPane.add(JPlagCreator.createLabel(
			Messages.getString("LoginDialog.Password_label") + ":", //$NON-NLS-1$ //$NON-NLS-2$
			170, 20), null);
		jContentPane.add(getJPasswordField(), null);
		jContentPane.add(getJCheckBox(), null);
           Dimension dim = getJCheckBox().getPreferredSize();
           jContentPane.add(javax.swing.Box.createHorizontalStrut(304-dim.width));
		jContentPane.add(getJProgressBar(), null);
		jContentPane.add(getJOKButton(), null);
		jContentPane.add(getJCancelButton(), null);
	}
	return jContentPane;
}
 
Example 8
Source File: LoginDialog.java    From jplag with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes jCancelButton
 * 
 * @return javax.swing.JButton
 */
private JButton getJCancelButton() {
	if (jCancelButton == null) {
		jCancelButton = JPlagCreator.createButton(
				Messages.getString("LoginDialog.Cancel"), //$NON-NLS-1$
				init ? Messages.getString("LoginDialog.Cancel_TIP_exit") //$NON-NLS-1$
					 : Messages.getString("LoginDialog.Cancel_TIP_dont_switch"), //$NON-NLS-1$
				150,20);
		jCancelButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(init) System.exit(0);
				else dispose();
			}
		});
	}
	return jCancelButton;
}
 
Example 9
Source File: LoginDialog.java    From android-auth with Apache License 2.0 6 votes vote down vote up
private void setLayoutSize() {
    WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    DisplayMetrics metrics = new DisplayMetrics();
    display.getMetrics(metrics);

    int dialogWidth = ViewGroup.LayoutParams.MATCH_PARENT;
    int dialogHeight = ViewGroup.LayoutParams.MATCH_PARENT;

    // If width or height measured in dp exceeds accepted range,
    // use max values and convert them back to pixels before setting the size.
    if (metrics.widthPixels / metrics.density > MAX_WIDTH_DP) {
        dialogWidth = (int) (MAX_WIDTH_DP * metrics.density);
    }

    if (metrics.heightPixels / metrics.density > MAX_HEIGHT_DP) {
        dialogHeight = (int) (MAX_HEIGHT_DP * metrics.density);
    }

    LinearLayout layout = (LinearLayout) findViewById(R.id.com_spotify_sdk_login_webview_container);
    layout.setLayoutParams(new FrameLayout.LayoutParams(dialogWidth, dialogHeight, Gravity.CENTER));
}
 
Example 10
Source File: LoginDialog.java    From jplag with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes this
 * 
 * @return
 */
private void initialize() {
	this.setTitle(Messages.getString("LoginDialog.JPlag_login_dialog_TITLE") + " v" + ATUJPLAG.VERSION_STRING); //$NON-NLS-1$
	this.setResizable(false);
	this.setContentPane(getJContentPane());
	
	// Emulate a click on the cancel button, when the dialog is closed
	addWindowListener(new WindowListener() {
		public void windowActivated(WindowEvent arg0) {}
		public void windowClosed(WindowEvent arg0) {}
		public void windowDeactivated(WindowEvent arg0) {}
		public void windowDeiconified(WindowEvent arg0) {}
		public void windowIconified(WindowEvent arg0) {}
		public void windowOpened(WindowEvent arg0) {}
		public void windowClosing(WindowEvent arg0) {
			jCancelButton.doClick();
		}});
}
 
Example 11
Source File: OnlineDialog.java    From lizzie with GNU General Public License v3.0 6 votes vote down vote up
private void login() {
  JSONObject data = new JSONObject();
  data.put("hall", "1");
  data.put("room", roomId);
  data.put("token", -1);
  data.put("user_id", userId);
  data.put("platform", 3);
  sendData(
      "login",
      data,
      new Ack() {
        @Override
        public void call(Object... args) {
          //            entry();
        }
      });
}
 
Example 12
Source File: LoginDialog.java    From cuba with Apache License 2.0 6 votes vote down vote up
public LoginDialog(JFrame owner, Connection connection) {
    super(owner);
    this.connection = connection;
    this.loginProperties = new LoginProperties();
    Configuration configuration = AppBeans.get(Configuration.NAME);
    desktopConfig = configuration.getConfig(DesktopConfig.class);
    this.locales = configuration.getConfig(GlobalConfig.class).getAvailableLocales();
    resolvedLocale = resolveLocale();
    addWindowListener(
            new WindowAdapter() {
                @Override
                public void windowClosed(WindowEvent e) {
                    DesktopComponentsHelper.getTopLevelFrame(LoginDialog.this).activate();
                }
            }
    );
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle(messages.getMainMessage("loginWindow.caption", resolvedLocale));
    setContentPane(createContentPane());
    setResizable(false);
    pack();
}
 
Example 13
Source File: LoginDialog.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
 * Enables/Disables the editable components in the login screen.
 *
 * @param editable true to enable components, otherwise false to disable.
 */
private void enableComponents(boolean editable) {

    // Need to set both editable and enabled for best behavior.
    usernameField.setEditable(editable);
    usernameField.setEnabled(editable && !loginAnonymouslyBox.isSelected());

    passwordField.setEditable(editable);
    passwordField.setEnabled(editable && !loginAnonymouslyBox.isSelected());

    final String lockedDownURL = Default.getString(Default.HOST_NAME);
    if (!ModelUtil.hasLength(lockedDownURL)) {
        serverField.setEditable(editable);
        serverField.setEnabled(editable);
    }


    if (editable) {
        // Reapply focus to username field
        passwordField.requestFocus();
    }
}
 
Example 14
Source File: GoogleLoginDialog.java    From zest-writer with GNU General Public License v3.0 6 votes vote down vote up
private Element getLogBox(Element el) {
    NodeList childNodes = el.getChildNodes();
    if("DIV".equals(el.getNodeName())){
        String attr = el.getAttribute("class");
        if(attr != null && attr.contains("my-account-dropdown")) {
            return el;
        }
    }
    for(int i=0; i<childNodes.getLength(); i++){
        org.w3c.dom.Node item = childNodes.item(i);
        if(item instanceof Element){
            Element res = getLogBox((Element)item);
            if(res != null) {
                return res;
            }
        }
    }
    return null;
}
 
Example 15
Source File: LoginDialog.java    From stendhal with GNU General Public License v2.0 6 votes vote down vote up
private void saveProfiles(final ProfileList profiles) {
	try {
		final OutputStream os = Persistence.get().getOutputStream(false,
				stendhal.getGameFolder(), "user.dat");

		try {
			profiles.save(os);
		} finally {
			os.close();
		}
	} catch (final IOException ioex) {
		JOptionPane.showMessageDialog(this,
				"An error occurred while saving your login information",
				"Error Saving Login Information",
				JOptionPane.WARNING_MESSAGE);
	}
}
 
Example 16
Source File: LoginDialog.java    From stendhal with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Load saves profiles.
 * @return ProfileList
 */
private ProfileList loadProfiles() {
	final ProfileList tmpProfiles = new ProfileList();

	try {
		final InputStream is = Persistence.get().getInputStream(false, stendhal.getGameFolder(),
				"user.dat");

		try {
			tmpProfiles.load(is);
		} finally {
			is.close();
		}
	} catch (final FileNotFoundException fnfe) {
		// Ignore
	} catch (final IOException ioex) {
		JOptionPane.showMessageDialog(this,
				"An error occurred while loading your login information",
				"Error Loading Login Information",
				JOptionPane.WARNING_MESSAGE);
	}

	return tmpProfiles;
}
 
Example 17
Source File: HelpsCommentActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void showLoginDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    AlertDialog alertDialog = builder.setMessage("请登录之后在评论")
            .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Intent intent = new Intent(HelpsCommentActivity.this, LoginActivity.class);
                    startActivity(intent);
                }
            }).setPositiveButton(android.R.string.no, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            }).create();
    alertDialog.show();
}
 
Example 18
Source File: LoginDialog.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected void initLocales(JComboBox<String> localeCombo) {
    String currLocale = loginProperties.loadLastLocale();
    if (StringUtils.isBlank(currLocale)) {
        currLocale = messages.getTools().localeToString(resolvedLocale);
    }
    String selected = null;
    for (Map.Entry<String, Locale> entry : locales.entrySet()) {
        localeCombo.addItem(entry.getKey());
        if (messages.getTools().localeToString(entry.getValue()).equals(currLocale))
            selected = entry.getKey();
    }
    if (selected == null)
        selected = locales.keySet().iterator().next();

    localeCombo.setSelectedItem(selected);
}
 
Example 19
Source File: UserLoginActivity.java    From v9porn with MIT License 6 votes vote down vote up
private void showNeedSetAddressFirstDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyDialogTheme);
    builder.setTitle("温馨提示");
    builder.setMessage("还未设置91porn视频地址,无法登录或注册,现在去设置?");
    builder.setPositiveButton("去设置", (dialog, which) -> {
        Intent intent = new Intent(context, SettingActivity.class);
        startActivityWithAnimation(intent);
        finish();
    });
    builder.setNegativeButton("退出", (dialog, which) -> {
        dialog.dismiss();
        onBackPressed();
    });
    builder.setCancelable(false);
    builder.show();
}
 
Example 20
Source File: WebLoginActivity.java    From twitt4droid with Apache License 2.0 6 votes vote down vote up
/** Shows a network error alert dialog. */
private void showNetworkAlertDialog() {
    new AlertDialog.Builder(this)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setTitle(R.string.twitt4droid_is_offline_title)
        .setMessage(R.string.twitt4droid_is_offline_messege)
        .setNegativeButton(android.R.string.cancel, 
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Log.i(TAG, "User canceled authentication process due to network failure");
                    setResult(RESULT_CANCELED, getIntent());
                    finish();
                }
        })
        .setPositiveButton(R.string.twitt4droid_goto_settings, 
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    startActivity(new Intent(Settings.ACTION_SETTINGS));
                    finish();
                }
            })
        .setCancelable(false)
        .show();
}
 
Example 21
Source File: LoginDialog.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Load the current state from the dialog settings
 */
private void loadFrom ()
{
    this.flagCredentialsAsProperties = this.dialogSettings.getBoolean ( SETTING_AS_PROPERTIES );
    final String user = this.dialogSettings.get ( SETTING_USER );
    final String contextId = this.dialogSettings.get ( SETTING_CONTEXT );
    if ( user != null && contextId != null )
    {
        this.userText.setText ( user );
        for ( final LoginContext context : this.contexts )
        {
            if ( context.getId ().equals ( contextId ) )
            {
                this.contextSelector.setSelection ( new StructuredSelection ( context ), true );
            }
        }
        this.passwordText.setFocus ();
    }
    else
    {
        this.contextSelector.getControl ().setFocus ();
    }
}
 
Example 22
Source File: LoginDialog.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createAdvancedContent ( final Composite advWrapper )
{
    final Composite advContent = new Composite ( advWrapper, SWT.NONE );
    advContent.setLayout ( new GridLayout ( 1, false ) );

    final Button credentialsAsProperties = new Button ( advContent, SWT.CHECK );
    credentialsAsProperties.setText ( Messages.LoginDialog_CredentialsButtons_Text );
    credentialsAsProperties.setToolTipText ( Messages.LoginDialog_CredentialsButtons_ToolTip );

    credentialsAsProperties.setSelection ( this.flagCredentialsAsProperties );
    credentialsAsProperties.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            LoginDialog.this.flagCredentialsAsProperties = credentialsAsProperties.getSelection ();
        }
    } );

    return advContent;
}
 
Example 23
Source File: LoginActivity.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
private void displayDialog() {
    // Build the about body view and append the link to see OSS licenses
    SpannableStringBuilder aboutBody = new SpannableStringBuilder();
    aboutBody.append(Html.fromHtml(getString(R.string.splash_dialog_body)));

    LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.dialog_about, null);
    aboutBodyView.setText(aboutBody);
    aboutBodyView.setMovementMethod(new LinkMovementMethod());
    new AlertDialog.Builder(this)
            .setTitle(getString(R.string.splash_dialog_title))
            .setView(aboutBodyView)
            .setPositiveButton(getString(R.string.ok),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            dialog.dismiss();
                        }
                    }
            )
            .show();
}
 
Example 24
Source File: LoginDialogFragment.java    From ghwatch with Apache License 2.0 6 votes vote down vote up
protected void loginClicked() {
  boolean go = true;
  if (Utils.trimToNull(fieldUsername.getText().toString()) == null) {
    fieldUsername.setError(getString(R.string.error_username_mandatory));
    go = false;
  }
  if (Utils.trimToNull(fieldPassword.getText().toString()) == null) {
    fieldPassword.setError(getString(R.string.error_password_mandatory));
    go = false;
  }

  String otp = null;
  if (fieldOtp.getVisibility() == View.VISIBLE) {
    otp = fieldOtp.getText().toString();
  }

  if (go) {
    new LoginTask().execute(fieldUsername.getText().toString(), fieldPassword.getText().toString(), otp);
  }
}
 
Example 25
Source File: AuthDialog.java    From ciscorouter with MIT License 6 votes vote down vote up
/**
 * Checks the credentials and allows login if the credentials are correct.
 * @param evt The ActionEvent object with relevant data
 */
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
    String username = fieldUsername.getText().trim();
    String password = new String(fieldPassword.getPassword());
    if (MainGUI.settingsManager.checkAuth(username, password)) {
        parent.setVisible(true);
        parent.setEnabled(true);
        this.dispose();
    }
    else {
        JOptionPane.showMessageDialog(this,
                "Please reenter your credentials", 
                "Invalid ID or Password",
                JOptionPane.ERROR_MESSAGE);
    }
}
 
Example 26
Source File: LoginDialog.java    From 4pdaClient-plus with Apache License 2.0 6 votes vote down vote up
LoginTask(Context context,
          String login, String password, Boolean privacy,
          String capVal, String capTime, String capSig) {
    mContext = new WeakReference<>(context);
    this.login = login;
    this.password = password;
    this.privacy = privacy;
    this.capVal = capVal;
    this.capTime = capTime;
    this.capSig = capSig;
    dialog = new MaterialDialog.Builder(mContext.get())
            .progress(true, 0)
            .cancelable(false)
            .content(R.string.performing_login)
            .build();
}
 
Example 27
Source File: LoginDialog.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build the login part of the box
 */
private void buildLogin() {
	final Label label = new Label(shell, SWT.NONE);
	final GridData gridData = new GridData(GridData.END, GridData.END, false, false, 1, 1);
	gridData.horizontalIndent = 35;
	gridData.verticalIndent = 15;
	label.setLayoutData(gridData);
	label.setText(ResourceManager.getLabel(ResourceManager.NAME));

	if (autorizedLogin != null && !autorizedLogin.isEmpty()) {
		// Combo
		buildLoginCombo();
	} else {
		// Text
		buildLoginText();
	}

}
 
Example 28
Source File: LoginDialog.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build the description part of the box
 */
private void buildDescription() {
	final Label label = new Label(shell, SWT.NONE);
	final GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false, 4, 1);
	gridData.verticalIndent = 5;
	gridData.horizontalIndent = 5;
	label.setLayoutData(gridData);
	final Font bold = SWTGraphicUtil.buildFontFrom(label, SWT.BOLD);
	label.setFont(bold);
	SWTGraphicUtil.addDisposer(label, bold);

	if (description == null || description.trim().equals("")) {
		label.setText(" ");
	} else {
		label.setText(description);
	}
}
 
Example 29
Source File: OdooUserLoginSelectorDialog.java    From framework with GNU Affero General Public License v3.0 6 votes vote down vote up
public OdooUserLoginSelectorDialog(Context context) {
    mContext = context;
    AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
            AbsListView.LayoutParams.WRAP_CONTENT);
    mGrid = new ExpandableHeightGridView(mContext);
    mGrid.setLayoutParams(params);
    List<OUser> accounts = OdooAccountManager.getAllAccounts(mContext);
    mAdapter = new ArrayAdapter<OUser>(mContext, R.layout.base_instance_item, accounts) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null)
                convertView = LayoutInflater.from(mContext).inflate(R.layout.base_instance_item, parent, false);
            generateView(position, convertView, getItem(position));
            return convertView;
        }
    };
    int padding = OResource.dimen(mContext, R.dimen.activity_horizontal_margin);
    mGrid.setPadding(padding, padding, padding, padding);
    if (accounts.size() > 1)
        mGrid.setNumColumns(2);
    mGrid.setAdapter(mAdapter);
    mGrid.setOnItemClickListener(this);
}
 
Example 30
Source File: LoginDialog.java    From blade-player with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mResultDelivered = false;

    mProgressDialog = new ProgressDialog(getContext());
    mProgressDialog.setMessage(getContext().getString(R.string.com_spotify_sdk_login_progress));
    mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mProgressDialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dismiss();
        }
    });

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    getWindow().setBackgroundDrawableResource(android.R.drawable.screen_background_dark_transparent);

    setContentView(R.layout.com_spotify_sdk_login_dialog);

    setLayoutSize();

    createWebView(mUri);
}
 
Example 31
Source File: LoginDialogBuilder.java    From YalpStore with GNU General Public License v2.0 6 votes vote down vote up
private LoginInfo collectFormData() {
    LoginInfo loginInfo = new LoginInfo();
    if (((CheckBox) findViewById(R.id.account_toggle)).isChecked()) {
        loginInfo.setTokenDispenserUrl(new TokenDispenserMirrors().get());
    } else {
        loginInfo.setEmail(((AutoCompleteTextView) findViewById(R.id.email)).getText().toString());
        loginInfo.setPassword(((EditText) findViewById(R.id.password)).getText().toString());
    }
    if (!((CheckBox) findViewById(R.id.device_toggle)).isChecked()) {
        String deviceDefinitionDisplayName = (String) ((Spinner) findViewById(R.id.device_list)).getSelectedItem();
        loginInfo.setDeviceDefinitionName(devices.get(deviceDefinitionDisplayName));
        loginInfo.setDeviceDefinitionDisplayName(deviceDefinitionDisplayName);
    }
    if (!((CheckBox) findViewById(R.id.language_toggle)).isChecked()) {
        loginInfo.setLocale(languages.get(((Spinner) findViewById(R.id.language_list)).getSelectedItem()));
    }
    return loginInfo;
}
 
Example 32
Source File: ProfileCenterMainActivity.java    From mobile-manager-tool with MIT License 6 votes vote down vote up
private void loginDialog() {
    final Dialog dialog = new Dialog(this, R.style.exit_dialog);
    dialog.setContentView(R.layout.sky_login_dialog);

    TextView lovePlay = (TextView) dialog.findViewById(R.id.love_play_login);
    lovePlay.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(LoginActivity.class);
            dialog.dismiss();
        }
    });

    TextView qqLogin = (TextView) dialog.findViewById(R.id.qq_login);
    qqLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onClickLogin();
            dialog.dismiss();
        }
    });
    dialog.show();
}
 
Example 33
Source File: LoginDialogBuilder.java    From YalpStore with GNU General Public License v2.0 6 votes vote down vote up
private void showDeviceRequest() {
    new DialogWrapper(activity)
        .setMessage(R.string.dialog_message_spoof_request)
        .setTitle(R.string.dialog_title_spoof_request)
        .setPositiveButton(android.R.string.ok, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                PreferenceUtil.getDefaultSharedPreferences(activity).edit().putBoolean(PREFERENCE_REQUEST_IS_SHOWN, true).commit();
                ContextUtil.toastShort(activity, activity.getString(R.string.thank_you));
                Intent intentBugReport = new Intent(activity.getApplicationContext(), BugReportService.class);
                intentBugReport.setAction(BugReportService.ACTION_SEND_FTP);
                intentBugReport.putExtra(BugReportService.INTENT_DEVICE_DEFINITION, true);
                activity.startService(intentBugReport);
            }
        })
        .setNegativeButton(android.R.string.cancel, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                PreferenceUtil.getDefaultSharedPreferences(activity).edit().putBoolean(PREFERENCE_REQUEST_IS_SHOWN, true).commit();
            }
        })
        .show()
    ;
}
 
Example 34
Source File: FacebookLoginActivity.java    From facebooklogin with MIT License 6 votes vote down vote up
void onWebDialogComplete(Bundle values,
                         FacebookException error) {
    if (values != null) {
        AccessToken token = AccessToken
            .createFromWebBundle(permissions, values, AccessTokenSource.WEB_VIEW);

        returnToCallingActivity(token.getToken());

    } else {
        if (error instanceof FacebookOperationCanceledException) {
            returnToCallingActivityWithError("User canceled log in.");
        } else if (error != null) {
            returnToCallingActivityWithError(error.getMessage());
        }
        else {
            returnToCallingActivityWithError("Unexpected Error.");
        }
    }

}
 
Example 35
Source File: ElexisEnvironmentLoginDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Set<String> parseRoles(Jws<Claims> jwsClaim){
	Set<String> roles = new HashSet<String>();
	Map<String, Object> realmAccess =
		(Map<String, Object>) jwsClaim.getBody().get("realm_access");
	if (realmAccess != null) {
		List<String> realmAccessRoles = (List<String>) realmAccess.get("roles");
		if (realmAccessRoles != null) {
			roles.addAll(realmAccessRoles);
		}
	}
	Map<String, Object> resourceAccess =
		(Map<String, Object>) jwsClaim.getBody().get("resource_access");
	if (resourceAccess != null) {
		Map<String, Object> elexisRcpOpenidAccess =
			(Map<String, Object>) resourceAccess.get("elexis-rcp-openid");
		if (elexisRcpOpenidAccess != null) {
			List<String> elexisRcpOpenidAccessRoles =
				(List<String>) elexisRcpOpenidAccess.get("roles");
			if (elexisRcpOpenidAccessRoles != null) {
				roles.addAll(elexisRcpOpenidAccessRoles);
			}
		}
	}
	return roles;
}
 
Example 36
Source File: GlobalSettingsDialog.java    From swingsane with Apache License 2.0 6 votes vote down vote up
private void editLoginActionPerformed(ActionEvent e) {
  String resource = loginList.getSelectedValue();
  if (resource == null) {
    return;
  }
  LoginDialog loginDialog = new LoginDialog(this);

  Login login = logins.get(resource);
  loginDialog.setResource(resource);
  loginDialog.setUsername(login.getUsername());
  loginDialog.setPassword(login.getPassword());

  loginDialog.setModal(true);
  loginDialog.setVisible(true);
  if (loginDialog.getDialogResult() == JOptionPane.OK_OPTION) {
    login.setUsername(loginDialog.getUsername().trim());
    login.setPassword(loginDialog.getPassword().trim());
    loginList.revalidate();
  }
}
 
Example 37
Source File: LoginDialogFragment.java    From ghwatch with Apache License 2.0 6 votes vote down vote up
protected void showErrorMessage(BaseViewData result) {
  StringBuilder sb = new StringBuilder();
  if (result.loadingStatus == LoadingStatus.AUTH_ERROR) {
    sb.append(getString(R.string.message_err_error_auth));
  } else {
    sb.append(getString(result.loadingStatus.getResId()));
  }
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setMessage(sb).setCancelable(true).setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int id) {
    }
  });

  builder.create().show();
}
 
Example 38
Source File: WebAuthProviderTest.java    From Auth0.Android with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Test
public void shouldReThrowAnyFailedCodeExchangeDialogOnLogin() {
    final Dialog dialog = Mockito.mock(Dialog.class);
    PKCE pkce = Mockito.mock(PKCE.class);
    Mockito.doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) {
            callbackCaptor.getValue().onFailure(dialog);
            return null;
        }
    }).when(pkce).getToken(any(String.class), callbackCaptor.capture());
    WebAuthProvider.init(account)
            .withState("1234567890")
            .useCodeGrant(true)
            .withPKCE(pkce)
            .start(activity, callback);
    Intent intent = createAuthIntent(createHash(null, null, null, null, 1111L, "1234567890", null, null));
    assertTrue(WebAuthProvider.resume(intent));

    verify(callback).onFailure(dialog);
}
 
Example 39
Source File: LoginDialog.java    From offspring with MIT License 6 votes vote down vote up
private void setupControls() {
  buttonBrowse.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent event) {
      FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
      fd.setText(Messages.LoginDialog_FileDialog_title);
      String path = fd.open();
      if (path != null) {
        updateWalletPath(path);
      }
    };
  });

  ModifyListener listener = new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      updateDialogButtons();
    }
  };
  textPassword.addModifyListener(listener);
  textPassword2.addModifyListener(listener);
}
 
Example 40
Source File: ElexisEnvironmentLoginDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void parseCallback(String callbackUrl){
	// e.g. https://localhost:11223/elexis-rcp-callback?session_state=67b0202a-60aa-4dee-895b-0d5e6bf759d2
	// &code=ff725f7a-d852-4c35-b37a-892c9628fecf.67b0202a-60aa-4dee-895b-0d5e6bf759d2.55d54f98-c266-47e9-87fb-ef1a4381295c
	
	callbackUrl = callbackUrl.replace("http://", "");
	callbackUrl = callbackUrl.replace("https://", "");
	callbackUrl = callbackUrl.replace("localhost:11223/elexis-rcp-callback?", "");
	String[] parameters = callbackUrl.split("&");
	for (String parameter : parameters) {
		String[] keyValue = parameter.split("=");
		if (keyValue.length == 2) {
			if ("code".equals(keyValue[0])) {
				String code = keyValue[1];
				handleExchange(code);
				return;
			}
		}
	}
	browser.setText("<HTML><B>Invalid callback url</B> " + callbackUrl + "</HTML>");
	logger.warn("Invalid callback url [{}]", callbackUrl);
}
 
Example 41
Source File: SocialDialogLoginStrategy.java    From Android-SDK with MIT License 6 votes vote down vote up
private android.widget.ImageView createCloseImage()
{
  android.widget.ImageView closeImageView = new android.widget.ImageView( getContext() );
  closeImageView.setOnClickListener( new android.view.View.OnClickListener()
  {
    @Override
    public void onClick( android.view.View v )
    {
      if( dialog.isShowing() )
        dialog.dismiss();
    }
  } );
  android.graphics.drawable.Drawable closeDrawable = getContext().getResources().getDrawable( R.drawable.ic_menu_close_clear_cancel );
  closeImageView.setImageDrawable( closeDrawable );

  return closeImageView;
}
 
Example 42
Source File: PhotoDetailActivity.java    From BaoKanAndroid with MIT License 6 votes vote down vote up
/**
 * 显示登录提示会话框
 */
private void showLoginTipDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(true);
    builder.setIcon(R.mipmap.ic_launcher);
    builder.setTitle("您还未登录");
    builder.setMessage("登录以后才能收藏文章哦!");
    builder.setPositiveButton("登录", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            LoginActivity.start(PhotoDetailActivity.this);
        }
    });
    builder.setNegativeButton("以后再说", null);
    builder.show();
}
 
Example 43
Source File: Dialog.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unused") /* Used from JNI */
private static Dialog displayLoginFromNative(long id, String title, String text,
                                             String defaultUsername, boolean askStore) {
    final LoginDialog dialog = new LoginDialog(id, title, text, defaultUsername, askStore);
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            if (sCallbacks != null)
                sCallbacks.onDisplay(dialog);
        }
    });
    return dialog;
}
 
Example 44
Source File: LoginDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Configures the central grid pane before it's used.
 */
private static void setupGridPane(GridPane grid) {
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(7);
    grid.setVgap(10);
    grid.setPadding(new Insets(25));
    grid.setPrefSize(390, 100);
    grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
    applyColumnConstraints(grid, 20, 16, 33, 2, 29);
}
 
Example 45
Source File: LoginDialog.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
LogoutTask(Context context) {
    mContext = new WeakReference<>(context);
    dialog = new MaterialDialog.Builder(context)
            .progress(true, 0)
            .cancelable(true)
            .content(R.string.performing_logout)
            .build();
}
 
Example 46
Source File: LoginDialog.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
void connect() {
    saveData();
    LoginTask loginTask = new LoginTask(mContext,
            username_edit.getText().toString(), password_edit.getText().toString(),
            privacy_checkbox.isChecked(),
            ((EditText) mView.findViewById(R.id.cap_value_ed)).getText().toString(),
            capTime, capSig);
    loginTask.execute(username_edit.getText().toString(), password_edit.getText().toString(),
            Boolean.toString(privacy_checkbox.isChecked()));
}
 
Example 47
Source File: LoginDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void changeFocus() {
    // Change focus depending on what fields are present
    if (repoOwnerField.getText().isEmpty()) {
        Platform.runLater(repoOwnerField::requestFocus);
    } else if (repoNameField.getText().isEmpty()) {
        Platform.runLater(repoNameField::requestFocus);
    } else if (usernameField.getText().isEmpty()) {
        Platform.runLater(usernameField::requestFocus);
    } else {
        Platform.runLater(passwordField::requestFocus);
    }
}
 
Example 48
Source File: LoginDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public LoginDialog(UI ui, Stage parentStage, String owner, String repo, String username, String password) {
    super(parentStage);
    this.ui = ui;
    repoOwnerField.setText(owner);
    repoNameField.setText(repo);
    usernameField.setText(username);
    passwordField.setText(password);
    changeFocus();
    if (repoOwnerField.getText().isEmpty()) {
        repoOwnerField.setText(FIELD_DEFAULT_REPO_OWNER);
    }
    if (repoNameField.getText().isEmpty()) {
        repoNameField.setText(FIELD_DEFAULT_REPO_NAME);
    }
}
 
Example 49
Source File: Dialog.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Post an answer
 *
 * @param username valid username (can't be empty)
 * @param password valid password (can be empty)
 * @param store    if true, store the credentials
 */
@MainThread
public void postLogin(String username, String password, boolean store) {
    if (mId != 0) {
        nativePostLogin(mId, username, password, store);
        mId = 0;
    }
}
 
Example 50
Source File: LoginActivity.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
@Override
public void showLoginDialog()
{
    mDialog = new ProgressDialog(this);
    mDialog.setCancelable(false);
    mDialog.setMessage(ResUtils.getString(this, R.string.pgb_login_dialog_content));
    mDialog.show();
}
 
Example 51
Source File: LoginDialogBuilder.java    From YalpStore with GNU General Public License v2.0 5 votes vote down vote up
private CheckLoginTask getCheckLoginTask(LoginInfo loginInfo) {
    CheckLoginTask task = new CheckLoginTask();
    task.setCaller(caller);
    task.setContext(activity);
    task.setLoginInfo(loginInfo);
    task.setPreviousEmail(previousEmail);
    task.prepareDialog(
        loginInfo.appProvidedEmail()
            ? R.string.dialog_message_logging_in_predefined
            : R.string.dialog_message_logging_in_provided_by_user
        ,
        R.string.dialog_title_logging_in
    );
    return task;
}
 
Example 52
Source File: LoginDialog.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new LoginDialog.
 *
 * @param owner parent window
 * @param client client
 */
public LoginDialog(final Frame owner, final StendhalClient client) {
	super(owner, true);
	this.client = client;
	initializeComponent();
	WindowUtils.closeOnEscape(this);
}
 
Example 53
Source File: LoginDialog.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new DataValidator.
 *
 * @param component component to be enabled depending on the state of
 *  documents
 * @param docs documents
 */
DataValidator(JComponent component, Document... docs) {
	this.component = component;
	documents = docs;
	for (Document doc : docs) {
		doc.addDocumentListener(this);
	}
	revalidate();
}
 
Example 54
Source File: LoginDialog.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setEnabled(final boolean b) {
	super.setEnabled(b);
	// Enabling login button is conditional
	fieldValidator.revalidate();
	removeButton.setEnabled(b);
}
 
Example 55
Source File: LoginDialog.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
LoginDialog(Context context) {
    mContext = context;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    assert inflater != null;
    mView = inflater.inflate(R.layout.login, null);

    mImageView = mView.findViewById(R.id.cap_img);
    mProgressBar = mView.findViewById(R.id.progressBar2);
    username_edit = mView.findViewById(R.id.username_edit);
    password_edit = mView.findViewById(R.id.password_edit);
    privacy_checkbox = mView.findViewById(R.id.privacy_checkbox);
    new CapTask().execute();
    loadData();
}
 
Example 56
Source File: QTalkUserLoginActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void showConfigNavDialog(){
    final Dialog dialog = new Dialog(this,R.style.myiosstyle);
    View view = getLayoutInflater().inflate(R.layout.atom_ui_dialog_nav_config_notice,null);
    view.findViewById(R.id.atom_ui_manu_config).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            Intent intent = new Intent(QTalkUserLoginActivity.this,NavConfigActivity.class);
            startActivityForResult(intent, LOGIN_TYPE);
        }
    });
    view.findViewById(R.id.atom_ui_nav_config_scan_layout).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            permissionCheck();
        }
    });
    view.findViewById(R.id.atom_ui_next_time).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    dialog.setContentView(view);
    dialog.show();
}
 
Example 57
Source File: LoginDialogBuilder.java    From YalpStore with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    super.onCheckedChanged(buttonView, isChecked);
    Spinner spinner = (Spinner) dialogBuilder.findViewById(layoutResId);
    if (null == spinner.getAdapter() || spinner.getAdapter().isEmpty()) {
        PrepareSpinnerTask task = getPrepareSpinnerTask();
        task.setSpinner((Spinner) dialogBuilder.findViewById(layoutResId));
        task.setValueKeyMap(valueKeyMap);
        task.execute();
    }
}
 
Example 58
Source File: QRcodeLoginConfirmFragment.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
    public Dialog onCreateDialog(Bundle savedInstanceState)
    {
//        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        // Get the layout inflater
        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.atom_ui_activity_qrcodelogin_comfirm_dialog, null);
        mCloseView = (TextView) view.findViewById(R.id.qrcodelogin_dialog_close);
        mCancelView = (TextView) view.findViewById(R.id.qrcodelogin_dialog_cancel);
        mConfirmView = (TextView) view.findViewById(R.id.qrcodelogin_dialog_confirm);
        TextView tip = (TextView) view.findViewById(R.id.qrcodelogin_dialog_tip);

        mCloseView.setOnClickListener(this);
        mCancelView.setOnClickListener(this);
        mConfirmView.setOnClickListener(this);
//        builder.setView(view);

        final Dialog dialog = new Dialog(getActivity(), R.style.style_dialog);
        dialog.setContentView(view);
        dialog.show();
        WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;   //设置宽度充满屏幕
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        dialog.getWindow().setAttributes(lp);

        b = getArguments();
        loginType = b.getString("type");
        if(!TextUtils.isEmpty(loginType) && "wiki".equals(loginType.toLowerCase())){
            tip.setText(getString(R.string.atom_ui_tip_qrcodelogin_confirm, "Wiki"));
        }else {
            tip.setText(getString(R.string.atom_ui_tip_qrcodelogin_confirm, CommonConfig.currentPlat));
        }
        authData(1, 1);

        return dialog;//builder.create();
    }
 
Example 59
Source File: LoginDialog.java    From android-auth with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStop() {
    if (!mResultDelivered && mListener != null) {
        mListener.onCancel();
    }
    mResultDelivered = true;
    mProgressDialog.dismiss();
    super.onStop();
}
 
Example 60
Source File: BaseDialogActivity.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void performLoginChatSuccessAction(Bundle bundle) {
    super.performLoginChatSuccessAction(bundle);

    checkMessageSendingPossibility();
    startLoadDialogMessages(false);
}