Example usage for android.widget ImageView setScaleY

List of usage examples for android.widget ImageView setScaleY

Introduction

In this page you can find the example usage for android.widget ImageView setScaleY.

Prototype

public void setScaleY(float scaleY) 

Source Link

Document

Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width.

Usage

From source file:com.scigames.registration.ProfileActivity.java

public void onResultsSucceeded(String[] serverResponseStrings, JSONObject serverResponseJSON)
        throws JSONException {

    //for debugging:
    //      alertDialog.setTitle("incoming:");
    //      alertDialog.setMessage("active: " + serverResponseStrings[2] +
    //            "      mass: " + serverResponseStrings[5] + 
    //            "      firstName: " + serverResponseStrings[2] + 
    //            "      lastName: " + serverResponseStrings[3] + 
    //            "      pw: " + serverResponseStrings[8] + 
    //            "      classId: " + serverResponseStrings[14] + 
    //            "      rfid: " + serverResponseStrings[9]
    //            );
    //      alertDialog.show();

    //download photo
    ImageView profilePhoto = (ImageView) findViewById(R.id.imageView1);
    profilePhoto.setTag(photoUrl);/* ww  w . ja  va 2s. c o m*/
    profilePhoto.setScaleX(1.4f);
    profilePhoto.setScaleY(1.4f);
    profilePhoto.setX(120f);
    profilePhoto.setY(123f);
    photoTask.cancel(true);
    photoTask = new DownloadProfilePhoto(ProfileActivity.this, photoUrl);
    //AsyncTask<ImageView, Void, Bitmap> pPhoto = 
    photoTask.execute(profilePhoto);

    //update all text fields
    Resources res = getResources();

    //TextView greets = (TextView)findViewById(R.id.greeting);
    greets.setText(String.format(res.getString(R.string.profile_name), serverResponseStrings[2],
            serverResponseStrings[3]));

    //TextView fname = (TextView)findViewById(R.id.first_name);
    //        fname.setText(String.format(res.getString(R.string.profile_first_name), serverResponseStrings[2]));
    //        
    //        //TextView lname = (TextView)findViewById(R.id.last_name);
    //        lname.setText(String.format(res.getString(R.string.profile_last_name), serverResponseStrings[3]));

    //TextView school = (TextView)findViewById(R.id.school_name);
    //schoolname.setText(String.format(res.getString(R.string.profile_school_name), serverResponseStrings[14]));

    //TextView teacher = (TextView)findViewById(R.id.teacher_name);
    teachername.setText(String.format(res.getString(R.string.profile_teacher_name), serverResponseStrings[13]));

    //TextView classid = (TextView)findViewById(R.id.class_id);
    classid.setText(String.format(res.getString(R.string.profile_classid), serverResponseStrings[14]));

    //        TextView mmass = (TextView)findViewById(R.id.mass);
    classname.setText(String.format(res.getString(R.string.profile_classname), serverResponseStrings[12]));

    //TextView mpass = (TextView)findViewById(R.id.password);
    mpass.setText(String.format(res.getString(R.string.profile_password), serverResponseStrings[8]));

    //        TextView mRfid = (TextView)findViewById(R.id.rfid);
    //        mRfid.setText(String.format(res.getString(R.string.profile_rfid), serverResponseStrings[9]));

    setTextViewFont(Museo500Regular, teachername, classid, mpass, classname);
    setTextViewFont(Museo700Regular, greets);

    Log.d(TAG, "...Profile Info");

}

From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java

