Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

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

Prototype

int FEATURE_NO_TITLE

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

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:co.taqat.call.LinphoneActivity.java

public Dialog displayWrongPasswordDialog(final String username, final String realm, final String domain) {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC));
    d.setAlpha(200);//  www. ja  va2  s  .co m
    dialog.setContentView(R.layout.input_dialog);
    dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT);
    dialog.getWindow().setBackgroundDrawable(d);

    TextView customText = (TextView) dialog.findViewById(R.id.customText);
    customText.setText(getString(R.string.error_bad_credentials));

    Button retry = (Button) dialog.findViewById(R.id.retry);
    Button cancel = (Button) dialog.findViewById(R.id.cancel);

    retry.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString();
            LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null,
                    newPassword, null, realm, domain);
            LinphoneManager.getLc().addAuthInfo(authInfo);
            LinphoneManager.getLc().refreshRegisters();
            dialog.dismiss();
        }
    });

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

    return dialog;
}

From source file:com.aegiswallet.actions.MainActivity.java

private void doBackupReminder() {

    if (System.currentTimeMillis() - application.lastReminderTime < 60000)
        return;// w  w w . j  av a 2 s  . c  om

    String lastBackupString = prefs.getString(Constants.LAST_BACKUP_DATE, null);
    int lastBackupNumAddresses = prefs.getInt(Constants.LAST_BACKUP_NUM_ADDRESSES, 0);

    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.backup_reminder_prompt);

    TextView backupText = (TextView) dialog.findViewById(R.id.backup_reminder_prompt_text);

    Button cancelButton = (Button) dialog.findViewById(R.id.backup_reminder_prompt_cancel_button);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });

    final Button okayButton = (Button) dialog.findViewById(R.id.backup_reminder_prompt_ok_button);

    okayButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();

            if (nfcEnabled) {
                Intent intent = new Intent(context, NFCActivity.class);
                intent.putExtra("nfc_action", "backup");
                startActivity(intent);
            } else
                application.showPasswordPrompt(context, Constants.ACTION_BACKUP);
        }
    });

    try {

        if (dialog.isShowing())
            return;

        if (lastBackupString != null) {
            Date lastBackupDate = Constants.backupDateFormat.parse(lastBackupString);
            long currentDate = System.currentTimeMillis();
            long difference = currentDate - lastBackupDate.getTime();

            long days = TimeUnit.MILLISECONDS.toDays(difference);
            int keyChainSize = wallet.getKeychainSize();

            if (days > 6) {
                dialog.show();
                application.lastReminderTime = System.currentTimeMillis();
            } else if (!prefs.contains(Constants.LAST_BACKUP_NUM_ADDRESSES)) {
                dialog.show();
                application.lastReminderTime = System.currentTimeMillis();

            } else if (keyChainSize > lastBackupNumAddresses) {
                backupText.setText(getString(R.string.backup_reminder_new_address));
                dialog.show();
                application.lastReminderTime = System.currentTimeMillis();
            }

        } else {
            application.lastReminderTime = System.currentTimeMillis();
            dialog.show();
        }

    } catch (ParseException e) {
        Log.d(TAG, e.getMessage());
    }
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Utility method to display an alert dialog. Use instead of AlertDialog to
 * get the right styling./*from  ww  w. j  a  va2  s .  c o  m*/
 * 
 * @param context
 * @param message
 */
public static void displayAlert(final Launcher context, String message) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.alert);

    final TextView alertTextView = (TextView) dialog.findViewById(R.id.alertText);
    alertTextView.setText(message);
    Button alertButton = (Button) dialog.findViewById(R.id.alertButton);
    alertButton.setOnClickListener(new OnClickListener() {

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

    });
    dialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            context.showCover(false);
        }

    });
    context.showCover(true);
    dialog.show();
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private ViewGroup generateLayout() {
    if (DEBUG)//from  w  w  w  .  j a v  a  2  s.  co  m
        Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    mIsFloating = a.getBoolean(R.styleable.SherlockTheme_android_windowIsFloating, false);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException(
                "You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (mIsFloating) {
            //Trash original dialog LinearLayout
            mDecor = (ViewGroup) mDecor.getParent();
            mDecor.removeAllViews();

            layoutResource = R.layout.abs__dialog_title_holo;
        } else {
            if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
                layoutResource = R.layout.abs__screen_action_bar_overlay;
            } else {
                layoutResource = R.layout.abs__screen_action_bar;
            }
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (DEBUG)
        Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup) mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Display a dialog to confirm that the user wants to delete an item.
 * /* w  ww  .  j  a  va2  s . c om*/
 * @param context
 */
