Skip to content

Commit

Permalink
Don't show dummy achievements data - show data only when loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishkumar468 committed Oct 25, 2021
1 parent ab6de22 commit f0dc195
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import androidx.recyclerview.widget.SimpleItemAnimator;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import fr.free.nrw.commons.Media;
import fr.free.nrw.commons.R;
Expand Down Expand Up @@ -137,7 +138,7 @@ public View onCreateView(
ButterKnife.bind(this, view);
contributionsListPresenter.onAttachView(this);

if (sessionManager.getUserName().equals(userName)) {
if (Objects.equals(sessionManager.getUserName(), userName)) {
tvContributionsOfUser.setVisibility(GONE);
fab_layout.setVisibility(VISIBLE);
} else {
Expand Down Expand Up @@ -302,6 +303,15 @@ private void setListeners() {
});
}

/**
* Launch Custom Selector.
*/
@OnClick(R.id.fab_custom_gallery)
void launchCustomSelector(){
controller.initiateCustomGalleryPickWithPermission(getActivity());
animateFAB(isFabOpen);
}

private void animateFAB(final boolean isFabOpen) {
this.isFabOpen = !isFabOpen;
if (fabPlus.isShown()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private void setUploadProgress(int uploadCount){
if (uploadCount==0){
setZeroAchievements();
}else {

imagesUploadedProgressbar.setVisibility(View.VISIBLE);
imagesUploadedProgressbar.setProgress
(100*uploadCount/levelInfo.getMaxUploadCount());
imagesUploadedProgressbar.setProgressTextFormatPattern
Expand All @@ -337,7 +337,7 @@ private void setUploadProgress(int uploadCount){
private void setZeroAchievements() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setMessage(
!sessionManager.getUserName().equals(userName) ?
!Objects.equals(sessionManager.getUserName(), userName) ?
getString(R.string.no_achievements_yet, userName) :
getString(R.string.you_have_no_achievements_yet)
)
Expand All @@ -361,6 +361,7 @@ private void setZeroAchievements() {
* @param notRevertPercentage
*/
private void setImageRevertPercentage(int notRevertPercentage){
imageRevertsProgressbar.setVisibility(View.VISIBLE);
imageRevertsProgressbar.setProgress(notRevertPercentage);
String revertPercentage = Integer.toString(notRevertPercentage);
imageRevertsProgressbar.setProgressTextFormatPattern(revertPercentage + "%%");
Expand All @@ -373,6 +374,7 @@ private void setImageRevertPercentage(int notRevertPercentage){
* @param achievements
*/
private void inflateAchievements(Achievements achievements) {
imagesUsedByWikiProgressBar.setVisibility(View.VISIBLE);
thanksReceived.setText(String.valueOf(achievements.getThanksReceived()));
imagesUsedByWikiProgressBar.setProgress
(100 * achievements.getUniqueUsedImages() / levelInfo.getMaxUniqueImages());
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/fragment_achievements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
app:progress_start_color="#3A3381"
app:progress_stroke_width="@dimen/progressbar_stroke"
app:progress_text_format_pattern="573/110"
android:visibility="gone"
app:progress_text_color="@color/secondaryColor"
app:style="solid_line" />

Expand Down Expand Up @@ -211,6 +212,7 @@
android:layout_marginRight="@dimen/large_gap"
android:layout_marginEnd="@dimen/large_gap"
android:progress="50"
android:visibility="gone"
android:id="@+id/image_reverts_progressbar"
app:progress_end_color="#8C8B98"
app:progress_start_color="#3A3381"
Expand Down Expand Up @@ -278,6 +280,7 @@
app:progress_end_color="#8C8B98"
app:progress_start_color="#3A3381"
app:progress_stroke_width="2.5dp"
android:visibility="gone"
app:progress_text_color="@color/secondaryColor"
app:progress_text_format_pattern="12/24"
app:style="solid_line" />
Expand Down

0 comments on commit f0dc195

Please sign in to comment.