Example usage for android.graphics Color argb

List of usage examples for android.graphics Color argb

Introduction

In this page you can find the example usage for android.graphics Color argb.

Prototype

@ColorInt
public static int argb(float alpha, float red, float green, float blue) 

Source Link

Document

Return a color-int from alpha, red, green, blue float components in the range \([0..1]\).

Usage

From source file:hu.py82c7.homework.view.BezelImageView.java

public BezelImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Attribute initialization
    final TypedArray a = context.obtainStyledAttributes(attrs, hu.py82c7.homework.R.styleable.BezelImageView,
            defStyle, hu.py82c7.homework.R.style.BezelImageView);

    mMaskDrawable = a.getDrawable(hu.py82c7.homework.R.styleable.BezelImageView_biv_maskDrawable);
    if (mMaskDrawable != null) {
        mMaskDrawable.setCallback(this);
    }/* w ww  .  j  a  va 2s . c om*/

    mDrawCircularShadow = a.getBoolean(hu.py82c7.homework.R.styleable.BezelImageView_biv_drawCircularShadow,
            true);

    mSelectorColor = a.getColor(hu.py82c7.homework.R.styleable.BezelImageView_biv_selectorOnPress, 0);

    a.recycle();

    // Other initialization
    mBlackPaint = new Paint();
    mBlackPaint.setColor(0xff000000);

    mMaskedPaint = new Paint();
    mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));

    // Always want a cache allocated.
    mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);

    // Create a desaturate color filter for pressed state.
    ColorMatrix cm = new ColorMatrix();
    cm.setSaturation(0);
    mDesaturateColorFilter = new ColorMatrixColorFilter(cm);

    //create a selectorFilter if we already have a color
    if (mSelectorColor != 0) {
        this.mSelectorFilter = new PorterDuffColorFilter(Color.argb(mSelectorAlpha, Color.red(mSelectorColor),
                Color.green(mSelectorColor), Color.blue(mSelectorColor)), PorterDuff.Mode.SRC_ATOP);
    }
}

From source file:com.mk4droid.IMC_Utils.GEO.java

/**
 * Draw polygon borders on the map defining the municipality
 * //from w  ww .  j  ava 2s .c o m
 * @param mgmap
 * @param resources
 */
public static Polygon MakeBorders(GoogleMap mgmap, Resources res) {

    String str = "";
    // parse from raw.polygoncoords.txt
    try {
        InputStream in_s = res.openRawResource(R.raw.polygoncoords);
        byte[] b = new byte[in_s.available()];
        in_s.read(b);
        str = new String(b);
    } catch (Exception e) {
        Log.e("Error", "can't read polygon.");
    }

    Polygon mPoly = null;

    if (options == null) {
        if (str.length() > 0) {
            String[] points = str.split(" ");
            options = new PolygonOptions();
            for (int i = 0; i < points.length; i = i + 2)
                options.add(new LatLng(Double.parseDouble(points[i + 1]), Double.parseDouble(points[i])));
        }
    }

    if (mgmap != null)
        mPoly = mgmap.addPolygon(
                options.strokeWidth(4).strokeColor(Color.BLACK).fillColor(Color.argb(10, 0, 100, 0)));

    return mPoly;
}