public static void displayDeleteItem(final Launcher context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.confirmation);

    TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText);
    confirmationTextView.setText(context.getString(R.string.dialog_delete_item_message));
    Button buttonYes = (Button) dialog.findViewById(R.id.button1);
    buttonYes.setText(context.getString(R.string.dialog_yes));
    buttonYes.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            context.deleteCurrentItem();
            context.showCover(false);
            dialog.dismiss();
        }

    });
    Button buttonNo = (Button) dialog.findViewById(R.id.button2);
    buttonNo.setText(context.getString(R.string.dialog_no));
    buttonNo.setOnClickListener(new OnClickListener() {

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

    });
    dialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            context.showCover(false);
        }

    });
    context.showCover(true);
    dialog.show();
    Analytics.logEvent(Analytics.DIALOG_DELETE_ITEM);
}

From source file:androidVNC.VncCanvasActivity.java

private void selectColorModel() {
    // Stop repainting the desktop
    // because the display is composited!
    vncCanvas.disableRepaints();//from  ww w  .  j a v a  2s. co  m

    String[] choices = new String[COLORMODEL.values().length];
    int currentSelection = -1;
    for (int i = 0; i < choices.length; i++) {
        COLORMODEL cm = COLORMODEL.values()[i];
        choices[i] = cm.toString();
        if (vncCanvas.isColorModel(cm))
            currentSelection = i;
    }

    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    ListView list = new ListView(this);
    list.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, choices));
    list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    list.setItemChecked(currentSelection, true);
    list.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            dialog.dismiss();
            COLORMODEL cm = COLORMODEL.values()[arg2];
            vncCanvas.setColorModel(cm);
            connection.setColorModel(cm.nameString());
            connection.save(database.getWritableDatabase());
            //Toast.makeText(VncCanvasActivity.this,"Updating Color Model to " + cm.toString(), Toast.LENGTH_SHORT).show();
        }
    });
    dialog.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface arg0) {
            Log.i(TAG, "Color Model Selector dismissed");
            // Restore desktop repaints
            vncCanvas.enableRepaints();
        }
    });
    dialog.setContentView(list);
    dialog.show();
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Display a dialog to confirm that a user wants to delete a row.
 * //from   w  w  w.  j  a v  a 2 s .c  o  m
 * @param context
 */
public static void displayDeleteRow(final Launcher context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.confirmation);

    TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText);
    confirmationTextView.setText(context.getString(R.string.dialog_delete_row_message));
    Button buttonYes = (Button) dialog.findViewById(R.id.button1);
    buttonYes.setText(context.getString(R.string.dialog_yes));
    buttonYes.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            context.deleteCurrentRow();
            context.showCover(false);
            dialog.dismiss();
        }

    });
    Button buttonNo = (Button) dialog.findViewById(R.id.button2);
    buttonNo.setText(context.getString(R.string.dialog_no));
    buttonNo.setOnClickListener(new OnClickListener() {

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

    });
    dialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            context.showCover(false);
        }

    });
    context.showCover(true);
    dialog.show();
    Analytics.logEvent(Analytics.DIALOG_DELETE_ROW);
}

From source file:es.javocsoft.android.lib.toolbox.ToolBox.java

/**
 * "Coach mark" (help overlay image)/*from w w w  .j a  va 2  s.co  m*/
 * 
 * @param context
 * @param coachMarkLayoutId   Is "Help overlay" layout id in UX talk :-) 
 *             [coach_mark.xml is your coach mark layout]
 * @param coachMarkMasterViewId   is the id of the top most view in coach_mark.xml
 */
