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.wuman.oauth.samples.ui.HtmlLicensesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.licenses);/*from  ww  w.  jav a2 s.c o  m*/
    requestWindowFeature(Window.FEATURE_LEFT_ICON);

    setContentView(R.layout.html_dialog_layout);
    WebView wv = (WebView) findViewById(R.id.wv);

    String content = getContentFromResource(this, R.raw.licenses).replaceAll("<app_name>",
            getString(R.string.app_name_long));

    try {
        wv.loadDataWithBaseURL("file:///android_asset/", content, null, "utf-8", null);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.vadimfrolov.duorem.AboutDialog.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (getDialog() != null) {
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);
    }//from  w  w w.j a v  a  2  s.c  o  m
}

From source file:de.grobox.liberario.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.activity_about);

    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_info);
    setTitle(getResources().getString(R.string.action_about) + " "
            + getResources().getString(R.string.app_name));

    String versionName;//from w  w w  .j av a 2s .c  o  m
    try {
        versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
        versionName = "?.?";
    }

    // add app name and version
    TextView aboutApp = (TextView) findViewById(R.id.aboutApp);
    aboutApp.setText(getResources().getString(R.string.app_name) + "  " + versionName);

    // create real paragraphs
    TextView t = (TextView) findViewById(R.id.aboutTextView);
    t.setText(Html.fromHtml(getString(R.string.about)));

    // make links in about text clickable
    t.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.wuman.oauth.samples.ui.HtmlLicensesActivity.java

@Override
public void onContentChanged() {
    super.onContentChanged();

    setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);

    mButtonBar = (BottomButtonBar) ((ViewStub) findViewById(R.id.bottom_button_bar_stub)).inflate();
    mButtonBar.setVisibility(View.GONE);
    mButtonBar.setBackgroundResource(android.R.drawable.bottom_bar);
    mButtonBar.setOnClickListener(this, R.id.btn_left, R.id.btn_middle, R.id.btn_right);
    onSetupButtonBar(mButtonBar);//from  w ww .ja va 2s .  c o  m
}

From source file:com.vadimfrolov.duorem.AboutDialog.java

@Nullable
@Override//from w ww .  j  a  v a  2  s .c o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);
    return inflater.inflate(R.layout.about, container);
}

From source file:dev.drsoran.moloko.activities.ChangeTagsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_LEFT_ICON);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.change_tags_activity);
    setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_dialog_tag);

    if (getChangeTagsFragment() == null) {
        addChangeTagsFragment();/*  w w  w . j  ava  2s.  c  o  m*/
    }

    registerButtonListener();
}

From source file:de.grobox.liberario.activities.SetHomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    if (Preferences.darkThemeEnabled(this)) {
        setTheme(R.style.SetHomeDialogTheme);
    } else {/*from  ww w.j  a  v a  2  s.  com*/
        setTheme(R.style.SetHomeDialogTheme_Light);
    }

    getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_action_home);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_set_home);

    setTitle(getString(R.string.home_dialog_title));

    Intent intent = getIntent();

    // show new home text
    if (!intent.getBooleanExtra("new", true)) {
        findViewById(R.id.homeMsgView).setVisibility(View.GONE);
    }

    final LocationInputView.LocationInputViewHolder holder = new LocationInputView.LocationInputViewHolder(
            findViewById(R.id.setHomeView));

    final LocationInputView loc = new LocationInputView(this, holder, true);
    loc.setFavs(true);

    holder.location.setHint(R.string.home);

    // OK Button
    Button okButton = (Button) findViewById(R.id.okButton);
    okButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (loc.getLocation() != null) {
                // save home location in file
                RecentsDB.setHome(v.getContext(), loc.getLocation());

                Intent returnIntent = new Intent();
                setResult(RESULT_OK, returnIntent);

                close(v);
            } else {
                Toast.makeText(v.getContext(),
                        getResources().getString(R.string.error_only_autocomplete_station), Toast.LENGTH_SHORT)
                        .show();
            }
        }
    });

    // Cancel Button
    Button cancelButton = (Button) findViewById(R.id.cancelButton);
    cancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent returnIntent = new Intent();
            setResult(RESULT_CANCELED, returnIntent);

            close(v);
        }
    });
}

