1 /* Copyright 2018 Braden Farmer
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 package com.farmerbb.taskbar.activity;
18 import android.annotation.SuppressLint;
19 import android.app.Activity;
20 import android.content.BroadcastReceiver;
21 import android.content.Context;
22 import android.content.Intent;
23 import android.content.IntentFilter;
24 import android.os.Bundle;
25 import android.support.v4.content.LocalBroadcastManager;
26 import android.widget.FrameLayout;
27 import android.widget.LinearLayout;
29 import com.farmerbb.taskbar.R;
30 import com.farmerbb.taskbar.util.DisplayInfo;
31 import com.farmerbb.taskbar.util.FreeformHackHelper;
32 import com.farmerbb.taskbar.util.U;
34 public class TouchAbsorberActivity extends Activity {
36 private BroadcastReceiver finishReceiver = new BroadcastReceiver() {
38 public void onReceive(Context context, Intent intent) {
43 @SuppressLint("HardwareIds")
44 @SuppressWarnings("deprecation")
46 protected void onCreate(Bundle savedInstanceState) {
47 super.onCreate(savedInstanceState);
48 setContentView(R.layout.incognito);
50 DisplayInfo display = U.getDisplayInfo(this);
51 LinearLayout layout = U.findViewById(this, R.id.incognitoLayout);
52 layout.setLayoutParams(new FrameLayout.LayoutParams(display.width, display.height));
54 LocalBroadcastManager.getInstance(this).registerReceiver(finishReceiver, new IntentFilter("com.farmerbb.taskbar.FINISH_FREEFORM_ACTIVITY"));
55 FreeformHackHelper.getInstance().setTouchAbsorberActive(true);
59 protected void onStop() {
65 protected void onDestroy() {
66 LocalBroadcastManager.getInstance(this).unregisterReceiver(finishReceiver);
67 FreeformHackHelper.getInstance().setTouchAbsorberActive(false);
73 public void onBackPressed() {}