public static void dialog_onCoachMark(Context context, int coachMarkLayoutId, int coachMarkMasterViewId,
        int bgColor) {

    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(bgColor));
    dialog.setContentView(coachMarkLayoutId);
    dialog.setCanceledOnTouchOutside(true);

    //for dismissing anywhere you touch
    View masterView = dialog.findViewById(coachMarkMasterViewId);
    masterView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Prompt the user to rate the app./*from w ww .  j  av a  2 s. co  m*/
 * 
 * @param context
 */
public static void displayRating(final Launcher context) {
    SharedPreferences prefs = context.getSharedPreferences(Launcher.PREFERENCES_NAME, Activity.MODE_PRIVATE);

    if (prefs.getBoolean(DONT_SHOW_RATING_AGAIN, false)) {
        return;
    }

    final SharedPreferences.Editor editor = prefs.edit();

    // Get date of first launch
    Long date_firstLaunch = prefs.getLong(DATE_FIRST_LAUNCHED, 0);
    if (date_firstLaunch == 0) {
        date_firstLaunch = System.currentTimeMillis();
        editor.putLong(DATE_FIRST_LAUNCHED, date_firstLaunch);
    }

    // Wait at least n days before opening
    if (System.currentTimeMillis() >= date_firstLaunch + (DAYS_UNTIL_PROMPT * 24 * 60 * 60 * 1000)) {
        final Dialog dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.confirmation);

        TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText);
        confirmationTextView.setText(context.getString(R.string.rating_message));
        Button buttonYes = (Button) dialog.findViewById(R.id.button1);
        buttonYes.setText(context.getString(R.string.dialog_yes));
        buttonYes.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id=com.entertailion.android.launcher"));
                context.startActivity(intent);
                if (editor != null) {
                    editor.putBoolean(DONT_SHOW_RATING_AGAIN, true);
                    editor.commit();
                }
                Analytics.logEvent(Analytics.RATING_YES);
                context.showCover(false);
                dialog.dismiss();
            }

        });
        Button buttonNo = (Button) dialog.findViewById(R.id.button2);
        buttonNo.setText(context.getString(R.string.dialog_no));
        buttonNo.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (editor != null) {
                    editor.putBoolean(DONT_SHOW_RATING_AGAIN, true);
                    editor.commit();
                }
                Analytics.logEvent(Analytics.RATING_NO);
                context.showCover(false);
                dialog.dismiss();
            }

        });
        dialog.setOnDismissListener(new OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
                context.showCover(false);
            }

        });
        context.showCover(true);
        dialog.show();
    }

    editor.commit();
}

From source file:co.taqat.call.CallActivity.java

private void showAcceptCallUpdateDialog() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC));
    d.setAlpha(200);//  w  ww . j a v  a 2 s  . co m
    dialog.setContentView(R.layout.dialog);
    dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT);
    dialog.getWindow().setBackgroundDrawable(d);

    TextView customText = (TextView) dialog.findViewById(R.id.customText);
    customText.setText(getResources().getString(R.string.add_video_dialog));
    Button delete = (Button) dialog.findViewById(R.id.delete_button);
    delete.setText(R.string.accept);
    Button cancel = (Button) dialog.findViewById(R.id.cancel);
    cancel.setText(R.string.decline);

    delete.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            int camera = getPackageManager().checkPermission(Manifest.permission.CAMERA, getPackageName());
            Log.i("[Permission] Camera permission is "
                    + (camera == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));

            if (camera == PackageManager.PERMISSION_GRANTED) {
                CallActivity.instance().acceptCallUpdate(true);
            } else {
                checkAndRequestPermission(Manifest.permission.CAMERA, PERMISSIONS_REQUEST_CAMERA);
            }

            dialog.dismiss();
        }
    });

    cancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (CallActivity.isInstanciated()) {
                CallActivity.instance().acceptCallUpdate(false);
            }
            dialog.dismiss();
        }
    });
    dialog.show();
}