Example usage for android.graphics.drawable Drawable getIntrinsicWidth

List of usage examples for android.graphics.drawable Drawable getIntrinsicWidth

Introduction

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

Prototype

public int getIntrinsicWidth() 

Source Link

Document

Returns the drawable's intrinsic width.

Usage

From source file:de.gebatzens.sia.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(SIAApp.SIA_APP.school.getTheme());
    super.onCreate(savedInstanceState);
    Log.w("ggvp", "CREATE NEW MAINACTIVITY");
    //Debug.startMethodTracing("sia3");
    SIAApp.SIA_APP.activity = this;
    savedState = savedInstanceState;/*from w w w . j  ava 2 s.  c o  m*/

    final FragmentData.FragmentList fragments = SIAApp.SIA_APP.school.fragments;

    Intent intent = getIntent();
    if (intent != null && intent.getStringExtra("fragment") != null) {
        FragmentData frag = fragments
                .getByType(FragmentData.FragmentType.valueOf(intent.getStringExtra("fragment"))).get(0);
        SIAApp.SIA_APP.setFragmentIndex(fragments.indexOf(frag));
    }

    if (intent != null && intent.getBooleanExtra("reload", false)) {
        SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));
        intent.removeExtra("reload");
    }

    setContentView(R.layout.activity_main);

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    mContent = getFragment();
    transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
    transaction.commit();

    Log.d("ggvp", "DATA: " + fragments.get(SIAApp.SIA_APP.getFragmentIndex()).getData());
    if (fragments.get(SIAApp.SIA_APP.getFragmentIndex()).getData() == null)
        SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));

    if ("Summer".equals(SIAApp.SIA_APP.getCurrentThemeName())) {
        ImageView summerNavigationPalm = (ImageView) findViewById(R.id.summer_navigation_palm);
        summerNavigationPalm.setImageResource(R.drawable.summer_palm);
        ImageView summerBackgroundImage = (ImageView) findViewById(R.id.summer_background_image);
        summerBackgroundImage.setImageResource(R.drawable.summer_background);
    }

    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {

            switch (menuItem.getItemId()) {
            case R.id.action_refresh:
                ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh)).setRefreshing(true);
                SIAApp.SIA_APP.refreshAsync(new Runnable() {
                    @Override
                    public void run() {
                        ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh))
                                .setRefreshing(false);
                    }
                }, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));
                return true;
            case R.id.action_settings:
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivityForResult(i, 1);
                return true;
            case R.id.action_addToCalendar:
                showExamDialog();
                return true;
            case R.id.action_help:
                AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                builder.setTitle(getApplication().getString(R.string.help));
                builder.setMessage(getApplication().getString(R.string.exam_explain));
                builder.setPositiveButton(getApplication().getString(R.string.close),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        });
                builder.create().show();
                return true;
            }

            return false;
        }
    });

    updateToolbar(SIAApp.SIA_APP.school.name, fragments.get(SIAApp.SIA_APP.getFragmentIndex()).name);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SIAApp.SIA_APP.setStatusBarColorTransparent(getWindow()); // because of the navigation drawer
    }

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolBar, R.string.drawer_open,
            R.string.drawer_close) {

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    navigationView = (NavigationView) findViewById(R.id.navigation_view);
    mNavigationHeader = navigationView.getHeaderView(0);
    mNavigationSchoolpictureText = (TextView) mNavigationHeader.findViewById(R.id.drawer_image_text);
    mNavigationSchoolpictureText.setText(SIAApp.SIA_APP.school.name);
    mNavigationSchoolpicture = (ImageView) mNavigationHeader.findViewById(R.id.navigation_schoolpicture);
    mNavigationSchoolpicture.setImageBitmap(SIAApp.SIA_APP.school.loadImage());
    mNavigationSchoolpictureLink = mNavigationHeader.findViewById(R.id.navigation_schoolpicture_link);
    mNavigationSchoolpictureLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewIn) {
            mDrawerLayout.closeDrawers();
            Intent linkIntent = new Intent(Intent.ACTION_VIEW);
            linkIntent.setData(Uri.parse(SIAApp.SIA_APP.school.website));
            startActivity(linkIntent);
        }
    });

    final Menu menu = navigationView.getMenu();
    menu.clear();
    for (int i = 0; i < fragments.size(); i++) {
        MenuItem item = menu.add(R.id.fragments, Menu.NONE, i, fragments.get(i).name);
        item.setIcon(fragments.get(i).getIconRes());
    }

    menu.add(R.id.settings, R.id.settings_item, fragments.size(), R.string.settings);
    menu.setGroupCheckable(R.id.fragments, true, true);
    menu.setGroupCheckable(R.id.settings, false, false);

    final Menu navMenu = navigationView.getMenu();
    selectedItem = SIAApp.SIA_APP.getFragmentIndex();
    if (selectedItem != -1)
        navMenu.getItem(selectedItem).setChecked(true);

    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(MenuItem menuItem) {
            if (menuItem.getItemId() == R.id.settings_item) {
                mDrawerLayout.closeDrawers();
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivityForResult(i, 1);
            } else {
                final int index = menuItem.getOrder();
                if (SIAApp.SIA_APP.getFragmentIndex() != index) {
                    SIAApp.SIA_APP.setFragmentIndex(index);
                    menuItem.setChecked(true);
                    updateToolbar(SIAApp.SIA_APP.school.name, menuItem.getTitle().toString());
                    mContent = getFragment();
                    Animation fadeOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
                    fadeOut.setAnimationListener(new Animation.AnimationListener() {

                        @Override
                        public void onAnimationStart(Animation animation) {

                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                            contentFrame.setVisibility(View.INVISIBLE);
                            if (fragments.get(index).getData() == null)
                                SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(index));

                            //removeAllFragments();

                            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                            transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
                            transaction.commit();

                            snowView.updateSnow();
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });
                    FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                    contentFrame.startAnimation(fadeOut);
                    mDrawerLayout.closeDrawers();
                } else {
                    mDrawerLayout.closeDrawers();
                }
            }
            return true;
        }
    });

    if (Build.VERSION.SDK_INT >= 25) {
        ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
        shortcutManager.removeAllDynamicShortcuts();

        for (int i = 0; i < fragments.size(); i++) {
            Drawable drawable = getDrawable(fragments.get(i).getIconRes());
            Bitmap icon;
            if (drawable instanceof VectorDrawable) {
                icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(),
                        Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(icon);
                drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
                drawable.draw(canvas);
            } else {
                icon = BitmapFactory.decodeResource(getResources(), fragments.get(i).getIconRes());
            }

            Bitmap connectedIcon = Bitmap.createBitmap(icon.getWidth(), icon.getHeight(),
                    Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(connectedIcon);
            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setColor(Color.parseColor("#f5f5f5"));
            canvas.drawCircle(icon.getWidth() / 2, icon.getHeight() / 2, icon.getWidth() / 2, paint);
            paint.setColorFilter(
                    new PorterDuffColorFilter(SIAApp.SIA_APP.school.getColor(), PorterDuff.Mode.SRC_ATOP));
            canvas.drawBitmap(icon, null, new RectF(icon.getHeight() / 4.0f, icon.getHeight() / 4.0f,
                    icon.getHeight() - icon.getHeight() / 4.0f, icon.getHeight() - icon.getHeight() / 4.0f),
                    paint);

            Intent newTaskIntent = new Intent(this, MainActivity.class);
            newTaskIntent.setAction(Intent.ACTION_MAIN);
            newTaskIntent.putExtra("fragment", fragments.get(i).type.toString());

            ShortcutInfo shortcut = new ShortcutInfo.Builder(this, fragments.get(i).name)
                    .setShortLabel(fragments.get(i).name).setLongLabel(fragments.get(i).name)
                    .setIcon(Icon.createWithBitmap(connectedIcon)).setIntent(newTaskIntent).build();

            shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut));
        }
    }

    if (SIAApp.SIA_APP.preferences.getBoolean("app_130_upgrade", true)) {
        if (!SIAApp.SIA_APP.preferences.getBoolean("first_use_filter", true)) {
            TextDialog.newInstance(R.string.upgrade1_3title, R.string.upgrade1_3)
                    .show(getSupportFragmentManager(), "upgrade_dialog");
        }

        SIAApp.SIA_APP.preferences.edit().putBoolean("app_130_upgrade", false).apply();
    }

    snowView = (SnowView) findViewById(R.id.snow_view);

    shareToolbar = (Toolbar) findViewById(R.id.share_toolbar);
    shareToolbar.getMenu().clear();
    shareToolbar.inflateMenu(R.menu.share_toolbar_menu);
    shareToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            toggleShareToolbar(false);
            for (Shareable s : MainActivity.this.shared) {
                s.setMarked(false);
            }
            MainActivity.this.shared.clear();

            mContent.updateFragment();
        }
    });

    shareToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            toggleShareToolbar(false);

            HashMap<Date, ArrayList<Shareable>> dates = new HashMap<Date, ArrayList<Shareable>>();

            for (Shareable s : MainActivity.this.shared) {
                ArrayList<Shareable> list = dates.get(s.getDate());
                if (list == null) {
                    list = new ArrayList<Shareable>();
                    dates.put(s.getDate(), list);
                }

                list.add(s);

                s.setMarked(false);
            }
            MainActivity.this.shared.clear();

            List<Date> dateList = new ArrayList<Date>(dates.keySet());
            Collections.sort(dateList);
            String content = "";

            for (Date key : dateList) {
                content += SubstListAdapter.translateDay(key) + "\n\n";

                Collections.sort(dates.get(key));
                for (Shareable s : dates.get(key)) {
                    content += s.getShareContent() + "\n";
                }

                content += "\n";
            }

            content = content.substring(0, content.length() - 1);

            mContent.updateFragment();

            if (item.getItemId() == R.id.action_copy) {
                ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);

                ClipData clip = ClipData.newPlainText(getString(R.string.entries), content);
                clipboard.setPrimaryClip(clip);
            } else if (item.getItemId() == R.id.action_share) {
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TEXT, content);
                sendIntent.setType("text/plain");
                startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
            }

            return true;
        }
    });

    if (shared.size() > 0) {
        shareToolbar.setVisibility(View.VISIBLE);
        updateShareToolbarText();
    }

    // if a fragment is opened via a notification or a shortcut reset the shared entries
    // delete extra fragment because the same intent is used when the device gets rotated and the user could have opened a new fragment
    if (intent != null && intent.hasExtra("fragment")) {
        resetShareToolbar();
        intent.removeExtra("fragment");
    }

}