From source file:com.esri.arcgisruntime.sample.transformsbysuitability.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the list of transformations
    final ListView tableList = findViewById(R.id.transforms_list);
    mTransformAdapter = new DatumTransformationAdapter(this, mTransformValues);
    tableList.setAdapter(mTransformAdapter);
    tableList.setOnItemClickListener((AdapterView<?> adapterView, View view, int i, long l) -> {

        view.setSelected(true);/*from  w  w  w . j ava  2s .com*/

        // Get the datum transformation selected by the user
        DatumTransformation selectedTransform = (DatumTransformation) adapterView.getAdapter().getItem(i);

        Point projectedGeometry;
        try {
            // Use the selected transformation to reproject the Geometry
            projectedGeometry = (Point) GeometryEngine.project(mOriginalGeometry,
                    mMapView.getSpatialReference(), selectedTransform);

        } catch (ArcGISRuntimeException agsEx) {
            // Catch errors thrown from project method. If a transformation is missing grid files, then it cannot be
            // successfully used to project a geometry, and will throw an exception.
            Snackbar.make(tableList,
                    agsEx.getMessage() + "\n" + getResources().getString(R.string.transform_missing_files),
                    Snackbar.LENGTH_LONG).show();
            removeProjectedGeometryGraphic();
            return;
        }

        // Add projected geometry as a second graphic - use a cross symbol which ensures the default transformation
        // graphic remains visible beneath this graphic.
        if (mProjectedGraphic == null) {
            mProjectedGraphic = addGraphic(projectedGeometry, Color.argb(255, 255, 0, 0),
                    SimpleMarkerSymbol.Style.CROSS);

        } else {
            // If graphic already set, just update the geometry
            mProjectedGraphic.setGeometry(projectedGeometry);
        }
    });

    // If the CheckBox is not checked (default), transformations should be ordered by suitability for the whole
    // spatial reference. If checked, then transformations will be ordered by suitability for the map extent.
    CheckBox checkBox = findViewById(R.id.order_by_check_box);
    checkBox.setOnCheckedChangeListener((CompoundButton compoundButton, boolean newCheckState) -> {
        // Store the new check state in a member variable and update the list of transformations.
        mUseExtentForSuitability = newCheckState;
        setupTransformsList();
    });

    // Get MapView from layout and set a map into this view
    mMapView = findViewById(R.id.mapView);
    mArcGISMap = new ArcGISMap(Basemap.createLightGrayCanvas());
    mMapView.setMap(mArcGISMap);

    // Create a geometry located in the Greenwich observatory courtyard in London, UK, the location of the
    // Greenwich prime meridian. This will be projected using the selected transformation.
    mOriginalGeometry = new Point(538985.355, 177329.516, SpatialReference.create(27700));

    // Add a Graphic to show the original geometry location, projected using the default transformation
    addGraphic(mOriginalGeometry, Color.argb(255, 0, 0, 255), SimpleMarkerSymbol.Style.SQUARE);

    mArcGISMap.addDoneLoadingListener(() -> {
        if (mArcGISMap.getLoadStatus() == LoadStatus.LOADED) {
            if (mTransformValues.size() == 0) {
                // Zoom to the initial default geometry at a suitable scale
                Viewpoint vp = new Viewpoint(mOriginalGeometry, 5000);
                mMapView.setViewpointAsync(vp, 2);

                // Once the map has loaded (which means the 'from' spatial reference is set), trigger populating the list
                // of transformations. Start by checking app has permissions to access local file storage, where projection
                // engine files for grid-based transformations are stored.
                checkPermissions();
            }
        }
    });
}

