Example usage for android.app Dialog setCancelable

List of usage examples for android.app Dialog setCancelable

Introduction

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

Prototype

public void setCancelable(boolean flag) 

Source Link

Document

Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key.

Usage

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

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

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

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

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

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

    dlgAbout.setCancelable(true);

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

    dlgAbout.show();
}

From source file:org.rm3l.maoni.ui.MaoniActivity.java

private void initScreenCaptureView(@NonNull final Intent intent) {
    final ImageButton screenshotThumb = (ImageButton) findViewById(R.id.maoni_screenshot);

    final TextView touchToPreviewTextView = (TextView) findViewById(R.id.maoni_screenshot_touch_to_preview);
    if (touchToPreviewTextView != null && intent.hasExtra(SCREENSHOT_TOUCH_TO_PREVIEW_HINT)) {
        touchToPreviewTextView.setText(intent.getCharSequenceExtra(SCREENSHOT_TOUCH_TO_PREVIEW_HINT));
    }/*from   ww  w .  ja  v a 2 s  .  c  o  m*/

    final View screenshotContentView = findViewById(R.id.maoni_include_screenshot_content);
    if (!TextUtils.isEmpty(mScreenshotFilePath)) {
        final File file = new File(mScreenshotFilePath.toString());
        if (file.exists()) {
            if (mIncludeScreenshot != null) {
                mIncludeScreenshot.setVisibility(View.VISIBLE);
            }
            if (screenshotContentView != null) {
                screenshotContentView.setVisibility(View.VISIBLE);
            }
            if (screenshotThumb != null) {
                //Thumbnail - load with smaller resolution so as to reduce memory footprint
                screenshotThumb.setImageBitmap(
                        ViewUtils.decodeSampledBitmapFromFilePath(file.getAbsolutePath(), 100, 100));
            }

            // Hook up clicks on the thumbnail views.
            if (screenshotThumb != null) {
                screenshotThumb.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        final Dialog imagePreviewDialog = new Dialog(MaoniActivity.this);

                        imagePreviewDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                        imagePreviewDialog.getWindow()
                                .setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

                        imagePreviewDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                            @Override
                            public void onDismiss(DialogInterface dialogInterface) {
                                //nothing;
                            }
                        });

                        imagePreviewDialog.setContentView(R.layout.maoni_screenshot_preview);

                        final View.OnClickListener clickListener = new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                imagePreviewDialog.dismiss();
                            }
                        };

                        final ImageView imageView = (ImageView) imagePreviewDialog
                                .findViewById(R.id.maoni_screenshot_preview_image);
                        imageView.setImageURI(Uri.fromFile(file));

                        final DrawableView drawableView = (DrawableView) imagePreviewDialog
                                .findViewById(R.id.maoni_screenshot_preview_image_drawable_view);
                        final DrawableViewConfig config = new DrawableViewConfig();
                        // If the view is bigger than canvas, with this the user will see the bounds
                        config.setShowCanvasBounds(true);
                        config.setStrokeWidth(57.0f);
                        config.setMinZoom(1.0f);
                        config.setMaxZoom(1.0f);
                        config.setStrokeColor(mHighlightColor);
                        final View decorView = getWindow().getDecorView();
                        config.setCanvasWidth(decorView.getWidth());
                        config.setCanvasHeight(decorView.getHeight());
                        drawableView.setConfig(config);
                        drawableView.bringToFront();

                        imagePreviewDialog.findViewById(R.id.maoni_screenshot_preview_pick_highlight_color)
                                .setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        config.setStrokeColor(mHighlightColor);
                                    }
                                });
                        imagePreviewDialog.findViewById(R.id.maoni_screenshot_preview_pick_blackout_color)
                                .setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        config.setStrokeColor(mBlackoutColor);
                                    }
                                });
                        imagePreviewDialog.findViewById(R.id.maoni_screenshot_preview_close)
                                .setOnClickListener(clickListener);

                        imagePreviewDialog.findViewById(R.id.maoni_screenshot_preview_undo)
                                .setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        drawableView.undo();
                                    }
                                });

                        imagePreviewDialog.findViewById(R.id.maoni_screenshot_preview_save)
                                .setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        ViewUtils.exportViewToFile(MaoniActivity.this,
                                                imagePreviewDialog.findViewById(
                                                        R.id.maoni_screenshot_preview_image_view_updated),
                                                new File(mScreenshotFilePath.toString()));
                                        initScreenCaptureView(intent);
                                        imagePreviewDialog.dismiss();
                                    }
                                });

                        imagePreviewDialog.setCancelable(true);
                        imagePreviewDialog.setCanceledOnTouchOutside(false);

                        imagePreviewDialog.show();
                    }
                });
            }
        } else {
            if (mIncludeScreenshot != null) {
                mIncludeScreenshot.setVisibility(View.GONE);
            }
            if (screenshotContentView != null) {
                screenshotContentView.setVisibility(View.GONE);
            }
        }
    } else {
        if (mIncludeScreenshot != null) {
            mIncludeScreenshot.setVisibility(View.GONE);
        }
        if (screenshotContentView != null) {
            screenshotContentView.setVisibility(View.GONE);
        }
    }
}

From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java

private void scanRemoteNetwork(final Dialog dialog, final ListView lv_ipaddr,
        final AdapterScanAddressResultList adap, final ArrayList<ScanAddressResultListItem> ipAddressList,
        final String subnet, final int begin_addr, final int end_addr, final NotifyEvent p_ntfy) {
    final Handler handler = new Handler();
    final ThreadCtrl tc = new ThreadCtrl();
    final LinearLayout ll_addr = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_scan_address);
    final LinearLayout ll_prog = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_progress);
    final TextView tvmsg = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_progress_msg);
    final Button btn_scan = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_ok);
    final Button btn_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_cancel);
    final Button scan_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_progress_cancel);

    final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog
            .findViewById(R.id.scan_remote_ntwk_ctv_use_port);
    final EditText et_port_number = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_port_number);

    tvmsg.setText("");
    scan_cancel.setText(R.string.msgs_scan_progress_spin_dlg_addr_cancel);
    ll_addr.setVisibility(LinearLayout.GONE);
    ll_prog.setVisibility(LinearLayout.VISIBLE);
    btn_scan.setVisibility(Button.GONE);
    btn_cancel.setVisibility(Button.GONE);
    adap.setButtonEnabled(false);//w ww .  j a v a2s. com
    scan_cancel.setEnabled(true);
    dialog.setOnKeyListener(new DialogBackKeyListener(mContext));
    dialog.setCancelable(false);
    // CANCEL?
    scan_cancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            scan_cancel.setText(mContext.getString(R.string.msgs_progress_dlg_canceling));
            scan_cancel.setEnabled(false);
            util.addDebugMsg(1, "W", "IP Address list creation was cancelled");
            tc.setDisabled();
        }
    });
    dialog.show();

    util.addDebugMsg(1, "I", "Scan IP address ransge is " + subnet + "." + begin_addr + " - " + end_addr);

    final String scan_prog = mContext.getString(R.string.msgs_ip_address_scan_progress);
    String p_txt = String.format(scan_prog, 0);
    tvmsg.setText(p_txt);

    new Thread(new Runnable() {
        @Override
        public void run() {//non UI thread
            mScanCompleteCount = 0;
            mScanAddrCount = end_addr - begin_addr + 1;
            int scan_thread = 60;
            String scan_port = "";
            if (ctv_use_port_number.isChecked())
                scan_port = et_port_number.getText().toString();
            for (int i = begin_addr; i <= end_addr; i += scan_thread) {
                if (!tc.isEnabled())
                    break;
                boolean scan_end = false;
                for (int j = i; j < (i + scan_thread); j++) {
                    if (j <= end_addr) {
                        startRemoteNetworkScanThread(handler, tc, dialog, p_ntfy, lv_ipaddr, adap, tvmsg,
                                subnet + "." + j, ipAddressList, scan_port);
                    } else {
                        scan_end = true;
                    }
                }
                if (!scan_end) {
                    for (int wc = 0; wc < 210; wc++) {
                        if (!tc.isEnabled())
                            break;
                        SystemClock.sleep(30);
                    }
                }
            }
            if (!tc.isEnabled()) {
                handler.post(new Runnable() {// UI thread
                    @Override
                    public void run() {
                        closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg);
                    }
                });
            } else {
                handler.postDelayed(new Runnable() {// UI thread
                    @Override
                    public void run() {
                        closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg);
                    }
                }, 10000);
            }
        }
    }).start();
}

From source file:com.orange.datavenue.StreamListFragment.java

/**
 *
 *///from   w  w w .  j  a v  a2 s  . c  o  m
