Friday 28 October 2016

Android Animation Example Using Java Code

Android Animation Example
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   
package="com.example.mihir.animationexamplenew">

    <
application
       
android:allowBackup="true"
       
android:icon="@mipmap/ic_launcher"
       
android:label="@string/app_name"
       
android:supportsRtl="true"
       
android:theme="@style/AppTheme">
      
        <
activity android:name=".AndroidListViewActivity"
           
android:label="Android List View">
            <
intent-filter>
                <
action android:name="android.intent.action.MAIN" />
                <
category android:name="android.intent.category.LAUNCHER" />
            </
intent-filter>
        </
activity>

        <
activity android:name=".SingleListItem"
           
android:label="Single Item Selected"></activity>

    </
application>
</
manifest>

Build.gradle(Project:AnimationExampleNew)
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {

        jcenter()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:2.1.2'

        // NOTE: Do not place your application dependencies here; they belong

        // in the individual module build.gradle files

    }

}

allprojects {

    repositories {

        jcenter()

        maven { url "https://jitpack.io" }

    }

}

task clean(type: Delete) {

    delete rootProject.buildDir

}

Builde.gradle(Module:app)
apply plugin: 'com.android.application'

android {

    compileSdkVersion 24

    buildToolsVersion "24.0.2"

    defaultConfig {

        applicationId "com.example.mihir.animationexamplenew"

        minSdkVersion 15

        targetSdkVersion 24

        versionCode 1

        versionName "1.0"

    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }

}

dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])

    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:24.2.1'

    compile 'com.github.ratty3697:android-smart-animation-library:1.5'

}

AndroidListViewActivity.java

package com.example.mihir.animationexamplenew;



import android.app.ListActivity;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.widget.AdapterView;

import android.widget.AdapterView.OnItemClickListener;

import android.widget.ArrayAdapter;

import android.widget.ListView;

import android.widget.TextView;



public class AndroidListViewActivity extends ListActivity {

    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        // storing string resources into Array

        String[] animation = getResources().getStringArray(R.array.animation);

        // Binding Array to ListAdapter

        this.setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, animation));

        ListView lv = getListView();

        // listening to single list item on click

        lv.setOnItemClickListener(new OnItemClickListener() {

          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

             // selected item 

             String animation = ((TextView) view).getText().toString();

             // Launching new Activity on selecting single List Item

             Intent i = new Intent(getApplicationContext(), SingleListItem.class);

             // sending data to new activity

             i.putExtra("animations", animation);

             startActivity(i);

          }

        });

    }

}

SingleListItem.java

package com.example.mihir.animationexamplenew;



import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.widget.TextView;

import com.podcopic.animationlib.library.AnimationType;

import com.podcopic.animationlib.library.StartSmartAnimation;



public class SingleListItem extends Activity {

