Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <service android:enabled="true" android:name=".Services.GhostModeService" />
- android:hardwareAccelerated="true"
- <activity android:name=".MainActivity"
- android:configChanges="orientation|screenSize|keyboardHidden"
- android:label="@string/app_name"
- android:launchMode="singleInstance">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Log.d(TAG,"classmain-> onCreate");
- initializeM();
- settingWebview();
- initializeNavigationTab();
- myoutube.loadUrl(URL);
- ghostModeServiceIntent=new Intent(MainActivity.this,GhostModeService.class);
- }
- private void settingWebview() {
- myoutube.setWebViewClient(new Myyoutube());
- myoutube.getSettings().setLoadsImagesAutomatically(true);
- myoutube.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
- myoutube.getSettings().setBuiltInZoomControls(false);
- myoutube.getSettings().setLoadsImagesAutomatically(true);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
- myoutube.getSettings().setMediaPlaybackRequiresUserGesture(true);
- myoutube.getSettings().setJavaScriptEnabled(true);
- myoutube.getSettings().setPluginState(WebSettings.PluginState.ON);
- }
- private WindowManager mWindowManager;
- private View mGhostmode;
- @Override
- public void onCreate() {
- super.onCreate();
- Log.d(TAG,"classghostservice-> onCreate()");
- LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
- mGhostmode = inflater.inflate(R.layout.layout_ghostmode,null,false);
- //setting the layout parameters
- WindowManager.LayoutParams params = new WindowManager.LayoutParams(
- 500,
- 500,
- WindowManager.LayoutParams.TYPE_PHONE,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
- PixelFormat.TRANSLUCENT);
- params.x=0;
- params.y=0;
- params.gravity=Gravity.END | Gravity.BOTTOM;
- //getting windows services and adding the floating view to it
- mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
- mWindowManager.addView(mGhostmode, params);
- }
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- Log.d(TAG,"classghostservice-> onstartCommand()");
- foregroundNotification(1);
- return START_NOT_STICKY;
- }
- <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer"
- android:layout_width="match_parent"
- android:layout_height="match_parent".....
- private static DrawerLayout windowMain;
- windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
- inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
- windowMain = (DrawerLayout) inflater.inflate(R.layout.activity_main, null);
- findViewById()
- windowMain.findViewById(R.id.btn);
- windowMain.findViewById(R.id.webview);
- WindowManager.LayoutParams=expandParams
- expandParams = new WindowManager.LayoutParams(
- WindowManager.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
- WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON|
- WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
- PixelFormat.TRANSLUCENT);
- expandParams.gravity = Gravity.START | Gravity.TOP;
- expandParams.x = 0;
- expandParams.y = 0;
- windowManager.addView(windowMain, expandParams);
- windowManager.updateViewLayout(windowMain, ghostParams);
- windowManager.removeView(windowMain);
- finish()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement