Skip to content

Commit 09302f5

Browse files
committed
all modules merged
1 parent bea5bdb commit 09302f5

31 files changed

+705
-15
lines changed

.idea/gradle.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@
2323
android:name=".MainActivity"
2424
android:windowSoftInputMode="stateAlwaysVisible">
2525

26+
</activity>
27+
28+
<activity android:name=".SplashActivity">
2629
<intent-filter>
2730
<action android:name="android.intent.action.MAIN" />
2831

2932
<category android:name="android.intent.category.LAUNCHER" />
3033
</intent-filter>
3134
</activity>
32-
35+
<activity android:name=".HomeActivity"></activity>
3336
<activity
3437
android:name=".ScoreActivity"
3538
android:theme="@style/Theme.AppCompat.Dialog"></activity>
512 KB
Binary file not shown.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.ayush.bitmath;
2+
3+
import android.content.Intent;
4+
import android.graphics.Typeface;
5+
import android.os.Bundle;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.view.View;
8+
import android.view.animation.Animation;
9+
import android.view.animation.AnimationUtils;
10+
import android.widget.Button;
11+
import android.widget.ImageView;
12+
import android.widget.LinearLayout;
13+
import android.widget.RelativeLayout;
14+
15+
public class HomeActivity extends AppCompatActivity {
16+
ImageView im2;
17+
private Animation mAnimation;
18+
RelativeLayout rv;
19+
LinearLayout rv2;
20+
Button bt1,bt2,bt3;
21+
@Override
22+
protected void onCreate(Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
25+
// getSupportActionBar().hide();
26+
setContentView(R.layout.activity_home);
27+
28+
bt1= (Button) findViewById(R.id.button1);
29+
bt2= (Button) findViewById(R.id.button2);
30+
bt3= (Button) findViewById(R.id.button3);
31+
findViewById(R.id.button1).getBackground().setLevel(0);
32+
findViewById(R.id.button2).getBackground().setLevel(1);
33+
findViewById(R.id.button3).getBackground().setLevel(2);
34+
35+
rv2= (LinearLayout) findViewById(R.id.downLayout);
36+
rv= (RelativeLayout) findViewById(R.id.upLayout);
37+
MyBounceInterpolator interpolator = new MyBounceInterpolator(0.1, 20);
38+
//im2= (ImageView) findViewById(R.id.imageView2);
39+
40+
Typeface face= Typeface.createFromAsset(getAssets(), "vtks _chalk.ttf");
41+
bt1.setTypeface(face);
42+
bt2.setTypeface(face);
43+
bt3.setTypeface(face);
44+
45+
// final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.bounce);
46+
final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.tansition);
47+
mAnimation=AnimationUtils.loadAnimation(this,R.anim.transition2);
48+
myAnim.setFillAfter(true);
49+
mAnimation.setFillAfter(true);
50+
mAnimation.setInterpolator(interpolator);
51+
rv2.setVisibility(View.VISIBLE);
52+
rv2.setAnimation(mAnimation);
53+
rv.setAnimation(myAnim);
54+
// rv2.setPivotX(0f);
55+
56+
/* ObjectAnimator scaleY = ObjectAnimator.ofFloat(rv2, "scaleX", 200f);
57+
scaleY.setInterpolator(new AccelerateInterpolator());
58+
scaleY.start();*/
59+
60+
// myAnim.setInterpolator(interpolator);
61+
// im2.startAnimation(myAnim);//bg transition and bounce
62+
bt1.setOnClickListener(new View.OnClickListener() {
63+
@Override
64+
public void onClick(View v) {
65+
Intent i=new Intent(HomeActivity.this,MainActivity.class);
66+
startActivity(i);
67+
}
68+
});
69+
70+
}
71+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.ayush.bitmath;
2+
3+
//
4+
// Interpolator to be used with Android view Animation class to achieve the spring-bounce effect.
5+
//
6+
// License: MIT
7+
// Source: http://evgenii.com/blog/spring-button-animation-on-android/
8+
//
9+
// Usage example, make the button wobble in scale:
10+
// ------------
11+
//
12+
// // Load animation
13+
// final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.bounce);
14+
// double animationDuration = getDurationValue() * 1000;
15+
//
16+
// // Create interpolator with the amplitude 0.2 and frequency 20
17+
// MyBounceInterpolator interpolator = new MyBounceInterpolator(0.2, 20);
18+
//
19+
// myAnim.setInterpolator(interpolator);
20+
// Button button = (Button)findViewById(R.id.button_to_animate);
21+
// button.startAnimation(myAnim);
22+
//
23+
// anim/bounce.xml file:
24+
// --------------------
25+
//
26+
// <?xml version="1.0" encoding="utf-8"?>
27+
// <set xmlns:android="http://schemas.android.com/apk/res/android" >
28+
//
29+
// <scale
30+
// android:duration="2000"
31+
// android:fromXScale="0.3"
32+
// android:toXScale="1.0"
33+
// android:fromYScale="0.3"
34+
// android:toYScale="1.0"
35+
// android:pivotX="50%"
36+
// android:pivotY="50%" />
37+
// </set>
38+
//
39+
//
40+
public class MyBounceInterpolator implements android.view.animation.Interpolator {
41+
/**
42+
* The amplitude of the bounces. The higher value (10, for example) produces more pronounced bounces.
43+
* The lower values (0.1, for example) produce less noticeable wobbles.
44+
*/
45+
double mAmplitude = 1;
46+
47+
/**
48+
* The frequency of the bounces. The higher value produces more wobbles during the animation time period.
49+
*/
50+
double mFrequency = 10;
51+
52+
/**
53+
* Initialize a new interpolator.
54+
*
55+
* @param amplitude The amplitude of the bounces. The higher value produces more pronounced bounces. The lower values (0.1, for example) produce less noticeable wobbles.
56+
* @param frequency The frequency of the bounces. The higher value produces more wobbles during the animation time period.
57+
*
58+
*/
59+
public MyBounceInterpolator(double amplitude, double frequency) {
60+
mAmplitude = amplitude;
61+
mFrequency = frequency;
62+
}
63+
64+
public float getInterpolation(float time) {
65+
double amplitude = mAmplitude;
66+
if (amplitude == 0) { amplitude = 0.05; }
67+
68+
// The interpolation curve equation:
69+
// -e^(-time / amplitude) * cos(frequency * time) + 1
70+
//
71+
// View the graph live: https://www.desmos.com/calculator/6gbvrm5i0s
72+
return (float) (-1 * Math.pow(Math.E, -time/ mAmplitude) * Math.cos(mFrequency * time) + 1);
73+
}
74+
}