private void createStream() {
    final android.app.Dialog dialog = new android.app.Dialog(getActivity());

    dialog.setContentView(R.layout.create_stream_dialog);

    dialog.setTitle(R.string.add_stream);

    final LinearLayout callbackLayout = (LinearLayout) dialog.findViewById(R.id.callback_layout);
    final EditText name = (EditText) dialog.findViewById(R.id.name);
    final EditText description = (EditText) dialog.findViewById(R.id.description);
    final EditText unit = (EditText) dialog.findViewById(R.id.unit);
    final EditText symbol = (EditText) dialog.findViewById(R.id.symbol);
    final EditText callback = (EditText) dialog.findViewById(R.id.callback);
    final EditText latitude = (EditText) dialog.findViewById(R.id.latitude);
    final EditText longitude = (EditText) dialog.findViewById(R.id.longitude);

    Button actionButton = (Button) dialog.findViewById(R.id.add_button);

    callbackLayout.setVisibility(View.VISIBLE);
    actionButton.setText(getString(R.string.add_stream));

    actionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.d(TAG_NAME, "name : " + name.getText().toString());
            Log.d(TAG_NAME, "description : " + description.getText().toString());
            Log.d(TAG_NAME, "unit : " + unit.getText().toString());
            Log.d(TAG_NAME, "symbol : " + symbol.getText().toString());

            Stream newStream = new Stream();

            newStream.setName(name.getText().toString());
            newStream.setDescription(description.getText().toString());

            /**
             * Allocate new Location
             */
            Double[] location = null;

            String strLatitude = latitude.getText().toString();
            String strLongitude = longitude.getText().toString();

            try {
                if ((!"".equals(strLatitude)) && (!"".equals(strLongitude))) {
                    location = new Double[2];
                    location[0] = Double.parseDouble(strLatitude);
                    location[1] = Double.parseDouble(strLongitude);
                }
            } catch (NumberFormatException e) {
                Log.e(TAG_NAME, e.toString());
                location = null;
            }

            if (location != null) {
                newStream.setLocation(location);
            }
            /**************************************************************************/

            /**
             * Allocate new Unit & Symbol
             */
            Unit newUnit = null;
            String strUnit = unit.getText().toString();
            String strSymbol = symbol.getText().toString();

            if (!"".equals(strUnit)) {
                if (newUnit == null) {
                    newUnit = new Unit();
                }
                newUnit.setName(strUnit);
            }

            if (!"".equals(strSymbol)) {
                if (newUnit == null) {
                    newUnit = new Unit();
                }
                newUnit.setSymbol(strSymbol);
            }

            if (newUnit != null) {
                newStream.setUnit(newUnit);
            }

            /**
             * Allocate new Callback
             */
            Callback newCallback = null;
            String callbackUrl = callback.getText().toString();

            if (!"".equals(callbackUrl)) {
                try {
                    URL url = new URL(callbackUrl);
                    newCallback = new Callback();
                    newCallback.setUrl(url.toString());
                    newCallback.setName("Callback");
                    newCallback.setDescription("application callback");
                    newCallback.setStatus("activated");
                } catch (MalformedURLException e) {
                    Log.e(TAG_NAME, e.toString());
                    callback.setText("");
                }
            }

            if (newCallback != null) {
                newStream.setCallback(newCallback);
            }

            /**************************************************************************/

            CreateStreamOperation createStreamOperation = new CreateStreamOperation(Model.instance.oapiKey,
                    Model.instance.key, Model.instance.currentDatasource, newStream, new OperationCallback() {
                        @Override
                        public void process(Object object, Exception exception) {
                            if (exception == null) {
                                getStreams();
                            } else {
                                Errors.displayError(getActivity(), exception);
                            }
                        }
                    });

            createStreamOperation.execute("");

            dialog.dismiss();

        }
    });

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

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

From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java

private void closeScanRemoteNetworkProgressDlg(final Dialog dialog, final NotifyEvent p_ntfy,
        final ListView lv_ipaddr, final AdapterScanAddressResultList adap, final TextView tvmsg) {
    final LinearLayout ll_addr = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_scan_address);
    final LinearLayout ll_prog = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_progress);
    final Button btn_scan = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_ok);
    final Button btn_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_cancel);
    ll_addr.setVisibility(LinearLayout.VISIBLE);
    ll_prog.setVisibility(LinearLayout.GONE);
    btn_scan.setEnabled(true);/*from   w w  w  .  j av  a2  s.  c  o m*/
    btn_cancel.setEnabled(true);
    adap.setButtonEnabled(true);
    dialog.setOnKeyListener(null);
    dialog.setCancelable(true);
    if (p_ntfy != null)
        p_ntfy.notifyToListener(true, null);

}

From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java

private void scanRemoteNetwork(final Dialog dialog, final ListView lv_ipaddr,
        final AdapterScanAddressResultList adap, final ArrayList<ScanAddressResultListItem> ipAddressList,
        final String subnet, final int begin_addr, final int end_addr, final NotifyEvent p_ntfy) {
    final Handler handler = new Handler();
    final ThreadCtrl tc = new ThreadCtrl();
    final LinearLayout ll_addr = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_scan_address);
    final LinearLayout ll_prog = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_progress);
    final TextView tvmsg = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_progress_msg);
    final Button btn_scan = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_ok);
    final Button btn_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_cancel);
    final Button scan_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_progress_cancel);

    final CheckBox cb_use_port_number = (CheckBox) dialog.findViewById(R.id.scan_remote_ntwk_use_port);
    final EditText et_port_number = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_port_number);

    tvmsg.setText("");
    scan_cancel.setText(R.string.msgs_progress_spin_dlg_addr_cancel);
    ll_addr.setVisibility(LinearLayout.GONE);
    ll_prog.setVisibility(LinearLayout.VISIBLE);
    btn_scan.setEnabled(false);// w ww .  j  a va2s . c  o m
    btn_cancel.setEnabled(false);
    adap.setButtonEnabled(false);
    scan_cancel.setEnabled(true);
    dialog.setOnKeyListener(new DialogBackKeyListener(mContext));
    dialog.setCancelable(false);
    // CANCEL?
    scan_cancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            scan_cancel.setText(mContext.getString(R.string.msgs_progress_dlg_canceling));
            scan_cancel.setEnabled(false);
            sendDebugLogMsg(1, "W", "IP Address list creation was cancelled");
            tc.setDisabled();
        }
    });
    dialog.show();

    sendDebugLogMsg(1, "I", "Scan IP address ransge is " + subnet + "." + begin_addr + " - " + end_addr);

    final String scan_prog = mContext.getString(R.string.msgs_ip_address_scan_progress);
    String p_txt = String.format(scan_prog, 0);
    tvmsg.setText(p_txt);

    new Thread(new Runnable() {
        @Override
        public void run() {//non UI thread
            mScanCompleteCount = 0;
            mScanAddrCount = end_addr - begin_addr + 1;
            int scan_thread = 50;
            String scan_port = "";
            if (cb_use_port_number.isChecked())
                scan_port = et_port_number.getText().toString();
            for (int i = begin_addr; i <= end_addr; i += scan_thread) {
                if (!tc.isEnabled())
                    break;
                boolean scan_end = false;
                for (int j = i; j < (i + scan_thread); j++) {
                    if (j <= end_addr) {
                        startRemoteNetworkScanThread(handler, tc, dialog, p_ntfy, lv_ipaddr, adap, tvmsg,
                                subnet + "." + j, ipAddressList, scan_port);
                    } else {
                        scan_end = true;
                    }
                }
                if (!scan_end) {
                    for (int wc = 0; wc < 210; wc++) {
                        if (!tc.isEnabled())
                            break;
                        SystemClock.sleep(30);
                    }
                }
            }
            if (!tc.isEnabled()) {
                handler.post(new Runnable() {// UI thread
                    @Override
                    public void run() {
                        closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg);
                    }
                });
            } else {
                handler.postDelayed(new Runnable() {// UI thread
                    @Override
                    public void run() {
                        closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg);
                    }
                }, 10000);
            }
        }
    }).start();
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void report(final boolean isCancelable) {
    final Dialog reportDialog = mNotifyer.createDialog(R.string.commentar, R.layout.dialog_comment, false,
            true);//from   ww w  . jav a 2 s  .c o  m
    new Thread(new Runnable() {
        @Override
        public void run() {
            /** Creates a report Email including a Comment and important device infos */
            final Button bGo = (Button) reportDialog.findViewById(R.id.bGo);
            bGo.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS))
                        Toast.makeText(mContext, R.string.please_ads, Toast.LENGTH_SHORT).show();
                    Toast.makeText(mContext, R.string.donate_to_support, Toast.LENGTH_SHORT).show();
                    try {
                        ArrayList<File> files = new ArrayList<File>();
                        File TestResults = new File(mContext.getFilesDir(), "results.txt");
                        try {
                            if (TestResults.exists()) {
                                if (TestResults.delete()) {
                                    FileOutputStream fos = openFileOutput(TestResults.getName(),
                                            Context.MODE_PRIVATE);
                                    fos.write(("Recovery-Tools:\n\n"
                                            + mShell.execCommand(
                                                    "ls -lR " + PathToRecoveryTools.getAbsolutePath())
                                            + "\nCache Tree:\n" + mShell.execCommand("ls -lR /cache") + "\n"
                                            + "\nMTD result:\n" + mShell.execCommand("cat /proc/mtd") + "\n"
                                            + "\nDevice Tree:\n\n" + mShell.execCommand("ls -lR /dev"))
                                                    .getBytes());
                                }
                                files.add(TestResults);
                            }
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        }
                        if (getPackageManager() != null) {
                            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            EditText text = (EditText) reportDialog.findViewById(R.id.etComment);
                            String comment = "";
                            if (text.getText() != null)
                                comment = text.getText().toString();
                            Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                            intent.setType("text/plain");
                            intent.putExtra(Intent.EXTRA_EMAIL,
                                    new String[] { "ashotmkrtchyan1995@gmail.com" });
                            intent.putExtra(Intent.EXTRA_SUBJECT, "Recovery-Tools report");
                            intent.putExtra(Intent.EXTRA_TEXT, "Package Infos:" + "\n\nName: "
                                    + pInfo.packageName + "\nVersionName: " + pInfo.versionName
                                    + "\nVersionCode: " + pInfo.versionCode + "\n\n\nProduct Info: "
                                    + "\n\nManufacture: " + android.os.Build.MANUFACTURER + "\nDevice: "
                                    + Build.DEVICE + " (" + mDevice.getDeviceName() + ")" + "\nBoard: "
                                    + Build.BOARD + "\nBrand: " + Build.BRAND + "\nModel: " + Build.MODEL
                                    + "\nFingerprint: " + Build.FINGERPRINT + "\nAndroid SDK Level: "
                                    + Build.VERSION.CODENAME + " (" + Build.VERSION.SDK_INT + ")"
                                    + "\nRecovery Supported: " + mDevice.isRecoverySupported()
                                    + "\nRecovery Path: " + mDevice.getRecoveryPath() + "\nRecovery Version: "
                                    + mDevice.getRecoveryVersion() + "\nRecovery MTD: "
                                    + mDevice.isRecoveryMTD() + "\nRecovery DD: " + mDevice.isRecoveryDD()
                                    + "\nKernel Supported: " + mDevice.isKernelSupported() + "\nKernel Path: "
                                    + mDevice.getKernelPath() + "\nKernel Version: "
                                    + mDevice.getKernelVersion() + "\nKernel MTD: " + mDevice.isKernelMTD()
                                    + "\nKernel DD: " + mDevice.isKernelDD() + "\n\nCWM: "
                                    + mDevice.isCwmSupported() + "\nTWRP: " + mDevice.isTwrpSupported()
                                    + "\nPHILZ: " + mDevice.isPhilzSupported()
                                    + "\n\n\n===========COMMENT==========\n" + comment
                                    + "\n===========COMMENT END==========\n" + "\n===========PREFS==========\n"
                                    + getAllPrefs() + "\n===========PREFS END==========\n");
                            File CommandLogs = new File(mContext.getFilesDir(), Shell.Logs);
                            if (CommandLogs.exists()) {
                                files.add(CommandLogs);
                            }
                            files.add(new File(getFilesDir(), "last_log.txt"));
                            ArrayList<Uri> uris = new ArrayList<Uri>();
                            for (File file : files) {
                                mShell.execCommand("cp " + file.getAbsolutePath() + " "
                                        + new File(mContext.getFilesDir(), file.getName()).getAbsolutePath());
                                file = new File(mContext.getFilesDir(), file.getName());
                                mToolbox.setFilePermissions(file, "644");
                                uris.add(Uri.fromFile(file));
                            }
                            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
                            startActivity(Intent.createChooser(intent, "Send over Gmail"));
                            reportDialog.dismiss();
                        }
                    } catch (Exception e) {
                        reportDialog.dismiss();
                        Notifyer.showExceptionToast(mContext, TAG, e);
                    }
                }
            });
        }
    }).start();
    reportDialog.setCancelable(isCancelable);
    reportDialog.show();
}

