-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySingleton.java
50 lines (39 loc) · 1.02 KB
/
MySingleton.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package myapp.util;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;
/**
* Created by Diogo on 29/07/2016.
*/
public class MySingleton {
private static MySingleton instance;
private MySingleton(){}
public static MySingleton getInstance(){
if(instance == null)
{
initInstance();
}
return instance;
}
private static synchronized void initInstance()
{
if (instance == null)
{
instance = new MySingleton();
}
}
public void showToast(String s) {
Toast.makeText(MyApp.get(), s, Toast.LENGTH_LONG).show();
}
/**
* Default view animation
*
* @param view - some button, image, etc.
* @param anim - Ex: R.anim.fade_in
*/
public void animView(View view, int anim){
Animation animation = AnimationUtils.loadAnimation(MyApp.get(),anim);
view.setAnimation(animation);
}
}