Example usage for android.app Dialog requestWindowFeature

List of usage examples for android.app Dialog requestWindowFeature

Introduction

In this page you can find the example usage for android.app Dialog requestWindowFeature.

Prototype

public final boolean requestWindowFeature(int featureId) 

Source Link

Document

Enable extended window features.

Usage

From source file:com.gpsmobitrack.gpstracker.MenuItems.SettingsPage.java

/**
 *  Profile is Public ON or OFF /* w ww.j  a v  a2 s .  c o m*/
 */
private void showPublicAlert(String Message, String Title, final int alertCode) {
    final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Translucent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCancelable(false);
    dialog.setContentView(R.layout.alert_dialog_main);
    final TextView alertTitle = (TextView) dialog.findViewById(R.id.alert_title);
    final TextView alertMsg = (TextView) dialog.findViewById(R.id.alert_msg);
    final EditText alertEditTxt = (EditText) dialog.findViewById(R.id.alert_edit_txt);
    Button okBtn = (Button) dialog.findViewById(R.id.alert_ok_btn);
    Button cancelBtn = (Button) dialog.findViewById(R.id.alert_cancel_btn);
    alertTitle.setText(Title);
    alertMsg.setText(Message);
    alertEditTxt.setVisibility(View.GONE);
    cancelBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            if (alertCode == 7) {
                publicPrivacy.setChecked(true);
                editor.putBoolean(AppConstants.IS_ENABLED_PROFILE_PRIVACY, true);
                editor.commit();

            }
        }
    });
    okBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            if (alertCode == 7) {
                publicPrivacy.setChecked(false);
                editor.putBoolean(AppConstants.IS_ENABLED_PROFILE_PRIVACY, false);
                editor.commit();

            }
        }
    });
    dialog.show();
}

From source file:com.gpsmobitrack.gpstracker.MenuItems.SettingsPage.java

/**
 *  Background updates show ON or OFF/*www  . ja v a2 s.co m*/
 */
private void showAlert(String Message, String Title, final int alertCode) {
    final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Translucent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCancelable(false);
    dialog.setContentView(R.layout.alert_dialog_main);
    final TextView alertTitle = (TextView) dialog.findViewById(R.id.alert_title);
    final TextView alertMsg = (TextView) dialog.findViewById(R.id.alert_msg);
    final EditText alertEditTxt = (EditText) dialog.findViewById(R.id.alert_edit_txt);
    Button okBtn = (Button) dialog.findViewById(R.id.alert_ok_btn);
    Button cancelBtn = (Button) dialog.findViewById(R.id.alert_cancel_btn);
    alertTitle.setText(Title);
    alertMsg.setText(Message);
    alertEditTxt.setVisibility(View.GONE);
    if (alertCode == 0 || alertCode == UPDATE_INT || alertCode == 7) {
        cancelBtn.setVisibility(View.VISIBLE);
    } else {
        cancelBtn.setVisibility(View.GONE);
    }
    cancelBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            if (alertCode == 7) {
                backUpdateToggle.setChecked(true);
                editor.putBoolean(AppConstants.IS_SERVICE_ENABLED_PREF, true);
                editor.commit();
            }
        }
    });
    okBtn.setOnClickListener(new OnClickListener() {
        @SuppressWarnings("unused")
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            if (alertCode == 3 || alertCode == 4) {

                session.logoutUser(getActivity());
                Intent i = new Intent(getActivity(), Login.class);
                startActivity(i);
                getActivity().finish();
            } else if (alertCode == 0) {
                deactivateAcc();
            } else if (alertCode == UPDATE_INT) {
                getActivity().finish();
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("market://details?id=com.gpstracker.pro"));
                startActivity(intent);
            } else if (alertCode == 7) {
                backUpdateToggle.setChecked(false);
                editor.putBoolean(AppConstants.IS_SERVICE_ENABLED_PREF, false);
                editor.commit();
                AlarmManager alarm = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
                Calendar cal = Calendar.getInstance();
                Intent intent2 = new Intent(getActivity(), BackgroundService.class);
                PendingIntent pintent = PendingIntent.getService(getActivity(), 0, intent2, 0);
                if (PendingIntent.getService(getActivity(), 0, intent2, PendingIntent.FLAG_NO_CREATE) != null) {
                    alarm.cancel(pintent);
                }
            }
        }
    });
    dialog.show();
}

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);//from   w w  w .  j ava2 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(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();
}