From source file:de.grobox.liberario.SetHomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.activity_set_home);

    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_action_home);
    setTitle(getString(R.string.home_dialog_title));

    Intent intent = getIntent();/*w ww .  ja  v  a  2  s .  c o  m*/

    // show new home text
    if (!intent.getBooleanExtra("new", true)) {
        findViewById(R.id.homeMsgView).setVisibility(View.GONE);
    }

    // home location TextView
    final AutoCompleteTextView homeView = (AutoCompleteTextView) findViewById(R.id.homeView);
    LocationAdapter locAdapter = new LocationAdapter(this, FavLocation.LOC_TYPE.FROM, true);
    locAdapter.setFavs(true);
    homeView.setAdapter(locAdapter);
    homeView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
            Location loc = (Location) parent.getItemAtPosition(position);
            homeView.setText(loc.uniqueShortName());
            homeView.setTag(loc);
            homeView.requestFocus();

            // hide soft-keyboard
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(homeView.getWindowToken(), 0);
        }
    });

    // clear from text button
    final ImageButton homeClearButton = (ImageButton) findViewById(R.id.homeClearButton);
    homeClearButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            homeView.setText("");
            homeView.requestFocus();
            homeView.setTag(null);
            homeClearButton.setVisibility(View.GONE);
        }
    });

    // When text changed
    homeView.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // clear saved station
            homeView.setTag(null);

            // show clear button
            homeClearButton.setVisibility(View.VISIBLE);
        }

        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }
    });

    // station name favorites button
    findViewById(R.id.homeFavButton).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            int size = ((LocationAdapter) homeView.getAdapter()).addFavs();

            if (size > 0) {
                homeView.showDropDown();
            } else {
                Toast.makeText(v.getContext(), getResources().getString(R.string.error_no_favs),
                        Toast.LENGTH_SHORT).show();
            }
        }
    });

    // OK Button
    Button okButton = (Button) findViewById(R.id.okButton);
    okButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (homeView.getTag() != null && homeView.getTag() instanceof Location) {
                // save home location in file
                FavDB.setHome(v.getContext(), (Location) homeView.getTag());

                Intent returnIntent = new Intent();
                setResult(RESULT_OK, returnIntent);

                close(v);
            } else {
                Toast.makeText(v.getContext(),
                        getResources().getString(R.string.error_only_autocomplete_station), Toast.LENGTH_SHORT)
                        .show();
            }
        }
    });

    // Cancel Button
    Button cancelButton = (Button) findViewById(R.id.cancelButton);
    cancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent returnIntent = new Intent();
            setResult(RESULT_CANCELED, returnIntent);

            close(v);
        }
    });
}

From source file:org.adblockplus.android.CrashReportDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.crashreport);

    Bundle extras = getIntent().getExtras();
    if (extras == null) {
        finish();/*www  .  ja  v  a 2s  .c o  m*/
        return;
    }
    report = extras.getString("report");

    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
}

From source file:damo.three.ie.activity.InternetExpirationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    supportRequestWindowFeature(Window.FEATURE_LEFT_ICON);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.internet_expired);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);

    textViewSummary = (TextView) findViewById(R.id.textViewSummary);
    Button buttonThree = (Button) findViewById(R.id.buttonThree);
    Button buttonOk = (Button) findViewById(R.id.buttonOk);

    // Get the tie it expired, in-case its already expired.
    alreadyExpired = getIntent().getExtras().getBoolean(InternetUsageRegistry.INTERNET_EXPIRED);

    /*/*w  w w. j  a  v a 2  s. co  m*/
     * Action for buttonThree
     * Opens my3account.three.ie and closes this Activity
     */
    buttonThree.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(Constants.MY3_MAIN_PAGE));
            startActivity(i);
            finish();
        }

    });

    /**
     * Action for ok button.
     * Closes the activity.
     */
    buttonOk.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    updateTextViewSummary();
}