Add progressbar

This commit is contained in:
neslihanturan 2018-05-20 08:53:28 +03:00 committed by maskara
parent 77639ce64f
commit 8b5a4e4af4
4 changed files with 29 additions and 8 deletions

View file

@ -16,6 +16,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ProgressBar;
import com.viewpagerindicator.CirclePageIndicator; import com.viewpagerindicator.CirclePageIndicator;
@ -82,7 +83,6 @@ public class ReviewActivity extends AuthenticatedActivity {
reviewController = new ReviewController(); reviewController = new ReviewController();
reviewPagerAdapter = new ReviewPagerAdapter(getSupportFragmentManager()); reviewPagerAdapter = new ReviewPagerAdapter(getSupportFragmentManager());
pager.setAdapter(reviewPagerAdapter); pager.setAdapter(reviewPagerAdapter);
reviewPagerAdapter.getItem(0); reviewPagerAdapter.getItem(0);
@ -109,6 +109,10 @@ public class ReviewActivity extends AuthenticatedActivity {
} }
private boolean runRandomizer() { private boolean runRandomizer() {
ProgressBar progressBar = reviewPagerAdapter.reviewImageFragments[pager.getCurrentItem()].progressBar;
if (progressBar != null) {
progressBar.setVisibility(View.VISIBLE);
}
Observable.fromCallable(() -> { Observable.fromCallable(() -> {
Media result = null; Media result = null;
try { try {

View file

@ -8,6 +8,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TextView; import android.widget.TextView;
@ -34,6 +35,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
private String catString; private String catString;
private View catsView; private View catsView;
private SimpleDraweeView simpleDraweeView; private SimpleDraweeView simpleDraweeView;
public ProgressBar progressBar;
public void update(int position, String fileName) { public void update(int position, String fileName) {
this.position = position; this.position = position;
@ -41,6 +43,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
if (simpleDraweeView!=null) { if (simpleDraweeView!=null) {
simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName)); simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName));
progressBar.setVisibility(View.GONE);
} }
} }
@ -63,6 +66,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
position = getArguments().getInt("position"); position = getArguments().getInt("position");
View layoutView = inflater.inflate(R.layout.fragment_review_image, container, View layoutView = inflater.inflate(R.layout.fragment_review_image, container,
false); false);
progressBar = layoutView.findViewById(R.id.progressBar);
View textView = layoutView.findViewById(R.id.reviewQuestion); View textView = layoutView.findViewById(R.id.reviewQuestion);
View textViewQuestion = layoutView.findViewById(R.id.reviewQuestion); View textViewQuestion = layoutView.findViewById(R.id.reviewQuestion);
View textViewQuestionContext = layoutView.findViewById(R.id.reviewQuestionContext); View textViewQuestionContext = layoutView.findViewById(R.id.reviewQuestionContext);
@ -89,6 +93,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
if (fileName != null) { if (fileName != null) {
simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName)); simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName));
progressBar.setVisibility(View.GONE);
} }
if (catString != null) { if (catString != null) {
((TextView) catsView).setText(catString); ((TextView) catsView).setText(catString);

View file

@ -47,8 +47,6 @@
</FrameLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View file

@ -8,13 +8,27 @@
android:gravity="center_horizontal|bottom" android:gravity="center_horizontal|bottom"
> >
<com.facebook.drawee.view.SimpleDraweeView <RelativeLayout
android:id="@+id/imageView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="3" android:layout_weight="3">
android:src="@drawable/commons_logo_large" <com.facebook.drawee.view.SimpleDraweeView
/> android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/commons_logo_large"
/>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="visible"
/>
</RelativeLayout>
<TextView <TextView
android:id="@+id/reviewQuestion" android:id="@+id/reviewQuestion"
android:layout_width="match_parent" android:layout_width="match_parent"