Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alighters/CubeGrid

Cube grid animation about the android.
https://github.com/alighters/CubeGrid

Last synced: 2 months ago
JSON representation

Cube grid animation about the android.

Awesome Lists containing this project

README

        

# CubeGrid
Cube grid animation about the android.

The android implementation about the [9-cube-grid](https://github.com/tobiasahlin/SpinKit/blob/master/examples/9-cube-grid.html)

## Demo
![test](http://7xpyth.com1.z0.glb.clouddn.com/cube1.gif)

## Usage
### Add dependency
allprojects {
repositories {
...
mavenCentral()
}
}
dependencies {
compile 'com.lighters.cubegrid:cubegridlibray:1.2.4'
}

### Step 1
```


```
### Step 2
```
public class MainActivity extends AppCompatActivity {

public final static String TAG = MainActivity.class.getName();

private CubeGridImageView mCubeGridImageView;
private CubeGridFrameLayout mCubeGridFrameLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}

private void init() {
mCubeGridImageView = (CubeGridImageView) findViewById(R.id.iv_cube_grid);
mCubeGridFrameLayout = (CubeGridFrameLayout) findViewById(R.id.fl_cube_grid);
mCubeGridImageView.start(mImageAnimCallback);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mCubeGridFrameLayout.start(mFrameLayoutAnimCallback);
}
}, 100);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mCubeGridImageView.stop();
}
}, 5000);
}

private ICubeGridAnimCallback mImageAnimCallback = new ICubeGridAnimCallback() {
@Override
public void onAnimStart() {

}

@Override
public void onAnimExecute(int curLoopCount) {
Log.d(TAG, "image loop:" + curLoopCount);
}

@Override
public void onAnimEnd() {
Toast.makeText(MainActivity.this, "ImageAnimEnd", Toast.LENGTH_SHORT).show();
}
};

private ICubeGridAnimCallback mFrameLayoutAnimCallback = new ICubeGridAnimCallback() {
@Override
public void onAnimStart() {

}

@Override
public void onAnimExecute(int curLoopCount) {
Log.d(TAG, "frame layout loop:" + curLoopCount);
}

@Override
public void onAnimEnd() {
Toast.makeText(MainActivity.this, "FrameAnimEnd", Toast.LENGTH_SHORT).show();
}
};

@Override
protected void onDestroy() {
super.onDestroy();
mCubeGridImageView.destory();
mCubeGridFrameLayout.destroy();
}
}
```

## LICENSE

```
Copyright (C) 2016 david.wei (lighters)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.