Skip to content

Commit

Permalink
Trying to improve the Layout mechanism. Still some way to go yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Banes committed Dec 20, 2012
1 parent d5f8146 commit 2aad9d5
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 206 deletions.
34 changes: 22 additions & 12 deletions library/res/layout/pull_to_refresh_header_horizontal.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" >

<ImageView
android:id="@+id/pull_to_refresh_image"
<FrameLayout
android:id="@+id/fl_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
android:layout_height="fill_parent"
android:paddingBottom="@dimen/header_footer_top_bottom_padding"
android:paddingLeft="@dimen/header_footer_left_right_padding"
android:paddingRight="@dimen/header_footer_left_right_padding"
android:paddingTop="@dimen/header_footer_top_bottom_padding" >

<ProgressBar
android:id="@+id/pull_to_refresh_progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone" />
<ImageView
android:id="@+id/pull_to_refresh_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />

<ProgressBar
android:id="@+id/pull_to_refresh_progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone" />
</FrameLayout>

</merge>
76 changes: 43 additions & 33 deletions library/res/layout/pull_to_refresh_header_vertical.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,58 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android" >

<FrameLayout
android:layout_width="wrap_content"
android:id="@+id/fl_inner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical" >
android:paddingBottom="@dimen/header_footer_top_bottom_padding"
android:paddingLeft="@dimen/header_footer_left_right_padding"
android:paddingRight="@dimen/header_footer_left_right_padding"
android:paddingTop="@dimen/header_footer_top_bottom_padding" >

<ImageView
android:id="@+id/pull_to_refresh_image"
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
android:layout_gravity="left|center_vertical" >

<ProgressBar
android:id="@+id/pull_to_refresh_progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone" />
</FrameLayout>
<ImageView
android:id="@+id/pull_to_refresh_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/pull_to_refresh_progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone" />
</FrameLayout>

<TextView
android:id="@+id/pull_to_refresh_text"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearance"
android:textStyle="bold" />
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical" >

<TextView
android:id="@+id/pull_to_refresh_sub_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/pull_to_refresh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearance"
android:textStyle="bold" />

<TextView
android:id="@+id/pull_to_refresh_sub_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>

</merge>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

public class LoadingLayoutProxy implements ILoadingLayout {

private final PullToRefreshBase<?> mPullToRefreshView;
private final HashSet<LoadingLayout> mLoadingLayouts;

LoadingLayoutProxy(PullToRefreshBase<?> pullToRefreshView) {
mPullToRefreshView = pullToRefreshView;
LoadingLayoutProxy() {
mLoadingLayouts = new HashSet<LoadingLayout>();
}

Expand All @@ -28,17 +26,13 @@ public void setLastUpdatedLabel(CharSequence label) {
for (LoadingLayout layout : mLoadingLayouts) {
layout.setLastUpdatedLabel(label);
}

mPullToRefreshView.refreshLoadingViewsSize();
}

@Override
public void setLoadingDrawable(Drawable drawable) {
for (LoadingLayout layout : mLoadingLayouts) {
layout.setLoadingDrawable(drawable);
}

mPullToRefreshView.refreshLoadingViewsSize();
}

@Override
Expand Down Expand Up @@ -66,7 +60,5 @@ public void setTextTypeface(Typeface tf) {
for (LoadingLayout layout : mLoadingLayouts) {
layout.setTextTypeface(tf);
}

mPullToRefreshView.refreshLoadingViewsSize();
}
}
Loading

0 comments on commit 2aad9d5

Please sign in to comment.