本文整理汇总了Java中com.facebook.shimmer.ShimmerFrameLayout类的典型用法代码示例。如果您正苦于以下问题:Java ShimmerFrameLayout类的具体用法?Java ShimmerFrameLayout怎么用?Java ShimmerFrameLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShimmerFrameLayout类属于com.facebook.shimmer包,在下文中一共展示了ShimmerFrameLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
final Bundle args = getArguments();
String unlockAction = "unlock";
if(args != null){
unlockAction = args.getString(EXTRA_UNLOCK_ACTION, unlockAction);
}
sliderText = (TextView) view.findViewById(R.id.slider_text);
sliderText.setText(R.string.unlock_slider_description);
final SlideButton slideButton = (SlideButton) view.findViewById(R.id.unlock_slider);
slideButton.setOnSeekBarChangeListener(this);
shimmerContainer = (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view_container);
shimmerContainer.startShimmerAnimation();
}
示例2: onCreate
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mShimmerViewContainer = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
mPresetButtons = new Button[]{
(Button) findViewById(R.id.preset_button0),
(Button) findViewById(R.id.preset_button1),
(Button) findViewById(R.id.preset_button2),
(Button) findViewById(R.id.preset_button3),
(Button) findViewById(R.id.preset_button4),
};
for (int i = 0; i < mPresetButtons.length; i++) {
final int preset = i;
mPresetButtons[i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
selectPreset(preset, true);
}
});
}
}
示例3: onViewCreated
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
final Bundle args = getArguments();
String unlockAction = "unlock";
if(args != null){
unlockAction = args.getString(EXTRA_UNLOCK_ACTION, unlockAction);
}
sliderText = (TextView) view.findViewById(R.id.slider_text);
sliderText.setText(getString(R.string.unlock_slider_description, unlockAction));
final SlideButton slideButton = (SlideButton) view.findViewById(R.id.unlock_slider);
slideButton.setOnSeekBarChangeListener(this);
shimmerContainer = (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view_container);
shimmerContainer.startShimmerAnimation();
}
示例4: updateCarStatusAsync
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
private void updateCarStatusAsync()
{
(findViewById(R.id.progressBar)).setVisibility(View.VISIBLE);
ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
container.startShimmerAnimation();
final Context context = this;
final Activity activity = this;
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
final Carwings carwings = new Carwings(context);
carwings.update();
LeafNotification.sendNotification(context, carwings);
activity.runOnUiThread(new Runnable() {
public void run() {
updateCarStatusUI(carwings);
}
});
return null;
}
}.execute(null, null, null);
}
示例5: updateCarStatusUI
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
private void updateCarStatusUI(Carwings carwings)
{
Resources res = getResources();
(findViewById(R.id.surfaceView2)).setBackgroundColor(res.getColor(
carwings.currentBattery == 12 ? R.color.green :
carwings.charging ? R.color.orange :
carwings.currentBattery > 2 ? R.color.blue : R.color.red));
(findViewById(R.id.progressBar)).setVisibility(View.GONE);
ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
container.stopShimmerAnimation();
((TextView) findViewById(R.id.battery_bars)).setText(
String.format(res.getString(R.string.charge_status_battery_bars), carwings.currentBattery));
((TextView) findViewById(R.id.chargetime)).setText(
String.format(res.getString(carwings.charging ? R.string.charge_status_charging
: R.string.charge_status_not_charging), carwings.chargeTime, carwings.chargerType));
((TextView) findViewById(R.id.range)).setText(carwings.range);
((TextView) findViewById(R.id.lastupdated)).setText(carwings.lastUpdateTime);
findViewById(R.id.button).setEnabled(true);
}
示例6: CommonShimmerVH
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public CommonShimmerVH(View view) {
super(view);
if (view instanceof ShimmerFrameLayout) {
final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
shimmerView.setAutoStart(false);
}
}
示例7: startAnim
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public void startAnim() {
if (itemView instanceof ShimmerFrameLayout) {
final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
if (!shimmerView.isAnimationStarted()) {
shimmerView.postDelayed(new Runnable() {
@Override
public void run() {
shimmerView.startShimmerAnimation();
}
}, 100);
}
}
}
示例8: stopAnim
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public void stopAnim() {
if (itemView instanceof ShimmerFrameLayout) {
final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
if (shimmerView.isAnimationStarted()) {
shimmerView.stopShimmerAnimation();
}
}
}
示例9: ShimmerViewHolder
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public ShimmerViewHolder(View view) {
super(view);
if (view instanceof ShimmerFrameLayout) {
final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
shimmerView.setAutoStart(false);
}
}
示例10: stopAnim
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public void stopAnim() {
if (itemView instanceof ShimmerFrameLayout) {
final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
if (shimmerView.isAnimationStarted()) {
shimmerView.setAutoStart(false);
}
}
}
示例11: onCreate
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
shimmer = (ShimmerFrameLayout) findViewById(R.id.shimmer);
shimmer.setAutoStart(true);
}
示例12: ItemHolder
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
public ItemHolder(View view) {
super(view);
shimmerFrameLayout = (ShimmerFrameLayout) view.findViewById(R.id.fl_shimmer);
txtCelebName = (TextView) view.findViewById(R.id.txtCelebName);
txtCelebMovie = (TextView) view.findViewById(R.id.txtCelebMovie);
profileImage = (CircleImageView) view.findViewById(R.id.profileImage);
}
示例13: selectPreset
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
/**
* Select one of the shimmer animation presets.
*
* @param preset index of the shimmer animation preset
* @param showToast whether to show a toast describing the preset, or not
*/
private void selectPreset(int preset, boolean showToast) {
if (mCurrentPreset == preset) {
return;
}
if (mCurrentPreset >= 0) {
mPresetButtons[mCurrentPreset].setBackgroundResource(R.color.preset_button_background);
}
mCurrentPreset = preset;
mPresetButtons[mCurrentPreset].setBackgroundResource(R.color.preset_button_background_selected);
// Save the state of the animation
boolean isPlaying = mShimmerViewContainer.isAnimationStarted();
// Reset all parameters of the shimmer animation
mShimmerViewContainer.useDefaults();
// If a toast is already showing, hide it
if (mPresetToast != null) {
mPresetToast.cancel();
}
switch (preset) {
default:
case 0:
// Default
mPresetToast = Toast.makeText(this, "Default", Toast.LENGTH_SHORT);
break;
case 1:
// Slow and reverse
mShimmerViewContainer.setDuration(5000);
mShimmerViewContainer.setRepeatMode(ObjectAnimator.REVERSE);
mPresetToast = Toast.makeText(this, "Slow and reverse", Toast.LENGTH_SHORT);
break;
case 2:
// Thin, straight and transparent
mShimmerViewContainer.setBaseAlpha(0.1f);
mShimmerViewContainer.setDropoff(0.1f);
mShimmerViewContainer.setTilt(0);
mPresetToast = Toast.makeText(this, "Thin, straight and transparent", Toast.LENGTH_SHORT);
break;
case 3:
// Sweep angle 90
mShimmerViewContainer.setAngle(ShimmerFrameLayout.MaskAngle.CW_90);
mPresetToast = Toast.makeText(this, "Sweep angle 90", Toast.LENGTH_SHORT);
break;
case 4:
// Spotlight
mShimmerViewContainer.setBaseAlpha(0);
mShimmerViewContainer.setDuration(2000);
mShimmerViewContainer.setDropoff(0.1f);
mShimmerViewContainer.setIntensity(0.35f);
mShimmerViewContainer.setMaskShape(ShimmerFrameLayout.MaskShape.RADIAL);
mPresetToast = Toast.makeText(this, "Spotlight", Toast.LENGTH_SHORT);
break;
}
// Show toast describing the chosen preset, if necessary
if (showToast) {
mPresetToast.show();
}
// Setting a value on the shimmer layout stops the animation. Restart it, if necessary.
if (isPlaying) {
mShimmerViewContainer.startShimmerAnimation();
}
}
示例14: onCreateView
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_layout, container, false);
ShimmerFrameLayout shimmerContainer = (ShimmerFrameLayout) view.findViewById(R.id.shimmerLayout);
shimmerContainer.setDuration(getResources().getInteger(R.integer.animation_duration));
shimmerContainer.setRepeatDelay(getResources().getInteger(R.integer.repeat_delay));
shimmerContainer.setRepeatMode(ValueAnimator.REVERSE);
shimmerContainer.startShimmerAnimation();
return view;
}
示例15: onCreate
import com.facebook.shimmer.ShimmerFrameLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
mShimmerViewContainer = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
mShimmerViewContainer.setDuration(2000);
mShimmerViewContainer.setRepeatMode(ObjectAnimator.REVERSE);
mShimmerViewContainer.startShimmerAnimation();
mSplashThread = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(4000);
}
}
catch(InterruptedException ex){
}
finish();
}
};
new android.os.Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo / company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(Splash.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, 4000);
}