diff --git a/app/src/main/java/ru/myitschool/work/MainActivity.java b/app/src/main/java/ru/myitschool/work/MainActivity.java index 05b8fd1..e4ce486 100644 --- a/app/src/main/java/ru/myitschool/work/MainActivity.java +++ b/app/src/main/java/ru/myitschool/work/MainActivity.java @@ -1,55 +1,16 @@ package ru.myitschool.work; -import static java.util.Map.entry; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Build; import android.os.Bundle; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; -import java.util.Map; -import ru.myitschool.work.databinding.ActivityMainBinding; - -@RequiresApi(api = Build.VERSION_CODES.TIRAMISU) public class MainActivity extends AppCompatActivity { - final static Map CodelabActionsMap = Map.ofEntries( - entry(Intent.ACTION_AIRPLANE_MODE_CHANGED, "ACTION_AIRPLANE_MODE_CHANGED"), - entry(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED, "ACTION_APPLICATION_RESTRICTIONS_CHANGED"), - entry(Intent.ACTION_APPLICATION_LOCALE_CHANGED, "ACTION_APPLICATION_LOCALE_CHANGED"), - entry(Intent.ACTION_ASSIST, "ACTION_ASSIST"), - entry(Intent.ACTION_BATTERY_CHANGED, "ACTION_BATTERY_CHANGED"), - entry(Intent.ACTION_BATTERY_LOW, "ACTION_BATTERY_LOW"), - entry(Intent.ACTION_BATTERY_OKAY, "ACTION_BATTERY_OKAY"), - entry(Intent.ACTION_CALL, "ACTION_CALL"), - entry(Intent.ACTION_DATE_CHANGED, "ACTION_DATE_CHANGED"), - entry(Intent.ACTION_DEFAULT, "ACTION_DEFAULT"), - entry(Intent.ACTION_HEADSET_PLUG, "ACTION_HEADSET_PLUG"), - entry(Intent.ACTION_LOCALE_CHANGED, "ACTION_LOCALE_CHANGED"), - entry(Intent.ACTION_TIME_TICK, "ACTION_TIME_TICK") - ); - - ActivityMainBinding ui; - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - ui = ActivityMainBinding.inflate(getLayoutInflater()); - setContentView(ui.getRoot()); - } - - public BroadcastReceiver makeBroadcastReceiver() { - return new BroadcastReceiver() { - public void onReceive(Context context, Intent intent) { - var text = CodelabActionsMap.get(intent.getAction()); - if (text != null) ui.content.statusText.setText(text); - } - }; + setContentView(R.layout.activity_main); } } \ No newline at end of file