Example usage for android.view Window FEATURE_LEFT_ICON

List of usage examples for android.view Window FEATURE_LEFT_ICON

Introduction

In this page you can find the example usage for android.view Window FEATURE_LEFT_ICON.

Prototype

int FEATURE_LEFT_ICON

To view the source code for android.view Window FEATURE_LEFT_ICON.

Click Source Link

Document

Flag for having an icon on the left side of the title bar

Usage

From source file:com.manning.androidhacks.hack023.authenticator.AuthenticatorActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mAccountManager = AccountManager.get(this);
    checkMaximumNumberOfAccounts();/*  ww w .  j av  a  2  s.  c om*/

    final Intent intent = getIntent();

    mUser = intent.getStringExtra(PARAM_USER);
    mAuthTokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false);

    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);

    findViews();
    initFields();
}

From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticatorActivity.java

/**
 * {@inheritDoc}//from w  w  w.  j  a  va2  s  . c o  m
 */
@Override
public void onCreate(Bundle icicle) {

    Log.i(TAG, "onCreate(" + icicle + ")");
    super.onCreate(icicle);
    mAccountManager = AccountManager.get(this);
    Log.i(TAG, "loading data from Intent");
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mIsUnknownAccountName = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRM_CREDENTIALS, false);
    Log.i(TAG, "IsUnknownAccount? : " + mIsUnknownAccountName);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);
    mEmailEdit = (EditText) findViewById(R.id.email_edit);
    mPhoneEdit = (EditText) findViewById(R.id.phone_edit);
    ((CheckBox) findViewById(R.id.new_account_box)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            findViewById(R.id.registration_layout).setVisibility(isChecked ? View.VISIBLE : View.GONE);
        }

    });
    if (!TextUtils.isEmpty(mUsername)) {
        mUsernameEdit.setText(mUsername);
    }
    mMessage.setText(getMessage());
}

From source file:edu.mit.mobile.android.locast.accounts.AuthenticatorActivity.java

/**
 * {@inheritDoc}//from ww w .  j  av a  2s .co  m
 */
@Override
public void onCreate(Bundle icicle) {
    Log.i(TAG, "onCreate(" + icicle + ")");
    super.onCreate(icicle);

    mAccountManager = AccountManager.get(this);
    Log.i(TAG, "loading data from Intent");

    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(EXTRA_USERNAME);
    mAuthtokenType = intent.getStringExtra(EXTRA_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(EXTRA_CONFIRMCREDENTIALS, false);

    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    // make the title based on the app name.
    setTitle(getString(R.string.login_title, getString(R.string.app_name)));

    setContentView(R.layout.login);
    // this is done this way, so the associated icon is managed in XML.
    try {
        getWindow().setFeatureDrawable(Window.FEATURE_LEFT_ICON,
                getPackageManager().getActivityIcon(getComponentName()));
    } catch (final NameNotFoundException e) {
        e.printStackTrace();
    }

    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username);
    mPasswordEdit = (EditText) findViewById(R.id.password);
    mPasswordEdit.setOnEditorActionListener(this);
    findViewById(R.id.login).setOnClickListener(this);
    findViewById(R.id.cancel).setOnClickListener(this);
    ((Button) findViewById(R.id.register)).setOnClickListener(this);

    mUsernameEdit.setText(mUsername);

    mAuthenticationTask = (AuthenticationTask) getLastNonConfigurationInstance();
    if (mAuthenticationTask != null) {
        mAuthenticationTask.attach(this);
    }
}

From source file:org.klnusbaum.udj.auth.AuthActivity.java

