aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-30 18:52:53 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-30 18:52:53 -0700
commitffa937ab0d5e9b0935de1e7b76b2ed3b3a395a64 (patch)
tree960678b3a65de518b4c44f4fb4cfd62aa01bea23 /src
parentb2e2394150a14cbffb00fd0a07e37241a3aa8d2b (diff)
downloaddsub-ffa937ab0d5e9b0935de1e7b76b2ed3b3a395a64.tar.gz
dsub-ffa937ab0d5e9b0935de1e7b76b2ed3b3a395a64.tar.bz2
dsub-ffa937ab0d5e9b0935de1e7b76b2ed3b3a395a64.zip
GB compat fixes (merged from source)
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/view/HeaderGridView.java47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/view/HeaderGridView.java b/src/github/daneren2005/dsub/view/HeaderGridView.java
index f9282494..8a82f353 100644
--- a/src/github/daneren2005/dsub/view/HeaderGridView.java
+++ b/src/github/daneren2005/dsub/view/HeaderGridView.java
@@ -261,14 +261,15 @@ public class HeaderGridView extends GridView {
return super.getNumColumns();
} else {
try {
- Field numColumns = getClass().getSuperclass().getDeclaredField("mNumColumns");
+ Field numColumns = GridView.class.getSuperclass().getDeclaredField("mNumColumns");
numColumns.setAccessible(true);
return numColumns.getInt(this);
} catch (Exception e) {
if (mNumColumns != -1) {
return mNumColumns;
+ } else {
+ return 2;
}
- throw new RuntimeException("Can not determine the mNumColumns for this API platform, please call setNumColumns to set it.");
}
}
}
@@ -308,6 +309,48 @@ public class HeaderGridView extends GridView {
return 0;
}
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ public int getVerticalSpacing(){
+ int value = 0;
+
+ try {
+ int currentapiVersion = android.os.Build.VERSION.SDK_INT;
+ if (currentapiVersion < Build.VERSION_CODES.JELLY_BEAN){
+ Field field = this.getClass().getSuperclass().getDeclaredField("mVerticalSpacing");
+ field.setAccessible(true);
+ value = field.getInt(this);
+ } else{
+ value = super.getVerticalSpacing();
+ }
+
+ }catch (Exception ex){
+
+ }
+
+ return value;
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ public int getHorizontalSpacing(){
+ int value = 0;
+
+ try {
+ int currentapiVersion = android.os.Build.VERSION.SDK_INT;
+ if (currentapiVersion < Build.VERSION_CODES.JELLY_BEAN){
+ Field field = this.getClass().getSuperclass().getDeclaredField("mHorizontalSpacing");
+ field.setAccessible(true);
+ value = field.getInt(this);
+ } else{
+ value = super.getHorizontalSpacing();
+ }
+
+ }catch (Exception ex){
+
+ }
+
+ return value;
+ }
+
public int getRowHeight() {
if (mRowHeight > 0) {
// return mRowHeight;