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:Main.java
public static void expand(final View v, final int targetHeight, int duration, Interpolator interpolator, final Animation.AnimationListener listener) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/*from w w w.j a va2 s . c om*/ protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = initialHeight + (int) (targetHeight * interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(duration); if (interpolator != null) { a.setInterpolator(interpolator); } a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { v.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (listener != null) listener.onAnimationStart(animation); } @Override public void onAnimationEnd(Animation animation) { v.setLayerType(View.LAYER_TYPE_NONE, null); if (listener != null) listener.onAnimationEnd(animation); } @Override public void onAnimationRepeat(Animation animation) { if (listener != null) onAnimationRepeat(animation); } }); v.startAnimation(a); }
From source file:com.facebook.react.uimanager.BaseViewManager.java
@ReactProp(name = PROP_RENDER_TO_HARDWARE_TEXTURE) public void setRenderToHardwareTexture(T view, boolean useHWTexture) { view.setLayerType(useHWTexture ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null); }
From source file:org.kiwix.kiwixmobile.views.KiwixWebView.java
public void deactivateNightMode() { setLayerType(View.LAYER_TYPE_NONE, null); }
From source file:com.yahala.ui.Views.BaseFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { // HW layer support only exists on API 11+ Animation animation = super.onCreateAnimation(transit, enter, nextAnim); // HW layer support only exists on API 11+ if (Build.VERSION.SDK_INT >= 11) { if (animation == null && nextAnim != 0) { animation = AnimationUtils.loadAnimation(getActivity(), nextAnim); }/*from w w w.java 2 s. c o m*/ if (animation != null) { getView().setLayerType(View.LAYER_TYPE_HARDWARE, null); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { BaseFragment.this.onAnimationStart(); } public void onAnimationEnd(Animation animation) { try { getView().setLayerType(View.LAYER_TYPE_NONE, null); BaseFragment.this.onAnimationEnd(); } catch (Exception e) { } } @Override public void onAnimationRepeat(Animation animation) { } }); } } return animation; /*if (nextAnim != 0) { Animation animation = AnimationUtils.loadAnimation(getActivity(), nextAnim); if (Build.VERSION.SDK_INT >= 11) { getView().setLayerType(View.LAYER_TYPE_HARDWARE, null); } animation.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { BaseFragment.this.onAnimationStart(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation){ BaseFragment.this.onAnimationEnd(); if (Build.VERSION.SDK_INT >= 11) { getView().setLayerType(View.LAYER_TYPE_NONE, null); } } }); return animation; } else { return super.onCreateAnimation(transit, enter, nextAnim); }*/ }
From source file:com.nexus.nsnik.randomno.view.fragments.CoinTossFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { Animation animation = super.onCreateAnimation(transit, enter, nextAnim); if (animation == null && nextAnim != 0) { animation = AnimationUtils.loadAnimation(getActivity(), nextAnim); }// w w w. j av a 2 s. c o m if (animation != null) { if (getView() != null) { getView().setLayerType(View.LAYER_TYPE_HARDWARE, null); } animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } public void onAnimationEnd(Animation animation) { if (getView() != null) { getView().setLayerType(View.LAYER_TYPE_NONE, null); } } @Override public void onAnimationRepeat(Animation animation) { } }); } return animation; }
From source file:android.support.design.widget.FloatingActionButtonIcs.java
private void updateFromViewRotation() { if (Build.VERSION.SDK_INT == 19) { // KitKat seems to have an issue with views which are rotated with angles which are // not divisible by 90. Worked around by moving to software rendering in these cases. if ((mRotation % 90) != 0) { if (mView.getLayerType() != View.LAYER_TYPE_SOFTWARE) { mView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); }//from w w w . j a v a2 s.co m } else { if (mView.getLayerType() != View.LAYER_TYPE_NONE) { mView.setLayerType(View.LAYER_TYPE_NONE, null); } } } // Offset any View rotation if (mShadowDrawable != null) { mShadowDrawable.setRotation(-mRotation); } if (mBorderDrawable != null) { mBorderDrawable.setRotation(-mRotation); } }
From source file:de.uni_weimar.benike.misex3.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // register for accelerometer events: mSensorManager = (SensorManager) getApplicationContext().getSystemService(Context.SENSOR_SERVICE); for (Sensor sensor : mSensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER)) { if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) { mAccelerometerSensor = sensor; }// ww w . j av a 2 s . co m } // if we can't access the accelerometer sensor then exit: if (mAccelerometerSensor == null) { Log.e(TAG, "Failed to attach to Accelerator Sensor."); Toast.makeText(this, "Error! Failed to create accelerometer sensor!", Toast.LENGTH_LONG).show(); cleanup(); } mSensorManager.registerListener(this, mAccelerometerSensor, SensorManager.SENSOR_DELAY_UI); // setup the Accelerometer History plot: mAccelerometerPlot = (XYPlot) findViewById(R.id.accelerometerPlot); mFftPlot = (XYPlot) findViewById(R.id.fftPlot); mAccelerometerPlot.setRangeBoundaries(-25, 25, BoundaryMode.FIXED); mAccelerometerPlot.setDomainBoundaries(0, mWindowSize - 1, BoundaryMode.FIXED); mFftPlot.setRangeBoundaries(0, 250, BoundaryMode.FIXED); mFftPlot.setDomainBoundaries(0, mWindowSize / 2, BoundaryMode.AUTO); mFftPlot.setDomainStep(XYStepMode.SUBDIVIDE, 10); //mFftPlot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 50); mAccelerometerXSeries = new SimpleXYSeries("X"); mAccelerometerXSeries.useImplicitXVals(); mAccelerometerYSeries = new SimpleXYSeries("Y"); mAccelerometerYSeries.useImplicitXVals(); mAccelerometerZSeries = new SimpleXYSeries("Z"); mAccelerometerZSeries.useImplicitXVals(); mAccelerometerMSeries = new SimpleXYSeries("magnitude"); mAccelerometerMSeries.useImplicitXVals(); mFftSeries = new SimpleXYSeries("FFT"); mFftSeries.useImplicitXVals(); mFftPlot.addSeries(mFftSeries, new LineAndPointFormatter(Color.rgb(0, 0, 0), null, null, null)); mAccelerometerPlot.addSeries(mAccelerometerXSeries, new LineAndPointFormatter(Color.rgb(100, 100, 200), null, null, null)); mAccelerometerPlot.addSeries(mAccelerometerYSeries, new LineAndPointFormatter(Color.rgb(100, 200, 100), null, null, null)); mAccelerometerPlot.addSeries(mAccelerometerZSeries, new LineAndPointFormatter(Color.rgb(200, 100, 100), null, null, null)); mAccelerometerPlot.addSeries(mAccelerometerMSeries, new LineAndPointFormatter(Color.rgb(0, 0, 0), null, null, null)); mAccelerometerPlot.setDomainStepValue(5); mAccelerometerPlot.setTicksPerRangeLabel(3); mAccelerometerPlot.setDomainLabel("Sample Index"); mAccelerometerPlot.getDomainLabelWidget().pack(); mAccelerometerPlot.setRangeLabel("m/s^2"); mAccelerometerPlot.getRangeLabelWidget().pack(); final PlotStatistics histStats = new PlotStatistics(1000, false); mAccelerometerPlot.addListener(histStats); // perform hardware accelerated rendering of the plots mAccelerometerPlot.setLayerType(View.LAYER_TYPE_NONE, null); mFftPlot.setLayerType(View.LAYER_TYPE_NONE, null); mFftPlot.setTicksPerRangeLabel(5); mFftPlot.setTicksPerDomainLabel(1); mSampleRateSeekBar = (SeekBar) findViewById(R.id.sampleRateSeekBar); mSampleRateSeekBar.setMax((SAMPLE_MAX_VALUE - SAMPLE_MIN_VALUE) / SAMPLE_STEP); mSampleRateSeekBar.setOnSeekBarChangeListener(this); mFftWindowSeekBar = (SeekBar) findViewById(R.id.fftWindowSeekBar); mFftWindowSeekBar.setMax((WINDOW_MAX_VALUE - WINDOW_MIN_VALUE) / WINDOW_STEP); mFftWindowSeekBar.setOnSeekBarChangeListener(this); mWindowSizeTextView = (TextView) findViewById(R.id.windowSizeTextView); // Perform FFT calculations in background thread mFft = new FFT(mWindowSize); Runnable r = new PerformFft(); mFftThread = new Thread(r); mFftThread.start(); mNotificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_help_outline_black_24dp).setContentTitle("MIS Ex3 Activity Recognizer") .setContentText("Trying to guess your activity").setOngoing(true); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(resultPendingIntent); mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(mNotificationId, mNotificationBuilder.build()); Runnable detectActivity = new DetectActivity(); mDetectActivityThread = new Thread(detectActivity); mDetectActivityThread.start(); }
From source file:org.mozilla.gecko.animation.PropertyAnimator.java
/** * Stop the animation, optionally snapping to the end position. * onPropertyAnimationEnd is only called when snapping to the end position. */// w w w . j av a 2 s . c o m public void stop(boolean snapToEndPosition) { mFramePoster.cancelAnimationFrame(); // Make sure to snap to the end position. for (ElementHolder element : mElementsList) { if (snapToEndPosition) invalidate(element, element.to); ViewCompat.setHasTransientState(element.view, false); if (shouldEnableHardwareLayer(element)) { element.view.setLayerType(View.LAYER_TYPE_NONE, null); } else { element.view.setDrawingCacheEnabled(false); } } mElementsList.clear(); if (mListeners != null) { if (snapToEndPosition) { for (PropertyAnimationListener listener : mListeners) { listener.onPropertyAnimationEnd(); } } mListeners.clear(); mListeners = null; } }
From source file:me.lizheng.deckview.views.DeckChildView.java
/** * Resets this view's properties */ void resetViewProperties() { setDim(0); setLayerType(View.LAYER_TYPE_NONE, null); DeckChildViewTransform.reset(this); }
From source file:org.mozilla.gecko.home.HomePager.java
/** * Loads and initializes the pager.//from w ww. j a v a2s .c om * * @param fm FragmentManager for the adapter */ public void load(LoaderManager lm, FragmentManager fm, String panelId, PropertyAnimator animator) { mLoadState = LoadState.LOADING; mVisible = true; mInitialPanelId = panelId; // Update the home banner message each time the HomePager is loaded. if (mHomeBanner != null) { mHomeBanner.update(); } // Only animate on post-HC devices, when a non-null animator is given final boolean shouldAnimate = Versions.feature11Plus && animator != null; final HomeAdapter adapter = new HomeAdapter(mContext, fm); adapter.setOnAddPanelListener(mAddPanelListener); adapter.setCanLoadHint(true); setAdapter(adapter); // Don't show the tabs strip until we have the // list of panels in place. mTabStrip.setVisibility(View.INVISIBLE); // Load list of panels from configuration lm.initLoader(LOADER_ID_CONFIG, null, mConfigLoaderCallbacks); if (shouldAnimate) { animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { setLayerType(View.LAYER_TYPE_HARDWARE, null); } @Override public void onPropertyAnimationEnd() { setLayerType(View.LAYER_TYPE_NONE, null); } }); ViewHelper.setAlpha(this, 0.0f); animator.attach(this, PropertyAnimator.Property.ALPHA, 1.0f); } }