This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handler handler = new Handler(); | |
handler.postDelayed(new Runnable(){ | |
@override | |
public void run(){ | |
Toast(......); | |
} | |
},5000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFirebaseMessagingService extends FirebaseMessagingService { | |
@Override | |
public void onMessageReceived(RemoteMessage remoteMessage) { | |
super.onMessageReceived(remoteMessage); | |
if (remoteMessage.getNotification() != null) { | |
String title = remoteMessage.getNotification().getTitle(); | |
String body = remoteMessage.getNotification().getBody(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NotificationHelper { | |
public static void displayNotification(Context context, String title, String body) { | |
Intent intent = new Intent(context, ActivityMain.class); | |
PendingIntent pendingIntent = PendingIntent.getActivity( | |
context, | |
100, | |
intent, | |
PendingIntent.FLAG_CANCEL_CURRENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<service android:name=".model.MyFirebaseMessagingService"> | |
<intent-filter> | |
<action android:name="com.google.firebase.MESSAGING_EVENT" /> | |
</intent-filter> | |
</service> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app.yourpackagename.bounce; | |
// | |
// Interpolator to be used with Android view Animation class to achieve the spring-bounce effect. | |
// | |
// License: MIT | |
// Source: http://evgenii.com/blog/spring-button-animation-on-android/ | |
// | |
// Usage example, make the button wobble in scale: | |
// ------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// Set window fullscreen and remove title bar, and force landscape orientation | |
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handler handler = new Handler(); | |
handler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
Intent intentMainActivity = new Intent(Welcome.this, MainActivity.class); | |
intentMainActivity.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); | |
startActivity(intentMainActivity); | |
finish(); | |
} | |
},SPLASH_TIME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar"> | |
<item name="android:windowNoTitle">true</item> | |
<item name="android:windowActionBar">false</item> | |
<item name="android:windowFullscreen">true</item> | |
<item name="android:windowContentOverlay">@null</item> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClassName { | |
private static ClassName instance; | |
private ClassName(){ | |
// Private to prevent anyone else from instantiating | |
} | |
public static ClassName getInstance(){ | |
if(instance == null){ | |
instance = new ClassName(); |
OlderNewer