/**
 * {@inheritDoc}/*w  w  w  . jav a2  s.c om*/
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mAccountManager = AccountManager.get(this);
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRM_CREDENTIALS, false);
    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);
    if (!TextUtils.isEmpty(mUsername))
        mUsernameEdit.setText(mUsername);
    mMessage.setText(getMessage());

    TextView signUp = (TextView) findViewById(R.id.signup_text);
    signUp.setText(Html.fromHtml(getString(R.string.dont_have_account)));
    signUp.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.ntsync.android.sync.activities.KeyPasswordActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    SystemHelper.initSystem(this);

    Log.i(TAG, "loading data from Intent");
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    pwdSalt = intent.getByteArrayExtra(PARAM_SALT);
    pwdCheck = intent.getByteArrayExtra(PARAM_CHECK);

    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.keypassword_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.key);
    mMessage = (TextView) findViewById(R.id.message_bottom);

    mPasswordEdit = new AutoCompleteTextView[5];
    mPasswordEdit[0] = (AutoCompleteTextView) findViewById(R.id.pwd1_edit);
    mPasswordEdit[1] = (AutoCompleteTextView) findViewById(R.id.pwd2_edit);
    mPasswordEdit[2] = (AutoCompleteTextView) findViewById(R.id.pwd3_edit);
    mPasswordEdit[3] = (AutoCompleteTextView) findViewById(R.id.pwd4_edit);
    mPasswordEdit[4] = (AutoCompleteTextView) findViewById(R.id.pwd5_edit);
    for (AutoCompleteTextView textView : mPasswordEdit) {
        textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE
                | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    }//from  ww  w .j av a 2 s.c  o m

    if (pwdSalt == null || pwdSalt.length != ClientKeyHelper.SALT_LENGHT || pwdCheck == null) {
        // disable password input
        for (AutoCompleteTextView textView : mPasswordEdit) {
            if (textView != null) {
                textView.setEnabled(false);
            }
        }
    }
    msgNewKey = (TextView) findViewById(R.id.message_newkey);
    SpannableString newKeyText = SpannableString.valueOf(getText(R.string.keypwd_activity_newkey_label));

    newKeyText.setSpan(new InternalURLSpan(this), 0, newKeyText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    msgNewKey.setText(newKeyText, BufferType.SPANNABLE);
    msgNewKey.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.nbos.phonebook.sync.authenticator.AuthenticatorActivity.java

/**
 * {@inheritDoc}//w  w w . ja  v a 2 s . co  m
 */
@Override
public void onCreate(Bundle icicle) {
    Log.i(tag, "onCreate(" + icicle + ")");
    super.onCreate(icicle);
    mAccountManager = AccountManager.get(this);
    Log.i(tag, "loading data from Intent");
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mAuthtokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false);

    Log.i(tag, "request new: " + mRequestNewAccount + " ,ConfirmCredentials: " + mConfirmCredentials);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);

    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.country_code_array,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);
    setSpinnerCountry(spinner);
    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);
    mPhoneEdit = (EditText) findViewById(R.id.phone_edit);
    getPhoneNumber(getApplicationContext());
    mUsernameEdit.setText(mUsername);
    mMessage.setText(getMessage());
}

From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.java

/**
 * {@inheritDoc}//from w  ww .  j  ava2 s.  co m
 */
@Override
public void onCreate(Bundle icicle) {
    if (BuildConfig.DEBUG) {
        Log.i(TAG, "onCreate(" + icicle + ")");
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        requestWindowFeature(Window.FEATURE_ACTION_BAR);
    }
    super.onCreate(icicle);

    mAccountManager = AccountManager.get(this);
    if (BuildConfig.DEBUG) {
        Log.i(TAG, "loading data from Intent");
    }

    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(EXTRA_USERNAME);
    mAuthtokenType = intent.getStringExtra(EXTRA_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(EXTRA_CONFIRMCREDENTIALS, false);

    if (BuildConfig.DEBUG) {
        Log.i(TAG, "    request new: " + mRequestNewAccount);
    }
    requestWindowFeature(Window.FEATURE_LEFT_ICON);

    final CharSequence appName = getAppName();

    // make the title based on the app name.
    setTitle(getString(R.string.login_title, appName));

    // TODO make this changeable. Maybe use fragments?
    setContentView(R.layout.login);
    // this is done this way, so the associated icon is managed in XML.
    try {
        getWindow().setFeatureDrawable(Window.FEATURE_LEFT_ICON,
                getPackageManager().getActivityIcon(getComponentName()));
    } catch (final NameNotFoundException e) {
        e.printStackTrace();
    }

    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username);
    mUsernameEdit.setHint(isEmailAddressLogin() ? R.string.auth_email_login_hint : R.string.auth_username_hint);
    mPasswordEdit = (EditText) findViewById(R.id.password);
    mPasswordEdit.setOnEditorActionListener(this);
    findViewById(R.id.login).setOnClickListener(this);
    findViewById(R.id.cancel).setOnClickListener(this);
    mRegisterButton = (Button) findViewById(R.id.register);
    mRegisterButton.setOnClickListener(this);
    final String regButton = getString(R.string.signup_text, appName);
    if (regButton.length() < 24) {
        mRegisterButton.setText(regButton);
    }

    ((TextView) findViewById(R.id.username_label)).setText(getString(R.string.username_label, appName));

    mUsernameEdit.setText(mUsername);

    // this will be unnecessary with fragments
    mAuthenticationTask = (AuthenticationTask) getLastNonConfigurationInstance();
    if (mAuthenticationTask != null) {
        mAuthenticationTask.attach(this);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.person.PersonProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (getDialog() != null) {
        getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);
    }/*from  w  w w.j  a  v a  2 s . c  o m*/

    alfSession = SessionUtils.getSession(getActivity());
    SessionUtils.checkSession(getActivity(), alfSession);

    // Create View
    vRoot = inflater.inflate(R.layout.app_user_profile, container, false);
    if (alfSession == null) {
        return vRoot;
    }

    // Icon
    if (renditionManager == null) {
        renditionManager = ApplicationManager.getInstance(getActivity()).getRenditionManager(getActivity());
    }
    renditionManager.display((ImageView) vRoot.findViewById(R.id.preview),
            getArguments().getString(ARGUMENT_PERSONID), R.drawable.ic_avatar);

    return vRoot;
}