   @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.single_list_item_view);

        TextView txtAnimation = (TextView) findViewById(R.id.animation_txt);

        Intent i = getIntent();

        // getting attached intent data

        String animation = i.getStringExtra("animations");

        // displaying selected animation name

        txtAnimation.setText(animation);



        switch(animation) {

            case "ShakeBand":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ShakeBand , 2000 , 0 , true , 300 );

                break;

            case "TakingOff":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.TakingOff , 2000 , 0 , true , 300 );

                break;

            case "Flash":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Flash , 2000 , 0 , true , 300 );

                break;

            case "Pulse":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Pulse , 2000 , 0 , true , 300 );

                break;

            case "RubberBand":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RubberBand , 2000 , 0 , true , 300 );

                break;

            case "Landing":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Landing , 2000 , 0 , true , 300 );

                break;

            case "Shake":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Shake , 2000 , 0 , true , 300 );

                break;

            case "Swing":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Swing , 2000 , 0 , true , 300 );

                break;

            case "Wobble":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Wobble , 2000 , 0 , true , 300 );

                break;

            case "Bounce":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Bounce , 2000 , 0 , true , 300 );

                break;

            case "Tada":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Tada , 2000 , 0 , true , 300 );

                break;

            case "StandUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.StandUp , 2000 , 0 , true , 300 );

                break;

            case "Wave":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Wave , 2000 , 0 , true , 300 );

                break;

            case "Hinge":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.Hinge , 2000 , 0 , true , 300 );

                break;

            case "BounceIn":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.BounceIn , 2000 , 0 , true , 300 );

                break;

            case "FadeIn":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeIn , 2000 , 0 , true , 300 );

                break;

            case "FadeOut":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeOut , 2000 , 0 , true , 300 );

                break;

            case "FlipInX":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FlipInX , 2000 , 0 , true , 300 );

                break;

            case "FlipInY":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FlipInY , 2000 , 0 , true , 300 );

                break;

            case "FlipOutX":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FlipOutX , 2000 , 0 , true , 300 );

                break;

            case "FlipOutY":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FlipOutY , 2000 , 0 , true , 300 );

                break;

            case "RotateIn":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateIn , 2000 , 0 , true , 300 );

                break;

            case "RotateInDownLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateInDownLeft , 2000 , 0 , true , 300 );

                break;

            case "RotateInDownRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateInDownRight , 2000 , 0 , true , 300 );

                break;

            case "RotateInUpLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateInUpLeft , 2000 , 0 , true , 300 );

                break;

            case "RotateInUpRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateInUpRight , 2000 , 0 , true , 300 );

                break;

            case "RotateOut":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateOut , 2000 , 0 , true , 300 );

                break;

            case "RotateOutDownLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateOutDownLeft , 2000 , 0 , true , 300 );

                break;

            case "RotateOutDownRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateOutDownRight , 2000 , 0 , true , 300 );

                break;

            case "RotateOutUpLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateOutUpLeft , 2000 , 0 , true , 300 );

                break;

            case "RotateOutUpRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RotateOutUpRight , 2000 , 0 , true , 300 );

                break;

            case "ZoomIn":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomIn , 2000 , 0 , true , 300 );

                break;

            case "ZoomInRubberBand":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomInRubberBand , 2000 , 0 , true , 300 );

                break;

            case "ZoomOut":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomOut , 2000 , 0 , true , 300 );

                break;

            case "DropOut":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.DropOut , 2000 , 0 , true , 300 );

                break;

            case "RollIn":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RollIn , 2000 , 0 , true , 300 );

                break;

            case "RollOut":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.RollOut , 2000 , 0 , true , 300 );

                break;

            case "BounceInDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.BounceInDown , 2000 , 0 , true , 300 );

                break;

            case "BounceInUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.BounceInUp , 2000 , 0 , true , 300 );

                break;

            case "BounceInLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.BounceInLeft , 2000 , 0 , true , 300 );

                break;

            case "BounceInRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.BounceInRight , 2000 , 0 , true , 300 );

                break;

            case "FadeInUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeInUp , 2000 , 0 , true , 300 );

                break;

            case "FadeInDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeInDown , 2000 , 0 , true , 300 );

                break;

            case "FadeInRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeInRight , 2000 , 0 , true , 300 );

                break;

            case "FadeInLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeInLeft , 2000 , 0 , true , 300 );

                break;

            case "FadeOutUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeOutUp , 2000 , 0 , true , 300 );

                break;

            case "FadeOutDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeOutDown , 2000 , 0 , true , 300 );

                break;

            case "FadeOutRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeOutRight , 2000 , 0 , true , 300 );

                break;

            case "FadeOutLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.FadeOutLeft , 2000 , 0 , true , 300 );

                break;

            case "SlideInLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideInLeft , 2000 , 0 , true , 300 );

                break;

            case "SlideInUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideInUp , 2000 , 0 , true , 300 );

                break;

            case "SlideInDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideInDown , 2000 , 0 , true , 300 );

                break;

            case "SlideInRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideInRight , 2000 , 0 , true , 300 );

                break;

            case "SlideOutLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideOutLeft , 2000 , 0 , true , 300 );

                break;

            case "SlideOutUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideOutUp , 2000 , 0 , true , 300 );

                break;

            case "SlideOutDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideOutDown , 2000 , 0 , true , 300 );

                break;

            case "SlideOutRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.SlideOutRight , 2000 , 0 , true , 300 );

                break;

            case "ZoomInDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomInDown , 2000 , 0 , true , 300 );

                break;

            case "ZoomInLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomInLeft , 2000 , 0 , true , 300 );

                break;

            case "ZoomInRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomInRight , 2000 , 0 , true , 300 );

                break;

            case "ZoomInUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomInUp , 2000 , 0 , true , 300 );

                break;

            case "ZoomOutDown":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomOutDown , 2000 , 0 , true , 300 );

                break;

            case "ZoomOutLeft":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomOutLeft , 2000 , 0 , true , 300 );

                break;

            case "ZoomOutRight":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomOutRight , 2000 , 0 , true , 300 );

                break;

            case "ZoomOutUp":

                StartSmartAnimation.startAnimation( findViewById(R.id.animation_txt) ,

                        AnimationType.ZoomOutUp , 2000 , 0 , true , 300 );

                break;



            default:

        }

    }

}