From source file:com.appunite.list.FastScroller.java

private void useThumbDrawable(Context context, Drawable drawable) {
    mThumbDrawable = drawable;//  ww w  .j  av a 2  s  . c o  m
    if (drawable instanceof NinePatchDrawable) {
        mThumbW = context.getResources().getDimensionPixelSize(R.dimen.fastscroll_thumb_width);
        mThumbH = context.getResources().getDimensionPixelSize(R.dimen.fastscroll_thumb_height);
    } else {
        mThumbW = drawable.getIntrinsicWidth();
        mThumbH = drawable.getIntrinsicHeight();
    }
    mChangedBounds = true;
}

From source file:com.nihaskalam.progressbuttonlibrary.CircularProgressButton.java

private void setIcon(int icon) {
    Drawable drawable = ContextCompat.getDrawable(getContext(), icon);//getResources().getDrawable(icon);
    if (drawable != null) {
        int padding = (getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);
        setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
        setPadding(padding, 0, 0, 0);/*from w w w.ja va 2  s. c  o m*/
    }
}

From source file:com.tpos.widget.pagertab.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//from  w ww  . j  a v a  2  s .com
            }
        }

        // steven add
        if (pager.getAdapter() instanceof IconTextTabProvider) {
            if (v instanceof TextView) {
                Drawable tDrawable = null;
                try {
                    tDrawable = getResources()
                            .getDrawable(((IconTextTabProvider) pager.getAdapter()).getPageIconResId(i));
                } catch (NotFoundException e) {
                    e.printStackTrace();
                    tDrawable = null;
                }
                if (tDrawable != null) {
                    tDrawable.setBounds(0, 0, (int) (tDrawable.getIntrinsicWidth() * 0.5),
                            (int) (tDrawable.getIntrinsicHeight() * 0.5));
                    ((TextView) v).setCompoundDrawables(null, tDrawable, null, null);
                }
            }
        }
    }

}

