Skip to content

Commit

Permalink
Renamed all classes from Lotte to Lottie
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Peal committed Oct 10, 2016
1 parent 1250a99 commit 5b9bd23
Show file tree
Hide file tree
Showing 60 changed files with 704 additions and 704 deletions.
Expand Up @@ -5,9 +5,9 @@

import org.junit.Test;

public class LotteTest extends ActivityInstrumentationTestCase2<MainActivity> {
public class LottieTest extends ActivityInstrumentationTestCase2<MainActivity> {

public LotteTest() {
public LottieTest() {
super(MainActivity.class);
}

Expand Down
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;

import com.airbnb.lottie.LotteAnimationView;
import com.airbnb.lottie.LottieAnimationView;
import com.facebook.testing.screenshot.Screenshot;
import com.facebook.testing.screenshot.ViewHelpers;

Expand All @@ -21,7 +21,7 @@ static void testStaticFile(Context context, String fileName) {
}

private static void testFile(Context context, String fileName, float[] progress) {
LotteAnimationView view = new LotteAnimationView(context);
LottieAnimationView view = new LottieAnimationView(context);
view.setAnimationSync(fileName);
ViewHelpers.setupView(view)
.layout();
Expand Down
Expand Up @@ -7,7 +7,7 @@
import com.codemonkeylabs.fpslibrary.FrameDataCallback;
import com.codemonkeylabs.fpslibrary.TinyDancer;

public class LotteApplication extends Application implements ILotteApplication {
public class LottieApplication extends Application implements ILottieApplication {

private int droppedFrames;
private long droppedFramesStartingNs;
Expand All @@ -22,8 +22,8 @@ public void onCreate() {
.addFrameDataCallback(new FrameDataCallback() {
@Override
public void doFrame(long previousFrameNs, long currentFrameNs, int droppedFrames) {
LotteApplication.this.droppedFrames += droppedFrames;
LotteApplication.this.currentFrameNs = currentFrameNs;
LottieApplication.this.droppedFrames += droppedFrames;
LottieApplication.this.currentFrameNs = currentFrameNs;
}
})
.show(this);
Expand Down
2 changes: 1 addition & 1 deletion LotteSample/src/main/AndroidManifest.xml
Expand Up @@ -10,7 +10,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="com.airbnb.lottie.samples.LotteApplication">
android:name="com.airbnb.lottie.samples.LottieApplication">
<activity android:name="com.airbnb.lottie.samples.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
Expand Up @@ -16,7 +16,7 @@
import android.widget.TextView;
import android.widget.ToggleButton;

import com.airbnb.lottie.LotteAnimationView;
import com.airbnb.lottie.LottieAnimationView;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand All @@ -36,7 +36,7 @@ static AnimationFragment newInstance(String fileName) {
return frag;
}

@BindView(R.id.animation_view) LotteAnimationView animationView;
@BindView(R.id.animation_view) LottieAnimationView animationView;
@BindView(R.id.seek_bar) AppCompatSeekBar seekBar;
@BindView(play) Button playButton;
@BindView(R.id.loop_button) ToggleButton loopButton;
Expand Down Expand Up @@ -141,7 +141,7 @@ private void recordDroppedFrames() {
droppedFramesPerSecondView.setText(String.format("Dropped frames per second: %.0f", droppedFps));
}

private ILotteApplication getApplication() {
return (ILotteApplication) getActivity().getApplication();
private ILottieApplication getApplication() {
return (ILottieApplication) getActivity().getApplication();
}
}
Expand Up @@ -10,7 +10,7 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.airbnb.lottie.LotteAnimationView;
import com.airbnb.lottie.LottieAnimationView;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand Down Expand Up @@ -61,7 +61,7 @@ public int getItemCount() {
static final class ViewHolder extends RecyclerView.ViewHolder {

@BindView(R.id.name) TextView nameView;
@BindView(R.id.animation_view) LotteAnimationView animationView;
@BindView(R.id.animation_view) LottieAnimationView animationView;

public ViewHolder(ViewGroup parent) {
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_grid_item, parent, false));
Expand Down
Expand Up @@ -2,7 +2,7 @@

import android.support.v4.util.Pair;

interface ILotteApplication {
interface ILottieApplication {
void startRecordingDroppedFrames();
/** Returns the number of frames dropped since starting **/
Pair<Integer, Long> stopRecordingDroppedFrames();
Expand Down
2 changes: 1 addition & 1 deletion LotteSample/src/main/res/layout/fragment_animation.xml
Expand Up @@ -6,7 +6,7 @@
android:clipChildren="false"
android:background="@android:color/white">

<com.airbnb.lottie.LotteAnimationView
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_gravity="center"
android:layout_width="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion LotteSample/src/main/res/layout/view_holder_grid_item.xml
Expand Up @@ -13,7 +13,7 @@
android:singleLine="true"
android:maxLines="1"/>

<com.airbnb.lottie.LotteAnimationView
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="match_parent"
android:layout_height="200dp"
Expand Down
Expand Up @@ -17,10 +17,10 @@
import android.util.LongSparseArray;
import android.widget.ImageView;

import com.airbnb.lottie.layers.LotteLayer;
import com.airbnb.lottie.layers.LotteLayerView;
import com.airbnb.lottie.layers.RootLotteAnimatableLayer;
import com.airbnb.lottie.model.LotteComposition;
import com.airbnb.lottie.layers.LottieLayer;
import com.airbnb.lottie.layers.LottieLayerView;
import com.airbnb.lottie.layers.RootLottieAnimatableLayer;
import com.airbnb.lottie.model.LottieComposition;

import org.json.JSONException;
import org.json.JSONObject;
Expand All @@ -30,44 +30,44 @@
import java.util.Collections;
import java.util.List;

public class LotteAnimationView extends ImageView {
private final LongSparseArray<LotteLayerView> layerMap = new LongSparseArray<>();
private final RootLotteAnimatableLayer rootAnimatableLayer = new RootLotteAnimatableLayer(this);
public class LottieAnimationView extends ImageView {
private final LongSparseArray<LottieLayerView> layerMap = new LongSparseArray<>();
private final RootLottieAnimatableLayer rootAnimatableLayer = new RootLottieAnimatableLayer(this);

/** Can be null because it is created async */
@Nullable private LotteComposition composition;
@Nullable private LottieComposition composition;
private boolean hasInvalidatedThisFrame;
@Nullable private Bitmap mainBitmap = null;
@Nullable private Bitmap maskBitmap = null;
@Nullable private Bitmap matteBitmap = null;
@Nullable private Bitmap mainBitmapForMatte = null;
@Nullable private Bitmap maskBitmapForMatte = null;

public LotteAnimationView(Context context) {
public LottieAnimationView(Context context) {
super(context);
init(null);
}

public LotteAnimationView(Context context, AttributeSet attrs) {
public LottieAnimationView(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs);
}

public LotteAnimationView(Context context, AttributeSet attrs, int defStyleAttr) {
public LottieAnimationView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs);
}

private void init(@Nullable AttributeSet attrs) {
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LotteAnimationView);
String fileName = ta.getString(R.styleable.LotteAnimationView_lotte_fileName);
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LottieAnimationView);
String fileName = ta.getString(R.styleable.LottieAnimationView_lotte_fileName);
if (fileName != null) {
setAnimation(fileName);
}
if (ta.getBoolean(R.styleable.LotteAnimationView_lotte_autoPlay, false)) {
if (ta.getBoolean(R.styleable.LottieAnimationView_lotte_autoPlay, false)) {
rootAnimatableLayer.play();
}
rootAnimatableLayer.loop(ta.getBoolean(R.styleable.LotteAnimationView_lotte_loop, false));
rootAnimatableLayer.loop(ta.getBoolean(R.styleable.LottieAnimationView_lotte_loop, false));
ta.recycle();
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
Expand Down Expand Up @@ -176,26 +176,26 @@ private JSONObject setAnimationSync(InputStream file) {

private void setJson(JSONObject json) {
// TODO: cancel these if the iew gets detached.
new AsyncTask<JSONObject, Void, LotteComposition>() {
new AsyncTask<JSONObject, Void, LottieComposition>() {

@Override
protected LotteComposition doInBackground(JSONObject... params) {
return LotteComposition.fromJson(params[0]);
protected LottieComposition doInBackground(JSONObject... params) {
return LottieComposition.fromJson(params[0]);
}

@Override
protected void onPostExecute(LotteComposition model) {
protected void onPostExecute(LottieComposition model) {
setComposition(model);
}
}.execute(json);
}

private void setJsonSync(JSONObject json) {
LotteComposition composition = LotteComposition.fromJson(json);
LottieComposition composition = LottieComposition.fromJson(json);
setComposition(composition);
}

private void setComposition(@NonNull LotteComposition composition) {
private void setComposition(@NonNull LottieComposition composition) {
this.composition = composition;
rootAnimatableLayer.setCompDuration(composition.getDuration());
rootAnimatableLayer.setBounds(0, 0, composition.getBounds().width(), composition.getBounds().height());
Expand All @@ -206,7 +206,7 @@ private void setComposition(@NonNull LotteComposition composition) {

private void buildSubviewsForComposition() {
//noinspection ConstantConditions
List<LotteLayer> reversedLayers = composition.getLayers();
List<LottieLayer> reversedLayers = composition.getLayers();
Collections.reverse(reversedLayers);

Rect bounds = composition.getBounds();
Expand All @@ -219,12 +219,12 @@ private void buildSubviewsForComposition() {
if (composition.hasMattes()) {
matteBitmap = Bitmap.createBitmap(bounds.width(), bounds.height(), Bitmap.Config.ARGB_8888);
}
LotteLayerView maskedLayer = null;
LottieLayerView maskedLayer = null;
for (int i = 0; i < reversedLayers.size(); i++) {
LotteLayer layer = reversedLayers.get(i);
LotteLayerView layerView;
LottieLayer layer = reversedLayers.get(i);
LottieLayerView layerView;
if (maskedLayer == null) {
layerView = new LotteLayerView(layer, composition, this, mainBitmap, maskBitmap, matteBitmap);
layerView = new LottieLayerView(layer, composition, this, mainBitmap, maskBitmap, matteBitmap);
} else {
if (mainBitmapForMatte == null) {
mainBitmapForMatte = Bitmap.createBitmap(bounds.width(), bounds.height(), Bitmap.Config.ALPHA_8);
Expand All @@ -233,14 +233,14 @@ private void buildSubviewsForComposition() {
maskBitmapForMatte = Bitmap.createBitmap(bounds.width(), bounds.height(), Bitmap.Config.ALPHA_8);
}

layerView = new LotteLayerView(layer, composition, this, mainBitmapForMatte, maskBitmapForMatte, null);
layerView = new LottieLayerView(layer, composition, this, mainBitmapForMatte, maskBitmapForMatte, null);
}
layerMap.put(layerView.getId(), layerView);
if (maskedLayer != null) {
maskedLayer.setMatte(layerView);
maskedLayer = null;
} else {
if (layer.getMatteType() == LotteLayer.MatteType.Add) {
if (layer.getMatteType() == LottieLayer.MatteType.Add) {
maskedLayer = layerView;
}
rootAnimatableLayer.addLayer(layerView);
Expand Down
Expand Up @@ -8,7 +8,7 @@
import android.view.animation.LinearInterpolator;

import com.airbnb.lottie.utils.JsonUtils;
import com.airbnb.lottie.utils.LotteKeyframeAnimation;
import com.airbnb.lottie.utils.LottieKeyframeAnimation;
import com.airbnb.lottie.utils.Observable;

import org.json.JSONArray;
Expand All @@ -18,7 +18,7 @@
import java.util.ArrayList;
import java.util.List;

abstract class BaseLotteAnimatableValue<V, O> implements LotteAnimatableValue<O> {
abstract class BaseLottieAnimatableValue<V, O> implements LottieAnimatableValue<O> {

final Observable<O> observable = new Observable<>();
final List<V> keyValues = new ArrayList<>();
Expand All @@ -34,7 +34,7 @@ abstract class BaseLotteAnimatableValue<V, O> implements LotteAnimatableValue<O>

V initialValue;

BaseLotteAnimatableValue(@Nullable JSONObject json, int frameRate, long compDuration) {
BaseLottieAnimatableValue(@Nullable JSONObject json, int frameRate, long compDuration) {
this.frameRate = frameRate;
this.compDuration = compDuration;
if (json != null) {
Expand Down Expand Up @@ -173,5 +173,5 @@ public Observable<O> getObservable() {

protected abstract V valueFromObject(Object object) throws JSONException;

public abstract LotteKeyframeAnimation animationForKeyPath();
public abstract LottieKeyframeAnimation animationForKeyPath();
}

This file was deleted.

This file was deleted.

0 comments on commit 5b9bd23

Please sign in to comment.