Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

In this page you can find the example usage for android.os Bundle getSerializable.

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.esri.arcgisruntime.sample.rgbrenderer.ParametersDialogFragment.java

/**
 * Builds parameter dialog with values pulled through from MainActivity.
 *
 * @param savedInstanceState/*from w ww. j  av a2s  .  c o  m*/
 * @return create parameter dialog box
 */
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    Bundle rgbParameters = getArguments();
    if (rgbParameters != null) {
        mMinR = rgbParameters.getInt("minR");
        mMaxR = rgbParameters.getInt("maxR");
        mMinG = rgbParameters.getInt("minG");
        mMaxG = rgbParameters.getInt("maxG");
        mMinB = rgbParameters.getInt("minB");
        mMaxB = rgbParameters.getInt("maxB");
        mPercentClipMin = rgbParameters.getInt("percent_clip_min");
        mPercentClipMax = rgbParameters.getInt("percent_clip_max");
        mStdDevFactor = rgbParameters.getInt("std_dev_factor");
        mStretchType = (MainActivity.StretchType) rgbParameters.getSerializable("stretch_type");
        Log.d("Incoming Parameters", "min r: " + mMinR + " max r: " + mMaxR + " min g: " + mMinG + " max g: "
                + mMaxG + " min b: " + mMinB + " max b: " + mMaxB);
    }

    final AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext());
    @SuppressLint("InflateParams")
    final View dialogView = inflater.inflate(R.layout.rgb_dialog_box, null);
    paramDialog.setView(dialogView);
    paramDialog.setTitle(R.string.rgb_rendering_parameters);
    paramDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dismiss();
        }
    });
    paramDialog.setPositiveButton("Render", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            ParametersListener activity = (ParametersListener) getActivity();
            activity.returnParameters(mMinR, mMaxR, mMinG, mMaxG, mMinB, mMaxB, mPercentClipMin,
                    mPercentClipMax, mStdDevFactor, mStretchType);
        }
    });
    // min max ui elements
    mMinRedTextView = (TextView) dialogView.findViewById(R.id.min_red_value_text_view);
    mMaxRedTextView = (TextView) dialogView.findViewById(R.id.max_red_value_text_view);
    mMinGreenTextView = (TextView) dialogView.findViewById(R.id.min_green_value_text_view);
    mMaxGreenTextView = (TextView) dialogView.findViewById(R.id.max_green_value_text_view);
    mMinBlueTextView = (TextView) dialogView.findViewById(R.id.min_blue_value_text_view);
    mMaxBlueTextView = (TextView) dialogView.findViewById(R.id.max_blue_value_text_view);
    mMinRedSeekBar = (SeekBar) dialogView.findViewById(R.id.min_red_seek_bar);
    mMaxRedSeekBar = (SeekBar) dialogView.findViewById(R.id.max_red_seek_bar);
    mMinGreenSeekBar = (SeekBar) dialogView.findViewById(R.id.min_green_seek_bar);
    mMaxGreenSeekBar = (SeekBar) dialogView.findViewById(R.id.max_green_seek_bar);
    mMinBlueSeekBar = (SeekBar) dialogView.findViewById(R.id.min_blue_seek_bar);
    mMaxBlueSeekBar = (SeekBar) dialogView.findViewById(R.id.max_blue_seek_bar);
    mMinRedSeekBar.setMax(255);
    mMaxRedSeekBar.setMax(255);
    mMinGreenSeekBar.setMax(255);
    mMaxGreenSeekBar.setMax(255);
    mMinBlueSeekBar.setMax(255);
    mMaxBlueSeekBar.setMax(255);
    mCurrMinRedTextView = (TextView) dialogView.findViewById(R.id.curr_min_red_text_view);
    mCurrMaxRedTextView = (TextView) dialogView.findViewById(R.id.curr_max_red_text_view);
    mCurrMinGreenTextView = (TextView) dialogView.findViewById(R.id.curr_min_green_text_view);
    mCurrMaxGreenTextView = (TextView) dialogView.findViewById(R.id.curr_max_green_text_view);
    mCurrMinBlueTextView = (TextView) dialogView.findViewById(R.id.curr_min_blue_text_view);
    mCurrMaxBlueTextView = (TextView) dialogView.findViewById(R.id.curr_max_blue_text_view);
    //update seek bar positions with current mMinMax values
    updateSeekBar(mMinRedSeekBar, mMinR, mCurrMinRedTextView);
    updateSeekBar(mMaxRedSeekBar, mMaxR, mCurrMaxRedTextView);
    updateSeekBar(mMinGreenSeekBar, mMinG, mCurrMinGreenTextView);
    updateSeekBar(mMaxGreenSeekBar, mMaxG, mCurrMaxGreenTextView);
    updateSeekBar(mMinBlueSeekBar, mMinB, mCurrMinBlueTextView);
    updateSeekBar(mMaxBlueSeekBar, mMaxB, mCurrMaxBlueTextView);
    // percent clip ui elements
    mPercentClipMinTextView = (TextView) dialogView.findViewById(R.id.percent_clip_min_value_text_view);
    mPercentClipMaxTextView = (TextView) dialogView.findViewById(R.id.percent_clip_max_value_text_view);
    mPercentClipMinSeekBar = (SeekBar) dialogView.findViewById(R.id.percent_clip_min_seek_bar);
    mPercentClipMaxSeekBar = (SeekBar) dialogView.findViewById(R.id.percent_clip_max_seek_bar);
    mPercentClipMinSeekBar.setMax(99);
    mPercentClipMaxSeekBar.setMax(99);
    mCurrPercentClipMinTextView = (TextView) dialogView.findViewById(R.id.curr_percent_clip_min_text_view);
    mCurrPercentClipMaxTextView = (TextView) dialogView.findViewById(R.id.curr_percent_clip_max_text_view);
    //update seek bar positions with current PercentClip
    updateSeekBar(mPercentClipMinSeekBar, mPercentClipMin, mCurrPercentClipMinTextView);
    updateSeekBar(mPercentClipMaxSeekBar, mPercentClipMax, mCurrPercentClipMaxTextView);
    // standard deviation ui elements
    mStdDevTextView = (TextView) dialogView.findViewById(R.id.std_dev_text_view);
    mStdDevSeekBar = (SeekBar) dialogView.findViewById(R.id.std_dev_seek_bar);
    mStdDevSeekBar.setMax(3);
    mCurrStdDevTextView = (TextView) dialogView.findViewById(R.id.curr_std_dev_text_view);
    //update seek bar position with current StandardDeviation
    updateSeekBar(mStdDevSeekBar, mStdDevFactor, mCurrStdDevTextView);

    // set ui to previous selection
    if (mStretchType == MainActivity.StretchType.MIN_MAX) {
        setMinMaxVisibility(true);
        setPercentClipVisibility(false);
        setStdDevVisibility(false);
    } else if (mStretchType == MainActivity.StretchType.PERCENT_CLIP) {
        setMinMaxVisibility(false);
        setPercentClipVisibility(true);
        setStdDevVisibility(false);
    } else if (mStretchType == MainActivity.StretchType.STANDARD_DEVIATION) {
        setMinMaxVisibility(false);
        setPercentClipVisibility(false);
        setStdDevVisibility(true);
    }
    // seek bar listeners
    mMinRedSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMinR = progress;
            updateSeekBar(mMinRedSeekBar, mMinR, mCurrMinRedTextView);
            // move max to march min if max goes below min
            if (mMaxR < mMinR) {
                mMaxR = mMinR;
                updateSeekBar(mMaxRedSeekBar, mMaxR, mCurrMaxRedTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mMaxRedSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMaxR = progress;
            updateSeekBar(mMaxRedSeekBar, mMaxR, mCurrMaxRedTextView);
            // move min to match max if min goes above max
            if (mMinR > mMaxR) {
                mMinR = mMaxR;
                updateSeekBar(mMinRedSeekBar, mMinR, mCurrMinRedTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mMinGreenSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMinG = progress;
            updateSeekBar(mMinGreenSeekBar, mMinG, mCurrMinGreenTextView);
            // move max to march min if max goes below min
            if (mMaxG < mMinG) {
                mMaxG = mMinG;
                updateSeekBar(mMaxGreenSeekBar, mMaxG, mCurrMaxGreenTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mMaxGreenSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMaxG = progress;
            updateSeekBar(mMaxGreenSeekBar, mMaxG, mCurrMaxGreenTextView);
            // move min to match max if min goes above max
            if (mMinG > mMaxG) {
                mMinG = mMaxG;
                updateSeekBar(mMinGreenSeekBar, mMinG, mCurrMinGreenTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mMinBlueSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMinB = progress;
            updateSeekBar(mMinBlueSeekBar, mMinB, mCurrMinBlueTextView);
            // move max to march min if max goes below min
            if (mMaxB < mMinB) {
                mMaxB = mMinB;
                updateSeekBar(mMaxBlueSeekBar, mMaxB, mCurrMaxBlueTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mMaxBlueSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mMaxB = progress;
            updateSeekBar(mMaxBlueSeekBar, mMaxB, mCurrMaxBlueTextView);
            // move min to match max if min goes above max
            if (mMinB > mMaxB) {
                mMinB = mMaxB;
                updateSeekBar(mMinBlueSeekBar, mMinB, mCurrMinBlueTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    mPercentClipMinSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mPercentClipMin = progress;
            updateSeekBar(mPercentClipMinSeekBar, mPercentClipMin, mCurrPercentClipMinTextView);
            if (mPercentClipMin + mPercentClipMax > 100) {
                // constrain min + max <= 100
                mPercentClipMax = 100 - mPercentClipMin;
                updateSeekBar(mPercentClipMaxSeekBar, mPercentClipMax, mCurrPercentClipMaxTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    mPercentClipMaxSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mPercentClipMax = progress;
            updateSeekBar(mPercentClipMaxSeekBar, mPercentClipMax, mCurrPercentClipMaxTextView);
            if (mPercentClipMin + mPercentClipMax > 100) {
                // constrain min + max <= 100
                mPercentClipMin = 100 - mPercentClipMax;
                updateSeekBar(mPercentClipMinSeekBar, mPercentClipMin, mCurrPercentClipMinTextView);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mStdDevSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mStdDevFactor = progress;
            updateSeekBar(mStdDevSeekBar, mStdDevFactor, mCurrStdDevTextView);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    // stretch type spinner
    List<String> stretchTypeArray = new ArrayList<>();
    stretchTypeArray.add(MainActivity.StretchType.MIN_MAX.toString()); //ordinals:0
    stretchTypeArray.add(MainActivity.StretchType.PERCENT_CLIP.toString()); //1
    stretchTypeArray.add(MainActivity.StretchType.STANDARD_DEVIATION.toString()); //2
    ArrayAdapter<String> stretchTypeSpinnerAdapter = new ArrayAdapter<>(getContext(),
            R.layout.rgb_spinner_text_view, stretchTypeArray);
    Spinner stretchTypeSpinner = (Spinner) dialogView.findViewById(R.id.stretch_type_spinner);
    stretchTypeSpinner.setAdapter(stretchTypeSpinnerAdapter);
    stretchTypeSpinner.setSelection(mStretchType.ordinal());
    stretchTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                mStretchType = MainActivity.StretchType.MIN_MAX;
                setMinMaxVisibility(true);
                setPercentClipVisibility(false);
                setStdDevVisibility(false);
                break;
            case 1:
                mStretchType = MainActivity.StretchType.PERCENT_CLIP;
                setMinMaxVisibility(false);
                setPercentClipVisibility(true);
                setStdDevVisibility(false);
                break;
            case 2:
                mStretchType = MainActivity.StretchType.STANDARD_DEVIATION;
                setMinMaxVisibility(false);
                setPercentClipVisibility(false);
                setStdDevVisibility(true);
                break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    return paramDialog.create();
}

From source file:com.fa.mastodon.activity.EditProfileActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    ButterKnife.bind(this);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from www . j a va  2s . c  o m
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(getString(R.string.title_edit_profile));
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    if (savedInstanceState != null) {
        priorDisplayName = savedInstanceState.getString("priorDisplayName");
        priorNote = savedInstanceState.getString("priorNote");
        isAlreadySaving = savedInstanceState.getBoolean("isAlreadySaving");
        currentlyPicking = (PickType) savedInstanceState.getSerializable("currentlyPicking");
        avatarBase64 = savedInstanceState.getString("avatarBase64");
        headerBase64 = savedInstanceState.getString("headerBase64");
    } else {
        priorDisplayName = null;
        priorNote = null;
        isAlreadySaving = false;
        currentlyPicking = PickType.NOTHING;
        avatarBase64 = null;
        headerBase64 = null;
    }

    avatarButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onMediaPick(PickType.AVATAR);
        }
    });
    headerButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onMediaPick(PickType.HEADER);
        }
    });

    avatarPreview.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            avatarPreview.setImageBitmap(null);
            avatarPreview.setVisibility(View.INVISIBLE);
            avatarBase64 = null;
        }
    });
    headerPreview.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            headerPreview.setImageBitmap(null);
            headerPreview.setVisibility(View.INVISIBLE);
            headerBase64 = null;
        }
    });

    mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
        @Override
        public void onResponse(Call<Account> call, Response<Account> response) {
            if (!response.isSuccessful()) {
                onAccountVerifyCredentialsFailed();
                return;
            }
            Account me = response.body();
            priorDisplayName = me.getDisplayName();
            priorNote = me.note.toString();
            CircularImageView avatar = (CircularImageView) findViewById(R.id.edit_profile_avatar_preview);
            ImageView header = (ImageView) findViewById(R.id.edit_profile_header_preview);

            displayNameEditText.setText(priorDisplayName);
            noteEditText.setText(priorNote);
            Picasso.with(avatar.getContext()).load(me.avatar).placeholder(R.drawable.avatar_default)
                    .error(R.drawable.avatar_error).into(avatar);
            Picasso.with(header.getContext()).load(me.header).placeholder(R.drawable.account_header_default)
                    .into(header);
        }

        @Override
        public void onFailure(Call<Account> call, Throwable t) {
            onAccountVerifyCredentialsFailed();
        }
    });
}

