Merge "Show mobile icons with left-to-right in order of slot index"
This commit is contained in:
@@ -43,6 +43,7 @@ import com.android.systemui.tuner.TunerService.Tunable;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY;
|
||||
@@ -121,7 +122,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
||||
// Remove all the icons.
|
||||
for (int i = currentSlots.size() - 1; i >= 0; i--) {
|
||||
Slot s = currentSlots.get(i);
|
||||
slotsToReAdd.put(s, s.getHolderListInViewOrder());
|
||||
slotsToReAdd.put(s, s.getHolderList());
|
||||
removeAllIconsForSlot(s.getName());
|
||||
}
|
||||
|
||||
@@ -200,6 +201,10 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
||||
Slot mobileSlot = getSlot(slot);
|
||||
int slotIndex = getSlotIndex(slot);
|
||||
|
||||
// Reverse the sort order to show icons with left to right([Slot1][Slot2]..).
|
||||
// StatusBarIconList has UI design that first items go to the right of second items.
|
||||
Collections.reverse(iconStates);
|
||||
|
||||
for (MobileIconState state : iconStates) {
|
||||
StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId);
|
||||
if (holder == null) {
|
||||
|
||||
@@ -249,6 +249,25 @@ public class StatusBarIconList {
|
||||
return holders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of the {@link StatusBarIconHolder}s in the same order.
|
||||
* This provides a safe list that can be iterated and inserted into its group.
|
||||
*
|
||||
* @return all holders contained here
|
||||
*/
|
||||
public List<StatusBarIconHolder> getHolderList() {
|
||||
ArrayList<StatusBarIconHolder> holders = new ArrayList<>();
|
||||
if (mHolder != null) {
|
||||
holders.add(mHolder);
|
||||
}
|
||||
|
||||
if (mSubSlots != null) {
|
||||
holders.addAll(mSubSlots);
|
||||
}
|
||||
|
||||
return holders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("(%s) %s", mName, subSlotsString());
|
||||
|
||||
Reference in New Issue
Block a user