mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Replaced Toasts With Snackbars in AchievementsFragment and LeaderboardFragment
This commit is contained in:
		
							parent
							
								
									67d2e7f1ab
								
							
						
					
					
						commit
						b8edbfc736
					
				
					 2 changed files with 12 additions and 10 deletions
				
			
		|  | @ -14,7 +14,6 @@ import android.widget.LinearLayout; | |||
| import android.widget.ProgressBar; | ||||
| import android.widget.RelativeLayout; | ||||
| import android.widget.TextView; | ||||
| import android.widget.Toast; | ||||
| import androidx.annotation.Nullable; | ||||
| import androidx.appcompat.view.ContextThemeWrapper; | ||||
| import androidx.appcompat.widget.AppCompatTextView; | ||||
|  | @ -24,15 +23,16 @@ import butterknife.BindView; | |||
| import butterknife.ButterKnife; | ||||
| import butterknife.OnClick; | ||||
| import com.dinuscxj.progressbar.CircleProgressBar; | ||||
| import com.google.android.material.snackbar.Snackbar; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.Utils; | ||||
| import fr.free.nrw.commons.auth.SessionManager; | ||||
| import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; | ||||
| import fr.free.nrw.commons.mwapi.OkHttpJsonApiClient; | ||||
| import fr.free.nrw.commons.profile.ProfileActivity; | ||||
| import fr.free.nrw.commons.utils.ConfigUtils; | ||||
| import fr.free.nrw.commons.utils.DialogUtil; | ||||
| import fr.free.nrw.commons.utils.ViewUtil; | ||||
| import fr.free.nrw.commons.profile.ProfileActivity; | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers; | ||||
| import io.reactivex.disposables.CompositeDisposable; | ||||
| import io.reactivex.schedulers.Schedulers; | ||||
|  | @ -220,9 +220,9 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment { | |||
|                 ctx = getView().getContext(); | ||||
|             } | ||||
|             if(ctx != null) { | ||||
|                 Toast.makeText(ctx, | ||||
|                     R.string.achievements_unavailable_beta, | ||||
|                     Toast.LENGTH_LONG).show(); | ||||
|                 Snackbar snackbar = Snackbar.make(getActivity().findViewById(R.id.drawer_layout),R.string.achievements_unavailable_beta, Snackbar.LENGTH_LONG); | ||||
|                 snackbar.setAction("OK", view -> snackbar.dismiss()); | ||||
|                 snackbar.show(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ import androidx.recyclerview.widget.MergeAdapter; | |||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import butterknife.BindView; | ||||
| import butterknife.ButterKnife; | ||||
| import com.google.android.material.snackbar.Snackbar; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.auth.SessionManager; | ||||
| import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; | ||||
|  | @ -198,9 +199,9 @@ public class LeaderboardFragment extends CommonsDaggerSupportFragment { | |||
|                 ctx = getView().getContext(); | ||||
|             } | ||||
|             if(ctx != null) { | ||||
|                 Toast.makeText(ctx, | ||||
|                     R.string.leaderboard_unavailable_beta, | ||||
|                     Toast.LENGTH_LONG).show(); | ||||
|                 Snackbar snackbar = Snackbar.make(getActivity().findViewById(R.id.drawer_layout),R.string.leaderboard_unavailable_beta, Snackbar.LENGTH_LONG); | ||||
|                 snackbar.setAction("OK", view -> snackbar.dismiss()); | ||||
|                 snackbar.show(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | @ -224,8 +225,9 @@ public class LeaderboardFragment extends CommonsDaggerSupportFragment { | |||
|     private void scrollToUserRank() { | ||||
| 
 | ||||
|         if(userRank==0){ | ||||
|             Toast.makeText(getContext(),R.string.no_achievements_yet,Toast.LENGTH_SHORT).show(); | ||||
|         }else { | ||||
|             Snackbar snackbar = Snackbar.make(getActivity().findViewById(R.id.drawer_layout),R.string.no_achievements_yet, Snackbar.LENGTH_LONG); | ||||
|             snackbar.setAction("OK", view -> snackbar.dismiss()); | ||||
|             snackbar.show();        }else { | ||||
|             if (Objects.requireNonNull(leaderboardListRecyclerView.getAdapter()).getItemCount() | ||||
|                 > userRank + 1) { | ||||
|                 leaderboardListRecyclerView.smoothScrollToPosition(userRank + 1); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Priyank Shankar
						Priyank Shankar