From source file:com.pixby.texo.MainActivity.java

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

    trackStart();/*from   w w w.j a va 2 s .  co  m*/

    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.app_toolbar);
    setSupportActionBar(toolbar);
    mStageView = (StageView) findViewById(R.id.stage_view);
    mEditPresenter = new EditToolsPresenter(this, mStageView);

    if (savedInstanceState == null) {
        importStyleData();
        mWatermark = Watermark.createDefaultWatermark(getApplication().getAssets(),
                getResources().getString(R.string.action_doubletap));
        handleImageOpenIntent(getIntent());
    } else {
        String imageUriString = savedInstanceState.getString(STATE_IMAGE_URI);
        loadImage(Uri.parse(imageUriString), mStageView);

        mWatermark = Watermark.fromJson(savedInstanceState.getString(STATE_WATERMARK),
                getApplication().getAssets());
        mShareImagePath = savedInstanceState.getString(STATE_SHARE_PATH);

        mEditPresenter.setEditorState((EditorState) savedInstanceState.getSerializable(STATE_EDITOR));
        mEditPresenter.setWatermarkModified(savedInstanceState.getBoolean(STATE_WATERMARK_CHANGED));
        mEditPresenter.setImageChanged(savedInstanceState.getBoolean(STATE_IMAGE_CHANGED));
        mEditPresenter.showTool();
    }

    mStageView.setWatermark(mWatermark);
}

