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:com.alivenet.dmv.driverapplication.fragment.MyAccount.java

public void showActionSheet() {

    LayoutInflater inflater = LayoutInflater.from(getActivity());
    final Dialog myDialog = new Dialog(getActivity(), android.R.style.Theme_Translucent_NoTitleBar);
    myDialog.setCanceledOnTouchOutside(true);
    myDialog.getWindow().setLayout(AbsoluteLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    myDialog.getWindow().setGravity(Gravity.BOTTOM);
    myDialog.getWindow().getAttributes().windowAnimations = R.anim.slide_up;
    WindowManager.LayoutParams lp = myDialog.getWindow().getAttributes();
    lp.dimAmount = 0.75f;/*from   w  w  w.java 2  s  .  co  m*/
    myDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    myDialog.getWindow();

    View dialoglayout = inflater.inflate(R.layout.dialog_profile_actionsheet, null);
    myDialog.setContentView(dialoglayout);
    TextView mTvTakeFromCamera = (TextView) myDialog.findViewById(R.id.tvTakeFromCamera);
    TextView mTvTakeFromLibrary = (TextView) myDialog.findViewById(R.id.tvTakeFromLibrary);

    long timestamp = System.currentTimeMillis();
    AppData.getSingletonObject().setmFileTemp(getActivity(), "" + timestamp);
    mTvTakeFromCamera.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            myDialog.dismiss();
            takePicture(getActivity());

        }

    });

    mTvTakeFromLibrary.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            myDialog.dismiss();
            openGallery(getActivity());
        }

    });

    TextView tvCancel = (TextView) myDialog.findViewById(R.id.tvCancel);

    tvCancel.setOnClickListener(new View.OnClickListener() {

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

    });

    try {
        myDialog.show();
    } catch (WindowManager.BadTokenException e) {

        Log.e("", "View not attached.");
    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

@Override
public void onBackPressed() {

    if (checkcurrentfragment())

    {/*from  w w w  . j a v a 2  s  . co m*/
        final Dialog dialog = new Dialog(TabsActivity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_leaving_confirmation);
        dialog.getWindow()
                .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

        Button yes = (Button) dialog.findViewById(R.id.yesbtn);
        yes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
                showpickupschool();

            }
        });
        Button no = (Button) dialog.findViewById(R.id.nobtn);
        no.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
    } else {
        super.onBackPressed();
    }
}

From source file:com.example.search.car.pools.welcome.java

private void showSearchDialog() {
    promptsView = new Dialog(this);
    promptsView.requestWindowFeature(Window.FEATURE_NO_TITLE);
    promptsView.setContentView(R.layout.search);
    promptsView.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    RelativeLayout rl = (RelativeLayout) promptsView.findViewById(R.id.RelativeLayout1);
    rl.setBackgroundColor(Color.parseColor("#00000000"));
    l_1 = (LinearLayout) promptsView.findViewById(R.id.dgdf);
    l_2 = (LinearLayout) promptsView.findViewById(R.id.ddf);
    l_3 = (LinearLayout) promptsView.findViewById(R.id.gdf);
    et_from = (EditText) promptsView.findViewById(R.id.et_search_from);
    et_to = (EditText) promptsView.findViewById(R.id.et_search_to);
    sp_city = (TextView) promptsView.findViewById(R.id.sp_sec_city);
    sp_category = (TextView) promptsView.findViewById(R.id.sp_category);
    sp_search_for = (TextView) promptsView.findViewById(R.id.sp_search_for);
    b_search = (Button) promptsView.findViewById(R.id.b_search);
    close = (RelativeLayout) promptsView.findViewById(R.id.iv_close);
    close.setVisibility(View.VISIBLE);
    close.setOnClickListener(this);
    b_search.setOnClickListener(this);
    sp_city.setOnClickListener(this);
    sp_category.setOnClickListener(this);
    sp_search_for.setOnClickListener(this);
    l_1.setOnClickListener(this);
    l_2.setOnClickListener(this);
    l_3.setOnClickListener(this);
    Typeface tf = Typeface.createFromAsset(welcome.this.getAssets(), "AvenirLTStd_Book.otf");
    et_from.setTypeface(tf);//from  w w w  .  j ava2s.c o m
    b_search.setTypeface(tf);
    et_to.setTypeface(tf);
    sp_category.setTypeface(tf);
    sp_city.setTypeface(tf);
    sp_search_for.setTypeface(tf);
    promptsView.show();
}

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