From source file:com.shizhefei.view.largeimage.LargeImageView.java

private void updateDrawable(Drawable d) {
    if (mDrawable != null) {
        mDrawable.setCallback(null);//from  www .j a  v  a2  s .  co m
        unscheduleDrawable(mDrawable);
    }
    mDrawable = d;
    if (d != null) {
        d.setCallback(this);
        DrawableCompat.setLayoutDirection(d, DrawableCompat.getLayoutDirection(d));
        if (d.isStateful()) {
            d.setState(getDrawableState());
        }
        d.setVisible(getVisibility() == VISIBLE, true);
        d.setLevel(mLevel);
        mDrawableWidth = d.getIntrinsicWidth();
        mDrawableHeight = d.getIntrinsicHeight();
    } else {
        mDrawableWidth = mDrawableHeight = -1;
    }
}

From source file:com.guodong.sun.guodong.widget.ZoomImageView.java

/**
 * ?ImageView?//w  w  w .  j  ava  2 s.  com
 */
@Override
public void onGlobalLayout() {

    if (mOnce) {

        // ?
        Drawable d = getDrawable();
        if (d == null) {
            return;
        }

        // 
        int width = getWidth();
        int height = getHeight();

        int dWidth = d.getIntrinsicWidth();
        int dHeight = d.getIntrinsicHeight();

        float scale = 1.0f;

        // ??
        if (dWidth > width && dHeight <= height) {
            scale = width * 1.0f / dWidth;
        }

        // ??
        if (dHeight > height && dWidth <= width) {
            scale = height * 1.0f / dHeight;
        }

        // ?
        // ??
        if ((dWidth > width && dHeight > height) || (dWidth < width && dHeight < height)) {

            scale = Math.min(width * 1.0f / dWidth, height * 1.0f / dHeight);
        }

        // ?
        mMinScale = scale;
        mMidScale = mMinScale * 2f;
        mMaxScale = mMinScale * 4f;

        // ?X?Y?
        int dX = (width - dWidth) / 2;
        int dY = (height - dHeight) / 2;
        // 
        mScaleMatrix.postTranslate(dX, dY);
        mScaleMatrix.postScale(mMinScale, mMinScale, width / 2, height / 2);
        setImageMatrix(mScaleMatrix);

        mOnce = false;
    }
}

