Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes different column count after rotation #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,6 +17,7 @@ public class AsymmetricGridView extends ListView {

private static final int DEFAULT_COLUMN_COUNT = 2;
private static final String TAG = "AsymmetricGridView";
private boolean requestedColumnCountCalled = false;
protected int numColumns = DEFAULT_COLUMN_COUNT;
protected int requestedHorizontalSpacing;
protected int requestedColumnWidth;
Expand Down Expand Up @@ -90,6 +91,7 @@ public void setRequestedColumnWidth(final int width) {

public void setRequestedColumnCount(int requestedColumnCount) {
this.requestedColumnCount = requestedColumnCount;
this.requestedColumnCountCalled = true;
}

public int getRequestedHorizontalSpacing() {
Expand Down Expand Up @@ -158,7 +160,9 @@ public void onRestoreInstanceState(final Parcelable state) {
allowReordering = ss.allowReordering;
debugging = ss.debugging;
numColumns = ss.numColumns;
requestedColumnCount = ss.requestedColumnCount;
if (!requestedColumnCountCalled) {
requestedColumnCount = ss.requestedColumnCount;
}
requestedColumnWidth = ss.requestedColumnWidth;
requestedHorizontalSpacing = ss.requestedHorizontalSpacing;

Expand Down