@Override
public boolean requestFeature(int featureId) {
    if (DEBUG)//from   w  w  w  .j av  a  2s  . c  o  m
        Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
    case Window.FEATURE_ACTION_BAR:
    case Window.FEATURE_ACTION_BAR_OVERLAY:
    case Window.FEATURE_ACTION_MODE_OVERLAY:
    case Window.FEATURE_INDETERMINATE_PROGRESS:
    case Window.FEATURE_NO_TITLE:
    case Window.FEATURE_PROGRESS:
        mFeatures |= (1 << featureId);
        return true;

    default:
        return false;
    }
}

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

/**
 * Display dialog to the user for the browser bookmarks. Allow the user to add a
 * browser bookmark to an existing row or a new row.
 * //w w  w  .j  ava2  s  . c om
 * @param context
 */
public static void displayAddBrowserBookmark(final Launcher context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.add_browser_bookmarks_list);

    final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName);
    final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio);
    currentRadioButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // hide the row name edit field if the current row radio button
            // is selected
            nameEditText.setVisibility(View.GONE);
        }

    });
    final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio);
    newRadioButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // show the row name edit field if the new radio button is
            // selected
            nameEditText.setVisibility(View.VISIBLE);
            nameEditText.requestFocus();
        }

    });

    ListView listView = (ListView) dialog.findViewById(R.id.list);
    final ArrayList<BookmarkInfo> bookmarks = loadBookmarks(context);
    Collections.sort(bookmarks, new Comparator<BookmarkInfo>() {

        @Override
        public int compare(BookmarkInfo lhs, BookmarkInfo rhs) {
            return lhs.getTitle().toLowerCase().compareTo(rhs.getTitle().toLowerCase());
        }

    });
    listView.setAdapter(new BookmarkAdapter(context, bookmarks));
    listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            // run in thread since network logic needed to get bookmark icon
            new Thread(new Runnable() {
                public void run() {
                    // if the new row radio button is selected, the user must enter
                    // a name for the new row
                    String name = nameEditText.getText().toString().trim();
                    if (newRadioButton.isChecked() && name.length() == 0) {
                        nameEditText.requestFocus();
                        displayAlert(context, context.getString(R.string.dialog_new_row_name_alert));
                        return;
                    }
                    boolean currentRow = !newRadioButton.isChecked();
                    try {
                        BookmarkInfo bookmark = (BookmarkInfo) parent.getAdapter().getItem(position);
                        int rowId = 0;
                        int rowPosition = 0;
                        if (currentRow) {
                            rowId = context.getCurrentGalleryId();
                            ArrayList<ItemInfo> items = ItemsTable.getItems(context, rowId);
                            rowPosition = items.size(); // in last
                            // position
                            // for selected
                            // row
                        } else {
                            rowId = (int) RowsTable.insertRow(context, name, 0, RowInfo.FAVORITE_TYPE);
                            rowPosition = 0;
                        }
                        Intent intent = new Intent(Intent.ACTION_VIEW);
                        intent.setData(Uri.parse(bookmark.getUrl()));

                        Uri uri = Uri.parse(bookmark.getUrl());
                        Log.d(LOG_TAG, "host=" + uri.getScheme() + "://" + uri.getHost());
                        String icon = Utils.getWebSiteIcon(context, "http://" + uri.getHost());
                        Log.d(LOG_TAG, "icon1=" + icon);
                        if (icon == null) {
                            // try base host address
                            int count = StringUtils.countMatches(uri.getHost(), ".");
                            if (count > 1) {
                                int index = uri.getHost().indexOf('.');
                                String baseHost = uri.getHost().substring(index + 1);
                                icon = Utils.getWebSiteIcon(context, "http://" + baseHost);
                                Log.d(LOG_TAG, "icon2=" + icon);
                            }
                        }

                        ItemsTable.insertItem(context, rowId, rowPosition, bookmark.getTitle(), intent, icon,
                                DatabaseHelper.SHORTCUT_TYPE);
                    } catch (Exception e) {
                        Log.e(LOG_TAG, "displayAddBrowserBookmark", e);
                    }

                    // need to do this on UI thread
                    context.getHandler().post(new Runnable() {
                        public void run() {
                            context.showCover(false);
                            dialog.dismiss();
                            context.reloadAllGalleries();
                        }
                    });

                    if (currentRow) {
                        Analytics.logEvent(Analytics.ADD_BROWSER_BOOKMARK);
                    } else {
                        Analytics.logEvent(Analytics.ADD_BROWSER_BOOKMARK_WITH_ROW);
                    }

                }
            }).start();
        }
    });
    listView.setDrawingCacheEnabled(true);
    listView.setOnKeyListener(onKeyListener);
    dialog.setOnDismissListener(new OnDismissListener() {

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

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

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

private void installDecor() {
    if (DEBUG)//from  w w  w . j a va  2 s  . c o m
        Log.d(TAG, "[installDecor]");

    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            views = new ArrayList<View>(1); //Usually there's only one child
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }

        mContentParent = generateLayout();

        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }

        mTitleView = (TextView) mDecor.findViewById(android.R.id.title);
        if (mTitleView != null) {
            if (hasFeature(Window.FEATURE_NO_TITLE)) {
                mTitleView.setVisibility(View.GONE);
                if (mContentParent instanceof FrameLayout) {
                    ((FrameLayout) mContentParent).setForeground(null);
                }
            } else {
                mTitleView.setText(mTitle);
            }
        } else {
            wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
            if (wActionBar != null) {
                wActionBar.setWindowCallback(this);
                if (wActionBar.getTitle() == null) {
                    wActionBar.setWindowTitle(mActivity.getTitle());
                }
                if (hasFeature(Window.FEATURE_PROGRESS)) {
                    wActionBar.initProgress();
                }
                if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                    wActionBar.initIndeterminateProgress();
                }

                //Since we don't require onCreate dispatching, parse for uiOptions here
                int uiOptions = loadUiOptionsFromManifest(mActivity);
                if (uiOptions != 0) {
                    mUiOptions = uiOptions;
                }

                boolean splitActionBar = false;
                final boolean splitWhenNarrow = (mUiOptions
                        & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
                if (splitWhenNarrow) {
                    splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
                } else {
                    splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme)
                            .getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
                }
                final ActionBarContainer splitView = (ActionBarContainer) mDecor
                        .findViewById(R.id.abs__split_action_bar);
                if (splitView != null) {
                    wActionBar.setSplitView(splitView);
                    wActionBar.setSplitActionBar(splitActionBar);
                    wActionBar.setSplitWhenNarrow(splitWhenNarrow);

                    mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                    mActionModeView.setSplitView(splitView);
                    mActionModeView.setSplitActionBar(splitActionBar);
                    mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
                } else if (splitActionBar) {
                    Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
                }

                // Post the panel invalidate for later; avoid application onCreateOptionsMenu
                // being called in the middle of onCreate or similar.
                mDecor.post(new Runnable() {
                    @Override
                    public void run() {
                        //Invalidate if the panel menu hasn't been created before this.
                        if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                            dispatchInvalidateOptionsMenu();
                        }
                    }
                });
            }
        }
    }
}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlidePowerLayout() {

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    float height = metrics.heightPixels;
    float width = metrics.widthPixels;

    int left500 = (int) ((width / 100) * 39);
    int top200 = (int) ((width / 100) * 15.7);

    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog powerdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    powerdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    powerdialog.setContentView(R.layout.powerdialoglayout);
    powerdialog.getWindow().getAttributes().windowAnimations = R.style.PowerDialogAnimation;
    powerdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = powerdialog.getWindow().getAttributes();
    lp.dimAmount = 0f;/*from  w  w w.j  a  v a2  s.c  o  m*/

    final CheckBox chkpower_headLight = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_headLight);
    final CheckBox chkpower_dim = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_dim);
    final CheckBox chkpower_highBeam = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_highBeam);
    final CheckBox chkpower_dashBoardLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_dashBoardLight);
    final CheckBox chkpower_cabinSeatLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_cabinSeatLight);
    final CheckBox chkpower_sideDoorLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_sideDoorLight);
    final CheckBox chkpower_turnSignal = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_turnSignal);
    final CheckBox chkpower_air = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_air);
    final CheckBox chkpower_thermometer = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_thermometer);
    final CheckBox chkpower_horn = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_horn);
    final CheckBox chkpower_wipe = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_wipe);
    final CheckBox chkpower_rainSensor = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_rainSensor);
    final CheckBox chkpower_thirdBrakeLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_thirdBrakeLight);
    final CheckBox chkpower_antiFoggyBack = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_antiFoggyBack);
    final CheckBox chkpower_antiFoggySide = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_antiFoggySide);
    final CheckBox chkpower_steeringWheelTest = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_steeringWheelTest);
    final CheckBox chkpower_steeringWheelSet = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_steeringWheelSet);
    final CheckBox chkpower_carStereo = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_carStereo);
    final CheckBox chkpower_electronicWindow = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_electronicWindow);
    final CheckBox chkpower_sideMirror = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_sideMirror);
    final CheckBox chkpower_warnDoor = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_warnDoor);
    final CheckBox chkpower_warnSeatBelt = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_warnSeatBelt);
    final CheckBox chkpower_warnHandBrake = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_warnHandBrake);
    final CheckBox chkpower_clock = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_clock);
    final CheckBox chkpower_remoteKey = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_remoteKey);
    final CheckBox chkpower_centralLock = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_centralLock);
    final CheckBox chkpower_transmissionPosition = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_transmissionPosition);

    // change font
    chkpower_headLight.setTypeface(type);
    chkpower_dim.setTypeface(type);
    chkpower_highBeam.setTypeface(type);
    chkpower_dashBoardLight.setTypeface(type);
    chkpower_cabinSeatLight.setTypeface(type);
    chkpower_sideDoorLight.setTypeface(type);
    chkpower_turnSignal.setTypeface(type);
    chkpower_air.setTypeface(type);
    chkpower_thermometer.setTypeface(type);
    chkpower_horn.setTypeface(type);
    chkpower_wipe.setTypeface(type);
    chkpower_rainSensor.setTypeface(type);
    chkpower_thirdBrakeLight.setTypeface(type);
    chkpower_antiFoggyBack.setTypeface(type);
    chkpower_antiFoggySide.setTypeface(type);
    chkpower_steeringWheelTest.setTypeface(type);
    chkpower_steeringWheelSet.setTypeface(type);
    chkpower_carStereo.setTypeface(type);
    chkpower_electronicWindow.setTypeface(type);
    chkpower_sideMirror.setTypeface(type);
    chkpower_warnDoor.setTypeface(type);
    chkpower_warnSeatBelt.setTypeface(type);
    chkpower_warnHandBrake.setTypeface(type);
    chkpower_clock.setTypeface(type);
    chkpower_remoteKey.setTypeface(type);
    chkpower_centralLock.setTypeface(type);
    chkpower_transmissionPosition.setTypeface(type);

    powerdialog.setCanceledOnTouchOutside(true);
    powerdialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            headpower.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadpower = new TranslateAnimation(0, 0, 200, 800);
            slideoutheadpower.setDuration(500);
            slideoutheadpower.setFillAfter(true);
            headpower.startAnimation(slideoutheadpower);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("power_headLight", chkpower_headLight.isChecked());
            mp.put("power_dim", chkpower_dim.isChecked());
            mp.put("power_highBeam", chkpower_highBeam.isChecked());
            mp.put("power_dashBoardLight", chkpower_dashBoardLight.isChecked());
            mp.put("power_cabinSeatLight", chkpower_cabinSeatLight.isChecked());
            mp.put("power_sideDoorLight", chkpower_sideDoorLight.isChecked());
            mp.put("power_turnSignal", chkpower_turnSignal.isChecked());
            mp.put("power_air", chkpower_air.isChecked());
            mp.put("power_thermometer", chkpower_thermometer.isChecked());
            mp.put("power_horn", chkpower_horn.isChecked());
            mp.put("power_wipe", chkpower_wipe.isChecked());
            mp.put("power_rainSensor", chkpower_rainSensor.isChecked());
            mp.put("power_thirdBrakeLight", chkpower_thirdBrakeLight.isChecked());
            mp.put("power_antiFoggyBack", chkpower_antiFoggyBack.isChecked());
            mp.put("power_antiFoggySide", chkpower_antiFoggySide.isChecked());
            mp.put("power_steeringWheelTest", chkpower_steeringWheelTest.isChecked());
            mp.put("power_steeringWheelSet", chkpower_steeringWheelSet.isChecked());
            mp.put("power_carStereo", chkpower_carStereo.isChecked());
            mp.put("power_electronicWindow", chkpower_electronicWindow.isChecked());
            mp.put("power_sideMirror", chkpower_sideMirror.isChecked());
            mp.put("power_warnDoor", chkpower_warnDoor.isChecked());
            mp.put("power_warnSeatBelt", chkpower_warnSeatBelt.isChecked());
            mp.put("power_warnHandBrake", chkpower_warnHandBrake.isChecked());
            mp.put("power_clock", chkpower_clock.isChecked());
            mp.put("power_remoteKey", chkpower_remoteKey.isChecked());
            mp.put("power_centralLock", chkpower_centralLock.isChecked());
            mp.put("power_transmissionPosition", chkpower_transmissionPosition.isChecked());

            filterStore("power", mp);
            save(mp);

        }
    });

    TextView power = (TextView) powerdialog.getWindow().findViewById(R.id.Power);
    power.setTypeface(type);
    Button powerback = (Button) powerdialog.getWindow().findViewById(R.id.Powerback);
    powerback.setTypeface(type);
    powerback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            powerdialog.dismiss();

            headpower.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadpower = new TranslateAnimation(0, 0, 200, 800);
            slideoutheadpower.setDuration(500);
            slideoutheadpower.setFillAfter(true);
            headpower.startAnimation(slideoutheadpower);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("power_headLight", chkpower_headLight.isChecked());
            mp.put("power_dim", chkpower_dim.isChecked());
            mp.put("power_highBeam", chkpower_highBeam.isChecked());
            mp.put("power_dashBoardLight", chkpower_dashBoardLight.isChecked());
            mp.put("power_cabinSeatLight", chkpower_cabinSeatLight.isChecked());
            mp.put("power_sideDoorLight", chkpower_sideDoorLight.isChecked());
            mp.put("power_turnSignal", chkpower_turnSignal.isChecked());
            mp.put("power_air", chkpower_air.isChecked());
            mp.put("power_thermometer", chkpower_thermometer.isChecked());
            mp.put("power_horn", chkpower_horn.isChecked());
            mp.put("power_wipe", chkpower_wipe.isChecked());
            mp.put("power_rainSensor", chkpower_rainSensor.isChecked());
            mp.put("power_thirdBrakeLight", chkpower_thirdBrakeLight.isChecked());
            mp.put("power_antiFoggyBack", chkpower_antiFoggyBack.isChecked());
            mp.put("power_antiFoggySide", chkpower_antiFoggySide.isChecked());
            mp.put("power_steeringWheelTest", chkpower_steeringWheelTest.isChecked());
            mp.put("power_steeringWheelSet", chkpower_steeringWheelSet.isChecked());
            mp.put("power_carStereo", chkpower_carStereo.isChecked());
            mp.put("power_electronicWindow", chkpower_electronicWindow.isChecked());
            mp.put("power_sideMirror", chkpower_sideMirror.isChecked());
            mp.put("power_warnDoor", chkpower_warnDoor.isChecked());
            mp.put("power_warnSeatBelt", chkpower_warnSeatBelt.isChecked());
            mp.put("power_warnHandBrake", chkpower_warnHandBrake.isChecked());
            mp.put("power_clock", chkpower_clock.isChecked());
            mp.put("power_remoteKey", chkpower_remoteKey.isChecked());
            mp.put("power_centralLock", chkpower_centralLock.isChecked());
            mp.put("power_transmissionPosition", chkpower_transmissionPosition.isChecked());

            filterStore("power", mp);
            save(mp);

        }
    });

    chkpower_headLight.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_dim.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_highBeam.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_dashBoardLight.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_cabinSeatLight.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_sideDoorLight.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_turnSignal.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_air.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_thermometer.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_horn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_wipe.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_rainSensor.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_thirdBrakeLight.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_antiFoggyBack.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_antiFoggySide.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_steeringWheelTest.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_steeringWheelSet.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_carStereo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_electronicWindow.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_sideMirror.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_warnDoor.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_warnSeatBelt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_warnHandBrake.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_clock.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_remoteKey.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_centralLock.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkpower_transmissionPosition.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalPower(increment);
            } else {
                increment = false;
                getTotalPower(increment);
            }
            PowerProgress.setProgress(PercenPower);
            percenpower.setText("" + PercenPower + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    headpower.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadpower = new TranslateAnimation(0, 0, 800, 200);
    slideheadpower.setDuration(300);
    slideheadpower.setFillAfter(true);
    headpower.startAnimation(slideheadpower);

    powerdialog.show();
    WindowManager.LayoutParams params = powerdialog.getWindow().getAttributes();
    params.y = top200;
    params.x = left500;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    powerdialog.getWindow().setAttributes(params);

    isSaveCheckBox();

    chkpower_headLight.setChecked(load("power_headLight"));
    chkpower_dim.setChecked(load("power_dim"));
    chkpower_highBeam.setChecked(load("power_highBeam"));
    chkpower_dashBoardLight.setChecked(load("power_dashBoardLight"));
    chkpower_cabinSeatLight.setChecked(load("power_cabinSeatLight"));
    chkpower_sideDoorLight.setChecked(load("power_sideDoorLight"));
    chkpower_turnSignal.setChecked(load("power_turnSignal"));
    chkpower_air.setChecked(load("power_air"));
    chkpower_thermometer.setChecked(load("power_thermometer"));
    chkpower_horn.setChecked(load("power_horn"));
    chkpower_wipe.setChecked(load("power_wipe"));
    chkpower_rainSensor.setChecked(load("power_rainSensor"));
    chkpower_thirdBrakeLight.setChecked(load("power_thirdBrakeLight"));
    chkpower_antiFoggyBack.setChecked(load("power_antiFoggyBack"));
    chkpower_antiFoggySide.setChecked(load("power_antiFoggySide"));
    chkpower_steeringWheelTest.setChecked(load("power_steeringWheelTest"));
    chkpower_steeringWheelSet.setChecked(load("power_steeringWheelSet"));
    chkpower_carStereo.setChecked(load("power_carStereo"));
    chkpower_electronicWindow.setChecked(load("power_electronicWindow"));
    chkpower_sideMirror.setChecked(load("power_sideMirror"));
    chkpower_warnDoor.setChecked(load("power_warnDoor"));
    chkpower_warnSeatBelt.setChecked(load("power_warnSeatBelt"));
    chkpower_warnHandBrake.setChecked(load("power_warnHandBrake"));
    chkpower_clock.setChecked(load("power_clock"));
    chkpower_remoteKey.setChecked(load("power_remoteKey"));
    chkpower_centralLock.setChecked(load("power_centralLock"));
    chkpower_transmissionPosition.setChecked(load("power_transmissionPosition"));

}

