Example usage for android.graphics.drawable BitmapDrawable BitmapDrawable

List of usage examples for android.graphics.drawable BitmapDrawable BitmapDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable BitmapDrawable BitmapDrawable.

Prototype

@Deprecated
public BitmapDrawable() 

Source Link

Document

Create an empty drawable, not dealing with density.

Usage

From source file:com.cybrosys.scientific.EventListener.java

@SuppressWarnings("deprecation")
private void Memread() {
    spMemory = ctx.getSharedPreferences(PREFNAME, 0);

    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    vwLayout = inflater.inflate(R.layout.memory, (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element));

    popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true);
    popmW1.setBackgroundDrawable(new BitmapDrawable());
    popmW1.setOutsideTouchable(true);//from w w  w  . java  2  s  .  com

    popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 0);
    ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain);
    btnCancel.setOnClickListener(new OnClickListener() {

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

        }
    });
    btns[0] = (Button) vwLayout.findViewById(R.id.btn1);
    btns[1] = (Button) vwLayout.findViewById(R.id.btn2);
    btns[2] = (Button) vwLayout.findViewById(R.id.btn3);
    btns[3] = (Button) vwLayout.findViewById(R.id.btn4);
    btns[4] = (Button) vwLayout.findViewById(R.id.btn5);
    btns[5] = (Button) vwLayout.findViewById(R.id.btn6);
    btns[6] = (Button) vwLayout.findViewById(R.id.btn7);
    btns[7] = (Button) vwLayout.findViewById(R.id.btn8);
    btns[8] = (Button) vwLayout.findViewById(R.id.btn9);
    for (int inI = 0; inI < 9; inI++) {
        btns[inI].setText(spMemory.getString("" + inI, ""));
        final int inK = inI;
        btns[inK].setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mHandler.insert(btns[inK].getText().toString());
                popmW1.dismiss();
            }
        });

    }

}

From source file:it.feio.android.omninotes.DetailFragment.java

@SuppressWarnings("deprecation")
private void showPopup(View anchor) {
    DisplayMetrics metrics = new DisplayMetrics();
    mainActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);

    // Inflate the popup_layout.xml
    LayoutInflater inflater = (LayoutInflater) mainActivity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.attachment_dialog, null);

    // Creating the PopupWindow
    attachmentDialog = new PopupWindow(mainActivity);
    attachmentDialog.setContentView(layout);
    attachmentDialog.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
    attachmentDialog.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    attachmentDialog.setFocusable(true);
    attachmentDialog.setOnDismissListener(() -> {
        if (isRecording) {
            isRecording = false;/*from   w w  w  . j a v a  2s .  c o  m*/
            stopRecording();
        }
    });

    // Clear the default translucent background
    attachmentDialog.setBackgroundDrawable(new BitmapDrawable());

    // Camera
    android.widget.TextView cameraSelection = (android.widget.TextView) layout.findViewById(R.id.camera);
    cameraSelection.setOnClickListener(new AttachmentOnClickListener());
    // Audio recording
    android.widget.TextView recordingSelection = (android.widget.TextView) layout.findViewById(R.id.recording);
    recordingSelection.setOnClickListener(new AttachmentOnClickListener());
    // Video recording
    android.widget.TextView videoSelection = (android.widget.TextView) layout.findViewById(R.id.video);
    videoSelection.setOnClickListener(new AttachmentOnClickListener());
    // Files
    android.widget.TextView filesSelection = (android.widget.TextView) layout.findViewById(R.id.files);
    filesSelection.setOnClickListener(new AttachmentOnClickListener());
    // Sketch
    android.widget.TextView sketchSelection = (android.widget.TextView) layout.findViewById(R.id.sketch);
    sketchSelection.setOnClickListener(new AttachmentOnClickListener());
    // Location
    android.widget.TextView locationSelection = (android.widget.TextView) layout.findViewById(R.id.location);
    locationSelection.setOnClickListener(new AttachmentOnClickListener());
    // Desktop note with PushBullet
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        android.widget.TextView pushbulletSelection = (android.widget.TextView) layout
                .findViewById(R.id.pushbullet);
        pushbulletSelection.setVisibility(View.VISIBLE);
        pushbulletSelection.setOnClickListener(new AttachmentOnClickListener());
    }

    try {
        attachmentDialog.showAsDropDown(anchor);
    } catch (Exception e) {
        mainActivity.showMessage(R.string.error, ONStyle.ALERT);

    }
}