From source file:com.raja.knowme.FragmentProjects.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mHolderView = inflater.inflate(R.layout.fragment_projects, null);
    shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
    adapter = new ProjectsListAdapter(getActivity());
    functions = new AppCommonFunctions(getActivity());
    pref = new AppPreferences(getActivity());
    knowmeData = new KnowMeDataObject(getActivity());
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setCancelable(false);
    mProgressDialog.setMessage(getString(R.string.loading));

    projects_list = (ListView) mHolderView.findViewById(R.id.projects_listview);
    comapny_switcher = (TextSwitcher) mHolderView.findViewById(R.id.projects_company_name_text);
    instruction_btn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout);

    projects_list.setSelector(this.getResources().getDrawable(R.drawable.transparent_shape));

    if (!pref.getProjectsFirstRun()) {
        instruction_btn.setVisibility(RelativeLayout.GONE);
    }//from  w w  w. j a  v  a  2 s.c o  m

    instruction_btn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            pref.setProjectsRunned();
            instruction_btn.setVisibility(RelativeLayout.GONE);
        }
    });
    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        //  Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        comapny_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(16 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        // Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        comapny_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(14 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        // Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();
        comapny_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //  Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        comapny_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(48 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    //Undefined Size

    else {
        //  Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        comapny_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(20 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });
    }
    mProgressDialog.show();
    new LoadData().execute();

    // Gesture detection
    gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {

        public boolean onSingleTapUp(MotionEvent e) {
            return false;
        }

        public void onShowPress(MotionEvent e) {
        }

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }

        public void onLongPress(MotionEvent e) {
        }

        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH)
                    return false;
                /** Left swipe */
                if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count < (MAX_COUNT - 1))
                        nextCompany();
                    else {
                        comapny_switcher.startAnimation(shake);
                        projects_list.startAnimation(shake);
                    }
                    /** Right Swipe */
                } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count != 0)
                        previousComapny();
                    else {
                        comapny_switcher.startAnimation(shake);
                        projects_list.startAnimation(shake);
                    }
                }
            } catch (Exception e) {
            }

            return false;
        }

        public boolean onDown(MotionEvent e) {
            return false;
        }
    });

    gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    projects_list.setOnTouchListener(gestureListener);
    return mHolderView;
}

From source file:com.raja.knowme.FragmentProfile.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mHolderView = inflater.inflate(R.layout.fragment_profile, null);
    shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
    functions = new AppCommonFunctions(getActivity());
    pref = new AppPreferences(getActivity());
    knowmeData = new KnowMeDataObject(getActivity());
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setCancelable(false);
    mProgressDialog.setMessage(getString(R.string.loading));

    mHeaderSwitcher = (TextSwitcher) mHolderView.findViewById(R.id.profile_subheader_text);
    mBodySwitcher = (TextSwitcher) mHolderView.findViewById(R.id.profile_body_text);
    mScrollview = (ScrollView) mHolderView.findViewById(R.id.profile_scrollview);
    mInstructionBtn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout);

    if (!pref.getProfileFirstRun()) {
        mInstructionBtn.setVisibility(RelativeLayout.GONE);
    }/*from   w w w  .j  a  v  a2s  . c o  m*/

    mInstructionBtn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            pref.setProfileRunned();
            mInstructionBtn.setVisibility(RelativeLayout.GONE);
        }
    });

    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        // Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(6 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        //Toast.makeText(getActivity(),"normal" , Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(14 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(9 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        //Toast.makeText(getActivity(),"large" , Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(18 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        // Toast.makeText(getActivity(),"xlarge" , Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(48 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    //Undefined Size

    else {
        //  Toast.makeText(getActivity(),"undefined" , Toast.LENGTH_SHORT).show();

        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(20 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }
    mProgressDialog.show();
    new LoadData().execute();

    gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {

        public boolean onSingleTapUp(MotionEvent e) {
            return false;
        }

        public void onShowPress(MotionEvent e) {
        }

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }

        public void onLongPress(MotionEvent e) {
        }

        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH)
                    return false;
                /** Left swipe */
                if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count < (MAX_COUNT - 1))
                        nextDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                    /** Right Swipe */
                } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count != 0)
                        previousDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                }
            } catch (Exception e) {
            }

            return false;
        }

        public boolean onDown(MotionEvent e) {
            return false;
        }
    });

    gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    mScrollview.setOnTouchListener(gestureListener);
    return mHolderView;
}

