mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Prepare base for new activity
This commit is contained in:
		
							parent
							
								
									64ad937258
								
							
						
					
					
						commit
						48c7a0372e
					
				
					 10 changed files with 196 additions and 0 deletions
				
			
		|  | @ -7,6 +7,7 @@ import fr.free.nrw.commons.WelcomeActivity; | |||
| import fr.free.nrw.commons.auth.LoginActivity; | ||||
| import fr.free.nrw.commons.auth.SignupActivity; | ||||
| import fr.free.nrw.commons.contributions.ContributionsActivity; | ||||
| import fr.free.nrw.commons.featured.FeaturedImagesActivity; | ||||
| import fr.free.nrw.commons.nearby.NearbyActivity; | ||||
| import fr.free.nrw.commons.notification.NotificationActivity; | ||||
| import fr.free.nrw.commons.settings.SettingsActivity; | ||||
|  | @ -46,4 +47,7 @@ public abstract class ActivityBuilderModule { | |||
| 
 | ||||
|     @ContributesAndroidInjector | ||||
|     abstract NotificationActivity bindNotificationActivity(); | ||||
| 
 | ||||
|     @ContributesAndroidInjector | ||||
|     abstract FeaturedImagesActivity bindFeaturedImagesActivity(); | ||||
| } | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ import dagger.Module; | |||
| import dagger.android.ContributesAndroidInjector; | ||||
| import fr.free.nrw.commons.category.CategorizationFragment; | ||||
| import fr.free.nrw.commons.contributions.ContributionsListFragment; | ||||
| import fr.free.nrw.commons.featured.FeaturedImagesListFragment; | ||||
| import fr.free.nrw.commons.media.MediaDetailFragment; | ||||
| import fr.free.nrw.commons.media.MediaDetailPagerFragment; | ||||
| import fr.free.nrw.commons.nearby.NearbyListFragment; | ||||
|  | @ -43,4 +44,7 @@ public abstract class FragmentBuilderModule { | |||
|     @ContributesAndroidInjector | ||||
|     abstract SingleUploadFragment bindSingleUploadFragment(); | ||||
| 
 | ||||
|     @ContributesAndroidInjector | ||||
|     abstract FeaturedImagesListFragment bindFeaturedImagesListFragment(); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,60 @@ | |||
| package fr.free.nrw.commons.featured; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| 
 | ||||
| import butterknife.ButterKnife; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.auth.AuthenticatedActivity; | ||||
| import fr.free.nrw.commons.contributions.ContributionsListFragment; | ||||
| import fr.free.nrw.commons.media.MediaDetailPagerFragment; | ||||
| 
 | ||||
| /** | ||||
|  * Created by root on 09.01.2018. | ||||
|  */ | ||||
| 
 | ||||
| public class FeaturedImagesActivity | ||||
|         extends AuthenticatedActivity | ||||
|         implements FragmentManager.OnBackStackChangedListener { | ||||
| 
 | ||||
|     private FeaturedImagesListFragment featuredImagesList; | ||||
|     private MediaDetailPagerFragment mediaDetails; | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onAuthCookieAcquired(String authCookie) { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onAuthFailure() { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|         setContentView(R.layout.activity_featured_images); | ||||
|         ButterKnife.bind(this); | ||||
| 
 | ||||
|         // Activity can call methods in the fragment by acquiring a | ||||
|         // reference to the Fragment from FragmentManager, using findFragmentById() | ||||
|         FragmentManager supportFragmentManager = getSupportFragmentManager(); | ||||
|         featuredImagesList = (FeaturedImagesListFragment)supportFragmentManager | ||||
|                 .findFragmentById(R.id.featuedListFragment); | ||||
| 
 | ||||
|         supportFragmentManager.addOnBackStackChangedListener(this); | ||||
|         if (savedInstanceState != null) { | ||||
|             mediaDetails = (MediaDetailPagerFragment)supportFragmentManager | ||||
|                     .findFragmentById(R.id.featuredFragmentContainer); | ||||
| 
 | ||||
|         } | ||||
|         requestAuthToken(); | ||||
|         initDrawer(); | ||||
|         setTitle(getString(R.string.title_activity_featured_images)); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onBackStackChanged() { | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,28 @@ | |||
| package fr.free.nrw.commons.featured; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.AdapterView; | ||||
| 
 | ||||
| import butterknife.ButterKnife; | ||||
| import dagger.android.support.DaggerFragment; | ||||
| import fr.free.nrw.commons.R; | ||||
| import timber.log.Timber; | ||||
| 
 | ||||
| import static android.view.View.GONE; | ||||
| 
 | ||||
| /** | ||||
|  * Created by root on 09.01.2018. | ||||
|  */ | ||||
| 
 | ||||
| public class FeaturedImagesListFragment extends DaggerFragment { | ||||
| 
 | ||||
|     @Override | ||||
|     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||||
|         View v = inflater.inflate(R.layout.fragment_contributions, container, false); | ||||
|         ButterKnife.bind(this, v); | ||||
|         return v; | ||||
|     } | ||||
| } | ||||
|  | @ -26,6 +26,7 @@ import fr.free.nrw.commons.WelcomeActivity; | |||
| import fr.free.nrw.commons.auth.AccountUtil; | ||||
| import fr.free.nrw.commons.auth.LoginActivity; | ||||
| import fr.free.nrw.commons.contributions.ContributionsActivity; | ||||
| import fr.free.nrw.commons.featured.FeaturedImagesActivity; | ||||
| import fr.free.nrw.commons.nearby.NearbyActivity; | ||||
| import fr.free.nrw.commons.notification.NotificationActivity; | ||||
| import fr.free.nrw.commons.settings.SettingsActivity; | ||||
|  | @ -148,6 +149,10 @@ public abstract class NavigationBaseActivity extends BaseActivity | |||
|                 drawerLayout.closeDrawer(navigationView); | ||||
|                 startActivityWithFlags(this, NotificationActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||||
|                 return true; | ||||
|             case R.id.action_featured_images: | ||||
|                 drawerLayout.closeDrawer(navigationView); | ||||
|                 startActivityWithFlags(this, FeaturedImagesActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||||
|                 return true; | ||||
|             default: | ||||
|                 Timber.e("Unknown option [%s] selected from the navigation menu", itemId); | ||||
|                 return false; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan