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.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG)
        Log.d(CLASSNAME, "onCreateDialog()");

    Dialog dialog = new Dialog(getActivity(),
            UI.resolveAttribute(getActivity(), R.attr.anhuu_f5be488d_theme_dialog));
    dialog.setCanceledOnTouchOutside(true);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.anhuu_f5be488d_title_bookmark_manager);
    dialog.setContentView(initContentView(dialog.getLayoutInflater(), null));
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.anhuu_f5be488d_bookmarks_dark);

    return dialog;
}

From source file:org.alfresco.mobile.android.application.accounts.fragment.AccountOAuthFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (getDialog() != null) {
        getDialog().setTitle(R.string.account_wizard_step2_title);
        getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);
    } else {/*from w  w w.  j a  v a 2s  . com*/
        UIUtils.displayTitle(getActivity(), R.string.account_wizard_step2_title,
                !(getActivity() instanceof HomeScreenActivity));
    }

    final View v = super.onCreateView(inflater, container, savedInstanceState);

    setOnOAuthAccessTokenListener(new OnOAuthAccessTokenListener() {

        @Override
        public void failedRequestAccessToken(Exception e) {
            if (DisplayUtils.hasCentralPane(getActivity())) {
                ((MainActivity) getActivity()).clearScreen();
            } else {
                getActivity().getFragmentManager().popBackStack();
            }

            Log.e(TAG, Log.getStackTraceString(e));
            MessengerManager.showLongToast(getActivity(), getActivity().getString(R.string.error_general));
        }

        @Override
        public void beforeRequestAccessToken(Bundle b) {
            int operationId = CreateAccountRequest.TYPE_ID;
            String intentId = IntentIntegrator.ACTION_CREATE_ACCOUNT_COMPLETED;
            if (getArguments().containsKey(PARAM_ACCOUNT)) {
                operationId = LoadSessionRequest.TYPE_ID;
                intentId = IntentIntegrator.ACTION_LOAD_ACCOUNT_COMPLETED;
            }

            if (getFragmentManager().findFragmentByTag(OperationWaitingDialogFragment.TAG) == null) {
                // Create Account + Session
                OperationWaitingDialogFragment
                        .newInstance(intentId, operationId, R.drawable.ic_cloud, getString(R.string.wait_title),
                                getString(R.string.wait_message), null, 0)
                        .show(getFragmentManager(), OperationWaitingDialogFragment.TAG);
            }
        }

        @Override
        public void afterRequestAccessToken(OAuthData result) {
            load(result);
        }
    });

    final View waiting = v.findViewById(R.id.waiting);

    setOnOAuthWebViewListener(new OnOAuthWebViewListener() {

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            if (waiting != null) {
                waiting.setVisibility(View.GONE);
            }
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            waiting.setVisibility(View.VISIBLE);
        }

    });

    return v;
}

From source file:group.pals.android.lib.ui.filechooser.utils.ui.bookmark.BookmarkFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG)
        Log.d(_ClassName, "onCreateDialog()");

    Dialog dialog = new Dialog(getActivity(), R.style.Afc_Theme_Dialog_Dark);
    dialog.setCanceledOnTouchOutside(true);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.afc_title_bookmark_manager);
    dialog.setContentView(initContentView(dialog.getLayoutInflater(), null));
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.afc_bookmarks_dark);

    return dialog;
}

From source file:org.alfresco.mobile.android.application.fragments.browser.CreateDocumentDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().setTitle(R.string.content_upload);
    getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);

    View v = inflater.inflate(R.layout.sdk_create_content_props, container, false);
    tv = (EditText) v.findViewById(R.id.content_name);
    final EditText desc = (EditText) v.findViewById(R.id.content_description);
    TextView tsize = (TextView) v.findViewById(R.id.content_size);

    editTags = (EditText) v.findViewById(R.id.content_tags);

    Button button = (Button) v.findViewById(R.id.cancel);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            File uploadFile = ((ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE)).getFile();

            // If the file is a temporary file, remove it on cancellation of
            // dialog.
            if (StorageManager.isTempFile(getActivity(), uploadFile)) {
                uploadFile.delete();// www  .ja  v  a  2 s.c  om
            }

            CreateDocumentDialogFragment.this.dismiss();
        }
    });

    final Button bcreate = UIUtils.initValidation(v, R.string.confirm);
    bcreate.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            createDocument(tv, desc, bcreate);
        }
    });

    if (getArguments().getSerializable(ARGUMENT_CONTENT_FILE) != null) {
        contentFile = (ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE);
        originalName = contentFile.getFileName();
        tv.setText(originalName);
        tsize.setText(Formatter.formatFileSize(getActivity(), contentFile.getLength()));
        tsize.setVisibility(View.VISIBLE);
        bcreate.setEnabled(true);
    } else {
        tsize.setVisibility(View.GONE);
    }

    tv.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
            if (tv.getText().length() == 0) {
                bcreate.setEnabled(false);
                tv.setError(null);
            } else {
                bcreate.setEnabled(true);
                if (UIUtils.hasInvalidName(tv.getText().toString().trim())) {
                    tv.setError(getString(R.string.filename_error_character));
                    bcreate.setEnabled(false);
                } else {
                    tv.setError(null);
                }
            }
            if (originalName.equals(tv.getText().toString())) {
                tv.setError(getString(R.string.create_document_filename_error));
            } else {
                tv.setError(null);
            }
        }

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

        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }
    });

    editTags.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                createDocument(tv, desc, bcreate);
                handled = true;
            }
            return handled;
        }
    });

    Folder parentFolder = getParent();
    OperationsRequestGroup group = new OperationsRequestGroup(getActivity(),
            SessionUtils.getAccount(getActivity()));
    group.enqueue(new RetrieveDocumentNameRequest(parentFolder.getIdentifier(), contentFile.getFileName())
            .setNotificationVisibility(OperationRequest.VISIBILITY_HIDDEN));
    BatchOperationManager.getInstance(getActivity()).enqueue(group);

    return v;
}

