debug-build-only logging of pane order

I'm seeing infrequent switching of panes' ordering when
rotating. Logging them hoping to see if it's in the layout or elsewhere.
This commit is contained in:
Eric House 2017-04-08 12:11:53 -07:00
parent b07fd2699c
commit 5b7559c223

View file

@ -28,6 +28,7 @@ import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.MenuItem;
@ -39,6 +40,7 @@ import junit.framework.Assert;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends XWActivity
@ -100,6 +102,7 @@ public class MainActivity extends XWActivity
if ( m_dpEnabled ) {
setVisiblePanes();
}
logPaneFragments();
}
// called when we're brought to the front (probably as a result of
@ -334,6 +337,8 @@ public class MainActivity extends XWActivity
m_pendingResult = null;
}
}
logPaneFragments();
}
////////////////////////////////////////////////////////////////////////
@ -350,6 +355,21 @@ public class MainActivity extends XWActivity
return frag;
}
private void logPaneFragments()
{
if ( BuildConfig.DEBUG ) {
List<String> pairs = new ArrayList<>();
int childCount = m_root.getChildCount();
for ( int ii = 0; ii < childCount; ++ii ) {
View child = m_root.getChildAt( ii );
String name = findFragment( child ).getClass().getSimpleName();
String pair = String.format("%d:%s", ii, name );
pairs.add( pair );
}
Log.d( TAG, "logPaneFragments(): %s", TextUtils.join(", ", pairs) );
}
}
protected XWFragment[] getVisibleFragments()
{
int childCount = m_root.getChildCount();
@ -391,6 +411,8 @@ public class MainActivity extends XWActivity
trySetTitle( child );
}
}
logPaneFragments();
}
private void trySetTitle( View view )