Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ This component implements transition animation to crumble view into tiny pieces.
<img src="star_wars-concept.gif" />
<br>Check this <a href="https://dribbble.com/shots/2109991-Star-Wars-App-concept">project on dribbble</a>.

Also, read how it was done in [our blog](https://yalantis.com/blog/star-wars-the-force-awakens-or-how-to-crumble-view-into-tiny-pieces-on-android)

##Requirements
- Android SDK 15+
- OpenGL ES 2.0+
Expand All @@ -24,7 +22,7 @@ Add to your module's build.gradle:
```Groovy
dependencies {
//...
compile 'com.yalantis:starwarstiles:0.1.1'
implementation 'com.yalantis:starwarstiles:0.1.2'
}
```

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha3'
classpath 'io.fabric.tools:gradle:1.21.0'
classpath 'com.android.tools.build:gradle:7.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,7 +15,8 @@ buildscript {

allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}

Expand Down
52 changes: 17 additions & 35 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,36 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.21.0'
}
}
apply plugin: 'com.android.application'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'io.fabric'


android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
compileSdkVersion 33
buildToolsVersion '30.0.3'

defaultConfig {
applicationId "com.yalantis.starwarsdemo"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "0.1.0"
targetSdkVersion 33
versionCode 2
versionName "0.1.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = false
buildFeatures {
viewBinding = true
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.jakewharton.timber:timber:4.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:percent:23.1.1'
compile project(':library')
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
transitive = true;
}
implementation project(':library')
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation "com.jakewharton.timber:timber:4.7.1"
testImplementation 'junit:junit:4.13.2'
}
10 changes: 5 additions & 5 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yalantis.starwarsdemo" >
package="com.yalantis.starwarsdemo">


<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="com.yalantis.starwarsdemo.App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
>
android:label="@string/sw_lib_name">

<activity
android:name=".view.DemoActivity"
android:label="StarWars"
android:screenOrientation="portrait"
android:theme="@style/StarWarsAppTheme"
android:screenOrientation="portrait">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
6 changes: 1 addition & 5 deletions demo/src/main/java/com/yalantis/starwarsdemo/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@
import android.app.Application;
import android.content.Context;

import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import timber.log.Timber;