From source file:es.eucm.eadandroid.utils.ViewPagerIndicator.java

/**
 * Add drawables for arrows/*w  w  w.j  av  a  2  s.  co m*/
 * 
 * @param prev Left pointing arrow
 * @param next Right pointing arrow
 */
public void setArrows(Drawable prev, Drawable next) {
    this.mPrevArrow = new ImageView(getContext());
    this.mPrevArrow.setImageDrawable(prev);
    if (this.startPos == 0)
        this.mPrevArrow.setVisibility(INVISIBLE);

    this.mNextArrow = new ImageView(getContext());
    this.mNextArrow.setImageDrawable(next);

    LinearLayout.LayoutParams arrowLayoutParams = new LinearLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
    arrowLayoutParams.gravity = Gravity.CENTER;

    mPreviousGroup.removeAllViews();
    mPreviousGroup.addView(mPrevArrow, arrowLayoutParams);
    mPreviousGroup.addView(mPrevious, arrowLayoutParams);

    mPrevious.setPadding(PADDING, 0, 0, 0);
    mNext.setPadding(0, 0, PADDING, 0);

    mArrowPadding = PADDING + prev.getIntrinsicWidth();

    mNextGroup.addView(mNextArrow, arrowLayoutParams);
}

From source file:it.configure.imageloader.zoom.PhotoViewAttacher.java