From source file:com.wit.and.dialog.LoginDialog.java

/**
 *//*w w  w . j a  v a2 s.  c  o  m*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    // Restore hints.
    this.mUserHint = getOptions().getUserHint();
    this.mPassHint = getOptions().getPassHint();

    // Restore patterns.
    this.mUserMatcher = ((Pattern) savedInstanceState.getSerializable(BUNDLE_USERNAME_PATTERN)).matcher("");
    this.mPassMatcher = ((Pattern) savedInstanceState.getSerializable(BUNDLE_PASSWORD_PATTERN)).matcher("");

    this.bAuthRunning = savedInstanceState.getBoolean(BUNDLE_AUTHENTICATION_RUNNING, false);
}

From source file:com.android.returncandidate.activities.SdmScannerActivity.java

/**
 * Initialize screen layout/*from ww  w  . j  av  a2s.  c  o  m*/
 *
 * @param state {@link Bundle}
 */
@Override
public void onCreate(Bundle state) {

    LogManager.i(TAG, Message.TAG_SCANNER_ACTIVITY + Message.MESSAGE_ACTIVITY_START);
    super.onCreate(state);

    setContentView(R.layout.activity_sdm_scanner);

    // Load user info

    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        userID = bundle.getString(Constants.COLUMN_USER_ID);
        shopID = bundle.getString(Constants.COLUMN_SHOP_ID);
        serverName = bundle.getString(Constants.COLUMN_SERVER_NAME);
        license = bundle.getString(Constants.COLUMN_LICENSE);
        hashMapArrBook = (HashMap<String, LinkedList<String[]>>) bundle
                .getSerializable(Constants.COLUMN_INFOR_LIST_SCAN);
    }
    Log.d("LINCONGPVScan", license);
    //Set default start app
    flagSettingNew = new FlagSettingNew();
    flagSettingOld = new FlagSettingOld();
    common = new Common();

    // UI init
    Users user = new UserModel().getUserInfo();
    TextView tvUserName = (TextView) findViewById(R.id.txv_user_name);
    tvUserName.setText(user.getName());

    lvBook = (ListView) findViewById(R.id.list_book);
    arrBookInlist = new LinkedList<>();
    if (hashMapArrBook != null) {
        arrBookInlist = new LinkedList<>(hashMapArrBook.get(Constants.COLUMN_INFOR_LIST_SCAN));

    }

    mBookModel = new BookModel();
    maxYearRankModel = new MaxYearRankModel();
    DatabaseManager.initializeInstance(new DatabaseHelper(getApplicationContext()));

    //Default flag setting new
    ArrayList<String> arrPublisherCd = new ArrayList<>();
    ArrayList<String> arrPublisherName = new ArrayList<>();
    ArrayList<String> arrGroup1Cd = new ArrayList<>();
    ArrayList<String> arrGroup1Name = new ArrayList<>();
    ArrayList<String> arrGroup2Cd = new ArrayList<>();
    ArrayList<String> arrGroup2Name = new ArrayList<>();
    arrPublisherCd.add(Constants.ID_ROW_ALL);
    arrPublisherName.add(Constants.ROW_ALL);
    arrGroup1Cd.add(Constants.ID_ROW_ALL);
    arrGroup1Name.add(Constants.ROW_ALL);
    arrGroup2Cd.add(Constants.ID_ROW_ALL);
    arrGroup2Name.add(Constants.ROW_ALL);

    maxYearRank = maxYearRankModel.getMaxYearRank();

    //Get list default group1 cd
    List<CLP> listDefaultGroup1 = mBookModel.getInfoGroupCd1();
    List<CLP> listDefaultGroup2 = mBookModel.getInfoGroupCd2(Constants.ID_ROW_ALL);
    for (int i = 0; i < listDefaultGroup1.size(); i++) {
        arrGroup1Cd.add(listDefaultGroup1.get(i).getId());
        arrGroup1Name.add(listDefaultGroup1.get(i).getName());
    }
    for (int i = 0; i < listDefaultGroup2.size(); i++) {
        arrGroup2Cd.add(listDefaultGroup2.get(i).getId());
        arrGroup2Name.add(listDefaultGroup2.get(i).getName());
    }
    flagSettingNew.setFlagClassificationGroup1Cd(arrGroup1Cd);
    flagSettingNew.setFlagClassificationGroup1Name(arrGroup1Name);
    flagSettingNew.setFlagClassificationGroup2Cd(arrGroup2Cd);
    flagSettingNew.setFlagClassificationGroup2Name(arrGroup2Name);

    flagSettingNew.setFlagPublisher(arrPublisherCd);
    flagSettingNew.setFlagPublisherShowScreen(arrPublisherName);

    flagSettingNew.setFlagReleaseDate(Constants.FLAG_DEFAULT);
    flagSettingNew.setFlagReleaseDateShowScreen(Constants.FLAG_DEFAULT_RELEASE_DATE_SHOW);

    flagSettingNew.setFlagUndisturbed(Constants.FLAG_DEFAULT);
    flagSettingNew.setFlagUndisturbedShowScreen(Constants.FLAG_DEFAULT_UNDISTURBED_SHOW);

    flagSettingNew.setFlagNumberOfStocks(Constants.FLAG_DEFAULT);
    flagSettingNew.setFlagNumberOfStocksShowScreen(Constants.FLAG_DEFAULT_NUMBER_OF_STOCKS_SHOW);

    flagSettingNew.setFlagStockPercent(Constants.FLAG_DEFAULT);
    flagSettingNew.setFlagStockPercentShowScreen(Constants.FLAG_DEFAULT_STOCKS_PERCENT_SHOW);

    flagSettingNew.setFlagJoubi(Constants.VALUE_YES_STANDING);

    // Default flag setting old
    flagSettingOld.setFlagClassificationGroup1Cd(arrGroup1Cd);
    flagSettingOld.setFlagClassificationGroup1Name(arrGroup1Name);
    flagSettingOld.setFlagClassificationGroup2Cd(arrGroup2Cd);
    flagSettingOld.setFlagClassificationGroup2Name(arrGroup2Name);

    flagSettingOld.setFlagPublisher(arrPublisherCd);
    flagSettingOld.setFlagPublisherShowScreen(arrPublisherName);

    flagSettingOld.setFlagReleaseDate(Constants.FLAG_DEFAULT);
    flagSettingOld.setFlagReleaseDateShowScreen(Constants.FLAG_DEFAULT_RELEASE_DATE_SHOW);

    flagSettingOld.setFlagUndisturbed(Constants.FLAG_DEFAULT);
    flagSettingOld.setFlagUndisturbedShowScreen(Constants.FLAG_DEFAULT_UNDISTURBED_SHOW);

    flagSettingOld.setFlagNumberOfStocks(Constants.FLAG_DEFAULT);
    flagSettingOld.setFlagNumberOfStocksShowScreen(Constants.FLAG_DEFAULT_NUMBER_OF_STOCKS_SHOW);

    flagSettingOld.setFlagStockPercent(Constants.FLAG_DEFAULT);
    flagSettingOld.setFlagStockPercentShowScreen(Constants.FLAG_DEFAULT_STOCKS_PERCENT_SHOW);

    flagSettingOld.setFlagJoubi(Constants.VALUE_YES_STANDING);

    //Flag disable OCR
    flagSwitchOCR = Constants.FLAG_0;

    flagFilterSubmit = true;
    // Init process loading screen
    progress = new ProgressDialog(this);
    progress.setMessage(Message.MESSAGE_UPLPOAD_LOG_SCREEN);
    progress.setCancelable(false);

    // Activate HSM license
    Log.d("LINCONGPVScanACTIVE1", license);
    ActivationResult activationResult = ActivationManager.activate(this, license);

    Toast.makeText(this, "Activation result: " + activationResult, Toast.LENGTH_LONG).show();

    decCom = (HSMDecodeComponent) findViewById(R.id.hsm_decodeComponent);

    // HSM init
    hsmDecoder = HSMDecoder.getInstance(this);

    // Declare symbology
    hsmDecoder.enableSymbology(Symbology.EAN13);

    // Declare HSM component UI
    hsmDecoder.enableFlashOnDecode(false);
    hsmDecoder.enableSound(false);
    hsmDecoder.enableAimer(false);
    hsmDecoder.setWindowMode(WindowMode.CENTERING);
    hsmDecoder.setWindow(18, 42, 0, 100);

    // Assign listener
    hsmDecoder.addResultListener(this);

    // Sound init
    normalSound = MediaPlayer.create(this, R.raw.pingpong_main); // sound is inside res/raw/mysound
    noReturnSound = MediaPlayer.create(this, R.raw.wrong_main); // sound is inside res/raw/mysound

    // Button init
    btnLogout = (Button) findViewById(R.id.btn_logout);
    btnCancel = (Button) findViewById(R.id.btn_cancel);
    imbFilter = (ImageButton) findViewById(R.id.imb_filter);
    aSwitchOCR = (Switch) findViewById(R.id.switch_OCR);
    btnLogout.setOnClickListener(this);
    btnCancel.setOnClickListener(this);
    imbFilter.setOnClickListener(this);

    aSwitchOCR.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (aSwitchOCR.isChecked()) {
                flagSwitchOCR = Constants.FLAG_1;
                hsmDecoder.enableSymbology(Symbology.OCR);
                //hsmDecoder.enableSymbology(Symbology.EAN13_ISBN);
                hsmDecoder.setOCRActiveTemplate(OCRActiveTemplate.ISBN);
                hsmDecoder.disableSymbology(Symbology.EAN13);
            } else {
                flagSwitchOCR = Constants.FLAG_0;
                hsmDecoder.enableSymbology(Symbology.EAN13);
                //hsmDecoder.setOCRActiveTemplate(OCRActiveTemplate.ISBN);
                hsmDecoder.disableSymbology(Symbology.OCR);

            }
        }
    });

    //Check if arr list books not null
    if (arrBookInlist != null) {
        // Set data adapter to list view
        ListViewScanAdapter adapterBook = new ListViewScanAdapter(this, arrBookInlist);
        lvBook.setAdapter(adapterBook);
    }
}

