Java 类com.facebook.shimmer.ShimmerFrameLayout 实例源码

项目:Tower-develop    文件:SlideToUnlockDialog.java   
@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();
}
项目:shimmer-android    文件:MainActivity.java   
@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);
      }
    });
  }
}
项目:DroidPlanner-Tower    文件:SlideToUnlockDialog.java   
@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();
}
项目:wear-LeafStatus    文件:MyActivity.java   
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);
}
项目:wear-LeafStatus    文件:MyActivity.java   
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);
}
项目:GitHub    文件:CommonShimmerVH.java   
public CommonShimmerVH(View view) {
    super(view);
    if (view instanceof ShimmerFrameLayout) {
        final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
        shimmerView.setAutoStart(false);
    }
}
项目:GitHub    文件:CommonShimmerVH.java   
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);

            }
        }
    }
项目:GitHub    文件:CommonShimmerVH.java   
public void stopAnim() {

        if (itemView instanceof ShimmerFrameLayout) {
            final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
            if (shimmerView.isAnimationStarted()) {
                shimmerView.stopShimmerAnimation();
            }
        }
    }
项目:GitHub    文件:ShimmerViewHolder.java   
public ShimmerViewHolder(View view) {
    super(view);
    if (view instanceof ShimmerFrameLayout) {
        final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
        shimmerView.setAutoStart(false);
    }
}
项目:GitHub    文件:ShimmerViewHolder.java   
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);

            }
        }
    }
项目:GitHub    文件:ShimmerViewHolder.java   
public void stopAnim() {

        if (itemView instanceof ShimmerFrameLayout) {
            final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
            if (shimmerView.isAnimationStarted()) {
                shimmerView.setAutoStart(false);
            }
        }
    }
项目:MultiTypeRecyclerViewAdapter    文件:CommonShimmerVH.java   
public CommonShimmerVH(View view) {
    super(view);
    if (view instanceof ShimmerFrameLayout) {
        final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
        shimmerView.setAutoStart(false);
    }
}
项目:MultiTypeRecyclerViewAdapter    文件:CommonShimmerVH.java   
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);

            }
        }
    }
项目:MultiTypeRecyclerViewAdapter    文件:CommonShimmerVH.java   
public void stopAnim() {

        if (itemView instanceof ShimmerFrameLayout) {
            final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
            if (shimmerView.isAnimationStarted()) {
                shimmerView.stopShimmerAnimation();
            }
        }
    }
项目:MultiTypeRecyclerViewAdapter    文件:ShimmerViewHolder.java   
public ShimmerViewHolder(View view) {
    super(view);
    if (view instanceof ShimmerFrameLayout) {
        final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) view;
        shimmerView.setAutoStart(false);
    }
}
项目:MultiTypeRecyclerViewAdapter    文件:ShimmerViewHolder.java   
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);

            }
        }
    }
项目:MultiTypeRecyclerViewAdapter    文件:ShimmerViewHolder.java   
public void stopAnim() {

        if (itemView instanceof ShimmerFrameLayout) {
            final ShimmerFrameLayout shimmerView = (ShimmerFrameLayout) itemView;
            if (shimmerView.isAnimationStarted()) {
                shimmerView.setAutoStart(false);
            }
        }
    }
项目:chintanrathod.com    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    shimmer = (ShimmerFrameLayout) findViewById(R.id.shimmer);
    shimmer.setAutoStart(true);
}
项目:chintanrathod.com    文件:ItemHolder.java   
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);
}
项目:shimmer-android    文件:MainActivity.java   
/**
 * 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();
  }
}
项目:fb-shimmer-animation    文件:ViewFragment.java   
@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;
}
项目:App_2016    文件:Splash.java   
@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);

}