From source file:com.ichi2.anki2.Reviewer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Themes.applyTheme(this);
    super.onCreate(savedInstanceState);
    Log.i(AnkiDroidApp.TAG, "Reviewer - onCreate");

    // Remove the status bar and title bar
    if (mPrefFullscreenReview) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        // Do not hide the title bar in Honeycomb, since it contains the action bar.
        if (AnkiDroidApp.SDK_VERSION <= 11) {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
        }/*  w  w  w  . j  a  v  a 2 s.c o  m*/
    }

    mChangeBorderStyle = Themes.getTheme() == Themes.THEME_ANDROID_LIGHT
            || Themes.getTheme() == Themes.THEME_ANDROID_DARK;

    // The hardware buttons should control the music volume while reviewing.
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    Collection col = AnkiDroidApp.getCol();
    if (col == null) {
        reloadCollection(savedInstanceState);
        return;
    } else {
        mSched = col.getSched();
        mCollectionFilename = col.getPath();

        mBaseUrl = Utils.getBaseUrl(col.getMedia().getDir());
        restorePreferences();
        setFullScreen(mPrefFullscreenReview);

        registerExternalStorageListener();

        if (mNightMode) {
            mCurrentBackgroundColor = Themes.getNightModeCardBackground(this);
        } else {
            mCurrentBackgroundColor = Color.WHITE;
        }

        mRefreshWebview = getRefreshWebviewAndInitializeWebviewVariables();

        initLayout(R.layout.flashcard);

        try {
            String[] title = mSched.getCol().getDecks().current().getString("name").split("::");
            AnkiDroidApp.getCompat().setTitle(this, title[title.length - 1], mInvertedColors);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
        AnkiDroidApp.getCompat().setSubtitle(this, "", mInvertedColors);

        if (mPrefTextSelection) {
            clipboardSetText("");
        }

        // Load the template for the card
        try {
            mCardTemplate = Utils.convertStreamToString(getAssets().open("card_template.html"));
        } catch (IOException e) {
            e.printStackTrace();
        }

        // Initialize text-to-speech. This is an asynchronous operation.
        if (mSpeakText) {
            ReadText.initializeTts(this);
        }

        // Initialize answer recorder
        if (mPrefRecord) {
            Recorder.initialize(this);
        }

        // Get last whiteboard state
        if (mPrefWhiteboard && mCurrentCard != null
                && MetaDB.getWhiteboardState(this, mCurrentCard.getDid()) == 1) {
            mShowWhiteboard = true;
            mWhiteboard.setVisibility(View.VISIBLE);
        }

        // Load the first card and start reviewing. Uses the answer card
        // task to load a card, but since we send null
        // as the card to answer, no card will be answered.
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler,
                new DeckTask.TaskData(mSched, null, 0));

        // Since we aren't actually answering a card, decrement the rep count
        mSched.setReps(mSched.getReps() - 1);
    }
}

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

