1. 멀티프로그래밍(MultiProgramming)


<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/FrameLayout1"
android:background="@drawable/aaa"
tools:context="org.android.soldesk.multiprogramming_01.MultiProgramming_01Activity">

<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/button01"
android:layout_x="200px"
android:layout_y="200px"
android:background="#aaff0000"
android:gravity="center"
android:onClick="myListener01"
android:text="Introduction"
/>

<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/button02"
android:layout_x="200px"
android:layout_y="300px"
android:background="#aaff0000"
android:gravity="center"
android:onClick="myListener02"
android:text="Settings"
/>

<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/button03"
android:layout_x="200px"
android:layout_y="400px"
android:background="#aaff0000"
android:gravity="center"
android:onClick="myListener03"
android:text="Start"
/>

<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/button05"
android:layout_x="200px"
android:layout_y="500px"
android:background="#aaff0000"
android:gravity="center"
android:onClick="myListener05"
android:text="Start2"
/>

<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/button04"
android:layout_x="200px"
android:layout_y="600px"
android:background="#aaff0000"
android:gravity="center"
android:onClick="myListener04"
android:text="Exit"
/>
</AbsoluteLayout>
</FrameLayout>

<xml>


package org.android.soldesk.multiprogramming_01;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MultiProgramming_01Activity extends AppCompatActivity {

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

public void myListener01(View target)
{
Intent intent = new Intent(getApplicationContext(),IntroActivity.class);
startActivity(intent);
}
public void myListener02(View target)
{
Intent intent = new Intent(getApplicationContext(),SetupActivity.class);
startActivity(intent);
}
public void myListener03(View target)
{
Intent intent = new Intent(getApplicationContext(),StartActivity.class);
startActivity(intent);
}

public void myListener05(View target)
{
Intent intent = new Intent(getApplicationContext(),Start2Activity.class);
startActivity(intent);
}

public void myListener04(View target)
{
moveTaskToBack(true);
}

}

<java>


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.android.soldesk.multiprogramming_01">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MultiProgramming_01Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".IntroActivity"/>
<activity android:name=".SetupActivity"/>
<activity android:name=".StartActivity"/>
<activity android:name=".Start2Activity"/>

</application>

</manifest>

<AndroidManifest.xml>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bbb"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView01"
android:text="http://tsitory.tistory.com/http://tsitory.tistory.com/http://tsitory.tistory.com/http://tsitory.tistory.com/http://tsitory.tistory.com/http://tsitory.tistory.com/"

android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff00"
/>

</LinearLayout>

<intro.xmp>


package org.android.soldesk.multiprogramming_01;


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class IntroActivity extends AppCompatActivity{

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

}

<IntroActivity.java>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ccc"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Difficulties"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/seekBar01"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Players"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/seekBar02"
/>

</LinearLayout>

<setup.xml>


package org.android.soldesk.multiprogramming_01;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

/**
* Created by soldesk on 2017-03-29.
*/

public class SetupActivity extends AppCompatActivity{

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

}

<SetupActivity.java>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ddd"
android:orientation="vertical">

<Chronometer
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chronometer01"
android:text="Chronometer"
android:textSize="25pt"
android:textStyle="bold|italic"
android:typeface="serif"
/>

</LinearLayout>

<start.xml>


package org.android.soldesk.multiprogramming_01;


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class StartActivity extends AppCompatActivity{


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

}

<StartActivity.java>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStart"
android:text="Strat"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStop"
android:text="Stop"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonExit"
android:text="Exit"
/>
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView01"
android:minWidth="552px"
android:minHeight="411px"
/>

</LinearLayout>

<start2.xml>


package org.android.soldesk.multiprogramming_01;

import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

/**
* Created by soldesk on 2017-03-29.
*/

public class Start2Activity extends AppCompatActivity{

AnimationDrawable mFrameAnimation = null;
Button buttonExit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start2);

ImageView imageView = (ImageView) findViewById(R.id.imageView01);