/**
* Created by Artem Kholodnyi on 11/2/15.
*/
public class App extends Application{
public class App extends Application {
private static App app;

@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
app = this;

Timber.plant(new Timber.DebugTree());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package com.yalantis.starwarsdemo.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewbinding.ViewBinding;

import com.yalantis.starwarsdemo.R;
import com.yalantis.starwarsdemo.databinding.ItemProfileGenderBinding;
import com.yalantis.starwarsdemo.databinding.ItemProfileOtherBinding;
import com.yalantis.starwarsdemo.databinding.ItemProfileSideBinding;
import com.yalantis.starwarsdemo.interfaces.ProfileAdapterListener;
import com.yalantis.starwarsdemo.model.User;
import com.yalantis.starwarsdemo.widget.BackgroundDrawableSwitchCompat;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
* Created by Artem Kholodnyi on 11/17/15.
*/
Expand All @@ -26,7 +26,7 @@ public class ProfileAdapter extends RecyclerView.Adapter<ProfileAdapter.ViewHold
private static final int VIEW_TYPE_TEXT_FIELD = 1;
private static final int VIEW_GENDER_FIELD = 2;
private final ProfileAdapterListener mListener;
private User mUser;
private final User mUser;

private final String mFullNameLabel;
private final String mHomeWorldLabel;
Expand Down Expand Up @@ -61,21 +61,19 @@ public int getItemViewType(int position) {

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@LayoutRes int layoutRes = getLayoutId(viewType);

View itemView = LayoutInflater.from(parent.getContext()).inflate(layoutRes, parent, false);
return new ViewHolder(itemView);
ViewBinding binding = inflateWithBinding(parent, viewType);
return new ViewHolder(binding);
}

@LayoutRes
private int getLayoutId(int viewType) {
private ViewBinding inflateWithBinding(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
switch (viewType) {
case VIEW_TYPE_SIDE:
return R.layout.item_profile_side;
return ItemProfileSideBinding.inflate(inflater, parent, false);
case VIEW_TYPE_TEXT_FIELD:
return R.layout.item_profile_other;
return ItemProfileOtherBinding.inflate(inflater, parent, false);
case VIEW_GENDER_FIELD:
return R.layout.item_profile_gender;
return ItemProfileGenderBinding.inflate(inflater, parent, false);
default:
throw new IllegalStateException();
}
Expand All @@ -89,12 +87,8 @@ public void onBindViewHolder(final ViewHolder holder, int position) {
// holder.getBinding().setVariable(BR.callback, mListener);
// holder.getBinding().setVariable(BR.user, mUser);
holder.mySwitch.setCheckedImmediate(mUser.isDarkSide());
holder.mySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
mListener.onSideSwitch(holder.mySwitch);
}
});
holder.mySwitch.setOnCheckedChangeListener((buttonView, isChecked) ->
mListener.onSideSwitch(holder.mySwitch));
holder.label.setText(mUser.getSideText());
break;
case 1:
Expand Down Expand Up @@ -122,22 +116,25 @@ public int getItemCount() {
return 5;
}

public class ViewHolder extends RecyclerView.ViewHolder {
class ViewHolder extends RecyclerView.ViewHolder {
@Nullable
@Bind(R.id.side_switch)
BackgroundDrawableSwitchCompat mySwitch;

@Nullable
@Bind(R.id.tv_label)
TextView label;

@Nullable
@Bind(R.id.tv_value)
TextView value;

public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
public ViewHolder(ViewBinding binding) {
super(binding.getRoot());
if (binding instanceof ItemProfileSideBinding) {
mySwitch = ((ItemProfileSideBinding) binding).sideSwitch;
label = ((ItemProfileSideBinding) binding).tvLabel;
} else if (binding instanceof ItemProfileOtherBinding) {
label = ((ItemProfileOtherBinding) binding).tvLabel;
value = ((ItemProfileOtherBinding) binding).tvValue;
} else if (binding instanceof ItemProfileGenderBinding) {
label = ((ItemProfileGenderBinding) binding).tvLabel;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.yalantis.starwarsdemo.interfaces;

import android.support.v7.widget.SwitchCompat;
import androidx.appcompat.widget.SwitchCompat;

/**
* Created by Artem Kholodnyi on 11/17/15.
Expand Down
10 changes: 6 additions & 4 deletions demo/src/main/java/com/yalantis/starwarsdemo/model/User.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yalantis.starwarsdemo.model;

import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;

import com.yalantis.starwarsdemo.R;

Expand All @@ -21,7 +21,8 @@ public User(boolean darkSide, String fullName, String homeworld, String birthday
mBirthday = birthday;
}

public @DrawableRes int getPhotoRes() {
public @DrawableRes
int getPhotoRes() {
return mDarkSide ? R.drawable.darth : R.drawable.anakin;
}

Expand All @@ -41,7 +42,8 @@ public String getBirthday() {
return mBirthday;
}

public @StringRes int getSideText() {
public @StringRes
int getSideText() {
return isDarkSide() ? R.string.dark_side_label : R.string.light_side_label;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class ParticleSystem implements Renderable {
private final ParticleSystemRenderer mRenderer;
public static final int PARTICLE_COUNT = 1_000;
private int mBufferId;
private final int mBufferId;

public static final int POS_DATA_SIZE = 3;
public static final int TEXTURE_COORDS_DATA_SIZE = 2;
Expand All @@ -39,7 +39,7 @@ public ParticleSystem(ParticleSystemRenderer renderer, FloatBuffer vertexBuffer)
Timber.d("generated in %d ms", System.currentTimeMillis() - startTime);

// Copy buffer into OpenGL's memory. After, we don't need to keep the client-side buffers around.
final int buffers[] = new int[1];
final int[] buffers = new int[1];
glGenBuffers(1, buffers, 0);

glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
public int sizeX = 35;
public int sizeY = 70;
public float mTime;
private GLSurfaceView mGlSurfaceView;
private final GLSurfaceView mGlSurfaceView;
/**
* Store the model matrix. This matrix is used to move models from object space (where each model can be thought
* of being located at the center of the universe) to world space.
*/
private float[] mModelMatrix = new float[16];
private final float[] mModelMatrix = new float[16];
/**
* Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space;
* it positions things relative to our eye.
*/
private float[] mViewMatrix = new float[16];
private final float[] mViewMatrix = new float[16];
/** Store the projection matrix. This is used to project the scene onto a 2D viewport. */
private float[] mProjectionMatrix = new float[16];
private final float[] mProjectionMatrix = new float[16];
/** Allocate storage for the final combined matrix. This will be passed into the shader program. */
private float[] mMVPMatrix = new float[16];
private float[] mTemporaryMatrix = new float[16];
private final float[] mMVPMatrix = new float[16];
private final float[] mTemporaryMatrix = new float[16];
private int timeHandle;
private long mStartTime;
private int frames;
Expand All @@ -59,7 +59,7 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
private float dt;
private long t_current;
private long t_prev;
private float dt_prev = 1;
private final float dt_prev = 1;
private ValueAnimator animator;
private Bitmap mBitmap;
private ParticleSystem mParticleSystem;
Expand All @@ -68,7 +68,7 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
private int mHeight;
private int timesRepeated;
private float delta;
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();


public ParticleSystemRenderer(GLSurfaceView glSurfaceView) {
Expand Down
Loading