@SuppressWarnings("deprecation")
public View getServiceView() {

    boolean sameLayout = GeneralResolver.isSameLayoutForLandscape(mContext);
    int inflateId = 0;
    if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) {
        inflateId = R.layout.panel_layout;
    } else {/*from w  ww  .j  a  va2 s  .  co  m*/
        inflateId = R.layout.panel_layout_land;
    }

    View view = LayoutInflater.from(mContext).inflate(inflateId, null, false);

    final DragViewGroup dragView = (DragViewGroup) view.findViewById(R.id.panel_drag_handler);
    dragView.setBackgroundDrawable(ColorsResolver.getBackgroundDrawable(mContext));

    if (ConstantHolder.getIsDebug()) {
        initTestVersionText(dragView);
    }

    ViewGroup viewToHide;
    if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) {
        LinearLayout panelsContainer = (LinearLayout) dragView.findViewById(R.id.panels_container);
        viewToHide = panelsContainer;
        if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT) {
            panelsContainer.setTranslationY(GeneralResolver.getPanelsOffset(mContext));
        }

        List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext);
        if (ShortcutsResolver.isShortcutsEnabled(mContext)) {
            ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.SHORTCUTS.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(svFactory.getShortcutsSectionView());
        }

        if (MusicResolver.isMusicPanelEnabled(mContext)) {
            MusicViewFactory mvFactory = new MusicViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.MUSIC.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(mvFactory.getMusicView());
        }

        if (TogglesResolver.isTogglesEnabled(mContext)) {
            TogglesViewFactory tvFactory = new TogglesViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.TOGGLES.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(tvFactory.getTogglesSectionView());
        }

        if (InfoResolver.isInfoPanelEnabled(mContext)) {
            InfoViewFactory ivFactory = new InfoViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.INFO.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(ivFactory.getInfoView());
        }

        if (NotificationsResolver.isNotificationsEnabled(mContext)) {
            final ImageView fakeNotificationsButton = (ImageView) dragView
                    .findViewById(R.id.notifications_button_fake);
            PressImageView notificationsButton = (PressImageView) dragView
                    .findViewById(R.id.notifications_button);
            fakeNotificationsButton.setVisibility(View.VISIBLE);
            notificationsButton.setVisibility(View.VISIBLE);
            fakeNotificationsButton.setImageResource(R.drawable.ic_notification_switch);
            fakeNotificationsButton.setColorFilter(ColorsResolver.getActiveColor(mContext));
            final float SCALE = 1.5f;
            fakeNotificationsButton.setScaleX(SCALE);
            fakeNotificationsButton.setScaleY(SCALE);
            notificationsButton.setOnPressedStateChangeListener(new OnPressedStateChangeListener() {
                private final int BG_COLOR = ColorsResolver.getPressedColor(mContext);

                @Override
                public void onPressedStateChange(ImageView v, boolean pressed) {
                    if (pressed) {
                        fakeNotificationsButton.setBackgroundColor(BG_COLOR);
                    } else {
                        fakeNotificationsButton.setBackgroundColor(0x00000000);
                    }
                }
            });

            NotificationViewFactory nvFactory = new NotificationViewFactory(mContext);
            ViewGroup notificationsView = nvFactory.getNotificationsView();
            notificationsView.setAlpha(0.0f);
            notificationsView.setVisibility(View.INVISIBLE);
            FrameLayout notificationsContainer = (FrameLayout) dragView
                    .findViewById(R.id.notifications_section);
            notificationsContainer.addView(notificationsView);
            notificationsButton
                    .setOnClickListener(new NotificationButtonClickListener(viewToHide, notificationsView));
        }

    } else {

        ViewPager pager = (ViewPager) view.findViewById(R.id.landscape_pager);
        viewToHide = pager;
        List<View> views = new ArrayList<View>();

        if (NotificationsResolver.isNotificationsEnabled(mContext)) {
            NotificationViewFactory nvFactory = new NotificationViewFactory(mContext);
            ViewGroup notificationsView = nvFactory.getNotificationsView();
            views.add(notificationsView);
        }

        List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext);
        for (String t : panelsOrder) {
            PanelType type = PanelType.valueOf(t);
            View v = null;
            FrameLayout container = (FrameLayout) LayoutInflater.from(mContext)
                    .inflate(R.layout.panel_section_land, null, false);
            switch (type) {
            case INFO:
                //     
                if (InfoResolver.isInfoPanelEnabled(mContext)) {
                    InfoViewFactory ivFactory = new InfoViewFactory(mContext);
                    FrameLayout fourthSection = (FrameLayout) view.findViewById(R.id.fourth_section);
                    fourthSection.addView(ivFactory.getInfoView());
                }
                break;
            case MUSIC:
                if (MusicResolver.isMusicPanelEnabled(mContext)) {
                    MusicViewFactory mvFactory = new MusicViewFactory(mContext);
                    v = mvFactory.getMusicView();
                }
                break;
            case SHORTCUTS:
                if (ShortcutsResolver.isShortcutsEnabled(mContext)) {
                    ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext);
                    v = svFactory.getShortcutsSectionView();
                }
                break;
            case TOGGLES:
                if (TogglesResolver.isTogglesEnabled(mContext)) {
                    TogglesViewFactory tvFactory = new TogglesViewFactory(mContext);
                    v = tvFactory.getTogglesSectionView();
                }
                break;
            }

            if (v != null) {
                views.add(v);
                container.addView(v);
            }
        }

        LandscapePanelsAdapter adapter = new LandscapePanelsAdapter(views);
        pager.setAdapter(adapter);
        pager.setOverScrollMode(View.OVER_SCROLL_NEVER);
        pager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGES_COUNT);
        pager.setPageMargin(mContext.getResources().getDimensionPixelSize(R.dimen.pager_margin));
    }

    return view;
}