Skip to content

Commit

Permalink
Replace deprecated Stack with an ArrayDeque
Browse files Browse the repository at this point in the history
  • Loading branch information
Neamar committed May 18, 2019
1 parent c2966cd commit 6c65423
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions app/src/main/java/fr/neamar/kiss/SettingsActivity.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -23,20 +22,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;
Expand Down Expand Up @@ -137,11 +132,11 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
final Dialog dialog = ((PreferenceScreen) preference).getDialog();
ViewGroup root = (ViewGroup) dialog.getWindow().getDecorView();

Stack<ViewGroup> viewGroups = new Stack<>();
ArrayDeque<ViewGroup> 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);
Expand All @@ -160,7 +155,7 @@ public void onClick(View v) {
}

if (child instanceof ViewGroup) {
viewGroups.push((ViewGroup) child);
viewGroups.addFirst((ViewGroup) child);
}
}
}
Expand Down

0 comments on commit 6c65423

Please sign in to comment.