This file contains 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
/** | |
* Created by Anton Potekhin (Anton.Potekhin@gmail.com) on 05.10.16. | |
*/ | |
public class LogCat { | |
/** | |
* Number of lines from logcat | |
*/ | |
private static final int LogcatNumLines = 10000; |
This file contains 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
class BaseFragment extends Fragment { | |
public boolean isVisibleOnScreen() { | |
if (isHidden()) return false; | |
//Check all parents | |
Fragment parentFragment = getParentFragment(); | |
while (parentFragment != null) { | |
if (parentFragment.isHidden()) return false; |
This file contains 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
/** | |
* Call onChange only data set after observe (do not call onChange for old data on call observe method) | |
*/ | |
public class PublishSubjectLiveDate<T> extends MutableLiveData<T> { | |
private static final String TAG = "PublishSubjectLiveDate"; | |
private AtomicInteger version = new AtomicInteger(); | |
private HashMap<Observer<? super T>, ObserverWrapper<T>> wrappers = new HashMap<>(); |
This file contains 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
/** | |
* need call setFitsSystemWindows(false) on view that need it | |
* | |
* @param activity | |
*/ | |
public static void setStatusBarTransparent(@NonNull Activity activity) { | |
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) { | |
setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true); | |
} | |
if (Build.VERSION.SDK_INT >= 19) { |
This file contains 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
/** | |
* need call setFitsSystemWindows(false) on view that need it | |
* | |
* @param activity | |
*/ | |
public static void setTransparentStatusBar(@NonNull Activity activity) { | |
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) { | |
setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true); | |
} | |
if (Build.VERSION.SDK_INT >= 19) { |
This file contains 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
//AppComponent.java | |
@Singleton | |
@Component( | |
modules = { | |
AndroidInjectionModule.class, | |
AppModule.class, | |
ActivityAModule.class, | |
ActivityBModule.class | |
} | |
) |