From source file:com.dycody.android.idealnote.DetailFragment.java

@SuppressWarnings("deprecation")
private void showPopup(View anchor) {
    DisplayMetrics metrics = new DisplayMetrics();
    mainActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);

    // Inflate the popup_layout.xml
    LayoutInflater inflater = (LayoutInflater) mainActivity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.attachment_dialog, null);

    // Creating the PopupWindow
    attachmentDialog = new PopupWindow(mainActivity);
    attachmentDialog.setContentView(layout);
    attachmentDialog.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
    attachmentDialog.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    attachmentDialog.setFocusable(true);
    attachmentDialog.setOnDismissListener(() -> {
        if (isRecording) {
            isRecording = false;//  w  w  w  . j  a v  a2s  .c om
            stopRecording();
        }
    });

    // Clear the default translucent background
    attachmentDialog.setBackgroundDrawable(new BitmapDrawable());

    // Camera
    android.widget.TextView cameraSelection = (android.widget.TextView) layout.findViewById(R.id.camera);
    cameraSelection.setOnClickListener(new AttachmentOnClickListener());
    // Audio recording
    android.widget.TextView recordingSelection = (android.widget.TextView) layout.findViewById(R.id.recording);
    recordingSelection.setOnClickListener(new AttachmentOnClickListener());
    // Video recording
    android.widget.TextView videoSelection = (android.widget.TextView) layout.findViewById(R.id.video);
    videoSelection.setOnClickListener(new AttachmentOnClickListener());
    // Files
    android.widget.TextView filesSelection = (android.widget.TextView) layout.findViewById(R.id.files);
    filesSelection.setOnClickListener(new AttachmentOnClickListener());
    // Sketch
    android.widget.TextView sketchSelection = (android.widget.TextView) layout.findViewById(R.id.sketch);
    sketchSelection.setOnClickListener(new AttachmentOnClickListener());
    // Location
    android.widget.TextView locationSelection = (android.widget.TextView) layout.findViewById(R.id.location);
    locationSelection.setOnClickListener(new AttachmentOnClickListener());
    // Desktop note with PushBullet
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        android.widget.TextView pushbulletSelection = (android.widget.TextView) layout
                .findViewById(R.id.pushbullet);
        pushbulletSelection.setVisibility(View.VISIBLE);
        pushbulletSelection.setOnClickListener(new AttachmentOnClickListener());
    }

    try {
        attachmentDialog.showAsDropDown(anchor);
    } catch (Exception e) {
        Toast.makeText(getActivity(), R.string.error, Toast.LENGTH_SHORT).show();
        //mainActivity.showMessage(R.string.error, ONStyle.ALERT);

    }
}

From source file:com.cybrosys.scientific.EventListener.java

