Skip to content

Instantly share code, notes, and snippets.

View ShwetaChauhan18's full-sized avatar
🎯
Focusing

Shweta Chauhan ShwetaChauhan18

🎯
Focusing
View GitHub Profile
view.systemUiVisibility =
// We wish to be laid out as if the
// navigation bar was hidden
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
// We wish to be laid out fullscreen,
// behind the status bar
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
// We wish to be laid out at
// the most extreme scenario of any other flags
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
<!-- values/themes.xml -->
<style name="Theme.MyApp">
<item name="android:navigationBarColor">
#B3FFFFFF
</item>
</style>
<!-- values-night/themes.xml -->
<style name="Theme.MyApp">
<item name="android:navigationBarColor">
<!-- values-v29/themes.xml -->
<style name="Theme.MyApp">
<item name="android:navigationBarColor">
@android:color/transparent
</item>
<!-- Optional, if drawing behind the status bar too -->
<item name="android:statusBarColor">
@android:color/transparent
</item>
public class BillPughSingleton {
private BillPughSingleton(){}
private static class BillPughSingletonInnerClass{
private static final BillPughSingleton INSTANCE = new BillPughSingleton();
}
public static BillPughSingleton getInstance(){
return BillPughSingletonInnerClass.INSTANCE;
public static ThreadSafeSingleton getInstanceUsingDoubleLocking(){
if(mThreadSafeSingleton == null){
synchronized (ThreadSafeSingleton.class) {
if(mThreadSafeSingleton == null){
mThreadSafeSingleton = new ThreadSafeSingleton();
}
}
}
return mThreadSafeSingleton;
}
public class ThreadSafeSingleton {
private static ThreadSafeSingleton mThreadSafeSigleton;
private ThreadSafeSingleton(){}
public static synchronized ThreadSafeSingleton getThreadSafeSingleton(){
if(mThreadSafeSigleton == null){
mThreadSafeSigleton = new ThreadSafeSingleton();
}
class SingletonLazy{
private static SingletonLazy mSingletonLazy;
private SingletonLazy(){}
public static SingletonLazy getSingletonLazy(){
if (mSingletonLazy == null){
mSingletonLazy = new SingletonLazy();//instance will be created at request time
}
return mSingletonLazy;
}
public class Singleton {
private static Singleton mSingleton = new Singleton(); //instance will be created at load time
private Singleton(){}
public static Singleton getInstance() {
return mSingleton;
}
}