diff --git a/app/src/main/java/fr/neamar/kiss/SettingsActivity.java b/app/src/main/java/fr/neamar/kiss/SettingsActivity.java index 16097e360..4eb36e4f8 100644 --- a/app/src/main/java/fr/neamar/kiss/SettingsActivity.java +++ b/app/src/main/java/fr/neamar/kiss/SettingsActivity.java @@ -1,7 +1,6 @@ package fr.neamar.kiss; import android.Manifest; -import android.app.ActionBar; import android.app.Dialog; import android.content.Intent; import android.content.SharedPreferences; @@ -22,20 +21,16 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.view.ViewParent; -import android.widget.FrameLayout; -import android.widget.ImageButton; -import android.widget.LinearLayout; import android.widget.Toast; import android.widget.Toolbar; import androidx.annotation.NonNull; +import java.util.ArrayDeque; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; -import java.util.Stack; import fr.neamar.kiss.broadcast.IncomingCallHandler; import fr.neamar.kiss.dataprovider.AppProvider; @@ -139,11 +134,11 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen final Dialog dialog = ((PreferenceScreen) preference).getDialog(); ViewGroup root = (ViewGroup) dialog.getWindow().getDecorView(); - Stack viewGroups = new Stack<>(); + ArrayDeque viewGroups = new ArrayDeque<>(); viewGroups.push(root); - bfs: while(!viewGroups.empty()) { - ViewGroup e = viewGroups.pop(); + bfs: while(!viewGroups.isEmpty()) { + ViewGroup e = viewGroups.removeFirst(); for (int i = 0; i < e.getChildCount(); i++) { View child = e.getChildAt(i); @@ -162,7 +157,7 @@ public void onClick(View v) { } if (child instanceof ViewGroup) { - viewGroups.push((ViewGroup) child); + viewGroups.addFirst((ViewGroup) child); } } }