aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;