https://medium.com/upday-devs/rxjava-subscribeon-vs-observeon-9af518ded53a
observeON -Acts downstream - thing that happen after the observeOn call - unlike subscribeOn
subscribeON - Influences the thread that is used when the Obserable is subscribed to and it will stay on it downstream. Position does not matter! If there are multiple instances of subscribeOn in the stream, only the first one has a pracical effect
Log
2018년 3월 28일 수요일
2013년 5월 20일 월요일
Above The Status Bar, AOT; Always On Top
Like Omega Status Bar you can find Android Market I just happen to make the view which exist above the status bar. It's If you want to make a view that exist above the status bar, a lock screen, and any window, this post may help you.
When you make view which exist above all other view(application), first thing to do is to make a service that has views. Second thing is make a view, a layout parameter and add them together to a window. When you add a view with layout parameter, it usually gets width, height, type(s), flag(s), and a format. To being above others, a view have to have this type and flag; WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY and
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN.
Refer this; http://stackoverflow.com/questions/9815901/display-view-above-status-bar
When you make view which exist above all other view(application), first thing to do is to make a service that has views. Second thing is make a view, a layout parameter and add them together to a window. When you add a view with layout parameter, it usually gets width, height, type(s), flag(s), and a format. To being above others, a view have to have this type and flag; WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY and
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN.
Refer this; http://stackoverflow.com/questions/9815901/display-view-above-status-bar
---
A view created with TYPE_SYSTEM_ALERT and FLAG_LAYOUT_IN_SCREEN is covered by the status bar.
To get an overlay on top of the status bar you need to use TYPE_SYSTEM_OVERLAY instead of TYPE_SYSTEM_ALERT.
----
----
If you use TYPE_SYSTEM_ALERT, the view will be mixed(I mean, alpha) with other views. So use TYPE_SYSTEM_OVERLAY alone. It prior to other types such as TYPE_PHONE, TYPE_SYSTEM_ALERT, etc.. And, don't forget to add permission in your manifest. Add it outside of <application/> scope.
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
This may help you too.
<uses-permission android:name="android.permission.FLAG_SHOW_WHEN_LOCKED"/>
So let me get straight all things(thanks to http://blog.daum.net/mailss/35)
1. Make a Service
public class CustomService extends Service {
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
2. Make a View and a Layout Parameter and Add them to the Top Window
private TextView mView;
private WindowManager.LayoutParams mLP;
private WindowManager mWindowManager;
private WindowManager.LayoutParams mLP;
private WindowManager mWindowManager;
@Override
public void onCreate() {
super.onCreate();
mView= new TextView(this);
mView setText("Hello World. I am above other views");
mView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
mView setTextColor(Color.WHITE);
mView.setBackgroundColor(Color.argb(125, 125, 255, 125));
mLP = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
public void onCreate() {
super.onCreate();
mView= new TextView(this);
mView setText("Hello World. I am above other views");
mView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
mView setTextColor(Color.WHITE);
mView.setBackgroundColor(Color.argb(125, 125, 255, 125));
mLP = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.RGB_565);
mLP = Gravity.TOP|Gravity.CENTER;
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mWindowManager.addView(mView, mLP);//Need permissions
}
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mWindowManager.addView(mView, mLP);//Need permissions
}
3. Remove a view when a service is destroyed.
@Override
public void onDestroy() {
if(mWindowManager != null) {
if(mPopupView != null) mWindowManager.removeView(mPopupView); }
super.onDestroy();
}
public void onDestroy() {
if(mWindowManager != null) {
if(mPopupView != null) mWindowManager.removeView(mPopupView); }
super.onDestroy();
}
That is all. It's done. :) Other parts are your remains like handling touch events, making an activity that trigger and killing a service and starting a service when boot is completed.
Extra information? refer these, although posts are written in Korean.
http://blog.daum.net/mailss/35
http://blog.daum.net/mailss/18
http://outliers.tistory.com/entry/Lock-%ED%99%94%EB%A9%B4-%EC%9C%84%EB%A1%9C-Activity-%EC%8B%A4%ED%96%89-%EC%8B%9C%ED%82%A4%EB%8A%94-%EB%B0%A9%EB%B2%95
피드 구독하기:
덧글 (Atom)