Cube grid animation about the android.
The android implementation about the 9-cube-grid
allprojects {
repositories {
...
mavenCentral()
}
}
dependencies {
compile 'com.lighters.cubegrid:cubegridlibray:1.2.4'
}
<com.lighters.cubegridlibrary.view.CubeGridImageView
android:id="@+id/iv_cube_grid"
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="12dp"
android:src="@drawable/ic_launcher"
app:fillColor="#f00"
app:loopCount="10"
app:roundCornerSize="6dp"/>
<com.lighters.cubegridlibrary.view.CubeGridFrameLayout
android:id="@+id/fl_cube_grid"
android:layout_width="80dp"
android:layout_marginTop="100dp"
android:layout_height="80dp"
app:fillColor="#0f0"
app:loopCount="10"
app:roundCornerSize="6dp"/>
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();
}
}
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.