List of usage examples for android.view View LAYER_TYPE_NONE
int LAYER_TYPE_NONE
To view the source code for android.view View LAYER_TYPE_NONE.
Click Source Link
From source file:com.example.alyshia.customsimplelauncher.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); initUI();/*from www. j a va2s .c o m*/ retrievePackageNames(); initLicense(); workSpaces.setOffscreenPageLimit(WORKSPACES_NUM); workSpaces.setPageMargin(Math.round(SAUtils.convertDpToPixel(2.0f, this))); workSpaces.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { Log.d("ME", "notvisible"); ((AppsGridFragment) mPagerAdapter.getItem(position)).notVisible(); } @Override public void onPageScrollStateChanged(int state) { if (state != ViewPager.SCROLL_STATE_IDLE) { final int childCount = workSpaces.getChildCount(); for (int i = 0; i < childCount; i++) workSpaces.getChildAt(i).setLayerType(View.LAYER_TYPE_NONE, null); } else { final int childCount = workSpaces.getChildCount(); for (int i = 0; i < childCount; i++) workSpaces.getChildAt(i).setLayerType(View.LAYER_TYPE_HARDWARE, null); } } }); screen = (LinearLayout) findViewById(R.id.wholeScreenlayout); screen.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Log.d("me", "longclick here on mainAct"); handleLongPress(); return false; } }); CirclePageIndicator cpi = (CirclePageIndicator) findViewById(R.id.circleindicator); cpi.setViewPager(workSpaces); f = new File(Environment.getExternalStorageDirectory(), TEMP_PHOTO_FILE); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
From source file:com.android.printspooler.widget.PrintContentView.java
private void onDragProgress(float progress) { if (Float.compare(mDragProgress, progress) == 0) { return;// www . j a v a 2 s . c om } if ((mDragProgress == 0 && progress > 0) || (mDragProgress == 1.0f && progress < 1.0f)) { mSummaryContent.setLayerType(View.LAYER_TYPE_HARDWARE, null); mDraggableContent.setLayerType(View.LAYER_TYPE_HARDWARE, null); mMoreOptionsButton.setLayerType(View.LAYER_TYPE_HARDWARE, null); ensureImeClosedAndInputFocusCleared(); } if ((mDragProgress > 0 && progress == 0) || (mDragProgress < 1.0f && progress == 1.0f)) { mSummaryContent.setLayerType(View.LAYER_TYPE_NONE, null); mDraggableContent.setLayerType(View.LAYER_TYPE_NONE, null); mMoreOptionsButton.setLayerType(View.LAYER_TYPE_NONE, null); mMoreOptionsButton.setLayerType(View.LAYER_TYPE_NONE, null); } mDragProgress = progress; mSummaryContent.setAlpha(progress); final float inverseAlpha = 1.0f - progress; mOptionsContainer.setAlpha(inverseAlpha); mMoreOptionsButton.setAlpha(inverseAlpha); mEmbeddedContentScrim.setBackgroundColor(computeScrimColor()); if (progress == 0) { if (mOptionsStateChangeListener != null) { mOptionsStateChangeListener.onOptionsOpened(); } mExpandCollapseHandle.setContentDescription(mContext.getString(R.string.collapse_handle)); announceForAccessibility(mContext.getString(R.string.print_options_expanded)); mSummaryContent.setVisibility(View.GONE); mEmbeddedContentScrim.setOnClickListener(this); mExpandCollapseIcon.setBackgroundResource(R.drawable.ic_expand_less); } else { mSummaryContent.setVisibility(View.VISIBLE); } if (progress == 1.0f) { if (mOptionsStateChangeListener != null) { mOptionsStateChangeListener.onOptionsClosed(); } mExpandCollapseHandle.setContentDescription(mContext.getString(R.string.expand_handle)); announceForAccessibility(mContext.getString(R.string.print_options_collapsed)); if (mMoreOptionsButton.getVisibility() != View.GONE) { mMoreOptionsButton.setVisibility(View.INVISIBLE); } mDraggableContent.setVisibility(View.INVISIBLE); // If we change the scrim visibility the dimming is lagging // and is janky. Now it is there but transparent, doing nothing. mEmbeddedContentScrim.setOnClickListener(null); mEmbeddedContentScrim.setClickable(false); mExpandCollapseIcon.setBackgroundResource(R.drawable.ic_expand_more); } else { if (mMoreOptionsButton.getVisibility() != View.GONE) { mMoreOptionsButton.setVisibility(View.VISIBLE); } mDraggableContent.setVisibility(View.VISIBLE); } }
From source file:com.android.tv.settings.dialog.old.BaseDialogFragment.java
/** * Animates a view./* w w w. ja v a2 s. c o m*/ * * @param v view to animate * @param initAlpha initial alpha * @param initTransX initial translation in the X * @param delay delay in ms * @param duration duration in ms * @param interpolator interpolator to be used, can be null * @param isIcon if {@code true}, this is the main icon being moved */ public void prepareAndAnimateView(final View v, float initAlpha, float initTransX, int delay, int duration, Interpolator interpolator, final boolean isIcon) { if (v != null && v.getWindowToken() != null) { v.setLayerType(View.LAYER_TYPE_HARDWARE, null); v.buildLayer(); v.setAlpha(initAlpha); v.setTranslationX(initTransX); v.animate().alpha(1f).translationX(0).setDuration(duration).setStartDelay(delay); if (interpolator != null) { v.animate().setInterpolator(interpolator); } v.animate().setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { v.setLayerType(View.LAYER_TYPE_NONE, null); if (isIcon) { if (mShadowLayer != null) { mShadowLayer.setShadowsAlpha(1f); } onIntroAnimationFinished(); } } }); v.animate().start(); } }
From source file:metro.k.cover.view.JazzyViewPager.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void manageLayer(View v, boolean enableHardware) { final int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (layerType != v.getLayerType()) { v.setLayerType(layerType, null); }/* ww w . ja v a2 s .c o m*/ }
From source file:metro.k.cover.view.JazzyViewPager.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void disableHardwareLayer() { View v;/*from www .ja va2 s. com*/ for (int i = 0; i < getChildCount(); i++) { v = getChildAt(i); if (v != null && v.getLayerType() != View.LAYER_TYPE_NONE) { v.setLayerType(View.LAYER_TYPE_NONE, null); } } }
From source file:com.insalyon.les24heures.JazzyViewPager.JazzyViewPager.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void manageLayer(View v, boolean enableHardware) { if (!API_11)//w ww . j a v a 2s.c om return; int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (layerType != v.getLayerType()) v.setLayerType(layerType, null); }
From source file:com.insalyon.les24heures.JazzyViewPager.JazzyViewPager.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void disableHardwareLayer() { if (!API_11)//w ww . j ava2s . c o m return; View v; for (int i = 0; i < getChildCount(); i++) { v = getChildAt(i); if (v.getLayerType() != View.LAYER_TYPE_NONE) v.setLayerType(View.LAYER_TYPE_NONE, null); } }
From source file:com.android.messaging.ui.conversationlist.ConversationListSwipeHelper.java
/** * Enable a hardware layer for the it view and build that layer. *//*from w w w.j ava2 s .c o m*/ private void setHardwareAnimatingLayerType(final ConversationListItemView itemView, final boolean animating) { if (animating) { itemView.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (itemView.getWindowToken() != null) { itemView.buildLayer(); } } else { itemView.setLayerType(View.LAYER_TYPE_NONE, null); } }
From source file:com.mylikes.likes.etchasketch.Slate.java
@SuppressLint("NewApi") private void init() { // setWillNotCacheDrawing(true); // setDrawingCacheEnabled(false); mEmpty = true;/*from w w w . ja v a 2 s. c om*/ // setup brush bitmaps final ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mMemClass = am.getLargeMemoryClass(); } else { mMemClass = am.getMemoryClass(); } mLowMem = (mMemClass <= 16); if (true || DEBUG) { Log.v(TAG, "Slate.init: memClass=" + mMemClass + (mLowMem ? " (LOW)" : "")); } final Resources res = getContext().getResources(); // mCircleBits = BitmapFactory.decodeResource(res, R.drawable.circle_1bpp); // if (mCircleBits == null) { Log.e(TAG, "SmoothStroker: Couldn't load circle bitmap"); } // mCircleBitsFrame = new Rect(0, 0, mCircleBits.getWidth(), mCircleBits.getHeight()); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.ALPHA_8; if (mLowMem) { // let's see how this works in practice opts.inSampleSize = 4; } mAirbrushBits = BitmapFactory.decodeResource(res, R.drawable.airbrush_light, opts); if (mAirbrushBits == null) { Log.e(TAG, "SmoothStroker: Couldn't load airbrush bitmap"); } mAirbrushBitsFrame = new Rect(0, 0, mAirbrushBits.getWidth(), mAirbrushBits.getHeight()); //Log.v(TAG, "airbrush: " + mAirbrushBitsFrame.right + "x" + mAirbrushBitsFrame.bottom); mFountainPenBits = BitmapFactory.decodeResource(res, R.drawable.fountainpen, opts); if (mFountainPenBits == null) { Log.e(TAG, "SmoothStroker: Couldn't load fountainpen bitmap"); } mFountainPenBitsFrame = new Rect(0, 0, mFountainPenBits.getWidth(), mFountainPenBits.getHeight()); // set up individual strokers for each pointer mStrokes = new MarkersPlotter[MAX_POINTERS]; // TODO: don't bother unless hasSystemFeature(MULTITOUCH_DISTINCT) for (int i = 0; i < mStrokes.length; i++) { mStrokes[i] = new MarkersPlotter(); } mPressureCooker = new PressureCooker(getContext()); setFocusable(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (HWLAYER) { setLayerType(View.LAYER_TYPE_HARDWARE, null); } else if (SWLAYER) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); } else { setLayerType(View.LAYER_TYPE_NONE, null); } } mWorkspacePaint = new Paint(); mWorkspacePaint.setColor(0x40606060); mBlitPaint = new Paint(); if (true) { mDebugPaints[0] = new Paint(); mDebugPaints[0].setStyle(Paint.Style.STROKE); mDebugPaints[0].setStrokeWidth(2.0f); mDebugPaints[0].setARGB(255, 0, 255, 255); mDebugPaints[1] = new Paint(mDebugPaints[0]); mDebugPaints[1].setARGB(255, 255, 0, 128); mDebugPaints[2] = new Paint(mDebugPaints[0]); mDebugPaints[2].setARGB(255, 0, 255, 0); mDebugPaints[3] = new Paint(mDebugPaints[0]); mDebugPaints[3].setARGB(255, 30, 30, 255); mDebugPaints[4] = new Paint(); mDebugPaints[4].setStyle(Paint.Style.FILL); mDebugPaints[4].setARGB(255, 128, 128, 128); } }
From source file:org.chromium.chrome.browser.payments.ui.EditorView.java
@Override public void onShow(DialogInterface dialog) { assert mDialogInOutAnimator == null; // Hide keyboard and disable EditText views for animation efficiency. if (getCurrentFocus() != null) UiUtils.hideKeyboard(getCurrentFocus()); for (int i = 0; i < mEditableTextFields.size(); i++) { mEditableTextFields.get(i).setEnabled(false); }/*from w w w . j ava2s . co m*/ mLayout.setLayerType(View.LAYER_TYPE_HARDWARE, null); mLayout.buildLayer(); Animator popUp = ObjectAnimator.ofFloat(mLayout, View.TRANSLATION_Y, mLayout.getHeight(), 0f); Animator fadeIn = ObjectAnimator.ofFloat(mLayout, View.ALPHA, 0f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(popUp, fadeIn); mDialogInOutAnimator = animatorSet; mDialogInOutAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS); mDialogInOutAnimator.setInterpolator(new LinearOutSlowInInterpolator()); mDialogInOutAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLayout.setLayerType(View.LAYER_TYPE_NONE, null); for (int i = 0; i < mEditableTextFields.size(); i++) { mEditableTextFields.get(i).setEnabled(true); } // Note that keyboard will not show for dropdown field since it's not necessary. if (getCurrentFocus() != null) UiUtils.showKeyboard(getCurrentFocus()); mDialogInOutAnimator = null; initFocus(); } }); mDialogInOutAnimator.start(); }