From source file:xj.property.activity.HXBaseActivity.MainActivity.java

/**
 * ??dialog//  ww w . j a  va2  s .  c  o m
 */
private void showConflictDialog() {
    isConflictDialogShow = true;
    final UserInfoDetailBean detailBean = PreferencesUtil.getLoginInfo(getApplication());
    username = detailBean.getUsername();
    password = detailBean.getPassword();
    final XJUserInfoBean bean = new XJUserInfoBean();
    bean.setInfo(detailBean);

    if (xjpushManager != null) {
        xjpushManager.unregisterLoginedPushService();
    } else {
        xjpushManager = new XJPushManager(this);
        xjpushManager.unregisterLoginedPushService();
    }

    //        boolean flag= PushManager.getInstance().unBindAlias(MainActivity.this,   PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId());
    //        Log.i("onion","flag"+flag);
    XjApplication.getInstance().logout(new EMCallBack() {
        @Override
        public void onSuccess() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    refreshUI();
                    refreshNewBangBiUI();
                }
            });
        }

        @Override
        public void onError(int i, String s) {

        }

        @Override
        public void onProgress(int i, String s) {

        }
    });
    PreferencesUtil.Logout(MainActivity.this);
    if (!MainActivity.this.isFinishing()) {
        // clear up global variables
        try {
            final Dialog dialog = new Dialog(MainActivity.this, R.style.MyDialogStyle);
            dialog.setContentView(R.layout.dialog_conflict);
            TextView tv_cancle = (TextView) dialog.findViewById(R.id.tv_cancle);
            TextView tv_relogin = (TextView) dialog.findViewById(R.id.tv_relogin);
            tv_cancle.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    conflictBuilder = null;
                    dialog.dismiss();
                    index = 0;
                    updateUnreadLabel();
                    startActivity(new Intent(MainActivity.this, MainActivity.class));
                    //                        finish();
                }
            });
            tv_relogin.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    final ProgressDialog pd = new ProgressDialog(MainActivity.this,
                            ProgressDialog.THEME_HOLO_LIGHT);
                    pd.setCanceledOnTouchOutside(false);
                    pd.setCancelable(false);
                    pd.setOnCancelListener(new DialogInterface.OnCancelListener() {

                        @Override
                        public void onCancel(DialogInterface dialog) {
                            progressShow = false;
                        }
                    });
                    progressShow = true;
                    pd.setMessage("...");
                    if (pd != null && !MainActivity.this.isFinishing())
                        pd.show();
                    //???
                    // getuser((int) detailBean.getCommunityId(),detailBean.getEmobId());
                    UserUtils.reLoginUser(MainActivity.this, username, password, new Handler() {
                        @Override
                        public void handleMessage(Message msg) {
                            switch (msg.what) {
                            case Config.LoginUserComplete:
                                if (progressShow)
                                    pd.dismiss();
                                dialog.dismiss();
                                startActivity(new Intent(MainActivity.this, MainActivity.class));
                                isConflict = false;

                                //                                        boolean flag = PushManager.getInstance().bindAlias(MainActivity.this, PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId());
                                PushManager.getInstance().turnOnPush(MainActivity.this);

                                if (xjpushManager == null) {
                                    xjpushManager = new XJPushManager(getmContext());
                                }
                                xjpushManager.registerLoginedPushService();
                                break;
                            case Config.LoginUserFailure:
                                if (progressShow && !MainActivity.this.isFinishing()) {
                                    pd.dismiss();
                                    Toast.makeText(MainActivity.this, "?", Toast.LENGTH_SHORT)
                                            .show();
                                }
                                break;
                            default:
                                pd.setMessage("..");
                                break;

                            }
                        }
                    });

                    /* UserUtils.loginEMChat(MainActivity.this, username, bean, new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                        switch (msg.what) {
                            case Config.LoginUserComplete:
                                if (progressShow) pd.dismiss();
                                dialog.dismiss();
                                UserUtils.appLogin(MainActivity.this,PushManager.getInstance().getClientid(MainActivity.this), PreferencesUtil.getLoginInfo(MainActivity.this).getUsername());
                                startActivity(new Intent(MainActivity.this,
                                    MainActivity.class));
                                isConflict=false;
                                boolean flag= PushManager.getInstance().bindAlias(MainActivity.this,   PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId());
                            
                                PushManager.getInstance().turnOnPush(MainActivity.this);
                                break;
                            case Config.LoginUserFailure:
                                if (progressShow && !MainActivity.this.isFinishing()) {
                                    pd.dismiss();
                                    Toast.makeText(MainActivity.this, "?", Toast.LENGTH_SHORT).show();
                                }
                                break;
                            default:
                                pd.setMessage("..");
                                break;
                            
                        }
                    }
                     });*/
                }
            });

            dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
            dialog.setCancelable(false);
            dialog.show();

            isConflict = true;
        } catch (Exception e) {
            EMLog.e(TAG, "---------color conflictBuilder error" + e.getMessage());
        }

    }
}

From source file:org.telegram.ui.PassportActivity.java