app/src/main/java/com/ayush/bitmath/ScoreActivity.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package com.ayush.bitmath;
22

3+
import android.content.Intent;
34
import android.content.SharedPreferences;
45
import android.os.Bundle;
56
import android.support.annotation.NonNull;
67
import android.support.v7.app.AppCompatActivity;
78
import android.view.View;
89
import android.widget.Button;
10+
import android.widget.ImageView;
11+
import android.widget.LinearLayout;
912
import android.widget.TextView;
1013

1114
import com.ayush.bitmath.Utils.LogWrapper;
@@ -15,8 +18,9 @@
1518

1619
public class ScoreActivity extends AppCompatActivity {
1720

18-
private TextView textViewScore, textViewHighScore;
19-
private Button buttonReplay, buttonStandings;
21+
private Button textViewScore, textViewHighScore;
22+
private ImageView buttonReplay, buttonStandings;
23+
LinearLayout option;
2024
int currentScore = 0;
2125
GoogleApiClient apiClient;
2226

@@ -31,10 +35,14 @@ protected void onCreate(Bundle savedInstanceState) {
3135
}
3236

3337
private void init() {
34-
textViewScore = (TextView) findViewById(R.id.scoreText);
35-
textViewHighScore = (TextView) findViewById(R.id.highScoreText);
36-
buttonReplay = (Button) findViewById(R.id.buttonReplay);
37-
buttonStandings = (Button) findViewById(R.id.buttonStandings);
38+
textViewScore = (Button) findViewById(R.id.scoreText);
39+
textViewHighScore = (Button) findViewById(R.id.highScoreText);
40+
buttonReplay = (ImageView) findViewById(R.id.buttonReplay);
41+
buttonStandings = (ImageView) findViewById(R.id.buttonStandings);
42+
option=(LinearLayout)findViewById(R.id.option);
43+
findViewById(R.id.scoreText).getBackground().setLevel(0);
44+
findViewById(R.id.highScoreText).getBackground().setLevel(1);
45+
findViewById(R.id.option).getBackground().setLevel(2);
3846
// apiClient = new GoogleApiClient.Builder(getApplicationContext())
3947
// .addApi(Games.API)
4048
// .addScope(Games.SCOPE_GAMES)
@@ -74,9 +82,13 @@ public void onClick(View v) {
7482
buttonStandings.setOnClickListener(new View.OnClickListener() {
7583
@Override
7684
public void onClick(View v) {
77-
startActivityForResult(
85+
/* startActivityForResult(
7886
Games.Leaderboards.getLeaderboardIntent(apiClient,
79-
getString(R.string.leaderboard_bit_math_global_rank)), 0);
87+
getString(R.string.leaderboard_bit_math_global_rank)), 0);*/
88+
Intent i=new Intent(ScoreActivity.this,HomeActivity.class);
89+
startActivity(i);
90+
overridePendingTransition(R.anim.fade,R.anim.fadeout);
91+
8092
}
8193
});
8294
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.ayush.bitmath;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.v7.app.AppCompatActivity;
6+
import android.view.animation.Animation;
7+
import android.view.animation.AnimationUtils;
8+
import android.widget.ImageView;
9+
10+
public class SplashActivity extends AppCompatActivity {
11+
ImageView im,im2;
12+
private Animation mAnimation;
13+
14+
15+
@Override
16+
protected void onCreate(Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
// getSupportActionBar().hide();
19+
setContentView(R.layout.activity_splash);
20+
im= (ImageView) findViewById(R.id.imageView);
21+
//im2= (ImageView) findViewById(R.id.imageView2);
22+
// MyBounceInterpolator interpolator = new MyBounceInterpolator(0.2, 20);
23+
// final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.bounce);
24+
//myAnim.setInterpolator(interpolator);
25+
26+
Thread timer = new Thread() {
27+
public void run() {
28+
try {
29+
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade1);
30+
im.startAnimation(animation);
31+
sleep(2500);
32+
} catch (InterruptedException e) {
33+
e.printStackTrace();
34+
} finally {
35+
Intent i = new Intent(SplashActivity.this, HomeActivity.class);
36+
// im2.setVisibility(View.VISIBLE);//bg
37+
final Animation myAnim = AnimationUtils.loadAnimation(SplashActivity.this, R.anim.bounce);
38+
// im.startAnimation(myAnim);
39+
// im2.startAnimation(myAnim);
40+
startActivity(i);
41+
overridePendingTransition(R.anim.fade,R.anim.fadeout);
42+
}
43+
}
44+
};
45+
timer.start();
46+
47+
48+
49+
/* fade anim*/
50+
/* mAnimation = new TranslateAnimation(
51+
TranslateAnimation.ABSOLUTE, -1f,
52+
TranslateAnimation.ABSOLUTE, 0f,
53+
TranslateAnimation.RELATIVE_TO_PARENT, -1f,
54+
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f);
55+
mAnimation.setDuration(250);
56+
mAnimation.setRepeatCount(0);
57+
mAnimation.setRepeatMode(Animation.REVERSE);
58+
mAnimation.setInterpolator(new LinearInterpolator());
59+
im.setAnimation(mAnimation);*/// fade anim on title
60+
}
61+
62+
@Override protected void onPause() {
63+
super.onPause();
64+
finish();
65+
66+
}
67+
}

app/src/main/res/anim/bounce.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android" >
3+
4+
<scale
5+
android:duration="1500"
6+
7+
android:fromXScale="0.3"
8+
android:toXScale="1.0"
9+
android:fromYScale="0.3"
10+
android:toYScale="1.0"
11+
android:pivotX="50%"
12+
android:pivotY="50%"
13+
android:repeatCount="0"/>
14+
<translate
15+
xmlns:android="http://schemas.android.com/apk/res/android"
16+
android:fromYDelta="-100%p"
17+
android:fromXDelta="100%p"
18+
android:toYDelta="0"
19+
android:toXDelta="0"
20+
android:repeatCount="0"
21+
android:duration="650">
22+
></translate>
23+
</set>

0 commit comments

Comments
 (0)