BitmapDrawable ff1 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa1);
BitmapDrawable ff2 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa2);
BitmapDrawable ff3 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa3);
BitmapDrawable ff4 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa4);
BitmapDrawable ff5 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa5);
BitmapDrawable ff6 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa6);
BitmapDrawable ff7 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa7);
BitmapDrawable ff8 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa8);
BitmapDrawable ff9 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa9);
BitmapDrawable ff10 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa10);
BitmapDrawable ff11 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa11);
BitmapDrawable ff12 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa12);
BitmapDrawable ff13 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa13);
BitmapDrawable ff14 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa14);
BitmapDrawable ff15 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa15);
BitmapDrawable ff16 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa16);
BitmapDrawable ff17 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa17);
BitmapDrawable ff18 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa18);
BitmapDrawable ff19 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa19);
BitmapDrawable ff20 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa20);
BitmapDrawable ff21 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa21);
BitmapDrawable ff22 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa22);
// BitmapDrawable ff23 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa23);
// BitmapDrawable ff24 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa24);
// BitmapDrawable ff25 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa25);
// BitmapDrawable ff26 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa26);
// BitmapDrawable ff27 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa27);

int mDuration = 30;

mFrameAnimation = new AnimationDrawable();

mFrameAnimation.setOneShot(false);
mFrameAnimation.addFrame(ff1, mDuration);
mFrameAnimation.addFrame(ff2, mDuration);
mFrameAnimation.addFrame(ff3, mDuration);
mFrameAnimation.addFrame(ff4, mDuration);
mFrameAnimation.addFrame(ff5, mDuration);
mFrameAnimation.addFrame(ff6, mDuration);
mFrameAnimation.addFrame(ff7, mDuration);
mFrameAnimation.addFrame(ff8, mDuration);
mFrameAnimation.addFrame(ff9, mDuration);
mFrameAnimation.addFrame(ff10, mDuration);
mFrameAnimation.addFrame(ff11, mDuration);
mFrameAnimation.addFrame(ff12, mDuration);
mFrameAnimation.addFrame(ff13, mDuration);
mFrameAnimation.addFrame(ff14, mDuration);
mFrameAnimation.addFrame(ff15, mDuration);
mFrameAnimation.addFrame(ff16, mDuration);
mFrameAnimation.addFrame(ff17, mDuration);
mFrameAnimation.addFrame(ff18, mDuration);
mFrameAnimation.addFrame(ff19, mDuration);
mFrameAnimation.addFrame(ff20, mDuration);
mFrameAnimation.addFrame(ff21, mDuration);
mFrameAnimation.addFrame(ff22, mDuration);
// mFrameAnimation.addFrame(ff23, mDuration);
// mFrameAnimation.addFrame(ff24, mDuration);
// mFrameAnimation.addFrame(ff25, mDuration);
// mFrameAnimation.addFrame(ff26, mDuration);
// mFrameAnimation.addFrame(ff27, mDuration);

imageView.setBackgroundDrawable(mFrameAnimation);

final Button onButton = (Button) findViewById(R.id.buttonStart);
onButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.start();
}
});
final Button offButton = (Button) findViewById(R.id.buttonStop);
offButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.stop();
}
});
buttonExit = (Button) findViewById(R.id.buttonExit);
buttonExit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}

<Start2Activity.java>




2. Frame_Animation_01 (프레임 애니메이션)


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context="org.android.soldesk.frame_animation_01.Frame_Animation_01Activity">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStart"
android:text="Strat"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStop"
android:text="Stop"
/>
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView01"
android:minWidth="552px"
android:minHeight="411px"
/>

</LinearLayout>

<xml>


package org.android.soldesk.frame_animation_01;

import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class Frame_Animation_01Activity extends AppCompatActivity {

ImageView imageView;
AnimationDrawable mFrameAnimation = null;

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

imageView = (ImageView) findViewById(R.id.imageView01);

imageView.setBackgroundResource(R.drawable.animation2);

mFrameAnimation = (AnimationDrawable) imageView.getBackground();

final Button onButton = (Button) findViewById(R.id.buttonStart);

onButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.start();
}
});

final Button offButton = (Button) findViewById(R.id.buttonStop);

offButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.stop();
}
});
}
}

<java>