private void createPasswordInterface(Context context) {
    TLRPC.User botUser = null;//w w w.  ja v  a2  s . co m
    if (currentForm != null) {
        for (int a = 0; a < currentForm.users.size(); a++) {
            TLRPC.User user = currentForm.users.get(a);
            if (user.id == currentBotId) {
                botUser = user;
                break;
            }
        }
    } else {
        botUser = UserConfig.getInstance(currentAccount).getCurrentUser();
    }

    FrameLayout frameLayout = (FrameLayout) fragmentView;

    actionBar.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport));

    emptyView = new EmptyTextProgressView(context);
    emptyView.showProgress();
    frameLayout.addView(emptyView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    passwordAvatarContainer = new FrameLayout(context);
    linearLayout2.addView(passwordAvatarContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 100));

    BackupImageView avatarImageView = new BackupImageView(context);
    avatarImageView.setRoundRadius(AndroidUtilities.dp(32));
    passwordAvatarContainer.addView(avatarImageView,
            LayoutHelper.createFrame(64, 64, Gravity.CENTER, 0, 8, 0, 0));

    AvatarDrawable avatarDrawable = new AvatarDrawable(botUser);
    TLRPC.FileLocation photo = null;
    if (botUser.photo != null) {
        photo = botUser.photo.photo_small;
    }
    avatarImageView.setImage(photo, "50_50", avatarDrawable, botUser);

    passwordRequestTextView = new TextInfoPrivacyCell(context);
    passwordRequestTextView.getTextView().setGravity(Gravity.CENTER_HORIZONTAL);
    if (currentBotId == 0) {
        passwordRequestTextView
                .setText(LocaleController.getString("PassportSelfRequest", R.string.PassportSelfRequest));
    } else {
        passwordRequestTextView.setText(AndroidUtilities.replaceTags(LocaleController
                .formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(botUser))));
    }
    ((FrameLayout.LayoutParams) passwordRequestTextView.getTextView()
            .getLayoutParams()).gravity = Gravity.CENTER_HORIZONTAL;
    linearLayout2.addView(passwordRequestTextView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0));

    noPasswordImageView = new ImageView(context);
    noPasswordImageView.setImageResource(R.drawable.no_password);
    noPasswordImageView.setColorFilter(new PorterDuffColorFilter(
            Theme.getColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY));
    linearLayout2.addView(noPasswordImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 13, 0, 0));

    noPasswordTextView = new TextView(context);
    noPasswordTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    noPasswordTextView.setGravity(Gravity.CENTER_HORIZONTAL);
    noPasswordTextView.setPadding(AndroidUtilities.dp(21), AndroidUtilities.dp(10), AndroidUtilities.dp(21),
            AndroidUtilities.dp(17));
    noPasswordTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
    noPasswordTextView.setText(LocaleController.getString("TelegramPassportCreatePasswordInfo",
            R.string.TelegramPassportCreatePasswordInfo));
    linearLayout2.addView(noPasswordTextView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 10, 21, 0));

    noPasswordSetTextView = new TextView(context);
    noPasswordSetTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText5));
    noPasswordSetTextView.setGravity(Gravity.CENTER);
    noPasswordSetTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    noPasswordSetTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    noPasswordSetTextView.setText(LocaleController.getString("TelegramPassportCreatePassword",
            R.string.TelegramPassportCreatePassword));
    linearLayout2.addView(noPasswordSetTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 24,
            (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 9, 21, 0));
    noPasswordSetTextView.setOnClickListener(v -> {
        TwoStepVerificationActivity activity = new TwoStepVerificationActivity(currentAccount, 1);
        activity.setCloseAfterSet(true);
        activity.setCurrentPasswordInfo(new byte[0], currentPassword);
        presentFragment(activity);
    });

    inputFields = new EditTextBoldCursor[1];
    inputFieldContainers = new ViewGroup[1];
    for (int a = 0; a < 1; a++) {
        inputFieldContainers[a] = new FrameLayout(context);
        linearLayout2.addView(inputFieldContainers[a],
                LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
        inputFieldContainers[a].setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));

        inputFields[a] = new EditTextBoldCursor(context);
        inputFields[a].setTag(a);
        inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
        inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setBackgroundDrawable(null);
        inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setCursorSize(AndroidUtilities.dp(20));
        inputFields[a].setCursorWidth(1.5f);
        inputFields[a].setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        inputFields[a].setMaxLines(1);
        inputFields[a].setLines(1);
        inputFields[a].setSingleLine(true);
        inputFields[a].setTransformationMethod(PasswordTransformationMethod.getInstance());
        inputFields[a].setTypeface(Typeface.DEFAULT);
        inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
        inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6));
        inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
        inputFieldContainers[a].addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
                LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6));

        inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> {
            if (i == EditorInfo.IME_ACTION_NEXT || i == EditorInfo.IME_ACTION_DONE) {
                doneItem.callOnClick();
                return true;
            }
            return false;
        });
        inputFields[a].setCustomSelectionActionModeCallback(new ActionMode.Callback() {
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public void onDestroyActionMode(ActionMode mode) {
            }

            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                return false;
            }
        });
    }

    passwordInfoRequestTextView = new TextInfoPrivacyCell(context);
    passwordInfoRequestTextView.setBackgroundDrawable(Theme.getThemedDrawable(context,
            R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    passwordInfoRequestTextView.setText(
            LocaleController.formatString("PassportRequestPasswordInfo", R.string.PassportRequestPasswordInfo));
    linearLayout2.addView(passwordInfoRequestTextView,
            LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

    passwordForgotButton = new TextView(context);
    passwordForgotButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
    passwordForgotButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    passwordForgotButton.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
    passwordForgotButton.setPadding(0, 0, 0, 0);
    linearLayout2.addView(passwordForgotButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 30,
            (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0));
    passwordForgotButton.setOnClickListener(v -> {
        if (currentPassword.has_recovery) {
            needShowProgress();
            TLRPC.TL_auth_requestPasswordRecovery req = new TLRPC.TL_auth_requestPasswordRecovery();
            int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req,
                    (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        needHideProgress();
                        if (error == null) {
                            final TLRPC.TL_auth_passwordRecovery res = (TLRPC.TL_auth_passwordRecovery) response;
                            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                            builder.setMessage(LocaleController.formatString("RestoreEmailSent",
                                    R.string.RestoreEmailSent, res.email_pattern));
                            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                                    (dialogInterface, i) -> {
                                        TwoStepVerificationActivity fragment = new TwoStepVerificationActivity(
                                                currentAccount, 1);
                                        fragment.setRecoveryParams(currentPassword);
                                        currentPassword.email_unconfirmed_pattern = res.email_pattern;
                                        presentFragment(fragment);
                                    });
                            Dialog dialog = showDialog(builder.create());
                            if (dialog != null) {
                                dialog.setCanceledOnTouchOutside(false);
                                dialog.setCancelable(false);
                            }
                        } else {
                            if (error.text.startsWith("FLOOD_WAIT")) {
                                int time = Utilities.parseInt(error.text);
                                String timeString;
                                if (time < 60) {
                                    timeString = LocaleController.formatPluralString("Seconds", time);
                                } else {
                                    timeString = LocaleController.formatPluralString("Minutes", time / 60);
                                }
                                showAlertWithText(LocaleController.getString("AppName", R.string.AppName),
                                        LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime,
                                                timeString));
                            } else {
                                showAlertWithText(LocaleController.getString("AppName", R.string.AppName),
                                        error.text);
                            }
                        }
                    }), ConnectionsManager.RequestFlagFailOnServerErrors
                            | ConnectionsManager.RequestFlagWithoutLogin);
            ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
        } else {
            if (getParentActivity() == null) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            builder.setNegativeButton(
                    LocaleController.getString("RestorePasswordResetAccount",
                            R.string.RestorePasswordResetAccount),
                    (dialog, which) -> Browser.openUrl(getParentActivity(),
                            "https://telegram.org/deactivate?phone="
                                    + UserConfig.getInstance(currentAccount).getClientPhone()));
            builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle",
                    R.string.RestorePasswordNoEmailTitle));
            builder.setMessage(LocaleController.getString("RestorePasswordNoEmailText",
                    R.string.RestorePasswordNoEmailText));
            showDialog(builder.create());
        }
    });

    updatePasswordInterface();
}

From source file:com.zoffcc.applications.zanavi.Navit.java

