Add theme dependent background color for Drawer Layout of activity_contributions layout file

This commit is contained in:
neslihanturan 2018-09-06 15:32:19 +03:00
parent 7b29ee5f63
commit 6a4d7fda0d
6 changed files with 17 additions and 6 deletions

View file

@ -7,7 +7,6 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.util.Log;
import javax.inject.Inject; import javax.inject.Inject;
@ -22,8 +21,7 @@ import fr.free.nrw.commons.upload.UploadService;
import static android.content.ContentResolver.requestSync; import static android.content.ContentResolver.requestSync;
public class ContributionsActivity public class ContributionsActivity extends AuthenticatedActivity {
extends AuthenticatedActivity {
@Inject @Inject
SessionManager sessionManager; SessionManager sessionManager;
@ -52,8 +50,7 @@ public class ContributionsActivity
requestAuthToken(); requestAuthToken();
initDrawer(); initDrawer();
setTitle(getString(R.string.navigation_item_home)); // Should I create a new string variable with another name instead? setTitle(getString(R.string.navigation_item_home)); // Should I create a new string variable with another name instead?
// Add tabs and fragments onAuthCookieAcquired
// Add tabs and fragments after Auth cookie received
} }
@Override @Override

View file

@ -4,6 +4,7 @@ import dagger.Module;
import dagger.android.ContributesAndroidInjector; import dagger.android.ContributesAndroidInjector;
import fr.free.nrw.commons.category.CategorizationFragment; import fr.free.nrw.commons.category.CategorizationFragment;
import fr.free.nrw.commons.category.SubCategoryListFragment; import fr.free.nrw.commons.category.SubCategoryListFragment;
import fr.free.nrw.commons.contributions.ContributionsFragment;
import fr.free.nrw.commons.contributions.ContributionsListFragment; import fr.free.nrw.commons.contributions.ContributionsListFragment;
import fr.free.nrw.commons.category.CategoryImagesListFragment; import fr.free.nrw.commons.category.CategoryImagesListFragment;
import fr.free.nrw.commons.explore.categories.SearchCategoryFragment; import fr.free.nrw.commons.explore.categories.SearchCategoryFragment;
@ -11,6 +12,7 @@ import fr.free.nrw.commons.explore.images.SearchImageFragment;
import fr.free.nrw.commons.explore.recentsearches.RecentSearchesFragment; import fr.free.nrw.commons.explore.recentsearches.RecentSearchesFragment;
import fr.free.nrw.commons.media.MediaDetailFragment; import fr.free.nrw.commons.media.MediaDetailFragment;
import fr.free.nrw.commons.media.MediaDetailPagerFragment; import fr.free.nrw.commons.media.MediaDetailPagerFragment;
import fr.free.nrw.commons.nearby.NearbyFragment;
import fr.free.nrw.commons.nearby.NearbyListFragment; import fr.free.nrw.commons.nearby.NearbyListFragment;
import fr.free.nrw.commons.nearby.NearbyMapFragment; import fr.free.nrw.commons.nearby.NearbyMapFragment;
import fr.free.nrw.commons.nearby.NoPermissionsFragment; import fr.free.nrw.commons.nearby.NoPermissionsFragment;
@ -67,4 +69,10 @@ public abstract class FragmentBuilderModule {
@ContributesAndroidInjector @ContributesAndroidInjector
abstract RecentSearchesFragment bindRecentSearchesFragment(); abstract RecentSearchesFragment bindRecentSearchesFragment();
@ContributesAndroidInjector
abstract ContributionsFragment bindContributionsFragment();
@ContributesAndroidInjector
abstract NearbyFragment bindNearbyFragment();
} }

View file

@ -4,8 +4,8 @@
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/contributionsListBackground"
> >
<!-- TODO: Neslihan android:background="?attr/contributionsListBackground"-->
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -16,6 +16,9 @@
<attr name="textDisabled" format="reference"/> <attr name="textDisabled" format="reference"/>
<attr name="textEnabled" format="reference"/> <attr name="textEnabled" format="reference"/>
<attr name="contributionsListBackground" format="reference"/>
<declare-styleable name="CompatTextView"> <declare-styleable name="CompatTextView">
<attr name="drawablePadding" format="dimension"/> <attr name="drawablePadding" format="dimension"/>
<attr name="drawableStart" format="reference"/> <attr name="drawableStart" format="reference"/>

View file

@ -3,6 +3,7 @@
<!-- Main application background color --> <!-- Main application background color -->
<color name="main_background_dark">#303030</color> <color name="main_background_dark">#303030</color>
<color name="main_background_light">#fafafa</color> <color name="main_background_light">#fafafa</color>
<color name="contributionListDarkBackground">#1a1a1a</color>
<!-- Colors used by newer Android + Support library for material design theme --> <!-- Colors used by newer Android + Support library for material design theme -->
<color name="primaryColor">#0c609c</color> <color name="primaryColor">#0c609c</color>

View file

@ -1,6 +1,7 @@
<resources> <resources>
<style name="DarkAppTheme" parent="Theme.AppCompat.NoActionBar"> <style name="DarkAppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="contributionsListBackground">@color/contributionListDarkBackground</item>
<item name="mainBackground">@color/main_background_dark</item> <item name="mainBackground">@color/main_background_dark</item>
<item name="colorPrimary">@color/primaryColor</item> <item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryDarkColor</item> <item name="colorPrimaryDark">@color/primaryDarkColor</item>
@ -22,6 +23,7 @@
</style> </style>
<style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="contributionsListBackground">@color/primaryColor</item>
<item name="mainBackground">@color/main_background_light</item> <item name="mainBackground">@color/main_background_light</item>
<item name="colorPrimaryDark">@color/primaryDarkColor</item> <item name="colorPrimaryDark">@color/primaryDarkColor</item>
<item name="colorAccent">@color/primaryColor</item> <item name="colorAccent">@color/primaryColor</item>