<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/aa1" android:duration="30"/>
<item android:drawable="@drawable/aa2" android:duration="30"/>
<item android:drawable="@drawable/aa3" android:duration="30"/>
<item android:drawable="@drawable/aa4" android:duration="30"/>
<item android:drawable="@drawable/aa5" android:duration="30"/>
<item android:drawable="@drawable/aa6" android:duration="30"/>
<item android:drawable="@drawable/aa7" android:duration="30"/>
<item android:drawable="@drawable/aa8" android:duration="30"/>
<item android:drawable="@drawable/aa9" android:duration="30"/>
<item android:drawable="@drawable/aa10" android:duration="30"/>
<item android:drawable="@drawable/aa11" android:duration="30"/>
<item android:drawable="@drawable/aa12" android:duration="30"/>
<item android:drawable="@drawable/aa13" android:duration="30"/>
<item android:drawable="@drawable/aa14" android:duration="30"/>
<item android:drawable="@drawable/aa15" android:duration="30"/>
<item android:drawable="@drawable/aa16" android:duration="30"/>
<item android:drawable="@drawable/aa17" android:duration="30"/>
<item android:drawable="@drawable/aa18" android:duration="30"/>
<item android:drawable="@drawable/aa19" android:duration="30"/>
<item android:drawable="@drawable/aa20" android:duration="30"/>
<item android:drawable="@drawable/aa21" android:duration="30"/>
<item android:drawable="@drawable/aa22" android:duration="30"/>
<item android:drawable="@drawable/aa23" android:duration="30"/>
<item android:drawable="@drawable/aa24" android:duration="30"/>
<item android:drawable="@drawable/aa25" android:duration="30"/>
<item android:drawable="@drawable/aa26" android:duration="30"/>
<item android:drawable="@drawable/aa27" android:duration="30"/>
</animation-list>

<animation2.xml>




3. Frame_Animation_02 (프레임 애니메이션)


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context="org.android.soldesk.frame_animation_02.Frame_Animation_02Activity">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStart"
android:text="Strat"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonStop"
android:text="Stop"
/>
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView01"
android:minWidth="552px"
android:minHeight="411px"
/>

</LinearLayout>

<xml>


package org.android.soldesk.frame_animation_02;

import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class Frame_Animation_02Activity extends AppCompatActivity {

AnimationDrawable mFrameAnimation = null;

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

ImageView imageView = (ImageView) findViewById(R.id.imageView01);

BitmapDrawable ff1 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa1);
BitmapDrawable ff2 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa2);
BitmapDrawable ff3 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa3);
BitmapDrawable ff4 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa4);
BitmapDrawable ff5 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa5);
BitmapDrawable ff6 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa6);
BitmapDrawable ff7 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa7);
BitmapDrawable ff8 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa8);
BitmapDrawable ff9 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa9);
BitmapDrawable ff10 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa10);
BitmapDrawable ff11 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa11);
BitmapDrawable ff12 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa12);
BitmapDrawable ff13 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa13);
BitmapDrawable ff14 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa14);
BitmapDrawable ff15 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa15);
BitmapDrawable ff16 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa16);
BitmapDrawable ff17 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa17);
BitmapDrawable ff18 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa18);
BitmapDrawable ff19 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa19);
BitmapDrawable ff20 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa20);
BitmapDrawable ff21 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa21);
BitmapDrawable ff22 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa22);
BitmapDrawable ff23 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa23);
BitmapDrawable ff24 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa24);
BitmapDrawable ff25 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa25);
BitmapDrawable ff26 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa26);
BitmapDrawable ff27 = (BitmapDrawable) getResources().getDrawable(R.drawable.aa27);

int mDuration = 30;

mFrameAnimation = new AnimationDrawable();