/**
 * Calculate Matrix for FIT_CENTER/*ww  w  .ja  v a2s .com*/
 * 
 * @param d - Drawable being displayed
 */
private void updateBaseMatrix(Drawable d) {
    ImageView imageView = getImageView();
    if (null == imageView || null == d) {
        return;
    }

    final float viewWidth = imageView.getWidth();
    final float viewHeight = imageView.getHeight();
    final int drawableWidth = d.getIntrinsicWidth();
    final int drawableHeight = d.getIntrinsicHeight();

    mBaseMatrix.reset();

    final float widthScale = viewWidth / drawableWidth;
    final float heightScale = viewHeight / drawableHeight;

    if (mScaleType == ScaleType.CENTER) {
        mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2F, (viewHeight - drawableHeight) / 2F);

    } else if (mScaleType == ScaleType.CENTER_CROP) {
        float scale = Math.max(widthScale, heightScale);
        mBaseMatrix.postScale(scale, scale);
        mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,
                (viewHeight - drawableHeight * scale) / 2F);

    } else if (mScaleType == ScaleType.CENTER_INSIDE) {
        float scale = Math.min(1.0f, Math.min(widthScale, heightScale));
        mBaseMatrix.postScale(scale, scale);
        mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,
                (viewHeight - drawableHeight * scale) / 2F);

    } else {
        RectF mTempSrc = new RectF(0, 0, drawableWidth, drawableHeight);
        RectF mTempDst = new RectF(0, 0, viewWidth, viewHeight);

        switch (mScaleType) {
        case FIT_CENTER:
            mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER);
            break;

        case FIT_START:
            mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START);
            break;

        case FIT_END:
            mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END);
            break;

        case FIT_XY:
            mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL);
            break;

        default:
            break;
        }
    }

    resetMatrix();
}

From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java

private void init(Context mContext) {
    //?//  w w w.  j  a v  a2s. co m
    drawables = new Drawable[7];
    Drawable love_0 = ContextCompat.getDrawable(mContext, R.drawable.love_heart1);
    Drawable love_1 = ContextCompat.getDrawable(mContext, R.drawable.love_heart2);
    Drawable love_2 = ContextCompat.getDrawable(mContext, R.drawable.love_heart3);
    Drawable love_3 = ContextCompat.getDrawable(mContext, R.drawable.love_heart4);
    Drawable love_4 = ContextCompat.getDrawable(mContext, R.drawable.love_heart5);
    Drawable love_5 = ContextCompat.getDrawable(mContext, R.drawable.love_heart6);
    Drawable love_6 = ContextCompat.getDrawable(mContext, R.drawable.love_heart7);

    drawables[0] = love_0;
    drawables[1] = love_1;
    drawables[2] = love_2;
    drawables[3] = love_3;
    drawables[4] = love_4;
    drawables[5] = love_5;
    drawables[6] = love_6;
    //? ??
    //? 3?,??
    dHeight = love_0.getIntrinsicHeight();
    dWidth = love_0.getIntrinsicWidth();

    //  
    lp = new LayoutParams(dWidth, dHeight);
    lp.addRule(CENTER_HORIZONTAL, TRUE);//TRUE ?? ?true
    lp.addRule(ALIGN_PARENT_BOTTOM, TRUE);

    // ??
    interpolators = new Interpolator[4];
    interpolators[0] = line;
    interpolators[1] = acc;
    interpolators[2] = dce;
    interpolators[3] = accdec;
}

From source file:baizhuan.hangzhou.com.gankcopy.view.customview.photoview.PhotoViewAttacher.java

/**
 * Helper method that maps the supplied Matrix to the current Drawable
 *
 * @param matrix - Matrix to map Drawable against
 * @return RectF - Displayed Rectangle/* w w  w . j a  v a  2s .  co  m*/
 */
private RectF getDisplayRect(Matrix matrix) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        Drawable d = imageView.getDrawable();
        if (null != d) {
            mDisplayRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
            matrix.mapRect(mDisplayRect);
            return mDisplayRect;
        }
    }
    return null;
}