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:org.alfresco.mobile.android.application.fragments.browser.CreateDocumentDialogFragment.java

@Override
public void onStart() {

    if (getArguments().getSerializable(ARGUMENT_CONTENT_FILE) != null) {
        ContentFile f = (ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE);
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
                MimeTypeManager.getIcon(getActivity(), f.getFileName()));
    } else {/*  www . jav a2  s.c  om*/
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.mime_file);
    }
    super.onStart();
}

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

@Override
public void onStart() {
    if (getDialog() != null) {
        if (fragmentPick instanceof TaskDetailsFragment) {
            getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_reassign);
            getDialog().setTitle(R.string.task_reassign_long);
        } else if (fragmentPick instanceof AdvancedSearchFragment) {
            getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_person_light);
            getDialog().setTitle(R.string.metadata_modified_by);
        } else {/*from  w w  w . ja v a 2 s  . com*/
            getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_person_light);
            getDialog().setTitle(R.string.search_title);
        }
    } else {
        if (title != null) {
            UIUtils.displayTitle(getActivity(), String.format(getString(R.string.search_title), title));
        } else if (keywords != null) {
            UIUtils.displayTitle(getActivity(), String.format(getString(R.string.search_title), keywords));
        }

    }
    super.onStart();
}

From source file:org.appcelerator.titanium.TiBaseActivity.java

protected void setNavBarHidden(boolean hidden) {
    if (!hidden) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            // Do not enable these features on Honeycomb or later since it will break the action bar.
            this.requestWindowFeature(Window.FEATURE_LEFT_ICON);
            this.requestWindowFeature(Window.FEATURE_RIGHT_ICON);
        }//from  w  w  w . ja  va2s .c  om

        this.requestWindowFeature(Window.FEATURE_PROGRESS);
        this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    } else {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
}

From source file:biz.bokhorst.xprivacy.ActivityApp.java

private void optionHelp() {
    // Show help//w  ww  .  ja  v a 2 s  . c  om
    Dialog dialog = new Dialog(ActivityApp.this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.menu_help);
    dialog.setContentView(R.layout.help);
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
    ((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
    ((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());
    dialog.setCancelable(true);
    dialog.show();
}

From source file:su.comp.bk.ui.BkEmuActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_COMPUTER_MODEL:
        final CharSequence[] models;
        List<String> modelList = new ArrayList<String>();
        for (Configuration model : Configuration.values()) {
            int modelNameId = getResources().getIdentifier(model.name().toLowerCase(), "string",
                    getPackageName());/*  w w  w .  j  a va  2 s  .  c  o  m*/
            modelList.add((modelNameId != 0) ? getString(modelNameId) : model.name());
        }
        models = modelList.toArray(new String[modelList.size()]);
        return new AlertDialog.Builder(this).setTitle(R.string.menu_select_model).setSingleChoiceItems(models,
                getComputerConfiguration().ordinal(), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        // Mark selected item by tag
                        ListView listView = ((AlertDialog) dialog).getListView();
                        listView.setTag(Integer.valueOf(which));
                    }
                }).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Get tagged selected item, if any
                        ListView listView = ((AlertDialog) dialog).getListView();
                        Integer selected = (Integer) listView.getTag();
                        if (selected != null) {
                            Configuration config = Configuration.values()[selected];
                            if (computer.getConfiguration() != config) {
                                // Set new computer configuration and restart activity
                                setComputerConfiguration(config);
                                restartActivity(null);
                            }
                        }
                    }
                }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Do nothing on cancel
                    }
                }).create();
    case DIALOG_ABOUT:
        Dialog aboutDialog = new Dialog(this);
        aboutDialog.setTitle(R.string.menu_about);
        aboutDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
        aboutDialog.setContentView(R.layout.about_dialog);
        aboutDialog.getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
                android.R.drawable.ic_dialog_info);
        TextView versionTextView = (TextView) aboutDialog.findViewById(R.id.about_version);
        try {
            versionTextView.setText(getResources().getString(R.string.about_version,
                    getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
        } catch (NameNotFoundException e) {
        }
        return aboutDialog;
    case DIALOG_DISK_MANAGER:
        Dialog fddManagerDialog = new Dialog(this);
        fddManagerDialog.setTitle(R.string.menu_disk_manager);
        fddManagerDialog.setContentView(R.layout.fdd_mgr_dialog);
        return fddManagerDialog;
    case DIALOG_DISK_MOUNT_ERROR:
        return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.err)
                .setMessage(R.string.dialog_disk_mount_error).setPositiveButton(R.string.ok, null).create();
    }
    return null;
}