From source file:com.raja.knowme.FragmentReferences.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mHolderView = inflater.inflate(R.layout.fragment_references, null);
    shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
    functions = new AppCommonFunctions(getActivity());
    pref = new AppPreferences(getActivity());
    knowmeData = new KnowMeDataObject(getActivity());
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setCancelable(false);
    mProgressDialog.setMessage(getString(R.string.loading));

    mHeaderSwitcher = (TextSwitcher) mHolderView.findViewById(R.id.references_subheader_text);
    mBodySwitcher = (TextSwitcher) mHolderView.findViewById(R.id.references_body_text);
    mScrollview = (ScrollView) mHolderView.findViewById(R.id.references_scrollview);
    mInstructionBtn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout);

    if (!pref.getReferencesFirstRun()) {
        mInstructionBtn.setVisibility(RelativeLayout.GONE);
    }/*from  www . ja  v  a 2s  .c  om*/

    mInstructionBtn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            pref.setReferencesRunned();
            mInstructionBtn.setVisibility(RelativeLayout.GONE);
        }
    });

    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        //  Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(6 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        //  Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(14 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(9 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        //   Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(18 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //   Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(48 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    //Undefined Size

    else {
        //  Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(20 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    mProgressDialog.show();
    new LoadData().execute();

    gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {

        public boolean onSingleTapUp(MotionEvent e) {
            return false;
        }

        public void onShowPress(MotionEvent e) {
        }

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }

        public void onLongPress(MotionEvent e) {
        }

        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH)
                    return false;
                /** Left swipe */
                if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count < (MAX_COUNT - 1))
                        nextDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                    /** Right Swipe */
                } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count != 0)
                        previousDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                }
            } catch (Exception e) {
            }

            return false;
        }

        public boolean onDown(MotionEvent e) {
            return false;
        }
    });

    gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    mScrollview.setOnTouchListener(gestureListener);
    return mHolderView;
}

From source file:com.example.jit.home.SlidingTabStrip.java

/**
 * Set the alpha value of the {@code color} to be the given {@code alpha} value.
 *//* w  ww  . j a va  2 s . c o m*/
private static int setColorAlpha(int color, byte alpha) {
    return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
}

From source file:com.raja.knowme.FragmentTestimonials.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mHolderView = inflater.inflate(R.layout.fragment_testimonials, null);
    shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
    functions = new AppCommonFunctions(getActivity());
    pref = new AppPreferences(getActivity());
    knowmeData = new KnowMeDataObject(getActivity());
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setCancelable(false);
    mProgressDialog.setMessage(getString(R.string.loading));

    mHeaderSwitcher = (TextSwitcher) mHolderView.findViewById(R.id.testimonials_subheader_text);
    mBodySwitcher = (TextSwitcher) mHolderView.findViewById(R.id.testimonials_body_text);
    mScrollview = (ScrollView) mHolderView.findViewById(R.id.testimonials_scrollview);
    mInstructionBtn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout);

    if (!pref.getTestimonialsFirstRun()) {
        mInstructionBtn.setVisibility(RelativeLayout.GONE);
    }//from   w w w.  j ava  2 s. com

    mInstructionBtn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            pref.setTestimonialsRunned();
            mInstructionBtn.setVisibility(RelativeLayout.GONE);
        }
    });
    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        //   Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(6 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        //   Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(14 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(9 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        //    Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();

        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(18 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //    Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(48 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(24 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });
    }

    //Undefined Size

    else {
        //   Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        mHeaderSwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(20 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

        mBodySwitcher.setFactory(new ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225));
                textSwitcher_text.setTextSize(12 * functions.getScreenDPI());
                return textSwitcher_text;
            }
        });

    }

    mProgressDialog.show();
    new LoadData().execute();

    gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {

        public boolean onSingleTapUp(MotionEvent e) {
            return false;
        }

        public void onShowPress(MotionEvent e) {
        }

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }

        public void onLongPress(MotionEvent e) {
        }

        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH)
                    return false;
                /** Left swipe */
                if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count < (MAX_COUNT - 1))
                        nextDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                    /** Right Swipe */
                } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count != 0)
                        previousDetail();
                    else {
                        mHeaderSwitcher.startAnimation(shake);
                        mBodySwitcher.startAnimation(shake);
                    }
                }
            } catch (Exception e) {
            }

            return false;
        }

        public boolean onDown(MotionEvent e) {
            return false;
        }
    });

    gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    mScrollview.setOnTouchListener(gestureListener);
    return mHolderView;
}