From source file:org.opendatakit.tables.activities.TableDisplayActivity.java

private void showDialogLocNuoc() {
    final ViewFragmentType fage = this.mCurrentFragmentType;
    final Dialog dialog = new Dialog(context);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    View layout = inflater.inflate(R.layout.dialog_loc, null);
    dialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    dialog.setContentView(R.layout.dialog_loc);
    final ListView lv = (ListView) dialog.findViewById(R.id.list_loc);
    TextView title = (TextView) dialog.findViewById(R.id.title);
    List<Model> list = new ArrayList<Model>();
    if (this.getTableId().equals("kdv_dnn_hogiadinh")) {
        list = SqliteLoc.getThonNuoc();//  w  ww  .  jav a2s.  c o  m
    }
    if (this.getTableId().equals("kdv_vs_hogiadinh")) {
        list = SqliteLoc.getThonGiaDinh();
    }
    if (this.getTableId().equals("kdv_vs_congtrinhcongcong")) {
        list = SqliteLoc.getThonCongCong();
    }
    if (loc_position >= 0 && list.size() > 0) {
        Model m = new Model(list.get(loc_position).getName(), true);
        list.set(loc_position, m);
    }
    if (list.size() == 0) {
        title.setText(getString(R.string.dialogloc));
    }
    adapter = new Adapter(this, list);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Model model = (Model) (lv.getItemAtPosition(position));
            String selectedFromList = model.getName();
            Intent intent = getIntent();
            intent.putExtra("loc", selectedFromList);
            intent.putExtra("loc_position", String.valueOf(position));
            intent.putExtra("all", "0");
            intent.putExtra("timkiem", "null");
            switch (fage) {
            case SPREADSHEET:
                intent.putExtra("page", "SPREADSHEET");
                break;
            case LIST:
                intent.putExtra("page", "LIST");
                break;
            case MAP:
                intent.putExtra("page", "MAP");
                break;
            case DETAIL:
                intent.putExtra("page", "DETAIL");
                break;
            default:
                break;
            }
            finish();
            startActivity(intent);
        }
    });
    dialog.show();
}

From source file:org.opendatakit.tables.activities.TableDisplayActivity.java

private void showDialogOder() {
    int i, j = 0, n;
    int k = 0;/*from w w  w  . ja v a 2 s .c  o  m*/
    final List<String[]> tile = readCsv(context);
    for (n = 0; n < tile.size(); n++) {
        if ("sort".equals(tile.get(n)[0])) {
            j++;
        }
    }
    String[] name = new String[j];
    final ViewFragmentType fage = this.mCurrentFragmentType;
    final Dialog dialog = new Dialog(context);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    View layout = inflater.inflate(R.layout.dialog_sapxep, null);
    dialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    dialog.setContentView(R.layout.dialog_sapxep);
    final ListView lv = (ListView) dialog.findViewById(R.id.list_oder);
    TextView title = (TextView) dialog.findViewById(R.id.title);
    title.setText("Sp xp theo");
    for (i = 0; i < tile.size(); i++) {
        if ("sort".equals(tile.get(i)[0])) {
            name[k] = tile.get(i)[1].toString();
            k++;
        }
    }
    List<Model> list = new ArrayList<Model>();
    for (String elementKey : name) {
        list.add(new Model(elementKey));
    }
    if (oder_position >= 0) {
        Model m = new Model(name[oder_position], true);
        list.set(oder_position, m);
    }
    adapter = new Adapter(this, list);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Model model = (Model) (lv.getItemAtPosition(position));
            String selectedFromList = model.getName();
            for (int n = 0; n < tile.size(); n++) {
                if (selectedFromList.equals(tile.get(n)[1])) {
                    String oder_key = tile.get(n)[2].toString();
                    Intent intent = getIntent();
                    intent.putExtra("oder", oder_key);
                    intent.putExtra("oder_position", String.valueOf(position));
                    intent.putExtra("all", "0");
                    switch (fage) {
                    case SPREADSHEET:
                        intent.putExtra("page", "SPREADSHEET");
                        break;
                    case LIST:
                        intent.putExtra("page", "LIST");
                        break;
                    case MAP:
                        intent.putExtra("page", "MAP");
                        break;
                    case DETAIL:
                        intent.putExtra("page", "DETAIL");
                        break;
                    default:
                        break;
                    }
                    finish();
                    startActivity(intent);
                }
            }

        }

    });
    dialog.show();
}

