Skip to content

Commit

Permalink
Merge pull request #17 from oxters168/XMBItemMoveToEmptyColumnCrash
Browse files Browse the repository at this point in the history
XMB Item Move Crash
  • Loading branch information
oxters168 authored Aug 27, 2023
2 parents 4c19b01 + eb78339 commit c9d0ad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void setFont(Typeface font) {

@Override
protected void shiftItemHorizontally(int toBeMovedColIndex, int toBeMovedLocalIndex, int moveToColIndex, int moveToLocalIndex, boolean createColumn) {
//Log.d("XMBAdapter", "Moving item [" + toBeMovedColIndex + ", " + toBeMovedLocalIndex + "] => [" + moveToColIndex + ", " + moveToLocalIndex + "] Create column: " + createColumn);
// Log.d("XMBAdapter", "Moving item [" + toBeMovedColIndex + ", " + toBeMovedLocalIndex + "] => [" + moveToColIndex + ", " + moveToLocalIndex + "] Create column: " + createColumn);
//XMBItem toBeMoved = items.get(toBeMovedColIndex).getInnerItem(toBeMovedLocalIndex - 1);
XMBItem toBeMoved = (XMBItem)getItem(toBeMovedColIndex, toBeMovedLocalIndex);
if (createColumn) {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/OxGames/OxShell/Views/XMBView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1401,9 +1401,9 @@ protected void onShiftHorizontally(int fromColIndex, int fromRowIndex, int toCol
//Log.d("XMBView", "OnShift [" + fromColIndex + ", " + fromRowIndex + "] => " + toColIndex);
//boolean isInColumn = (!columnMode || moveLocalIndex > 0) && catHasSubItems(fromColIndex);
boolean isInColumn = moveLocalIndex > 0 && catHasSubItems(fromColIndex);
// -1 to move out of the 0th column, columnCount - 2 to not go past the settings
// -1 to move out of the 0th column
int nextColIndex = Math.min(Math.max(toColIndex, isInColumn ? -1 : 0), adapter.getColumnCount() - (isInColumn ? 0 : 1));
//Log.d("XMBView", "Attempting to move right from " + moveColIndex + " to " + nextColIndex + ", in column: " + isInColumn);
// Log.d("XMBView", "Attempting to move from [" + fromColIndex + "," + fromRowIndex + "] to " + nextColIndex + ", in column: " + isInColumn);
if (fromColIndex != nextColIndex) {
nextColIndex = Math.max(nextColIndex, 0);
boolean nextIsColumn = adapter.canPlaceItemsIn(nextColIndex, 0);//adapter.isColumnHead(nextColIndex, 0);
Expand All @@ -1422,7 +1422,8 @@ protected void onShiftHorizontally(int fromColIndex, int fromRowIndex, int toCol
setColIndex = fromColIndex;
}
}
if (nextIsColumn && adapter.getColumnSize(nextColIndex) == 0)
// Log.d("XMBView", "Next index: [" + nextColIndex + ", " + nextLocalIndex + "] Next is column: " + nextIsColumn + " Next column size: " + adapter.getColumnSize(nextColIndex));
if (!isInColumn && nextIsColumn && adapter.getColumnSize(nextColIndex) == 0)
nextLocalIndex = 1;

//getViewHolder(fromColIndex, fromRowIndex).setDirty();
Expand Down

0 comments on commit c9d0ad5

Please sign in to comment.