@SuppressLint("NewApi")
@Override/*  w w  w .ja  v  a 2  s  . c  o m*/
public void onResume() {
    // if (Navit.METHOD_DEBUG) Navit.my_func_name(0);

    // System.gc();
    super.onResume();

    //      // --- alive timestamp ---
    //      app_status_lastalive = System.currentTimeMillis();
    //      System.out.println("app_status_string set:[onResume]:app_status_lastalive=" + app_status_lastalive);
    //      PreferenceManager.getDefaultSharedPreferences(this).edit().putLong(PREF_KEY_LASTALIVE, app_status_lastalive).commit();
    //      // --- alive timestamp ---

    // hide main progress bar ------------
    if (Navit.progressbar_main_activity.getVisibility() == View.VISIBLE) {
        Navit.progressbar_main_activity.setProgress(0);
        Navit.progressbar_main_activity.setVisibility(View.GONE);
    }
    // hide main progress bar ------------

    try {
        sensorManager.registerListener(lightSensorEventListener, lightSensor, (int) (8 * 1000000)); // updates approx. every 8 seconds
    } catch (Exception e) {
    }

    // get the intent fresh !! ----------
    startup_intent = this.getIntent();
    // get the intent fresh !! ----------

    // ------------- get all the flags for intro pages -------------
    // ------------- get all the flags for intro pages -------------
    // ------------- get all the flags for intro pages -------------
    try {
        intro_flag_nomaps = false;
        if (!have_maps_installed()) {
            if ((!NavitMapDownloader.download_active) && (!NavitMapDownloader.download_active_start)) {
                intro_flag_nomaps = true;
            }
        }
    } catch (Exception e) {
    }

    try {
        intro_flag_indexmissing = false;
        allow_use_index_search();
        if (Navit_index_on_but_no_idx_files) {
            if (!NavitMapDownloader.download_active_start) {
                intro_flag_indexmissing = true;
            }
        }

    } catch (Exception e) {
    }

    intro_flag_firststart = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREF_KEY_FIRST_START,
            true);
    if (intro_flag_firststart) {
        intro_flag_update = false;
    }

    if (EasyPermissions.hasPermissions(this, perms)) {
        // have permissions!
        intro_flag_permissions = false;
    } else {
        // ask for permissions
        intro_flag_permissions = true;
    }

    // only show in onCreate() ------
    //      if (intro_show_count > 0)
    //      {
    //         intro_flag_info = false;
    //         intro_flag_firststart = false;
    //         intro_flag_update = false;
    //      }
    // only show in onCreate() ------

    // ------------- get all the flags for intro pages -------------
    // ------------- get all the flags for intro pages -------------
    // ------------- get all the flags for intro pages -------------

    // -------------- INTRO --------------
    // -------------- INTRO --------------
    // -------------- INTRO --------------
    if (Navit.CIDEBUG == 0) // -MAT-INTRO-
    {
        //         intro_flag_nomaps = true;
        //         intro_flag_info = true;
        //         intro_flag_firststart = false;
        //         intro_flag_update = false;
        //         intro_flag_indexmissing = false;
        //        intro_flag_crash = true;

        if (intro_flag_crash || intro_flag_firststart || intro_flag_indexmissing || intro_flag_info
                || intro_flag_nomaps || intro_flag_permissions || intro_flag_update) {

            System.out.println("flags=" + "intro_flag_crash:" + intro_flag_crash + " intro_flag_firststart:"
                    + intro_flag_firststart + " intro_flag_indexmissing:" + intro_flag_indexmissing
                    + " intro_flag_info:" + intro_flag_info + " intro_flag_nomaps:" + intro_flag_nomaps
                    + " intro_flag_permissions:" + intro_flag_permissions + " intro_flag_update:"
                    + intro_flag_update);

            // intro pages
            System.out.println("ZANaviMainIntroActivity:" + "start count=" + intro_show_count);
            intro_show_count++;
            Intent intent = new Intent(this, ZANaviMainIntroActivityStatic.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivityForResult(intent, ZANaviIntro_id);
        }
    }
    //      // -------------- INTRO --------------
    //      // -------------- INTRO --------------
    //      // -------------- INTRO --------------

    PackageInfo pkgInfo;
    Navit_Plugin_001_Installed = false;
    try {
        // is the donate version installed?
        pkgInfo = getPackageManager().getPackageInfo("com.zoffcc.applications.zanavi_msg", 0);
        String sharedUserId = pkgInfo.sharedUserId;
        System.out.println("str nd=" + sharedUserId);
        if (sharedUserId.equals("com.zoffcc.applications.zanavi")) {
            System.out.println("##plugin 001##");
            Navit_Plugin_001_Installed = true;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    // ---- Intent dump ----
    // ---- Intent dump ----
    // ---- Intent dump ----
    // ---- Intent dump ----

    try {
        System.out.println("XXIIXX:111");
        String mid_str = this.getIntent().getExtras().getString("com.zoffcc.applications.zanavi.mid");
        System.out.println("XXIIXX:111a:mid_str=" + mid_str);

        if (mid_str != null) {
            if (mid_str.equals("201:UPDATE-APP")) {
                // a new ZANavi version is available, show something to the user here -------------------
                // a new ZANavi version is available, show something to the user here -------------------
                // a new ZANavi version is available, show something to the user here -------------------
                // a new ZANavi version is available, show something to the user here -------------------
                // a new ZANavi version is available, show something to the user here -------------------
                // a new ZANavi version is available, show something to the user here -------------------
            } else if (mid_str.startsWith("202:UPDATE-MAP:")) {
                System.out.println("need to update1:" + mid_str);
                System.out.println("need to update2:" + mid_str.substring(15));

                auto_start_update_map(mid_str.substring(15));
            }
        }

        System.out.println("XXIIXX:111b:mid_str=" + mid_str);
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("XXIIXX:111:EEEE");
    }

    try {
        System.out.println("XXIIXX:" + this.getIntent());
        Bundle bundle77 = this.getIntent().getExtras();
        System.out.println("XXIIXX:" + intent_flags_to_string(this.getIntent().getFlags()));
        if (bundle77 == null) {
            System.out.println("XXIIXX:" + "null");
        } else {
            for (String key : bundle77.keySet()) {
                Object value = bundle77.get(key);
                System.out.println("XXIIXX:"
                        + String.format("%s %s (%s)", key, value.toString(), value.getClass().getName()));
            }
        }
    } catch (Exception ee22) {
        String exst = Log.getStackTraceString(ee22);
        System.out.println("XXIIXX:ERR:" + exst);
    }
    // ---- Intent dump ----
    // ---- Intent dump ----
    // ---- Intent dump ----
    // ---- Intent dump ----

    is_paused = false;

    Navit_doubleBackToExitPressedOnce = false;

    app_window = getWindow();

    Log.e("Navit", "OnResume");

    while (Global_Init_Finished == 0) {
        Log.e("Navit", "OnResume:Global_Init_Finished==0 !!!!!");
        try {
            Thread.sleep(30, 0); // sleep
        } catch (InterruptedException e) {
        }
    }

    //InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    cwthr.NavitActivity2(1);

    try {
        NSp.resume_me();
    } catch (Exception e) {
        e.printStackTrace();
    }

    NavitVehicle.turn_on_sat_status();

    try {
        if (wl != null) {
            //            try
            //            {
            //               wl.release();
            //            }
            //            catch (Exception e2)
            //            {
            //            }
            wl.acquire();
            Log.e("Navit", "WakeLock: acquire 2");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    //Intent caller = this.getIntent();
    //System.out.println("A=" + caller.getAction() + " D=" + caller.getDataString());
    //System.out.println("C=" + caller.getComponent().flattenToString());

    if (unsupported) {
        class CustomListener implements View.OnClickListener {
            private final Dialog dialog;

            public CustomListener(Dialog dialog) {
                this.dialog = dialog;
            }

            @Override
            public void onClick(View v) {

                // Do whatever you want here

                // If you want to close the dialog, uncomment the line below
                //dialog.dismiss();
            }
        }

        AlertDialog.Builder dialog = new AlertDialog.Builder(this);
        dialog.setTitle("WeltBild Tablet");
        dialog.setCancelable(false);
        dialog.setMessage("Your device is not supported!");
        dialog.show();
        //Button theButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
        //theButton.setOnClickListener(new CustomListener(dialog));
    }

    // reset "maps too old" flag
    Navit_maps_too_old = false;

    if (Navit_maps_loaded == false) {
        Navit_maps_loaded = true;
        // activate all maps
        Log.e("Navit", "**** LOAD ALL MAPS **** start");
        Message msg3 = new Message();
        Bundle b3 = new Bundle();
        b3.putInt("Callback", 20);
        msg3.setData(b3);
        NavitGraphics.callback_handler.sendMessage(msg3);
        Log.e("Navit", "**** LOAD ALL MAPS **** end");
    }

    try {
        NavitGraphics.no_maps_container.setVisibility(View.INVISIBLE);

        //         if (!have_maps_installed())
        //         {
        //            // System.out.println("MMMM=no maps installed");
        //            // show semi transparent box "no maps installed" ------------------
        //            // show semi transparent box "no maps installed" ------------------
        //            NavitGraphics.no_maps_container.setVisibility(View.VISIBLE);
        //            try
        //            {
        //               NavitGraphics.no_maps_container.setActivated(true);
        //            }
        //            catch (NoSuchMethodError e)
        //            {
        //            }
        //
        //            show_case_001();
        //
        //            // show semi transparent box "no maps installed" ------------------
        //            // show semi transparent box "no maps installed" ------------------
        //         }
        //         else
        //         {
        //            NavitGraphics.no_maps_container.setVisibility(View.INVISIBLE);
        //            try
        //            {
        //               NavitGraphics.no_maps_container.setActivated(false);
        //            }
        //            catch (NoSuchMethodError e)
        //            {
        //            }
        //         }
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        // draw map no-async
        Message msg = new Message();
        Bundle b = new Bundle();
        b.putInt("Callback", 64);
        msg.setData(b);
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
        e.printStackTrace();
    }

    String intent_data = null;
    try {
        //Log.e("Navit", "**9**A " + startup_intent.getAction());
        //Log.e("Navit", "**9**D " + startup_intent.getDataString());

        int type = 1; // default = assume it's a map coords intent

        try {
            String si = startup_intent.getDataString();
            String tmp2 = si.split(":", 2)[0];
            Log.e("Navit", "**9a**A " + startup_intent.getAction());
            Log.e("Navit", "**9a**D " + startup_intent.getDataString() + " " + tmp2);
            if (tmp2.equals("file")) {
                Log.e("Navit", "**9b**D " + startup_intent.getDataString() + " " + tmp2);
                if (si.toLowerCase().endsWith(".gpx")) {
                    Log.e("Navit", "**9c**D " + startup_intent.getDataString() + " " + tmp2);
                    type = 4;
                }
            }
        } catch (Exception e2) {
        }

        if (type != 4) {
            Bundle extras = startup_intent.getExtras();
            // System.out.println("DH:001");
            if (extras != null) {
                // System.out.println("DH:002");
                long l = extras.getLong("com.zoffcc.applications.zanavi.ZANAVI_INTENT_type");
                // System.out.println("DH:003 l=" + l);
                if (l != 0L) {
                    // System.out.println("DH:004");
                    if (l == Navit.NAVIT_START_INTENT_DRIVE_HOME) {
                        // System.out.println("DH:005");
                        type = 2; // call from drive-home-widget
                    }
                    // ok, now remove that key
                    extras.remove("com.zoffcc.applications.zanavi");
                    startup_intent.replaceExtras((Bundle) null);
                    // System.out.println("DH:006");
                }
            }
        }

        // ------------------------  BIG LOOP  ------------------------
        // ------------------------  BIG LOOP  ------------------------
        if (type == 2) {
            // drive home

            // check if we have a home location
            int home_id = find_home_point();

            if (home_id != -1) {
                Message msg7 = progress_handler.obtainMessage();
                Bundle b7 = new Bundle();
                msg7.what = 2; // long Toast message
                b7.putString("text", Navit.get_text("driving to Home Location")); //TRANS
                msg7.setData(b7);
                progress_handler.sendMessage(msg7);

                // clear any previous destinations
                Message msg2 = new Message();
                Bundle b2 = new Bundle();
                b2.putInt("Callback", 7);
                msg2.setData(b2);
                NavitGraphics.callback_handler.sendMessage(msg2);

                // set position to middle of screen -----------------------
                // set position to middle of screen -----------------------
                // set position to middle of screen -----------------------
                //               Message msg67 = new Message();
                //               Bundle b67 = new Bundle();
                //               b67.putInt("Callback", 51);
                //               b67.putInt("x", (int) (NavitGraphics.Global_dpi_factor * Navit.NG__map_main.view.getWidth() / 2));
                //               b67.putInt("y", (int) (NavitGraphics.Global_dpi_factor * Navit.NG__map_main.view.getHeight() / 2));
                //               msg67.setData(b67);
                //               N_NavitGraphics.callback_handler.sendMessage(msg67);
                // set position to middle of screen -----------------------
                // set position to middle of screen -----------------------
                // set position to middle of screen -----------------------

                try {
                    Thread.sleep(60);
                } catch (Exception e) {
                }

                Navit.destination_set();

                // set destination to home location
                //               String lat = String.valueOf(map_points.get(home_id).lat);
                //               String lon = String.valueOf(map_points.get(home_id).lon);
                //               String q = map_points.get(home_id).point_name;
                route_wrapper(map_points.get(home_id).point_name, 0, 0, false, map_points.get(home_id).lat,
                        map_points.get(home_id).lon, true);

                final Thread zoom_to_route_001 = new Thread() {
                    int wait = 1;
                    int count = 0;
                    int max_count = 60;

                    @Override
                    public void run() {
                        while (wait == 1) {
                            try {
                                if ((NavitGraphics.navit_route_status == 17)
                                        || (NavitGraphics.navit_route_status == 33)) {
                                    zoom_to_route();
                                    wait = 0;
                                } else {
                                    wait = 1;
                                }

                                count++;
                                if (count > max_count) {
                                    wait = 0;
                                } else {
                                    Thread.sleep(400);
                                }
                            } catch (Exception e) {
                            }
                        }
                    }
                };
                zoom_to_route_001.start();

                //               try
                //               {
                //                  show_geo_on_screen(Float.parseFloat(lat), Float.parseFloat(lon));
                //               }
                //               catch (Exception e2)
                //               {
                //                  e2.printStackTrace();
                //               }

                try {
                    Navit.follow_button_on();
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            } else {
                // no home location set
                Message msg = progress_handler.obtainMessage();
                Bundle b = new Bundle();
                msg.what = 2; // long Toast message
                b.putString("text", Navit.get_text("No Home Location set")); //TRANS
                msg.setData(b);
                progress_handler.sendMessage(msg);
            }
        } else if (type == 4) {

            if (startup_intent != null) {
                // Log.e("Navit", "**7**A " + startup_intent.getAction() + System.currentTimeMillis() + " " + Navit.startup_intent_timestamp);
                if (System.currentTimeMillis() <= Navit.startup_intent_timestamp + 4000L) {
                    Log.e("Navit", "**7**A " + startup_intent.getAction());
                    Log.e("Navit", "**7**D " + startup_intent.getDataString());
                    intent_data = startup_intent.getDataString();
                    try {
                        intent_data = java.net.URLDecoder.decode(intent_data, "UTF-8");
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                    // we consumed the intent, so reset timestamp value to avoid double consuming of event
                    Navit.startup_intent_timestamp = 0L;

                    if (intent_data != null) {
                        // file:///mnt/sdcard/zanavi_pos_recording_347834278.gpx
                        String tmp1;
                        tmp1 = intent_data.split(":", 2)[1].substring(2);

                        Log.e("Navit", "**7**f=" + tmp1);

                        // convert gpx file ---------------------
                        convert_gpx_file_real(tmp1);
                    }
                }
            }
        } else if (type == 1) {
            if (startup_intent != null) {
                if (System.currentTimeMillis() <= Navit.startup_intent_timestamp + 4000L) {
                    Log.e("Navit", "**2**A " + startup_intent.getAction());
                    Log.e("Navit", "**2**D " + startup_intent.getDataString());
                    intent_data = startup_intent.getDataString();
                    // we consumed the intent, so reset timestamp value to avoid double consuming of event
                    Navit.startup_intent_timestamp = 0L;

                    if (intent_data != null) {
                        // set position to middle of screen -----------------------
                        // set position to middle of screen -----------------------
                        // set position to middle of screen -----------------------
                        //                     Message msg67 = new Message();
                        //                     Bundle b67 = new Bundle();
                        //                     b67.putInt("Callback", 51);
                        //                     b67.putInt("x", (int) (NavitGraphics.Global_dpi_factor * Navit.NG__map_main.view.getWidth() / 2));
                        //                     b67.putInt("y", (int) (NavitGraphics.Global_dpi_factor * Navit.NG__map_main.view.getHeight() / 2));
                        //                     msg67.setData(b67);
                        //                     N_NavitGraphics.callback_handler.sendMessage(msg67);
                        // set position to middle of screen -----------------------
                        // set position to middle of screen -----------------------
                        // set position to middle of screen -----------------------
                    }
                } else {
                    Log.e("Navit", "timestamp for navigate_to expired! not using data");
                }
            }

            System.out.println("SUI:000a " + intent_data);

            if ((intent_data != null) && ((substring_without_ioobe(intent_data, 0, 18)
                    .equals("google.navigation:"))
                    || (substring_without_ioobe(intent_data, 0, 23).equals("http://maps.google.com/"))
                    || (substring_without_ioobe(intent_data, 0, 24).equals("https://maps.google.com/")))) {

                System.out.println("SUI:000b");

                // better use regex later, but for now to test this feature its ok :-)
                // better use regex later, but for now to test this feature its ok :-)

                // g: google.navigation:///?ll=49.4086,17.4855&entry=w&opt=
                // d: google.navigation:q=blabla-strasse # (this happens when you are offline, or from contacts)
                // b: google.navigation:q=48.25676,16.643
                // a: google.navigation:ll=48.25676,16.643&q=blabla-strasse
                // e: google.navigation:ll=48.25676,16.643&title=blabla-strasse
                //    sample: -> google.navigation:ll=48.026096,16.023993&title=N%C3%B6stach+43%2C+2571+N%C3%B6stach&entry=w
                //            -> google.navigation:ll=48.014413,16.005579&title=Hainfelder+Stra%C3%9Fe+44%2C+2571%2C+Austria&entry=w
                // f: google.navigation:ll=48.25676,16.643&...
                // c: google.navigation:ll=48.25676,16.643
                // h: http://maps.google.com/?q=48.222210,16.387058&z=16
                // i: https://maps.google.com/?q=48.222210,16.387058&z=16
                // i:,h: https://maps.google.com/maps/place?ftid=0x476d07075e933fc5:0xccbeba7fe1e3dd36&q=48.222210,16.387058&ui=maps_mini
                //
                // ??!!new??!!: http://maps.google.com/?cid=10549738100504591748&hl=en&gl=gb

                String lat;
                String lon;
                String q;

                String temp1 = null;
                String temp2 = null;
                String temp3 = null;
                boolean parsable = false;
                boolean unparsable_info_box = true;
                try {
                    intent_data = java.net.URLDecoder.decode(intent_data, "UTF-8");
                } catch (Exception e1) {
                    e1.printStackTrace();
                }

                // DEBUG
                // DEBUG
                // DEBUG
                // intent_data = "google.navigation:q=Wien Burggasse 27";
                // intent_data = "google.navigation:q=48.25676,16.643";
                // intent_data = "google.navigation:ll=48.25676,16.643&q=blabla-strasse";
                // intent_data = "google.navigation:ll=48.25676,16.643";
                // DEBUG
                // DEBUG
                // DEBUG

                try {
                    Log.e("Navit", "found DEBUG 1: " + intent_data.substring(0, 20));
                    Log.e("Navit", "found DEBUG 2: " + intent_data.substring(20, 22));
                    Log.e("Navit", "found DEBUG 3: " + intent_data.substring(20, 21));
                    Log.e("Navit", "found DEBUG 4: " + intent_data.split("&").length);
                    Log.e("Navit", "found DEBUG 4.1: yy"
                            + intent_data.split("&")[1].substring(0, 1).toLowerCase() + "yy");
                    Log.e("Navit", "found DEBUG 5: xx" + intent_data.split("&")[1] + "xx");
                } catch (Exception e) {
                    e.printStackTrace();
                }

                if (!Navit.NavitStartupAlreadySearching) {
                    if (intent_data.length() > 19) {
                        // if h: then show target
                        if (substring_without_ioobe(intent_data, 0, 23).equals("http://maps.google.com/")) {
                            Uri uri = Uri.parse(intent_data);
                            Log.e("Navit", "target found (h): " + uri.getQueryParameter("q"));
                            parsable = true;
                            intent_data = "google.navigation:ll=" + uri.getQueryParameter("q") + "&q=Target";
                        }
                        // if i: then show target
                        else if (substring_without_ioobe(intent_data, 0, 24)
                                .equals("https://maps.google.com/")) {
                            Uri uri = Uri.parse(intent_data);
                            Log.e("Navit", "target found (i): " + uri.getQueryParameter("q"));
                            parsable = true;
                            intent_data = "google.navigation:ll=" + uri.getQueryParameter("q") + "&q=Target";
                        }
                        // if d: then start target search
                        else if ((substring_without_ioobe(intent_data, 0, 20).equals("google.navigation:q="))
                                && ((!substring_without_ioobe(intent_data, 20, 21).equals('+'))
                                        && (!substring_without_ioobe(intent_data, 20, 21).equals('-'))
                                        && (!substring_without_ioobe(intent_data, 20, 22)
                                                .matches("[0-9][0-9]")))) {
                            Log.e("Navit", "target found (d): " + intent_data.split("q=", -1)[1]);
                            Navit.NavitStartupAlreadySearching = true;
                            start_targetsearch_from_intent(intent_data.split("q=", -1)[1]);
                            // dont use this here, already starting search, so set to "false"
                            parsable = false;
                            unparsable_info_box = false;
                        }
                        // if b: then remodel the input string to look like a:
                        else if (substring_without_ioobe(intent_data, 0, 20).equals("google.navigation:q=")) {
                            intent_data = "ll=" + intent_data.split("q=", -1)[1] + "&q=Target";
                            Log.e("Navit", "target found (b): " + intent_data);
                            parsable = true;
                        }
                        // if g: [google.navigation:///?ll=49.4086,17.4855&...] then remodel the input string to look like a:
                        else if (substring_without_ioobe(intent_data, 0, 25)
                                .equals("google.navigation:///?ll=")) {
                            intent_data = "google.navigation:ll="
                                    + intent_data.split("ll=", -1)[1].split("&", -1)[0] + "&q=Target";
                            Log.e("Navit", "target found (g): " + intent_data);
                            parsable = true;
                        }
                        // if e: then remodel the input string to look like a:
                        else if ((substring_without_ioobe(intent_data, 0, 21).equals("google.navigation:ll="))
                                && (intent_data.split("&").length > 1)
                                && (substring_without_ioobe(intent_data.split("&")[1], 0, 1).toLowerCase()
                                        .equals("f"))) {
                            int idx = intent_data.indexOf("&");
                            intent_data = substring_without_ioobe(intent_data, 0, idx) + "&q=Target";
                            Log.e("Navit", "target found (e): " + intent_data);
                            parsable = true;
                        }
                        // if f: then remodel the input string to look like a:
                        else if ((substring_without_ioobe(intent_data, 0, 21).equals("google.navigation:ll="))
                                && (intent_data.split("&").length > 1)) {
                            int idx = intent_data.indexOf("&");
                            intent_data = intent_data.substring(0, idx) + "&q=Target";
                            Log.e("Navit", "target found (f): " + intent_data);
                            parsable = true;
                        }
                        // already looks like a: just set flag
                        else if ((substring_without_ioobe(intent_data, 0, 21).equals("google.navigation:ll="))
                                && (intent_data.split("&q=").length > 1)) {
                            // dummy, just set the flag
                            Log.e("Navit", "target found (a): " + intent_data);
                            Log.e("Navit", "target found (a): " + intent_data.split("&q=").length);
                            parsable = true;
                        }
                        // if c: then remodel the input string to look like a:
                        else if ((substring_without_ioobe(intent_data, 0, 21).equals("google.navigation:ll="))
                                && (intent_data.split("&q=").length < 2)) {

                            intent_data = intent_data + "&q=Target";
                            Log.e("Navit", "target found (c): " + intent_data);
                            parsable = true;
                        }
                    }
                } else {
                    Log.e("Navit", "already started search from startup intent");
                    parsable = false;
                    unparsable_info_box = false;
                }

                if (parsable) {
                    // now string should be in form --> a:
                    // now split the parts off
                    temp1 = intent_data.split("&q=", -1)[0];
                    try {
                        temp3 = temp1.split("ll=", -1)[1];
                        temp2 = intent_data.split("&q=", -1)[1];
                    } catch (Exception e) {
                        // java.lang.ArrayIndexOutOfBoundsException most likely
                        // so let's assume we dont have '&q=xxxx'
                        temp3 = temp1;
                    }

                    if (temp2 == null) {
                        // use some default name
                        temp2 = "Target";
                    }

                    lat = temp3.split(",", -1)[0];
                    lon = temp3.split(",", -1)[1];
                    q = temp2;
                    // is the "search name" url-encoded? i think so, lets url-decode it here
                    q = URLDecoder.decode(q);
                    // System.out.println();

                    Navit.remember_destination(q, lat, lon);
                    Navit.destination_set();

                    Message msg = new Message();
                    Bundle b = new Bundle();
                    b.putInt("Callback", 3);
                    b.putString("lat", lat);
                    b.putString("lon", lon);
                    b.putString("q", q);
                    msg.setData(b);
                    NavitGraphics.callback_handler.sendMessage(msg);

                    final Thread zoom_to_route_002 = new Thread() {
                        int wait = 1;
                        int count = 0;
                        int max_count = 60;

                        @Override
                        public void run() {
                            while (wait == 1) {
                                try {
                                    if ((NavitGraphics.navit_route_status == 17)
                                            || (NavitGraphics.navit_route_status == 33)) {
                                        zoom_to_route();
                                        wait = 0;
                                    } else {
                                        wait = 1;
                                    }

                                    count++;
                                    if (count > max_count) {
                                        wait = 0;
                                    } else {
                                        Thread.sleep(400);
                                    }
                                } catch (Exception e) {
                                }
                            }
                        }
                    };
                    zoom_to_route_002.start();

                    //                  try
                    //                  {
                    //                     Thread.sleep(400);
                    //                  }
                    //                  catch (InterruptedException e)
                    //                  {
                    //                  }
                    //
                    //                  //                  try
                    //                  //                  {
                    //                  //                     show_geo_on_screen(Float.parseFloat(lat), Float.parseFloat(lon));
                    //                  //                  }
                    //                  //                  catch (Exception e2)
                    //                  //                  {
                    //                  //                     e2.printStackTrace();
                    //                  //                  }

                    try {
                        Navit.follow_button_on();
                    } catch (Exception e2)

                    {
                        e2.printStackTrace();
                    }
                } else {
                    if (unparsable_info_box && !searchBoxShown) {
                        try {
                            searchBoxShown = true;
                            String searchString = intent_data.split("q=")[1];
                            searchString = searchString.split("&")[0];
                            searchString = URLDecoder.decode(searchString); // decode the URL: e.g. %20 -> space
                            Log.e("Navit", "Search String :" + searchString);
                            executeSearch(searchString);
                        } catch (Exception e) {
                            // safety net
                            try {
                                Log.e("Navit", "problem with startup search 7 str=" + intent_data);
                            } catch (Exception e2) {
                                e2.printStackTrace();
                            }
                        }
                    }
                }
            } else if ((intent_data != null)
                    && (substring_without_ioobe(intent_data, 0, 10).equals("geo:0,0?q="))) {
                // g: geo:0,0?q=wien%20burggasse

                System.out.println("SUI:001");

                boolean parsable = false;
                boolean unparsable_info_box = true;
                try {
                    intent_data = java.net.URLDecoder.decode(intent_data, "UTF-8");
                } catch (Exception e1) {
                    e1.printStackTrace();

                }

                System.out.println("SUI:002");

                if (!Navit.NavitStartupAlreadySearching) {
                    if (intent_data.length() > 10) {
                        // if g: then start target search
                        Log.e("Navit", "target found (g): " + intent_data.split("q=", -1)[1]);
                        Navit.NavitStartupAlreadySearching = true;
                        start_targetsearch_from_intent(intent_data.split("q=", -1)[1]);
                        // dont use this here, already starting search, so set to "false"
                        parsable = false;
                        unparsable_info_box = false;
                    }
                } else {
                    Log.e("Navit", "already started search from startup intent");
                    parsable = false;
                    unparsable_info_box = false;
                }

                if (unparsable_info_box && !searchBoxShown) {
                    try {
                        searchBoxShown = true;
                        String searchString = intent_data.split("q=")[1];
                        searchString = searchString.split("&")[0];
                        searchString = URLDecoder.decode(searchString); // decode the URL: e.g. %20 -> space
                        Log.e("Navit", "Search String :" + searchString);
                        executeSearch(searchString);
                    } catch (Exception e) {
                        // safety net
                        try {
                            Log.e("Navit", "problem with startup search 88 str=" + intent_data);
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }

            } else if ((intent_data != null) && (substring_without_ioobe(intent_data, 0, 4).equals("geo:"))) {
                // g: geo:16.8,46.3?z=15

                System.out.println("SUI:002a");

                boolean parsable = false;
                boolean unparsable_info_box = true;

                String tmp1;
                String tmp2;
                String tmp3;
                float lat1 = 0;
                float lon1 = 0;
                int zoom1 = 15;

                try {
                    intent_data = java.net.URLDecoder.decode(intent_data, "UTF-8");
                } catch (Exception e1) {
                    e1.printStackTrace();
                }

                if (!Navit.NavitStartupAlreadySearching) {
                    try {
                        tmp1 = intent_data.split(":", 2)[1];
                        tmp2 = tmp1.split("\\?", 2)[0];
                        tmp3 = tmp1.split("\\?", 2)[1];
                        lat1 = Float.parseFloat(tmp2.split(",", 2)[0]);
                        lon1 = Float.parseFloat(tmp2.split(",", 2)[1]);
                        zoom1 = Integer.parseInt(tmp3.split("z=", 2)[1]);
                        parsable = true;
                    } catch (Exception e4) {
                        e4.printStackTrace();
                    }
                }

                if (parsable) {
                    // geo: intent -> only show destination on map!

                    // set nice zoomlevel before we show destination
                    //                  int zoom_want = zoom1;
                    //                  //
                    //                  Message msg = new Message();
                    //                  Bundle b = new Bundle();
                    //                  b.putInt("Callback", 33);
                    //                  b.putString("s", Integer.toString(zoom_want));
                    //                  msg.setData(b);
                    //                  try
                    //                  {
                    //                     N_NavitGraphics.callback_handler.sendMessage(msg);
                    //                     Navit.GlobalScaleLevel = Navit_SHOW_DEST_ON_MAP_ZOOMLEVEL;
                    //                     if ((zoom_want > 8) && (zoom_want < 17))
                    //                     {
                    //                        Navit.GlobalScaleLevel = (int) (Math.pow(2, (18 - zoom_want)));
                    //                        System.out.println("GlobalScaleLevel=" + Navit.GlobalScaleLevel);
                    //                     }
                    //                  }
                    //                  catch (Exception e)
                    //                  {
                    //                     e.printStackTrace();
                    //                  }
                    //                  if (PREF_save_zoomlevel)
                    //                  {
                    //                     setPrefs_zoomlevel();
                    //                  }
                    // set nice zoomlevel before we show destination

                    try {
                        Navit.follow_button_off();
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }

                    show_geo_on_screen(lat1, lon1);
                    //                  final Thread zoom_to_route_003 = new Thread()
                    //                  {
                    //                     @Override
                    //                     public void run()
                    //                     {
                    //                        try
                    //                        {
                    //                           Thread.sleep(200);
                    //                           show_geo_on_screen(lat1, lon1);
                    //                        }
                    //                        catch (Exception e)
                    //                        {
                    //                        }
                    //                     }
                    //                  };
                    //                  zoom_to_route_003.start();

                }
            }
        }

        System.out.println("SUI:099 XX" + substring_without_ioobe(intent_data, 0, 10) + "XX");

        // clear intent
        startup_intent = null;
        // ------------------------  BIG LOOP  ------------------------
        // ------------------------  BIG LOOP  ------------------------
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("SUI:199");
    }

    // clear intent
    startup_intent = null;

    // hold all map drawing -----------
    Message msg = new Message();
    Bundle b = new Bundle();
    b.putInt("Callback", 69);
    msg.setData(b);
    try {
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
    }
    // hold all map drawing -----------

    getPrefs();
    activatePrefs();
    sun_moon__mLastCalcSunMillis = -1L;

    push_pin_view = (ImageView) findViewById(R.id.bottom_slide_left_side);
    if (p.PREF_follow_gps) {
        push_pin_view.setImageResource(R.drawable.pin1_down);
    } else {
        push_pin_view.setImageResource(R.drawable.pin1_up);
    }

    // paint for bitmapdrawing on map
    if (p.PREF_use_anti_aliasing) {
        NavitGraphics.paint_for_map_display.setAntiAlias(true);
    } else {
        NavitGraphics.paint_for_map_display.setAntiAlias(false);
    }
    if (p.PREF_use_map_filtering) {
        NavitGraphics.paint_for_map_display.setFilterBitmap(true);
    } else {
        NavitGraphics.paint_for_map_display.setFilterBitmap(false);
    }

    // activate gps AFTER 3g-location
    NavitVehicle.turn_on_precise_provider();

    // allow all map drawing -----------
    msg = new Message();
    b = new Bundle();
    b.putInt("Callback", 70);
    msg.setData(b);
    try {
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
    }
    // allow all map drawing -----------

    // --- disabled --- NavitVehicle.set_last_known_pos_fast_provider();

    try {
        //Simulate = new SimGPS(NavitVehicle.vehicle_handler_);
        //Simulate.start();
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        watchmem = new WatchMem();
        watchmem.start();
    } catch (Exception e) {
        e.printStackTrace();
    }

    // ----- check if we have some index files downloaded -----

    if (api_version_int < 11) {
        if (Navit.have_maps_installed()) {
            if (Navit_maps_too_old) {
                TextView no_maps_text = (TextView) this.findViewById(R.id.no_maps_text);
                no_maps_text.setText("\n\n\n" + Navit.get_text("Some Maps are too old!") + "\n"
                        + Navit.get_text("Please update your maps") + "\n\n");

                try {
                    NavitGraphics.no_maps_container.setVisibility(View.VISIBLE);
                    try {
                        NavitGraphics.no_maps_container.setActivated(true);
                    } catch (NoSuchMethodError e) {
                    }
                    NavitGraphics.no_maps_container.bringToFront();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                allow_use_index_search();
                if (Navit_index_on_but_no_idx_files) {
                    TextView no_maps_text = (TextView) this.findViewById(R.id.no_maps_text);
                    no_maps_text.setText("\n\n\n" + Navit.get_text("No Index for some Maps") + "\n"
                            + Navit.get_text("Please update your maps") + "\n\n");

                    try {
                        NavitGraphics.no_maps_container.setVisibility(View.VISIBLE);
                        try {
                            NavitGraphics.no_maps_container.setActivated(true);
                        } catch (NoSuchMethodError e) {
                        }
                        NavitGraphics.no_maps_container.bringToFront();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    try {
                        NavitGraphics.no_maps_container.setVisibility(View.INVISIBLE);
                        try {
                            NavitGraphics.no_maps_container.setActivated(false);
                        } catch (NoSuchMethodError e) {
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    } else {
        try {
            NavitGraphics.no_maps_container.setVisibility(View.INVISIBLE);
            try {
                NavitGraphics.no_maps_container.setActivated(false);
            } catch (NoSuchMethodError e) {
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    // ----- check if we have some index files downloaded -----

    // ---- DEBUG ----
    // ---- DEBUG ----
    // ---- DEBUG ----
    try {
        if (!NavitVehicle.is_pos_recording) {
            if (p.PREF_enable_debug_write_gpx) {
                NavitVehicle.pos_recording_start();
                NavitVehicle.pos_recording_add(0, 0, 0, 0, 0, 0);
            }
        }
    } catch (Exception e) {
    }
    // ---- DEBUG ----
    // ---- DEBUG ----
    // ---- DEBUG ----

    // glSurfaceView.onResume();

    // if (Navit.METHOD_DEBUG) Navit.my_func_name(1);

    if (Navit.CIDEBUG == 1) {
        new Thread() {
            public void run() {
                try {
                    System.out.println("DR_run_all_yaml_tests --> want");

                    if (CIRUN == false) {
                        System.out.println("DR_run_all_yaml_tests --> do");
                        CIRUN = true;
                        Thread.sleep(20000); // 20 secs.
                        ZANaviDebugReceiver.DR_run_all_yaml_tests();
                    }
                } catch (Exception e) {
                }
            }
        }.start();
    }
}