From source file:org.opendatakit.tables.activities.TableDisplayActivity.java

private void showDialogTimkiem() {
    int i, j = 0, n;
    int k = 0;/* w w w.jav  a  2 s  .co m*/
    final List<String[]> tile = readCsv(context);
    final ViewFragmentType fage = this.mCurrentFragmentType;
    for (n = 0; n < tile.size(); n++) {
        if ("filter".equals(tile.get(n)[0])) {
            j++;
        }
    }
    String[] name = new String[j];
    final Dialog dialog = new Dialog(context);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    View layout = inflater.inflate(R.layout.dialog_sapxep, null);
    dialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    dialog.setContentView(R.layout.dialog_sapxep);
    final ListView lv = (ListView) dialog.findViewById(R.id.list_oder);
    TextView title = (TextView) dialog.findViewById(R.id.title);
    title.setText("L?c theo trng thi");
    for (i = 0; i < tile.size(); i++) {
        if ("filter".equals(tile.get(i)[0])) {
            name[k] = tile.get(i)[1].toString();
            k++;
        }
    }
    List<Model> list = new ArrayList<Model>();
    for (String elementKey : name) {
        list.add(new Model(elementKey));

    }

    if (position_check >= 0) {

        Model m = new Model(name[position_check], true);
        list.set(position_check, m);
    }
    adapter = new Adapter(this, list);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            RadioButton checkbox = (RadioButton) view.getTag(R.id.radioBT);
            checkbox.setChecked(true);
            Model model = (Model) (lv.getItemAtPosition(position));
            String selectedFromList = model.getName();
            for (int n = 0; n < tile.size(); n++) {
                if (selectedFromList.equals(tile.get(n)[1])) {
                    String mj = tile.get(n)[2].toString();
                    Intent intent = getIntent();
                    StringBuilder s = new StringBuilder();
                    s.append(mj);
                    intent.putExtra("timkiem", s.toString());
                    intent.putExtra("vitri", String.valueOf(position));
                    intent.putExtra("all", "0");
                    switch (fage) {
                    case SPREADSHEET:
                        intent.putExtra("page", "SPREADSHEET");
                        break;
                    case LIST:
                        intent.putExtra("page", "LIST");
                        break;
                    case MAP:
                        intent.putExtra("page", "MAP");
                        break;
                    case DETAIL:
                        intent.putExtra("page", "DETAIL");
                        break;
                    default:
                        break;
                    }
                    finish();
                    startActivity(intent);

                }
            }

        }

    });
    dialog.show();

}

From source file:com.gpsmobitrack.gpstracker.MenuItems.SettingsPage.java

/**
 * Show frequency dialog/*from   ww  w  .  ja va2 s. com*/
 */
