1 /* Copyright 2016 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.content.BroadcastReceiver;
19 import android.content.Context;
20 import android.content.Intent;
21 import android.content.IntentFilter;
22 import android.os.Bundle;
23 import androidx.localbroadcastmanager.content.LocalBroadcastManager;
25 import com.farmerbb.taskbar.BuildConfig;
26 import com.farmerbb.taskbar.util.U;
28 public class ImportSettingsActivity extends AbstractProgressActivity {
30 boolean broadcastSent = false;
32 private BroadcastReceiver settingsReceivedReceiver = new BroadcastReceiver() {
34 public void onReceive(Context context, Intent intent) {
35 U.restartApp(ImportSettingsActivity.this, true);
40 protected void onCreate(Bundle savedInstanceState) {
41 super.onCreate(savedInstanceState);
43 LocalBroadcastManager.getInstance(this).registerReceiver(settingsReceivedReceiver, new IntentFilter("com.farmerbb.taskbar.IMPORT_FINISHED"));
46 Intent intent = new Intent("com.farmerbb.taskbar.RECEIVE_SETTINGS");
47 intent.setPackage(BuildConfig.BASE_APPLICATION_ID);
48 sendBroadcast(intent);
55 protected void onDestroy() {
58 LocalBroadcastManager.getInstance(this).unregisterReceiver(settingsReceivedReceiver);