From source file:org.thoughtland.xlocation.ActivityApp.java

private void optionLegend() {
    // Show help//w  ww.jav a2 s .c  o m
    Dialog dialog = new Dialog(ActivityApp.this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.menu_legend);
    dialog.setContentView(R.layout.legend);
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));

    ((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
    ((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());

    for (View child : Util.getViewsByTag((ViewGroup) dialog.findViewById(android.R.id.content), "main"))
        child.setVisibility(View.GONE);

    ((LinearLayout) dialog.findViewById(R.id.llUnsafe))
            .setVisibility(PrivacyManager.cVersion3 ? View.VISIBLE : View.GONE);

    dialog.setCancelable(true);
    dialog.show();
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

private void optionLegend() {
    // Show help//from   ww  w.  ja va2 s  .  c  om
    Dialog dialog = new Dialog(ActivityMain.this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.menu_legend);
    dialog.setContentView(R.layout.legend);
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));

    ((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
    ((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());

    for (View child : Util.getViewsByTag((ViewGroup) dialog.findViewById(android.R.id.content), "details"))
        child.setVisibility(View.GONE);

    ((LinearLayout) dialog.findViewById(R.id.llUnsafe))
            .setVisibility(PrivacyManager.cVersion3 ? View.VISIBLE : View.GONE);

    dialog.setCancelable(true);
    dialog.show();
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

private void optionTutorial() {
    ((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE);
    ((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE);
    int userId = Util.getUserId(Process.myUid());
    PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString());

    Dialog dlgUsage = new Dialog(this);
    dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dlgUsage.setTitle(R.string.title_usage_header);
    dlgUsage.setContentView(R.layout.usage);
    dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
    dlgUsage.setCancelable(true);/* ww w. ja  v a 2  s .com*/
    dlgUsage.show();
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@SuppressLint("DefaultLocale")
private void optionAbout() {
    // About/* w  w w .jav a  2s .c  o  m*/
    Dialog dlgAbout = new Dialog(this);
    dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dlgAbout.setTitle(R.string.menu_about);
    dlgAbout.setContentView(R.layout.about);
    dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));

    // Show version
    try {
        int userId = Util.getUserId(Process.myUid());
        Version currentVersion = new Version(Util.getSelfVersionName(this));
        Version storedVersion = new Version(
                PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0"));
        boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false);
        String versionName = currentVersion.toString();
        if (currentVersion.compareTo(storedVersion) != 0)
            versionName += "/" + storedVersion.toString();
        if (!migrated)
            versionName += "!";
        int versionCode = Util.getSelfVersionCode(this);
        TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion);
        tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode));
    } catch (Throwable ex) {
        Util.bug(null, ex);
    }

    if (!PrivacyManager.cVersion3 || Hook.isAOSP(19))
        ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE);

    // Show license
    String licensed = Util.hasProLicense(this);
    TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed);
    TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt);
    if (licensed == null) {
        tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath());
        tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
                .getAbsolutePath());
    } else {
        tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed));
        tvLicensed2.setVisibility(View.GONE);
    }

    // Show some build properties
    String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT);
    ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android);
    ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND);
    ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER);
    ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL);
    ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT);
    ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE);
    ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST);
    ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY);
    ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID);

    dlgAbout.setCancelable(true);

    final int userId = Util.getUserId(Process.myUid());
    if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true))
        dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                Dialog dlgUsage = new Dialog(ActivityMain.this);
                dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
                dlgUsage.setTitle(R.string.app_name);
                dlgUsage.setContentView(R.layout.usage);
                dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
                dlgUsage.setCancelable(true);
                dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun,
                                Boolean.FALSE.toString());
                        optionLegend();
                    }
                });
                dlgUsage.show();
            }
        });

    dlgAbout.show();
}