Thingse/app/src/main/java/com/daneshzaki/thingse/ViewFullscreen.java
//fill fields with selected thing's values
fill fields with selected thing's values
fill fields with selected thing ' s values
private void loadValues()
    {
        if (bundle == null)
        {
            return;
        }
        Log.i("ViewFullScreen", "bundle is " + bundle.toString());
        ImageView thingImage = ((ImageView)findViewById(R.id.thingImage));
        thingImage.setOnTouchListener(this);
        if(bundle.getString("picLocation")!= null && bundle.getString("picLocation").trim().length() > 0)
        {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            options.inDither = false;
            if (options.outWidth > 3000 || options.outHeight > 2000)
            {
                options.inSampleSize = 5;
            } else if (options.outWidth > 2000 || options.outHeight > 1500)
            {
                options.inSampleSize = 4;
            } else if (options.outWidth > 1000 || options.outHeight > 1000)
            {
                options.inSampleSize = 3;
            }
            options.inJustDecodeBounds = false;
            Bitmap bmp = BitmapFactory.decodeFile(bundle.getString("picLocation"), options);
            Display display = getWindowManager().getDefaultDisplay();
            Point size = new Point();
            display.getSize(size);
            int width = size.x;
            int height = size.y;
            int ratio = bmp.getWidth() / bmp.getHeight();
            if (ratio <=0)
            {
                ratio = 1;
            }
            bmp = Bitmap.createScaledBitmap(bmp, (int) (height * ratio), height, false);
            Drawable d = new BitmapDrawable(getResources(), bmp);
            thingImage.setImageDrawable(d);
        }
        else
        {
            thingImage.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.1f));
            thingImage.setImageResource(R.drawable.ic_launcher);
        }
    }
private void loadValues ( ) { if ( bundle == null ) { return ; } Log . i ( "ViewFullScreen" , "bundle is " + bundle . toString ( ) ) ; ImageView thingImage = ( ( ImageView ) findViewById ( R . id . thingImage ) ) ; thingImage . setOnTouchListener ( this ) ; if ( bundle . getString ( "picLocation" ) != null && bundle . getString ( "picLocation" ) . trim ( ) . length ( ) > 0 ) { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; options . inDither = false ; if ( options . outWidth > 3000 || options . outHeight > 2000 ) { options . inSampleSize = 5 ; } else if ( options . outWidth > 2000 || options . outHeight > 1500 ) { options . inSampleSize = 4 ; } else if ( options . outWidth > 1000 || options . outHeight > 1000 ) { options . inSampleSize = 3 ; } options . inJustDecodeBounds = false ; Bitmap bmp = BitmapFactory . decodeFile ( bundle . getString ( "picLocation" ) , options ) ; Display display = getWindowManager ( ) . getDefaultDisplay ( ) ; Point size = new Point ( ) ; display . getSize ( size ) ; int width = size . x ; int height = size . y ; int ratio = bmp . getWidth ( ) / bmp . getHeight ( ) ; if ( ratio <= 0 ) { ratio = 1 ; } bmp = Bitmap . createScaledBitmap ( bmp , ( int ) ( height * ratio ) , height , false ) ; Drawable d = new BitmapDrawable ( getResources ( ) , bmp ) ; thingImage . setImageDrawable ( d ) ; } else { thingImage . setLayoutParams ( new LinearLayout . LayoutParams ( LinearLayout . LayoutParams . WRAP_CONTENT , LinearLayout . LayoutParams . WRAP_CONTENT , 0.1f ) ) ; thingImage . setImageResource ( R . drawable . ic_launcher ) ; } }
fill fields with selected thing's values
fill fields with selected thing ' s values
//scale and set pic //9-Sep-2015 scale large images //get display size //handle wide images //set a default image if there is no associated pic with this thing