From source file:com.am.pagergradienttab.view.PagerGradientTabStrip.java

public PagerGradientTabStrip(Context context, AttributeSet attrs) {
    super(context, attrs);
    density = getResources().getDisplayMetrics().density;
    final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
    textSize = a.getDimensionPixelSize(0, (int) (16 * density));
    textColorSelected = a.getColor(1, Color.BLACK);
    textColorNormal = Color.argb(Color.alpha(0x80000000), Color.red(textColorSelected),
            Color.green(textColorSelected), Color.blue(textColorSelected));
    a.recycle();/*www.j  a v  a 2  s. c om*/
    mTextPaint.setAntiAlias(true);

    intervalWidth = (int) (0 * density);
    indicatorPadding = (int) (10 * density);
    indicatorHeight = (int) (3 * density);
    underLineHeight = (int) (2 * density);
}

From source file:com.raja.knowme.FragmentQualification.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mHolderView = inflater.inflate(R.layout.fragment_qualification, null);
    shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
    adapter = new QualificationListAdapter(getActivity());
    functions = new AppCommonFunctions(getActivity());
    pref = new AppPreferences(getActivity());
    knowmeData = new KnowMeDataObject(getActivity());
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setCancelable(false);
    mProgressDialog.setMessage(getString(R.string.loading));

    qualification_list = (ListView) mHolderView.findViewById(R.id.qualification_listview);
    institution_switcher = (TextSwitcher) mHolderView.findViewById(R.id.qualification_institution_name_text);
    instruction_btn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout);

    qualification_list.setSelector(this.getResources().getDrawable(R.drawable.transparent_shape));

    if (!pref.getQualificationFirstRun()) {
        instruction_btn.setVisibility(RelativeLayout.GONE);
    }/*from www.j av a2 s  .c  o m*/

    instruction_btn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            pref.setQualificationRunned();
            instruction_btn.setVisibility(RelativeLayout.GONE);
        }
    });

    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        // Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        institution_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(16 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        // Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        institution_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(14 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        // Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();
        institution_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(32 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //   Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        institution_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(48 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    //Undefined Size

    else {
        //  Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        institution_switcher.setFactory(new ViewSwitcher.ViewFactory() {
            public View makeView() {
                /** Set up the custom auto scrolling text view class for lengthy album names */
                AppTextView textSwitcher_text = new AppTextView(getActivity());
                textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11));
                textSwitcher_text.setTextSize(20 * functions.getScreenDPI());
                textSwitcher_text.setSingleLine(true);
                textSwitcher_text.setEllipsize(TextUtils.TruncateAt.MARQUEE);
                textSwitcher_text.setMarqueeRepeatLimit(-1);
                textSwitcher_text.setHorizontallyScrolling(true);
                return textSwitcher_text;
            }
        });

    }

    mProgressDialog.show();
    new LoadData().execute();

    // Gesture detection
    gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {

        public boolean onSingleTapUp(MotionEvent e) {
            return false;
        }

        public void onShowPress(MotionEvent e) {
        }

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }

        public void onLongPress(MotionEvent e) {
        }

        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH)
                    return false;
                /** Left swipe */
                if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count < (MAX_COUNT - 1))
                        nextInstitution();
                    else {
                        institution_switcher.startAnimation(shake);
                        qualification_list.startAnimation(shake);
                    }
                    /** Right Swipe */
                } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE
                        && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) {
                    if (count != 0)
                        previousInstitution();
                    else {
                        institution_switcher.startAnimation(shake);
                        qualification_list.startAnimation(shake);
                    }
                }
            } catch (Exception e) {
            }

            return false;
        }

        public boolean onDown(MotionEvent e) {
            return false;
        }
    });

    gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    qualification_list.setOnTouchListener(gestureListener);
    return mHolderView;
}