From source file:com.hackensack.umc.activity.DependentDetailsActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
    case addressCode:
        if (data != null) {
            Bundle bundle = data.getExtras();
            mAddress = (Address) bundle.getSerializable(AddressActivity.ADRESS_STR);
            ((TextView) findViewById(R.id.addr_tv)).setText(mAddress.toString());
        }// ww  w  . j  a v  a 2  s. c om
        break;
    case insuranceCode:
        if (data != null) {
            Bundle bundle = data.getExtras();
            mInsuranceInfo = (InsuranceInfo) bundle.getSerializable(InsuranceInfoActivity.INSURANCE_STR);
            ((TextView) findViewById(R.id.insurance_tv)).setText(mInsuranceInfo.toString());
        }
        break;
    }
}

From source file:com.nextgis.maplibui.overlay.EditLayerOverlay.java

@Override
public void onRestoreState(Bundle bundle) {
    if (null != bundle && mType == bundle.getInt(BUNDLE_KEY_TYPE, 0)) {
        mMode = bundle.getInt(BUNDLE_KEY_MODE);
        mHasEdits = bundle.getBoolean(BUNDLE_KEY_HAS_EDITS);

        if (bundle.containsKey(BUNDLE_KEY_OVERLAY_POINT)) {
            GeoPoint point = (GeoPoint) bundle.getSerializable(BUNDLE_KEY_OVERLAY_POINT);

            if (point != null) {
                point.setCRS(GeoConstants.CRS_WGS84);
                mOverlayPoint.setCoordinates(point);
                mOverlayPoint.setVisible(true);
            }//w  ww. j  a  v a 2  s. c  o  m
        }
    }

    super.onRestoreState(bundle);
}