private void showFrequencyPurchaseDialog(final int value) {
    final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Translucent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCancelable(false);
    dialog.setContentView(R.layout.alert_dialog_main);
    final TextView alertTitle = (TextView) dialog.findViewById(R.id.alert_title);
    final TextView alertMsg = (TextView) dialog.findViewById(R.id.alert_msg);
    final EditText alertEditTxt = (EditText) dialog.findViewById(R.id.alert_edit_txt);
    Button okBtn = (Button) dialog.findViewById(R.id.alert_ok_btn);
    Button cancelBtn = (Button) dialog.findViewById(R.id.alert_cancel_btn);
    final RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.myRadioGroup);

    final RadioButton radioOneMonth = (RadioButton) dialog.findViewById(R.id.oneMonth);
    final RadioButton radioThreeMonth = (RadioButton) dialog.findViewById(R.id.threeMonth);
    final RadioButton radioSixMonth = (RadioButton) dialog.findViewById(R.id.sixMonth);
    final RadioButton radioOneYear = (RadioButton) dialog.findViewById(R.id.oneYear);

    //long updateTime = pref.getLong(AppConstants.FREQ_UPDATE_PREF, AppConstants.DEFAULT_TIME_INTERVAL);
    radioGroup.setVisibility(View.VISIBLE);
    alertTitle.setText("Purchase Product");
    if (value == updateDurationValue[0]) {
        alertMsg.setText("Buy Update Frequency for 1 Minutes");
        //radioOneMonth.setChecked(true);
        if (userType == PurchaseStatus.FULL_ACCESS_USER) {
            if (duration.equalsIgnoreCase("OneMonth")) {
                radioOneMonth.setChecked(true);
            } else {
                radioOneMonth.setChecked(false);
                ;
            }
            if (duration.equalsIgnoreCase("ThreeMonth")) {
                radioThreeMonth.setChecked(true);
            } else {
                radioThreeMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("SixMonth")) {
                radioSixMonth.setChecked(true);
            } else {
                radioSixMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("OneYear")) {
                radioOneYear.setChecked(true);
            } else {
                radioOneYear.setChecked(false);
            }
        }
    } else if (value == updateDurationValue[1]) {
        alertMsg.setText("Buy Update Frequency for 2 Minutes");
        if (userType == PurchaseStatus.SEMI_FULL_ACCESS_USER) {
            if (duration.equalsIgnoreCase("OneMonth")) {
                radioOneMonth.setChecked(true);
            } else {
                radioOneMonth.setChecked(false);
                ;
            }
            if (duration.equalsIgnoreCase("ThreeMonth")) {
                radioThreeMonth.setChecked(true);
            } else {
                radioThreeMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("SixMonth")) {
                radioSixMonth.setChecked(true);
            } else {
                radioSixMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("OneYear")) {
                radioOneYear.setChecked(true);
            } else {
                radioOneYear.setChecked(false);
            }
        }
    } else if (value == updateDurationValue[2]) {
        alertMsg.setText("Buy Update Frequency for 3 Minutes");

        if (userType == PurchaseStatus.PARTIAL_ACCESS_USER) {
            if (duration.equalsIgnoreCase("OneMonth")) {
                radioOneMonth.setChecked(true);
            } else {
                radioOneMonth.setChecked(false);
                ;
            }
            if (duration.equalsIgnoreCase("ThreeMonth")) {
                radioThreeMonth.setChecked(true);
            } else {
                radioThreeMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("SixMonth")) {
                radioSixMonth.setChecked(true);
            } else {
                radioSixMonth.setChecked(false);
            }
            if (duration.equalsIgnoreCase("OneYear")) {
                radioOneYear.setChecked(true);
            } else {
                radioOneYear.setChecked(false);
            }
        }
    }
    alertEditTxt.setVisibility(View.GONE);

    radioOneMonth.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (value == updateDurationValue[0]) {
                purchaseClicked = PurchaseClicked.ONE_MIN_ONE_MONTH;
            } else if (value == updateDurationValue[1]) {
                purchaseClicked = PurchaseClicked.TWO_MIN_ONE_MONTH;
            } else if (value == updateDurationValue[2]) {
                purchaseClicked = PurchaseClicked.THREE_MIN_ONE_MONTH;
            }
        }
    });
    radioThreeMonth.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (value == updateDurationValue[0]) {
                purchaseClicked = PurchaseClicked.ONE_MIN_THREE_MONTH;
            } else if (value == updateDurationValue[1]) {
                purchaseClicked = PurchaseClicked.TWO_MIN_THREE_MONTH;
            } else if (value == updateDurationValue[2]) {
                purchaseClicked = PurchaseClicked.THREE_MIN_THREE_MONTH;
            }
        }
    });
    radioSixMonth.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (value == updateDurationValue[0]) {
                purchaseClicked = PurchaseClicked.ONE_MIN_SIX_MONTH;
            } else if (value == updateDurationValue[1]) {
                purchaseClicked = PurchaseClicked.TWO_MIN_SIX_MONTH;
            } else if (value == updateDurationValue[2]) {
                purchaseClicked = PurchaseClicked.THREE_MIN_SIX_MONTH;
            }
        }
    });
    radioOneYear.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (value == updateDurationValue[0]) {
                purchaseClicked = PurchaseClicked.ONE_MIN_ONE_YEAR;
            } else if (value == updateDurationValue[1]) {
                purchaseClicked = PurchaseClicked.TWO_MIN_ONE_YEAR;
            } else if (value == updateDurationValue[2]) {
                purchaseClicked = PurchaseClicked.THREE_MIN_ONE_YEAR;
            }
        }
    });
    cancelBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            long updateTime = pref.getLong(AppConstants.FREQ_UPDATE_PREF, AppConstants.DEFAULT_TIME_INTERVAL);

            // Set Spinner
            setSpinnerUpdateTime(updateTime);
            firstSelect = false;
        }
    });
    okBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            if (radioOneMonth.isChecked() || radioThreeMonth.isChecked() || radioSixMonth.isChecked()
                    || radioOneYear.isChecked()) {
                // One min update
                if (value == updateDurationValue[0] && radioOneMonth.isChecked()) {
                    fullPurchaseOneMonth();
                    purchaseClicked = PurchaseClicked.ONE_MIN_ONE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[0] && radioThreeMonth.isChecked()) {
                    fullPurchaseThreeMonth();
                    purchaseClicked = PurchaseClicked.ONE_MIN_THREE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[0] && radioSixMonth.isChecked()) {
                    fullPurchaseSixMonth();
                    purchaseClicked = PurchaseClicked.ONE_MIN_SIX_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[0] && radioOneYear.isChecked()) {
                    fullPurchaseOneYear();
                    purchaseClicked = PurchaseClicked.ONE_MIN_ONE_YEAR;
                    //startUpdatePurchaseStatus();
                }
                // Two min update
                else if (value == updateDurationValue[1] && radioOneMonth.isChecked()) {
                    semiparticalPurchaseOneMonth();
                    purchaseClicked = PurchaseClicked.TWO_MIN_ONE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[1] && radioThreeMonth.isChecked()) {
                    semiparticalPurchaseThreeMonth();
                    purchaseClicked = PurchaseClicked.TWO_MIN_THREE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[1] && radioSixMonth.isChecked()) {
                    semiparticalPurchaseSixMonth();
                    purchaseClicked = PurchaseClicked.TWO_MIN_SIX_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[1] && radioOneYear.isChecked()) {
                    semiparticalPurchaseOneYear();
                    purchaseClicked = PurchaseClicked.TWO_MIN_ONE_YEAR;
                    //startUpdatePurchaseStatus();
                }
                // Three min update
                else if (value == updateDurationValue[2] && radioOneMonth.isChecked()) {
                    particalPurchaseOneMonth();
                    purchaseClicked = PurchaseClicked.THREE_MIN_ONE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[2] && radioThreeMonth.isChecked()) {
                    particalPurchaseThreeMonth();
                    purchaseClicked = PurchaseClicked.THREE_MIN_THREE_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[2] && radioSixMonth.isChecked()) {
                    particalPurchaseSixMonth();
                    purchaseClicked = PurchaseClicked.THREE_MIN_SIX_MONTH;
                    //startUpdatePurchaseStatus();
                } else if (value == updateDurationValue[2] && radioOneYear.isChecked()) {
                    particalPurchaseOneYear();
                    purchaseClicked = PurchaseClicked.THREE_MIN_ONE_YEAR;
                    //startUpdatePurchaseStatus();
                }

                long updateTime = pref.getLong(AppConstants.FREQ_UPDATE_PREF,
                        AppConstants.DEFAULT_TIME_INTERVAL);
                // Set Spinner
                setSpinnerUpdateTime(updateTime);
                firstSelect = false;
                dialog.dismiss();
            } else {
                dialog.show();
                Utils.showToast("Select durations");
                //Toast.makeText(getActivity(), "Select durations", Toast.LENGTH_LONG).show();
            }
        }
    });
    dialog.show();
}

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

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