From source file:org.alfresco.mobile.android.application.fragments.user.UserSearchFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (getDialog() != null) {
        getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);
    }/*w w w .  j av  a 2  s .  c om*/

    // Retrieve session object
    checkSession();

    if (getArguments() != null && getArguments().containsKey(ARGUMENT_MODE)) {
        fieldId = getArguments().getString(ARGUMENT_FIELD_ID);
        keywords = getArguments().getString(ARGUMENT_KEYWORD);
        title = getArguments().getString(ARGUMENT_TITLE);
        mode = getArguments().getInt(ARGUMENT_MODE);
        singleChoice = getArguments().getBoolean(ARGUMENT_SINGLE_CHOICE);
        String pickFragmentTag = getArguments().getString(ARGUMENT_FRAGMENT_TAG);
        fragmentPick = getFragmentManager().findFragmentByTag(pickFragmentTag);
        if (fragmentPick != null && fragmentPick instanceof UserPickerCallback) {
            selectedItems = ((UserPickerCallback) fragmentPick).retrieveSelection();
        } else if (fragmentPick instanceof onPickAuthorityFragment && fieldId != null) {
            selectedItems = ((onPickAuthorityFragment) fragmentPick).getPersonSelected(fieldId);
        }
    }

    // Create View
    setRootView(inflater.inflate(R.layout.app_pick_person, container, false));
    if (getSession() == null) {
        return getRootView();
    }

    // Init list
    init(getRootView(), R.string.person_not_found);
    gv.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
    setListShown(true);

    if (keywords != null && !keywords.isEmpty()) {
        search(keywords);
        hide(R.id.search_form_group);
    } else {
        // Init form search
        searchForm = (EditText) viewById(R.id.search_query);
        searchForm.setImeOptions(EditorInfo.IME_ACTION_SEARCH);

        searchForm.setOnEditorActionListener(new OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (event != null && (event.getAction() == KeyEvent.ACTION_DOWN)
                        && ((actionId == EditorInfo.IME_ACTION_SEARCH)
                                || (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))) {
                    if (searchForm.getText().length() > 0) {
                        keywords = searchForm.getText().toString();
                        search(keywords);
                    } else {
                        AlfrescoNotificationManager.getInstance(getActivity())
                                .showLongToast(getString(R.string.search_form_hint));
                    }
                    return true;
                }
                return false;
            }
        });

        // Speech to Text
        Boolean hasTextToSpeech = ActionUtils.hasSpeechToText(getActivity());
        ImageButton speechToText = (ImageButton) viewById(R.id.search_microphone);
        if (hasTextToSpeech) {
            speechToText.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    speechToText();
                }
            });
        } else {
            hide(R.id.search_microphone);
        }
    }

    if (getMode() == MODE_PICK) {
        show(R.id.validation_panel);
        validation = UIUtils.initValidation(getRootView(), R.string.done);
        updatePickButton();
        validation.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                onSelect(selectedItems);
                if (getDialog() != null) {
                    getDialog().dismiss();
                } else {
                    getFragmentManager().popBackStack();
                }
            }
        });

        Button cancel = UIUtils.initCancel(getRootView(), R.string.cancel);
        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (getDialog() != null) {
                    getDialog().dismiss();
                } else {
                    getFragmentManager().popBackStack();
                }
            }
        });
    } else {
        hide(R.id.validation_panel);
    }

    return getRootView();
}

From source file:org.alfresco.mobile.android.application.fragments.user.UserProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (getDialog() != null) {
        getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);
    }/*from w ww  . j  a  v  a  2 s.  co m*/

    if (getArguments() != null) {
        userName = getArguments().getString(ARGUMENT_USERNAME);
        if (getArguments().containsKey(ARGUMENT_ACCOUNTID)) {
            accountId = getArguments().getLong(ARGUMENT_ACCOUNTID);
        }
    }

    session = SessionUtils.getSession(getActivity());
    if (accountId != null && accountId != -1) {
        session = SessionManager.getInstance(getActivity()).getSession(accountId);
    }

    setSession(session);
    SessionUtils.checkSession(getActivity(), getSession());

    // Create View
    setRootView(inflater.inflate(R.layout.app_user_profile, container, false));
    if (getSession() == null) {
        return getRootView();
    }

    if (TextUtils.isEmpty(userName)) {
        userName = getSession().getPersonIdentifier();
        titleId = R.string.my_profile;
    }

    // Icon
    RenditionManager.with(getActivity()).loadAvatar(userName).placeHolder(R.drawable.ic_person_light)
            .into((ImageView) viewById(R.id.preview));
    return getRootView();
}