list_item.xml

<?xml version="1.0" encoding="utf-8"?>



<!--  Single List Item Design -->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"

   android:id="@+id/label"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:padding="10dip"

    android:textSize="16dip"

    android:textStyle="bold" >

</TextView>

Single_list_item_view.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout

  xmlns:android="http://schemas.android.com/apk/res/android"

  android:layout_width="match_parent"

  android:layout_height="match_parent">

  <TextView android:id="@+id/animation_txt"

         android:layout_width="wrap_content"

         android:layout_height="wrap_content"

         android:textSize="25dip"

         android:textStyle="bold"

         android:padding="10dip"

         android:textColor="#000000"

     android:layout_centerVertical="true"

     android:layout_centerHorizontal="true" />

</RelativeLayout>

Create list_data.xml in values directory.

list_data.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>

    <string-array name="animation">

       <item>ShakeBand</item>

       <item>TakingOff</item>

       <item>Flash</item>

       <item>Pulse</item>

       <item>RubberBand</item>

       <item>Landing</item>

        <item>Shake</item>

        <item>Swing</item>

        <item>Wobble</item>

        <item>Bounce</item>

        <item>Tada</item>

        <item>StandUp</item>

        <item>Wave</item>

        <item>Hinge</item>

        <item>BounceIn</item>

        <item>FadeIn</item>

        <item>FadeOut</item>

        <item>FlipInX</item>

        <item>FlipInY</item>

        <item>FlipOutX</item>

        <item>FlipOutY</item>

        <item>RotateIn</item>

        <item>RotateInDownLeft</item>

        <item>RotateInDownRight</item>

        <item>RotateInUpLeft</item>

        <item>RotateInUpRight</item>

        <item>RotateOut</item>

        <item>RotateOutDownLeft</item>

        <item>RotateOutDownRight</item>

        <item>RotateOutUpLeft</item>

        <item>RotateOutUpRight</item>

        <item>ZoomIn</item>

        <item>ZoomInRubberBand</item>

        <item>ZoomOut</item>

        <item>DropOut</item>

        <item>RollIn</item>

        <item>RollOut</item>

        <item>BounceInDown</item>

        <item>BounceInUp</item>

        <item>BounceInLeft</item>

        <item>BounceInRight</item>

        <item>FadeInUp</item>

        <item>FadeInDown</item>

        <item>FadeInRight</item>

        <item>FadeInLeft</item>

        <item>FadeOutUp</item>

        <item>FadeOutDown</item>

        <item>FadeOutRight</item>

        <item>FadeOutLeft</item>

        <item>SlideInLeft</item>

        <item>SlideInUp</item>

        <item>SlideInDown</item>

        <item>SlideInRight</item>

        <item>SlideOutLeft</item>

        <item>SlideOutUp</item>

        <item>SlideOutDown</item>

        <item>SlideOutRight</item>

        <item>ZoomInDown</item>

        <item>ZoomInLeft</item>

        <item>ZoomInRight</item>

        <item>ZoomInUp</item>

        <item>ZoomOutDown</item>

        <item>ZoomOutLeft</item>

        <item>ZoomOutRight</item>

        <item>ZoomOutUp</item>

    </string-array>

</resources>
 

Now you are ready to play different animation in your android project.

CCAvenue Payment Gateway Android Integration

CCAvenue Payment Gateway Android Integration CCAvenue payment gateway android integration using PHP RSA and Response Handling. An...