From source file:com.pindroid.fragment.ViewBookmarkFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from ww  w  . j a  va  2s.  co  m*/
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mBookmarkView = (ScrollView) getView().findViewById(R.id.bookmark_scroll_view);
    mTitle = (TextView) getView().findViewById(R.id.view_bookmark_title);
    mUrl = (TextView) getView().findViewById(R.id.view_bookmark_url);
    notesSection = getView().findViewById(R.id.view_bookmark_notes_section);
    mNotes = (TextView) getView().findViewById(R.id.view_bookmark_notes);
    tagsSection = getView().findViewById(R.id.view_bookmark_tag_section);
    mTags = (TextView) getView().findViewById(R.id.view_bookmark_tags);
    mTime = (TextView) getView().findViewById(R.id.view_bookmark_time);
    mUsername = (TextView) getView().findViewById(R.id.view_bookmark_account);
    bookmarkIcon = (ImageView) getView().findViewById(R.id.view_bookmark_title_icon);
    mWebContent = (WebView) getView().findViewById(R.id.web_view);

    mWebContent.getSettings().setJavaScriptEnabled(true);

    if (savedInstanceState != null) {
        viewType = (BookmarkViewType) savedInstanceState.getSerializable(STATE_VIEWTYPE);
        bookmark = (Bookmark) savedInstanceState.getParcelable(STATE_BOOKMARK);
        mWebContent.restoreState(savedInstanceState);
    }

    setHasOptionsMenu(true);

    if (savedInstanceState == null || (viewType != null && viewType.equals(BookmarkViewType.VIEW))) {
        refresh();
    } else
        setViews();

}