From source file:org.csp.everyaware.offline.Map.java

/****************** OTTIENE RIFERIMENTO AI BOTTONI *********************************/

public void getButtonRefs() {
    mZoomControls = (LinearLayout) findViewById(R.id.zoomLinearLayout);
    mZoomControls.setVisibility(View.GONE);

    mTrackLengthBtn = (Button) findViewById(R.id.trackLengthBtn);
    mFollowCamBtn = (Button) findViewById(R.id.followCameraBtn);
    mZoomOutBtn = (Button) findViewById(R.id.zoomOutBtn);
    mZoomInBtn = (Button) findViewById(R.id.zoomInBtn);
    mInsertAnnBtn = (Button) findViewById(R.id.insertAnnBtn);
    mShareBtn = (Button) findViewById(R.id.shareBtn);

    mTrackLengthBtn.setVisibility(View.GONE);
    mInsertAnnBtn.setVisibility(View.GONE);

    mZoomOutBtn.setOnClickListener(new OnClickListener() {
        @Override//from ww w.j  av a 2  s  .  c  o m
        public void onClick(View arg0) {
            // Zoom out
            try {
                mGoogleMap.moveCamera(CameraUpdateFactory.zoomBy(-1f));
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
            //read and save actual zoom level
            mZoom = mGoogleMap.getCameraPosition().zoom;
        }
    });

    mZoomInBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            // Zoom in
            try {
                mGoogleMap.moveCamera(CameraUpdateFactory.zoomBy(1f));
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
            //read and save actual zoom level
            mZoom = mGoogleMap.getCameraPosition().zoom;
        }
    });

    mShareBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            mFacebookManager = FacebookManager.getInstance(Map.this, mFacebookHandler);
            mTwitterManager = TwitterManager.getInstance(Map.this);

            final Dialog dialog = new Dialog(Map.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.share_dialog);
            //dialog.setTitle("Activate login on...");

            getShareButtonsRef(dialog);

            dialog.show();
        }
    });

    mFollowCamBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            //mCameraTrackOn = !mCameraTrackOn;
            setCameraTracking();

            if (mCameraTrackOn) {
                try {
                    if (Utils.lastPhoneLocation != null)
                        mGoogleMap.animateCamera(
                                CameraUpdateFactory.newLatLng(new LatLng(Utils.lastPhoneLocation.getLatitude(),
                                        Utils.lastPhoneLocation.getLongitude())));
                    else if (Utils.lastNetworkLocation != null)
                        mGoogleMap.animateCamera(CameraUpdateFactory
                                .newLatLng(new LatLng(Utils.lastNetworkLocation.getLatitude(),
                                        Utils.lastNetworkLocation.getLongitude())));
                } catch (NullPointerException e) {
                    e.printStackTrace();
                }
            }
        }
    });

    mShareBtn.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View arg0) {
            Toast toast = Toast.makeText(getApplicationContext(),
                    getResources().getString(R.string.share_btn_text), Toast.LENGTH_LONG);
            toast.setGravity(Gravity.TOP | Gravity.RIGHT, 0, 250); //250 from top on a 480x800 screen
            toast.show();
            return false;
        }
    });

    //status icons references
    mGpsStatus = (ImageView) findViewById(R.id.gpsStatusIv);
    mInterUplStatus = (ImageView) findViewById(R.id.interUplStatusIv);

    //gps status icon initialization
    mGpsStatus.setBackgroundResource(R.drawable.gps_off);

    //read network type index on which upload data is allowed: 0 - only wifi; 1 - both wifi and mobile
    int networkTypeIndex = Utils.getUploadNetworkTypeIndex(getApplicationContext());

    //1 - is internet connection available? 
    boolean[] connectivity = Utils.haveNetworkConnection(getApplicationContext());

    //if user wants to upload only on wifi networks, connectivity[0] (network connectivity) must be true
    if (networkTypeIndex == 0) {
        if (connectivity[0])
            mConnectivityOn = true;
        else
            mConnectivityOn = false;
    } else //if user wants to upload both on wifi/mobile networks
        mConnectivityOn = connectivity[0] || connectivity[1];

    //network status icon initialization
    if (mConnectivityOn) {
        mInterUplStatus.setBackgroundResource(R.drawable.internet_on);
        Utils.uploadOn = Constants.INTERNET_ON_INT;
    } else {
        mInterUplStatus.setBackgroundResource(R.drawable.internet_off);
        Utils.uploadOn = Constants.INTERNET_OFF_INT;
    }

    //button to get from server black carbon levels around user
    mGetBcLevelsBtn = (Button) findViewById(R.id.getBcLevelsBtn);
    mGetBcLevelsBtn.setVisibility(View.VISIBLE);
    mGetBcLevelsBtn.setOnClickListener(mGetBcLevelsOnClickListener);

    //bcLayout.addView(mGetBcLevelsBtn);
    mSpectrum = (LinearLayout) findViewById(R.id.spectrumLinearLayout);
    mSpectrum.setVisibility(View.VISIBLE);
}

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   www . java  2s. c om
    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;
}