public Dialog displayDialog(String text) {
    Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC));
    d.setAlpha(200);/*from  w  w w.j  a  v  a2  s .  c o 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(text);
    return dialog;
}

From source file:com.hichinaschool.flashcards.anki.Reviewer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Themes.applyTheme(this);
    super.onCreate(savedInstanceState);
    // Log.i(AnkiDroidApp.TAG, "Reviewer - onCreate");

    // Remove the status bar and title bar
    if (mPrefFullscreenReview) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        // Do not hide the title bar in Honeycomb, since it contains the action bar.
        if (AnkiDroidApp.SDK_VERSION <= 11) {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
        }//from  w  ww  .  j  av  a2s.com
    }

    mChangeBorderStyle = Themes.getTheme() == Themes.THEME_ANDROID_LIGHT
            || Themes.getTheme() == Themes.THEME_ANDROID_DARK;

    // The hardware buttons should control the music volume while reviewing.
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    Collection col = AnkiDroidApp.getCol();
    if (col == null) {
        reloadCollection(savedInstanceState);
        return;
    } else {
        mSched = col.getSched();
        mCollectionFilename = col.getPath();

        mBaseUrl = Utils.getBaseUrl(col.getMedia().getDir());
        restorePreferences();
        setFullScreen(mPrefFullscreenReview);

        registerExternalStorageListener();

        if (mNightMode) {
            mCurrentBackgroundColor = Themes.getNightModeCardBackground(this);
        } else {
            mCurrentBackgroundColor = Color.WHITE;
        }

        mUseQuickUpdate = shouldUseQuickUpdate();

        initLayout(R.layout.flashcard);

        try {
            String[] title = mSched.getCol().getDecks().current().getString("name").split("::");
            AnkiDroidApp.getCompat().setTitle(this, title[title.length - 1], mInvertedColors);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
        AnkiDroidApp.getCompat().setSubtitle(this, "", mInvertedColors);

        if (mPrefTextSelection) {
            clipboardSetText("");
        }

        // Load the template for the card
        try {
            mCardTemplate = Utils.convertStreamToString(getAssets().open("card_template.html"));
        } catch (IOException e) {
            e.printStackTrace();
        }

        // Initialize text-to-speech. This is an asynchronous operation.
        if (mSpeakText) {
            ReadText.initializeTts(this);
        }

        // Get last whiteboard state
        if (mPrefWhiteboard && mCurrentCard != null
                && MetaDB.getWhiteboardState(this, mCurrentCard.getDid()) == 1) {
            mShowWhiteboard = true;
            mWhiteboard.setVisibility(View.VISIBLE);
        }

        // Load the first card and start reviewing. Uses the answer card
        // task to load a card, but since we send null
        // as the card to answer, no card will be answered.
        DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler,
                new DeckTask.TaskData(mSched, null, 0));

        // Since we aren't actually answering a card, decrement the rep count
        mSched.setReps(mSched.getReps() - 1);
    }
}