From source file:com.fabernovel.alertevoirie.ReportDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.layout_report_details);

    boolean existingIncident = getIntent().getBooleanExtra("existing", false);

    // init title
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
            existingIncident ? R.drawable.icon_mes_rapports : R.drawable.icon_nouveau_rapport);
    getWindow().setTitle(getString(R.string.report_detail_new_report_title));

    findViewById(R.id.LinearLayout_comment).setVisibility(View.GONE);
    Button validate = (Button) findViewById(R.id.Button_validate);

    File img_close = new File(getFilesDir() + "/" + CAPTURE_CLOSE);
    File img_far = new File(getFilesDir() + "/" + CAPTURE_ARROW);
    File img_far2 = new File(getFilesDir() + "/" + CAPTURE_FAR);

    img_close.delete();/*w  ww .  ja v a  2 s  .co m*/
    img_far.delete();
    img_far2.delete();

    if (existingIncident) {
        validate.setVisibility(View.GONE);
        validate.setEnabled(true);
        findViewById(R.id.existing_incidents_layout).setVisibility(View.VISIBLE);
        try {
            imgd = new ImageDownloader(this);
            String jsonEvent = getIntent().getStringExtra("event");
            //Log.d("AlerteVoirie_PM", "json : " + jsonEvent);
            currentIncident = Incident.fromJSONObject(this, new JSONObject(jsonEvent));
            setCategory(currentIncident.categoryId);

            // NO, use title instead as comment is not editable
            // ((TextView) findViewById(R.id.TextView_comment)).setText(currentIncident.description);
            // load title
            findViewById(R.id.LinearLayout_title).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.TextView_title)).setText(currentIncident.description);
            ((TextView) findViewById(R.id.TextView_date)).setText(getFormatedDate(currentIncident.date));
            // hide comment edit buttons
            findViewById(R.id.LinearLayout_comment).setVisibility(View.GONE);

            ((TextView) findViewById(R.id.TextView_address)).setText(currentIncident.address);
            // imgd.setDefault_img(((ImageView) findViewById(R.id.ImageView_far)).getBackground());

            findViewById(R.id.existing_incident_solved).setOnClickListener(this);
            findViewById(R.id.existing_incidents_confirmed).setOnClickListener(this);
            findViewById(R.id.existing_incidents_add_picture).setOnClickListener(this);
            findViewById(R.id.existing_incidents_invalid).setOnClickListener(this);

            // if (currentIncident.description != null && currentIncident.description.length() > 0) {
            // findViewById(R.id.TextView_nocomment).setVisibility(View.GONE);
            // findViewById(R.id.LinearLayout_comment).setVisibility(View.VISIBLE);
            // }

            updateConfirmsDisplay();

            imgd.download((String) currentIncident.pictures_far.get(0),
                    ((ImageView) findViewById(R.id.ImageView_far)));
            if (currentIncident.pictures_close.length() > 0) {
                imgd.download((String) currentIncident.pictures_close.get(0),
                        ((ImageView) findViewById(R.id.ImageView_close)));
            }

        } catch (JSONException e) {
            Log.e(Constants.PROJECT_TAG, "JSONException in onCreate", e);
        }

        // launch the json request to load additional images
        requestAdditionalPhotos();
    } else {
        validate.setEnabled(false);
        findViewById(R.id.LinearLayout_comment).setOnClickListener(this);
        findViewById(R.id.ImageView_far).setOnClickListener(this);
        findViewById(R.id.ImageView_close).setOnClickListener(this);
    }

    // init buttons
    findViewById(R.id.LinearLayout_category).setOnClickListener(this);
    findViewById(R.id.LinearLayout_where).setOnClickListener(this);

    validate.setOnClickListener(this);

    if (getIntent().getLongExtra(IntentData.EXTRA_CATEGORY_ID, -1) != -1) {
        setCategory(getIntent().getLongExtra(IntentData.EXTRA_CATEGORY_ID, 0));
        startActivityForResult(new Intent(this, SelectPositionActivity.class), REQUEST_POSITION);
    }
}

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

