fix crash on old device by using new API conditionally

This commit is contained in:
Eric House 2016-07-02 12:29:16 -07:00
parent 88d8e61620
commit 68df61daa8

View file

@ -86,14 +86,18 @@ public class ChatDelegate extends DelegateBase {
m_scroll = (ScrollView)findViewById( R.id.scroll ); m_scroll = (ScrollView)findViewById( R.id.scroll );
m_layout = (TableLayout)findViewById( R.id.chat_history ); m_layout = (TableLayout)findViewById( R.id.chat_history );
m_layout.addOnLayoutChangeListener( new OnLayoutChangeListener() {
@Override // OnLayoutChangeListener added in API 11
public void onLayoutChange( View vv, int ll, int tt, int rr, if ( 11 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
int bb, int ol, int ot, m_layout.addOnLayoutChangeListener( new OnLayoutChangeListener() {
int or, int ob ) { @Override
scrollDown(); public void onLayoutChange( View vv, int ll, int tt, int rr,
} int bb, int ol, int ot,
}); int or, int ob ) {
scrollDown();
}
});
}
DBUtils.HistoryPair[] pairs DBUtils.HistoryPair[] pairs
= DBUtils.getChatHistory( m_activity, m_rowid, locals ); = DBUtils.getChatHistory( m_activity, m_rowid, locals );
@ -110,7 +114,7 @@ public class ChatDelegate extends DelegateBase {
// Should really assert.... // Should really assert....
finish(); finish();
} }
} } // init
@Override @Override
protected void onResume() protected void onResume()