@SuppressWarnings("deprecation")
public void mode(String strDisplay, int inMode) {

    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    vwLayout = inflater.inflate(R.layout.fse, (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element));
    popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true);
    popmW1.setBackgroundDrawable(new BitmapDrawable());
    popmW1.setOutsideTouchable(true);//  w w  w . j  a  v a  2 s . co m
    TextView txtvHeaderPop = (TextView) vwLayout.findViewById(R.id.txtvHeaderFse);
    popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 30);
    ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain);
    btnCancel.setOnClickListener(new OnClickListener() {

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

        }
    });

    btnsM[0] = (Button) vwLayout.findViewById(R.id.btn1);
    btnsM[1] = (Button) vwLayout.findViewById(R.id.btn2);
    btnsM[2] = (Button) vwLayout.findViewById(R.id.btn3);
    btnsM[3] = (Button) vwLayout.findViewById(R.id.btn4);
    btnsM[4] = (Button) vwLayout.findViewById(R.id.btn5);
    btnsM[5] = (Button) vwLayout.findViewById(R.id.btn6);
    btnsM[6] = (Button) vwLayout.findViewById(R.id.btn7);
    btnsM[7] = (Button) vwLayout.findViewById(R.id.btn8);
    btnsM[8] = (Button) vwLayout.findViewById(R.id.btn9);
    btnsM[9] = (Button) vwLayout.findViewById(R.id.btn10);
    switch (inMode) {
    case 1:
        for (int inI = 1; inI <= 10; inI++) {
            btnsM[inI - 1].setText(fixDisp(Double.parseDouble(strDisplay), inI));
            final int inK = inI;
            btnsM[inI - 1].setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    PreferenceClass.setMyIntPref(ctx, inK);
                    ScientificActivity.txtvFSE.setText("FIX:" + (inK - 1));
                    popmW1.dismiss();
                }
            });
        }
        break;
    case 2:
        txtvHeaderPop.setText("Significant Digits");
        for (int inI = 1; inI <= 10; inI++) {
            btnsM[inI - 1].setText(sciDisp(Double.parseDouble(strDisplay), inI));
            final int inK = inI;
            btnsM[inI - 1].setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    inP = inK;
                    ScientificActivity.txtvFSE.setText("SCI:" + inK);
                    PreferenceClass.setMyIntPref(ctx, inP);
                    popmW1.dismiss();
                }
            });
        }
        break;
    case 3:
        break;

    }
}

From source file:com.dk.view.FolderDrawerLayout.java

private boolean createCache() {
    ViewGroup left = (ViewGroup) findDrawerWithGravity(Gravity.LEFT);

    if (left.getChildCount() > 0 && !(left.getChildAt(0) instanceof MeshImageView)) {
        mDrawingCache = drawViewToBitmap(mDrawingCache, left, left.getWidth(), left.getHeight(), 1,
                new BitmapDrawable());

        if (mCoreCalc == null)
            mCoreCalc = new CoreCalc(left.getWidth(), left.getHeight());
        return true;
    } else {/*from  www  .  j  a v  a2s  . c  o  m*/
        return false;
    }

}

From source file:com.android.dialer.DialtactsFragment.java

/**
 * @author bbk wangchunhe/*from w  w w.j a  va 2  s .  co  m*/
 * @Date 2016/07/13
 * initialize CallLogSelectPopupWindow
 */
private void initCallLogSelectPopupWindow() {
    if (mCallLogSelectPopupWindow == null) {
        LayoutInflater layoutInflater = LayoutInflater.from(this.getContext());
        View contentView = layoutInflater.inflate(R.layout.dialtacts_call_log_select_popupwindow, mParentLayout,
                false);
        mCallLogSelectPopupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        contentView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCallLogSelectPopupWindow.dismiss();
            }
        });

    }

    mCallLogSelectPopupWindow.setTouchable(true);
    mCallLogSelectPopupWindow.setFocusable(true);
    mCallLogSelectPopupWindow.setOutsideTouchable(true);
    mCallLogSelectPopupWindow.setAnimationStyle(R.style.PopupWindowAinm);
    mCallLogSelectPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    mCallLogSelectPopupWindow.showAsDropDown(getActivity().getActionBar().getCustomView());
    //        mActionbarMenu.setImageResource(R.drawable.actionbar_menu_down_up);
    mDialtactsActionBarController.setActionMenuIcon(R.drawable.actionbar_menu_down_up);
    popupWindowItemSelect(mCallLogSelectPopupWindow);
    mCallLogSelectPopupWindow.update();
    mCallLogSelectPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            //                mActionbarMenu.setImageResource(R.drawable.actionbar_menu_down);

            mDialtactsActionBarController.setActionMenuIcon(R.drawable.actionbar_menu_down);
        }
    });

}