@Override
public void onStart() {
    super.onStart();
    if (getDialog() != null) {
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_avatar);
        getDialog().setTitle(R.string.user_profile);
    }/*w  ww. j a v a2 s.  c o  m*/
}

From source file:no.barentswatch.fiskinfo.MyPageActivity.java

public void createSubscriptionInformationDialog(int JSONObjectIndex) {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setContentView(R.layout.subscription_info_dialog);

    TextView subscriptionNameView = (TextView) dialog.findViewById(R.id.subscription_description_text_view);
    TextView subscriptionOwnerView = (TextView) dialog.findViewById(R.id.subscription_owner_text_view);
    TextView subscriptionUpdatedView = (TextView) dialog.findViewById(R.id.subscription_last_updated_text_view);
    Button okButton = (Button) dialog.findViewById(R.id.dismiss_dialog_button);
    Button viewOnMapButton = (Button) dialog.findViewById(R.id.go_to_map_button);
    String subscriptionName = null;
    String subscriptionOwner = null;
    String subscriptionDescription = null;

    JSONArray subscriptions = getSharedCacheOfAvailableSubscriptions();
    List<String> updateValues = new ArrayList<String>();
    JSONObject currentSubscription;//from  ww  w.  j a v a  2  s .  c  o  m
    String lastUpdated = "";

    updateValues.add("Name");
    updateValues.add("DataOwner");
    updateValues.add("LastUpdated");
    updateValues.add("Description");
    updateValues.add("UpdateFrequencyText");

    if (subscriptions != null) {
        try {
            currentSubscription = getSharedCacheOfAvailableSubscriptions().getJSONObject(JSONObjectIndex);
            subscriptionName = currentSubscription.getString("Name");
            subscriptionOwner = currentSubscription.getString("DataOwner");
            subscriptionDescription = currentSubscription.getString("Description");
            lastUpdated = currentSubscription.get("LastUpdated").toString();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    String[] updateDateAndTime = lastUpdated.split("T");
    lastUpdated = updateDateAndTime[1] + "  " + updateDateAndTime[0];

    subscriptionNameView.setText(subscriptionDescription);
    subscriptionOwnerView.setText(subscriptionOwner);
    subscriptionUpdatedView.setText(lastUpdated);

    okButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    viewOnMapButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Do some map stuff here so we only show this layer I
            // guess?
            loadView(MapActivity.class);
        }
    });

    int subscriptionIconId = getSubscriptionIconId(subscriptionName);

    dialog.setTitle(subscriptionName);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    if (subscriptionIconId != 0) {
        dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, subscriptionIconId);
    }

}

From source file:org.alfresco.mobile.android.application.accounts.fragment.AccountEditFragment.java

@Override
public void onStart() {
    if (receiver == null) {
        receiver = new AccountsReceiver();
        IntentFilter filters = new IntentFilter(IntentIntegrator.ACTION_CREATE_ACCOUNT_COMPLETED);
        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, filters);
    }//w ww .j  av  a2  s  . co m

    if (getDialog() != null) {
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_alfresco);
    }

    initForm();

    if (retrieveFormValues()) {
        validate.setEnabled(true);
    } else {
        validate.setEnabled(false);
    }

    super.onStart();
}

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

@Override
public void onStart() {
    super.onStart();
    if (getDialog() != null) {
        getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_person_light);
        getDialog().setTitle(titleId);//from  ww w . j  a  v a  2  s  .  co  m
    } else {
        UIUtils.displayTitle(getActivity(), titleId);
    }
}

From source file:no.barentswatch.fiskinfo.MapActivity.java

/**
 * //from w  w  w . j av  a2 s  .  co  m
 */
public void showMapLayersDialog() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setContentView(R.layout.dialog_select_map_layers);

    final LinearLayout mapLayerLayout = (LinearLayout) dialog.findViewById(R.id.map_layers_checkbox_layout);
    Button okButton = (Button) dialog.findViewById(R.id.dismiss_dialog_button);
    Button cancelButton = (Button) dialog.findViewById(R.id.go_to_map_button);

    for (int i = 0; i < 5; i++) {
        View mapLayerRow = getMapLayerCheckBoxRow(getContext(), Integer.toString(i));
        mapLayerLayout.addView(mapLayerRow);
    }

    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            for (int i = 0; i < mapLayerLayout.getChildCount(); i++) {
                if (((CheckBox) ((TableRow) mapLayerLayout.getChildAt(i)).getChildAt(0)).isChecked()) {
                    // TODO: Add layer to list

                }
            }
            // TODO: Implement logic for adding map layers here.            

            dialog.dismiss();
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.setTitle(R.string.choose_map_layers);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}