From source file:uf.edu.encDetailActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.encdetail_activity);
    context = this.getApplicationContext();
    TextView tv = null;//w w w. j  av  a 2  s .c  o m
    SeekBar sb = null;
    Button b = null;
    Bundle bundle = this.getIntent().getExtras();
    Log.i("TAG", "encDetailActivity:onCreate,  Max Trust =" + getString(R.string.TrustSliderMax));
    MaxTrust = Integer.parseInt(getString(R.string.TrustSliderMax)) / 2;

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
                //Okay clicked.
                break;

            case DialogInterface.BUTTON_NEGATIVE:
                //No button clicked
                break;
            }
        }
    };

    //builder.setMessage("Are you sure?").setPositiveButton("Okay", dialogClickListener);

    final EncUser encUser = (EncUser) bundle.getSerializable("userdata");
    final ArrayList<String> Address = (ArrayList<String>) bundle.getSerializable("useraddress");
    if (encUser == null) {
        Log.i(TAG, "encDetailsActivity: parameter received was null");
    }
    //Name
    tv = (TextView) findViewById(R.id.encdetail_name);
    tv.setText(encUser.Name);
    //Mac
    tv = (TextView) findViewById(R.id.encdetail_mac);
    tv.setText(encUser.Mac);
    tv.setOnClickListener(new View.OnClickListener() { //event listener to fetch more info abt a user.
        @Override
        public void onClick(View v) {
            iTrust.cd.write("Registration Lookup requested for " + encUser.Mac);
            Toast.makeText(encDetailActivity.this, "Please wait while we lookup the information",
                    Toast.LENGTH_LONG).show();
            String data = getData(encUser.Mac).replace('\n', ' ').trim();
            String message = null;
            if (data.substring(0, 5).compareToIgnoreCase("Error") == 0) {
                message = "No more info available for this device";
            } else {
                data = data.replace('\'', ' '); //remove single quotes
                data = data.replace(')', ' ').trim(); //remove closing brackets.
                StringTokenizer tok = new StringTokenizer(data.substring(1), ",");
                message = "Name: " + tok.nextToken() + " " + tok.nextToken() + "\n" + "Email: "
                        + tok.nextToken() + "\n" + "Profile: " + tok.nextToken();
            }
            //Toast.makeText(encDetailActivity.this, getData(encUser.Mac), Toast.LENGTH_LONG).show();
            builder.setMessage(message);
            builder.show();
        }
    });
    //lasttime
    tv = (TextView) findViewById(R.id.encdetail_lasttime);
    tv.setText((new java.util.Date((long) encUser.lastEncounterTime * 1000)).toString());
    tv.setOnClickListener(new View.OnClickListener() { //To generate graph
        @Override
        public void onClick(View v) {
            Intent intent = barchartIntent(encUser.timeSeries, encUser.Mac, encUser.Name);
            startActivity(intent);
        }
    });

    //tv.setText(Integer.toString(encUser.lastEncounterTime)); 
    //FE
    tv = (TextView) findViewById(R.id.encdetail_FE);
    tv.setText(Float.toString(encUser.score[0]));
    tv = (TextView) findViewById(R.id.encdetail_decayFE);
    tv.setText(Float.toString(encUser.decayScore[0] * ((float) Math.pow(.5,
            (float) (((float) System.currentTimeMillis() / 1000) - (float) encUser.lastEncounterTime)
                    / (float) 15552000.0F))));
    //DE
    tv = (TextView) findViewById(R.id.encdetail_DE);
    tv.setText(Float.toString(encUser.score[1]));
    tv = (TextView) findViewById(R.id.encdetail_decayDE);
    tv.setText(Float.toString(encUser.decayScore[1] * ((float) Math.pow(.5,
            (float) (((float) System.currentTimeMillis() / 1000) - (float) encUser.lastEncounterTime)
                    / (float) 15552000.0F))));
    //LV-C
    tv = (TextView) findViewById(R.id.encdetail_LVC);
    tv.setText(Float.toString(encUser.score[2]));
    //LV-D
    tv = (TextView) findViewById(R.id.encdetail_LVD);
    tv.setText(Float.toString(encUser.score[3]));
    //combined 
    //FE
    tv = (TextView) findViewById(R.id.encdetail_comb);
    tv.setText(Float.toString(encUser.score[4]));

    //check the toggle button state

    sb = (SeekBar) findViewById(R.id.encdetail_trust);
    //since Seekbar cannot go into -ve values we scale -Max Value to Max Value
    sb.setProgress(encUser.trusted + MaxTrust);
    tv = (TextView) findViewById(R.id.CurrentTrustValue);
    tv.setText(TrustArray[encUser.trusted + MaxTrust]);

    sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        TextView tvcurrent = (TextView) findViewById(R.id.CurrentTrustValue);

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser == true) {
                Log.i(TAG, "encDetailsActivity: User changed value for Trust to " + progress);
                encUser.trusted = progress - MaxTrust;
                tvcurrent.setText(TrustArray[progress]);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }
    });

    b = (Button) findViewById(R.id.encdetail_done);
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            iTrust.cd.write("Trust Value changed for this user :" + encUser.Mac + " to:" + encUser.trusted);
            Bundle bundle = new Bundle();
            Intent returnIntent = new Intent();
            bundle.putSerializable("Object", encUser);
            returnIntent.putExtras(bundle);
            //returnIntent.putExtra("TrustSet",trustResult);
            encDetailActivity.this.setResult(Activity.RESULT_OK, returnIntent);
            finish();
        }
    });

    //show map
    tv = (TextView) findViewById(R.id.encdetail_map);
    tv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            iTrust.cd.write("Map lookup for encounter user " + encUser.Mac);
            Bundle bundle = new Bundle();
            Intent newIntent = new Intent(context, map.class);
            bundle.putSerializable("useraddress", Address);
            newIntent.putExtras(bundle);
            startActivity(newIntent);
        }
    });

}

From source file:com.ibuildapp.romanblack.WebPlugin.WebPlugin.java