mFrameAnimation.setOneShot(false);
mFrameAnimation.addFrame(ff1,mDuration);
mFrameAnimation.addFrame(ff2,mDuration);
mFrameAnimation.addFrame(ff3,mDuration);
mFrameAnimation.addFrame(ff4,mDuration);
mFrameAnimation.addFrame(ff5,mDuration);
mFrameAnimation.addFrame(ff6,mDuration);
mFrameAnimation.addFrame(ff7,mDuration);
mFrameAnimation.addFrame(ff8,mDuration);
mFrameAnimation.addFrame(ff9,mDuration);
mFrameAnimation.addFrame(ff10,mDuration);
mFrameAnimation.addFrame(ff11,mDuration);
mFrameAnimation.addFrame(ff12,mDuration);
mFrameAnimation.addFrame(ff13,mDuration);
mFrameAnimation.addFrame(ff14,mDuration);
mFrameAnimation.addFrame(ff15,mDuration);
mFrameAnimation.addFrame(ff16,mDuration);
mFrameAnimation.addFrame(ff17,mDuration);
mFrameAnimation.addFrame(ff18,mDuration);
mFrameAnimation.addFrame(ff19,mDuration);
mFrameAnimation.addFrame(ff20,mDuration);
mFrameAnimation.addFrame(ff21,mDuration);
mFrameAnimation.addFrame(ff22,mDuration);
mFrameAnimation.addFrame(ff23,mDuration);
mFrameAnimation.addFrame(ff24,mDuration);
mFrameAnimation.addFrame(ff25,mDuration);
mFrameAnimation.addFrame(ff26,mDuration);
mFrameAnimation.addFrame(ff27,mDuration);

imageView.setBackgroundDrawable(mFrameAnimation);

final Button onButton = (Button) findViewById(R.id.buttonStart);
onButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.start();
}
});
final Button offButton = (Button) findViewById(R.id.buttonStop);
offButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFrameAnimation.stop();
}
});
}
}

<java>




4. Tweened_Animation


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="org.android.soldesk.tweened_animation_0111.Tweened_Animation_0111Activity"
android:padding="10dp"
android:background="#88777777">
<ViewFlipper
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ViewFlipper01"
android:flipInterval="2000"
android:layout_marginBottom="30dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="30sp"
android:text="Freedom"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="30sp"
android:text="is nothing else but"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="30sp"
android:text="a chance to be better"/>
</ViewFlipper>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="Select one animation~~~~~~"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Spinner01"/>
</LinearLayout>

<xml>


package org.android.soldesk.tweened_animation_0111;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.ViewFlipper;

public class Tweened_Animation_0111Activity extends AppCompatActivity {
private ViewFlipper mFlipper;
private String[] ANIMATIONS={"Push Left","Push up","Zoom","Fade"};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tweened__animation_0111);
mFlipper= (ViewFlipper) findViewById(R.id.ViewFlipper01);
mFlipper.startFlipping();
ArrayAdapter adapter=new ArrayAdapter(getApplicationContext(),
android.R.layout.simple_spinner_item,ANIMATIONS);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

Spinner spin= (Spinner) findViewById(R.id.Spinner01);
spin.setAdapter(adapter);
spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position)
{
case 0:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.push_left_in));
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.push_left_out));
break;
case 1:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.push_up_in));
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.push_up_out));
break;
case 2:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.zoom_in));
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.zoom_out));
break;
case 3:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
android.R.anim.fade_in));
mFlipper.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
android.R.anim.fade_out));
break;
}
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});
}
}

<java>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="400"
android:fromXDelta="100%"
android:toXDelta="0"/>
<alpha
android:duration="400"
android:fromAlpha="0.0"
android:toAlpha="1.0"/>
</set>

<push_left_in.xml>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="400"
android:fromXDelta="0"
android:toXDelta="-100%"/>
<alpha
android:duration="400"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
</set>

<push_left_out.xml>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="400"
android:fromYDelta="100%"
android:toYDelta="0"/>
<alpha
android:duration="400"
android:fromAlpha="0.0"
android:toAlpha="1.0"/>
</set>

<push_up_in.xml>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="400"
android:fromYDelta="0"
android:toYDelta="-100%"/>
<alpha
android:duration="400"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
</set>

<push_up_out.xml>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="@android:integer/config_shortAnimTime"
android:fromXScale="2.0"
android:fromYScale="2.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0"/>
</set>

<zoom_in.xml>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="@android:integer/config_shortAnimTime"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale=".5"
android:toYScale=".5"/>
<alpha
android:duration="@android:integer/config_shortAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
</set>

<zoom_out.xml>


+ Recent posts