Merge "Adding a loading view for widgets list" into ub-launcher3-calgary

This commit is contained in:
Sunny Goyal 2016-05-26 23:40:05 +00:00 committed by Android (Google) Code Review
commit 5c93eac3ae
2 changed files with 12 additions and 0 deletions

View File

@ -49,6 +49,12 @@
android:theme="@style/CustomOverscroll.Dark" android:theme="@style/CustomOverscroll.Dark"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/loader"
android:layout_gravity="center" />
</FrameLayout> </FrameLayout>

View File

@ -26,6 +26,7 @@ import android.support.v7.widget.RecyclerView.State;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast; import android.widget.Toast;
import com.android.launcher3.BaseContainerView; import com.android.launcher3.BaseContainerView;
@ -329,6 +330,11 @@ public class WidgetsContainerView extends BaseContainerView
mRecyclerView.setWidgets(model); mRecyclerView.setWidgets(model);
mAdapter.setWidgetsModel(model); mAdapter.setWidgetsModel(model);
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();
View loader = getContentView().findViewById(R.id.loader);
if (loader != null) {
((ViewGroup) getContentView()).removeView(loader);
}
} }
public boolean isEmpty() { public boolean isEmpty() {