@Override
public void create() {
    try {/*w w w.j av  a2  s .  c o m*/

        setContentView(R.layout.romanblack_html_main);
        root = (FrameLayout) findViewById(R.id.romanblack_root_layout);
        webView = new ObservableWebView(this);
        webView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
                RelativeLayout.LayoutParams.MATCH_PARENT));
        root.addView(webView);

        webView.setHorizontalScrollBarEnabled(false);
        setTitle("HTML");

        Intent currentIntent = getIntent();
        Bundle store = currentIntent.getExtras();
        widget = (Widget) store.getSerializable("Widget");
        if (widget == null) {
            handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100);
            return;
        }
        appName = widget.getAppName();

        if (widget.getPluginXmlData().length() == 0) {
            if (currentIntent.getStringExtra("WidgetFile").length() == 0) {
                handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100);
                return;
            }
        }

        if (widget.getTitle() != null && widget.getTitle().length() > 0) {
            setTopBarTitle(widget.getTitle());
        } else {
            setTopBarTitle(getResources().getString(R.string.romanblack_html_web));
        }

        currentUrl = (String) getSession();
        if (currentUrl == null) {
            currentUrl = "";
        }

        ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        if (ni != null && ni.isConnectedOrConnecting()) {
            isOnline = true;
        }

        // topbar initialization
        setTopBarLeftButtonText(getString(R.string.common_home_upper), true, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });

        if (isOnline) {
            webView.getSettings().setJavaScriptEnabled(true);
        }

        webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        webView.getSettings().setGeolocationEnabled(true);
        webView.getSettings().setAllowFileAccess(true);
        webView.getSettings().setAppCacheEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setUseWideViewPort(false);
        webView.getSettings().setSavePassword(false);
        webView.clearHistory();
        webView.invalidate();

        if (Build.VERSION.SDK_INT >= 19) {
        }
        webView.getSettings().setUserAgentString(
                "Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");

        webView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                v.invalidate();

                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN: {
                }
                    break;
                case MotionEvent.ACTION_UP: {
                    if (!v.hasFocus()) {
                        v.requestFocus();
                    }
                }
                    break;

                case MotionEvent.ACTION_MOVE: {
                }
                    break;

                }
                return false;
            }
        });

        webView.setBackgroundColor(Color.WHITE);
        try {
            if (widget.getBackgroundColor() != Color.TRANSPARENT) {
                webView.setBackgroundColor(widget.getBackgroundColor());
            }
        } catch (IllegalArgumentException e) {
        }

        webView.setDownloadListener(new DownloadListener() {
            @Override
            public void onDownloadStart(String url, String userAgent, String contentDisposition,
                    String mimetype, long contentLength) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
                startActivity(intent);
            }
        });

        webView.setWebChromeClient(new WebChromeClient() {

            FrameLayout.LayoutParams LayoutParameters = new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

            @Override
            public void onGeolocationPermissionsShowPrompt(final String origin,
                    final GeolocationPermissions.Callback callback) {
                AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this);
                builder.setTitle(R.string.location_dialog_title);
                builder.setMessage(R.string.location_dialog_description);
                builder.setCancelable(true);

                builder.setPositiveButton(R.string.location_dialog_allow,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                callback.invoke(origin, true, false);
                            }
                        });

                builder.setNegativeButton(R.string.location_dialog_not_allow,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                callback.invoke(origin, false, false);
                            }
                        });

                AlertDialog alert = builder.create();
                alert.show();
            }

            @Override
            public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
                if (customView != null) {
                    customViewCallback.onCustomViewHidden();
                    return;
                }

                view.setBackgroundColor(Color.BLACK);
                view.setLayoutParams(LayoutParameters);
                root.addView(view);
                customView = view;
                customViewCallback = callback;
                webView.setVisibility(View.GONE);
            }

            @Override
            public void onHideCustomView() {
                if (customView == null) {
                    return;
                } else {
                    closeFullScreenVideo();
                }
            }

            public void openFileChooser(ValueCallback<Uri> uploadMsg) {

                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);//Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("image/*");
                isMedia = true;
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);

            }

            // For Android 3.0+
            public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("*/*");
                startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
            }

            //For Android 4.1
            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                isMedia = true;
                i.setType("image/*");
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);

            }

            @Override
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                    FileChooserParams fileChooserParams) {
                isV21 = true;
                mUploadMessageV21 = filePathCallback;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("image/*");
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
                return true;
            }

            @Override
            public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) {
                super.onReceivedTouchIconUrl(view, url, precomposed);
            }
        });

        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);

                if (state == states.EMPTY) {
                    currentUrl = url;
                    setSession(currentUrl);
                    state = states.LOAD_START;
                    handler.sendEmptyMessage(SHOW_PROGRESS);
                }
            }

            @Override
            public void onLoadResource(WebView view, String url) {

                if (!alreadyLoaded
                        && (url.startsWith("http://www.youtube.com/get_video_info?")
                                || url.startsWith("https://www.youtube.com/get_video_info?"))
                        && Build.VERSION.SDK_INT < 11) {
                    try {
                        String path = url.contains("https://www.youtube.com/get_video_info?")
                                ? url.replace("https://www.youtube.com/get_video_info?", "")
                                : url.replace("http://www.youtube.com/get_video_info?", "");

                        String[] parqamValuePairs = path.split("&");

                        String videoId = null;

                        for (String pair : parqamValuePairs) {
                            if (pair.startsWith("video_id")) {
                                videoId = pair.split("=")[1];
                                break;
                            }
                        }

                        if (videoId != null) {
                            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com"))
                                    .setData(Uri.parse("http://www.youtube.com/watch?v=" + videoId)));
                            needRefresh = true;
                            alreadyLoaded = !alreadyLoaded;

                            return;
                        }
                    } catch (Exception ex) {
                    }
                } else {
                    super.onLoadResource(view, url);
                }
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                if (hideProgress) {
                    if (TextUtils.isEmpty(WebPlugin.this.url)) {
                        state = states.LOAD_COMPLETE;
                        handler.sendEmptyMessage(HIDE_PROGRESS);
                        super.onPageFinished(view, url);
                    } else {
                        view.loadUrl("javascript:(function(){" + "l=document.getElementById('link');"
                                + "e=document.createEvent('HTMLEvents');" + "e.initEvent('click',true,true);"
                                + "l.dispatchEvent(e);" + "})()");
                        hideProgress = false;
                    }
                } else {
                    state = states.LOAD_COMPLETE;
                    handler.sendEmptyMessage(HIDE_PROGRESS);
                    super.onPageFinished(view, url);
                }
            }

            @Override
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                if (errorCode == WebViewClient.ERROR_BAD_URL) {
                    startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)),
                            DOWNLOAD_REQUEST_CODE);
                }
            }

            @Override
            public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this);
                builder.setMessage(R.string.notification_error_ssl_cert_invalid);
                builder.setPositiveButton(WebPlugin.this.getResources().getString(R.string.wp_continue),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                handler.proceed();
                            }
                        });
                builder.setNegativeButton(WebPlugin.this.getResources().getString(R.string.wp_cancel),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                handler.cancel();
                            }
                        });
                final AlertDialog dialog = builder.create();
                dialog.show();
            }

            @Override
            public void onFormResubmission(WebView view, Message dontResend, Message resend) {
                super.onFormResubmission(view, dontResend, resend);
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
                return super.shouldInterceptRequest(view, request);
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                try {

                    if (url.contains("youtube.com/watch")) {
                        if (Build.VERSION.SDK_INT < 11) {
                            try {
                                startActivity(
                                        new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com"))
                                                .setData(Uri.parse(url)));
                                return true;
                            } catch (Exception ex) {
                                return false;
                            }
                        } else {
                            return false;
                        }
                    } else if (url.contains("paypal.com")) {
                        if (url.contains("&bn=ibuildapp_SP")) {
                            return false;
                        } else {
                            url = url + "&bn=ibuildapp_SP";

                            webView.loadUrl(url);

                            return true;
                        }
                    } else if (url.contains("sms:")) {
                        try {
                            Intent smsIntent = new Intent(Intent.ACTION_VIEW);
                            smsIntent.setData(Uri.parse(url));
                            startActivity(smsIntent);
                            return true;
                        } catch (Exception ex) {
                            Log.e("", ex.getMessage());
                            return false;
                        }
                    } else if (url.contains("tel:")) {
                        Intent callIntent = new Intent(Intent.ACTION_CALL);
                        callIntent.setData(Uri.parse(url));
                        startActivity(callIntent);
                        return true;
                    } else if (url.contains("mailto:")) {
                        MailTo mailTo = MailTo.parse(url);

                        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                        emailIntent.setType("plain/text");
                        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                                new String[] { mailTo.getTo() });

                        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mailTo.getSubject());
                        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, mailTo.getBody());
                        WebPlugin.this.startActivity(Intent.createChooser(emailIntent,
                                getString(R.string.romanblack_html_send_email)));
                        return true;
                    } else if (url.contains("rtsp:")) {
                        Uri address = Uri.parse(url);
                        Intent intent = new Intent(Intent.ACTION_VIEW, address);

                        final PackageManager pm = getPackageManager();
                        final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0);
                        if (matches.size() > 0) {
                            startActivity(intent);
                        } else {
                            Toast.makeText(WebPlugin.this, getString(R.string.romanblack_html_no_video_player),
                                    Toast.LENGTH_SHORT).show();
                        }

                        return true;
                    } else if (url.startsWith("intent:") || url.startsWith("market:")
                            || url.startsWith("col-g2m-2:")) {
                        Intent it = new Intent();
                        it.setData(Uri.parse(url));
                        startActivity(it);

                        return true;
                    } else if (url.contains("//play.google.com/")) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                        return true;
                    } else {
                        if (url.contains("ibuildapp.com-1915109")) {
                            String param = Uri.parse(url).getQueryParameter("widget");
                            finish();
                            if (param != null && param.equals("1001"))
                                com.appbuilder.sdk.android.Statics.launchMain();
                            else if (param != null && !"".equals(param)) {
                                View.OnClickListener widget = Statics.linkWidgets.get(Integer.valueOf(param));
                                if (widget != null)
                                    widget.onClick(view);
                            }
                            return false;
                        }

                        currentUrl = url;
                        setSession(currentUrl);
                        if (!isOnline) {
                            handler.sendEmptyMessage(HIDE_PROGRESS);
                            handler.sendEmptyMessage(STOP_LOADING);
                        } else {
                            String pageType = "application/html";
                            if (!url.contains("vk.com")) {
                                getPageType(url);
                            }
                            if (pageType.contains("application") && !pageType.contains("html")
                                    && !pageType.contains("xml")) {
                                startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)),
                                        DOWNLOAD_REQUEST_CODE);
                                return super.shouldOverrideUrlLoading(view, url);
                            } else {
                                view.getSettings().setLoadWithOverviewMode(true);
                                view.getSettings().setUseWideViewPort(true);
                                view.setBackgroundColor(Color.WHITE);
                            }
                        }
                        return false;
                    }

                } catch (Exception ex) { // Error Logging
                    return false;
                }
            }
        });

        handler.sendEmptyMessage(SHOW_PROGRESS);

        new Thread() {
            @Override
            public void run() {

                EntityParser parser;
                if (widget.getPluginXmlData() != null) {
                    if (widget.getPluginXmlData().length() > 0) {
                        parser = new EntityParser(widget.getPluginXmlData());
                    } else {
                        String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile"));
                        parser = new EntityParser(xmlData);
                    }
                } else {
                    String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile"));
                    parser = new EntityParser(xmlData);
                }

                parser.parse();

                url = parser.getUrl();
                html = parser.getHtml();

                if (url.length() > 0 && !isOnline) {
                    handler.sendEmptyMessage(NEED_INTERNET_CONNECTION);
                } else {
                    if (isOnline) {
                    } else {
                        if (html.length() == 0) {
                        }
                    }
                    if (html.length() > 0 || url.length() > 0) {
                        handler.sendEmptyMessageDelayed(SHOW_HTML, 700);
                    } else {
                        handler.sendEmptyMessage(HIDE_PROGRESS);
                        handler.sendEmptyMessage(INITIALIZATION_FAILED);
                    }
                }
            }
        }.start();

    } catch (Exception ex) {
    }
}