Merge pull request #605 from maskaravivek/navigationDrawer

Navigation drawer in all activities
This commit is contained in:
neslihanturan 2017-05-16 13:40:31 +03:00 committed by GitHub
commit a41323f91e
20 changed files with 672 additions and 179 deletions

View file

@ -1,14 +1,15 @@
package fr.free.nrw.commons;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import fr.free.nrw.commons.theme.BaseActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
public class AboutActivity extends BaseActivity {
public class AboutActivity extends NavigationBaseActivity {
@BindView(R.id.about_version) TextView versionText;
@Override
@ -19,5 +20,11 @@ public class AboutActivity extends BaseActivity {
ButterKnife.bind(this);
versionText.setText(BuildConfig.VERSION_NAME);
initDrawer();
}
public static void startYourself(Context context) {
Intent settingsIntent = new Intent(context, AboutActivity.class);
context.startActivity(settingsIntent);
}
}

View file

@ -12,8 +12,9 @@ import java.io.IOException;
import fr.free.nrw.commons.theme.BaseActivity;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
public abstract class AuthenticatedActivity extends BaseActivity {
public abstract class AuthenticatedActivity extends NavigationBaseActivity {
String accountType;
CommonsApplication app;

View file

@ -25,11 +25,13 @@ import android.widget.AdapterView;
import java.util.ArrayList;
import java.util.Locale;
import butterknife.ButterKnife;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.HandlerService;
import fr.free.nrw.commons.Media;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.auth.AuthenticatedActivity;
import fr.free.nrw.commons.hamburger.HamburgerMenuContainer;
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
import fr.free.nrw.commons.settings.Prefs;
import fr.free.nrw.commons.upload.UploadService;
@ -41,7 +43,8 @@ public class ContributionsActivity
AdapterView.OnItemClickListener,
MediaDetailPagerFragment.MediaDetailProvider,
FragmentManager.OnBackStackChangedListener,
ContributionsListFragment.SourceRefresher {
ContributionsListFragment.SourceRefresher,
HamburgerMenuContainer {
private Cursor allContributions;
private ContributionsListFragment contributionsList;
@ -50,6 +53,7 @@ public class ContributionsActivity
private boolean isUploadServiceConnected;
private ArrayList<DataSetObserver> observersWaitingForLoad = new ArrayList<>();
private String CONTRIBUTION_SELECTION = "";
/*
This sorts in the following order:
Currently Uploading
@ -119,8 +123,8 @@ public class ContributionsActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.title_activity_contributions);
setContentView(R.layout.activity_contributions);
ButterKnife.bind(this);
// Activity can call methods in the fragment by acquiring a reference to the Fragment from FragmentManager, using findFragmentById()
contributionsList = (ContributionsListFragment)getSupportFragmentManager().findFragmentById(R.id.contributionsListFragment);
@ -136,6 +140,7 @@ public class ContributionsActivity
}
}
requestAuthToken();
initDrawer();
}
@Override
@ -320,4 +325,9 @@ public class ContributionsActivity
public void refreshSource() {
getSupportLoaderManager().restartLoader(0, null, this);
}
public static void startYourself(Context context) {
Intent settingsIntent = new Intent(context, ContributionsActivity.class);
context.startActivity(settingsIntent);
}
}

View file

@ -126,46 +126,6 @@ public class ContributionsListFragment extends Fragment {
case R.id.menu_from_camera:
controller.startCameraCapture();
return true;
case R.id.menu_settings:
Intent settingsIntent = new Intent(getActivity(), SettingsActivity.class);
startActivity(settingsIntent);
return true;
case R.id.menu_about:
Intent aboutIntent = new Intent(getActivity(), AboutActivity.class);
startActivity(aboutIntent);
return true;
case R.id.menu_feedback:
Intent feedbackIntent = new Intent(Intent.ACTION_SEND);
feedbackIntent.setType("message/rfc822");
feedbackIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { CommonsApplication.FEEDBACK_EMAIL });
feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, BuildConfig.VERSION_NAME));
try {
startActivity(feedbackIntent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show();
}
return true;
case R.id.menu_nearby:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this.getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
//See http://stackoverflow.com/questions/33169455/onrequestpermissionsresult-not-being-called-in-dialog-fragment
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 2);
return true;
} else {
Intent nearbyIntent = new Intent(getActivity(), NearbyActivity.class);
startActivity(nearbyIntent);
return true;
}
}
else {
Intent nearbyIntent = new Intent(getActivity(), NearbyActivity.class);
startActivity(nearbyIntent);
return true;
}
case R.id.menu_refresh:
((SourceRefresher)getActivity()).refreshSource();
return true;
default:
return super.onOptionsItemSelected(item);
}
@ -203,8 +163,6 @@ public class ContributionsListFragment extends Fragment {
if (!app.deviceHasCamera()) {
menu.findItem(R.id.menu_from_camera).setEnabled(false);
}
menu.findItem(R.id.menu_refresh).setVisible(false);
}
@Override

View file

@ -0,0 +1,9 @@
package fr.free.nrw.commons.hamburger;
import android.support.v7.app.ActionBarDrawerToggle;
public interface HamburgerMenuContainer {
void setDrawerListener(ActionBarDrawerToggle listener);
void toggleDrawer();
boolean isDrawerVisible();
}

View file

@ -0,0 +1,133 @@
package fr.free.nrw.commons.hamburger;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import fr.free.nrw.commons.AboutActivity;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.contributions.ContributionsActivity;
import fr.free.nrw.commons.nearby.NearbyActivity;
import fr.free.nrw.commons.settings.SettingsActivity;
public class NavigationBaseFragment extends Fragment {
@BindView(R.id.pictureOfTheDay)
ImageView pictureOfTheDay;
@BindView(R.id.upload_item)
TextView uploadItem;
@BindView(R.id.nearby_item)
TextView nearbyItem;
@BindView(R.id.about_item)
TextView aboutItem;
@BindView(R.id.settings_item)
TextView settingsItem;
@BindView(R.id.feedback_item)
TextView feedbackItem;
@BindView(R.id.logout_item)
TextView logoutItem;
private DrawerLayout drawerLayout;
private RelativeLayout drawerPane;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View hamburgerView = inflater.inflate(R.layout.navigation_drawer_menu, container, false);
ButterKnife.bind(this, hamburgerView);
showPictureOfTheDay();
setupHamburgerMenu();
return hamburgerView;
}
private void showPictureOfTheDay() {
pictureOfTheDay.setImageDrawable(getResources().getDrawable(R.drawable.commons_logo_large));
}
@Override
public void onResume() {
super.onResume();
}
private void setupHamburgerMenu() {
ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(getActivity(),
drawerLayout, R.string.ok, R.string.cancel);
if (getActivity() instanceof HamburgerMenuContainer) {
((HamburgerMenuContainer) getActivity()).setDrawerListener(drawerToggle);
}
}
@OnClick(R.id.upload_item)
protected void onUploadItemClicked() {
closeDrawer();
ContributionsActivity.startYourself(getActivity());
}
@OnClick(R.id.settings_item)
protected void onSettingsItemClicked() {
closeDrawer();
SettingsActivity.startYourself(getActivity());
}
@OnClick(R.id.about_item)
protected void onAboutItemClicked() {
closeDrawer();
AboutActivity.startYourself(getActivity());
}
@OnClick(R.id.nearby_item)
protected void onNearbyItemClicked() {
closeDrawer();
NearbyActivity.startYourself(getActivity());
}
@OnClick(R.id.feedback_item)
protected void onFeedbackItemClicked() {
closeDrawer();
Intent feedbackIntent = new Intent(Intent.ACTION_SEND);
feedbackIntent.setType("message/rfc822");
feedbackIntent.putExtra(Intent.EXTRA_EMAIL,
new String[]{CommonsApplication.FEEDBACK_EMAIL});
feedbackIntent.putExtra(Intent.EXTRA_SUBJECT,
String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT,
BuildConfig.VERSION_NAME));
try {
startActivity(feedbackIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show();
}
}
private void closeDrawer() {
if (drawerLayout != null) {
drawerLayout.closeDrawer(drawerPane);
}
}
public void setDrawerLayout(DrawerLayout drawerLayout, RelativeLayout drawerPane) {
this.drawerLayout = drawerLayout;
this.drawerPane = drawerPane;
}
}

View file

@ -1,12 +1,9 @@
package fr.free.nrw.commons.nearby;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.LocationManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@ -20,23 +17,21 @@ import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.location.LocationServiceManager;
import fr.free.nrw.commons.theme.BaseActivity;
import fr.free.nrw.commons.utils.UriSerializer;
import fr.free.nrw.commons.R;
import timber.log.Timber;
import java.util.List;
public class NearbyActivity extends BaseActivity {
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.location.LocationServiceManager;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.utils.UriSerializer;
import timber.log.Timber;
public class NearbyActivity extends NavigationBaseActivity {
@BindView(R.id.progressBar)
ProgressBar progressBar;
private boolean isMapViewActive = false;
@ -64,7 +59,7 @@ public class NearbyActivity extends BaseActivity {
curLatLang = locationManager.getLatestLocation();
nearbyAsyncTask = new NearbyAsyncTask(this);
nearbyAsyncTask.execute();
initDrawer();
}
@Override
@ -251,4 +246,9 @@ public class NearbyActivity extends BaseActivity {
fragmentTransaction.replace(R.id.container, fragment);
fragmentTransaction.commit();
}
public static void startYourself(Context context) {
Intent settingsIntent = new Intent(context, NearbyActivity.class);
context.startActivity(settingsIntent);
}
}

View file

@ -1,14 +1,20 @@
package fr.free.nrw.commons.settings;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatDelegate;
import android.view.MenuItem;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
public class SettingsActivity extends NavigationBaseActivity {
private SettingsFragment settingsFragment;
public class SettingsActivity extends PreferenceActivity {
private AppCompatDelegate settingsDelegate;
@Override
@ -20,11 +26,13 @@ public class SettingsActivity extends PreferenceActivity {
setTheme(R.style.LightAppTheme);
}
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment()).commit();
settingsFragment = (SettingsFragment) getFragmentManager().findFragmentById(R.id.settingsFragment);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
ButterKnife.bind(this);
initDrawer();
}
// Get an action bar
@ -37,7 +45,7 @@ public class SettingsActivity extends PreferenceActivity {
settingsDelegate.onPostCreate(savedInstanceState);
//Get an up button
settingsDelegate.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//settingsDelegate.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
//Handle action-bar clicks
@ -51,4 +59,9 @@ public class SettingsActivity extends PreferenceActivity {
return super.onOptionsItemSelected(item);
}
}
public static void startYourself(Context context) {
Intent settingsIntent = new Intent(context, SettingsActivity.class);
context.startActivity(settingsIntent);
}
}

View file

@ -3,14 +3,19 @@ package fr.free.nrw.commons.theme;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.widget.RelativeLayout;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.hamburger.NavigationBaseFragment;
import fr.free.nrw.commons.utils.FragmentUtils;
public class BaseActivity extends AppCompatActivity {
boolean currentTheme;
@Override
protected void onCreate(Bundle savedInstanceState) {
if(Utils.isDarkTheme(this)){

View file

@ -0,0 +1,82 @@
package fr.free.nrw.commons.theme;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.hamburger.HamburgerMenuContainer;
import fr.free.nrw.commons.hamburger.NavigationBaseFragment;
import fr.free.nrw.commons.utils.FragmentUtils;
import static android.support.v4.view.GravityCompat.START;
public class NavigationBaseActivity extends BaseActivity implements HamburgerMenuContainer {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.drawer_layout)
DrawerLayout drawerLayout;
@BindView(R.id.drawer_pane)
RelativeLayout drawerPane;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void initDrawer() {
initSubviews();
NavigationBaseFragment baseFragment = new NavigationBaseFragment();
baseFragment.setDrawerLayout(drawerLayout, drawerPane);
FragmentUtils.addAndCommitFragmentWithImmediateExecution(getSupportFragmentManager(),
R.id.drawer_fragment,
baseFragment);
}
private void initSubviews() {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,
drawerLayout,
toolbar,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
drawerLayout.setDrawerListener(toggle);
toggle.setDrawerIndicatorEnabled(true);
toggle.syncState();
setDrawerPaneWidth();
}
private void setDrawerPaneWidth() {
ViewGroup.LayoutParams params = drawerPane.getLayoutParams();
// set width to lowerBound of 80% of the screen size
params.width = (getResources().getDisplayMetrics().widthPixels * 70) / 100;
drawerPane.setLayoutParams(params);
}
@Override
public void setDrawerListener(ActionBarDrawerToggle listener) {
drawerLayout.setDrawerListener(listener);
}
@Override
public void toggleDrawer() {
if (drawerLayout.isDrawerVisible(START)) {
drawerLayout.closeDrawer(START);
} else {
drawerLayout.openDrawer(START);
}
}
@Override
public boolean isDrawerVisible() {
return drawerLayout.isDrawerVisible(START);
}
}

View file

@ -0,0 +1,31 @@
package fr.free.nrw.commons.utils;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import timber.log.Timber;
public class FragmentUtils {
public static boolean addAndCommitFragmentWithImmediateExecution(
@NonNull FragmentManager fragmentManager,
@IdRes int containerViewId,
@NonNull Fragment fragment) {
if (fragment.isAdded()) {
Timber.w("Could not add fragment. The fragment is already added.");
return false;
}
try {
fragmentManager.beginTransaction()
.add(containerViewId, fragment)
.commitNow();
return true;
} catch (IllegalStateException e) {
Timber.e(e, "Could not add & commit fragment. " +
"Did you mean to call commitAllowingStateLoss?");
}
return false;
}
}

View file

@ -1,71 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_height="match_parent">
<ImageView
android:src="@drawable/ic_launcher"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/app_name"
style="?android:textAppearanceLarge"
/>
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/about_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:gravity="center"
android:orientation="vertical">
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_license"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="?android:textAppearanceSmall"
android:gravity="center"
android:text="@string/about_license"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_improve"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
style="?android:textAppearanceSmall"
android:gravity="center"
android:text="@string/about_improve"
/>
<TextView
style="?android:textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_privacy_policy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="?android:textAppearanceSmall"
android:gravity="center"
android:text="@string/about_privacy_policy"
/>
<TextView
android:id="@+id/about_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_credits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="?android:textAppearanceSmall"
android:gravity="center"
android:text="@string/about_credits"
/>
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_license"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/about_license" />
</LinearLayout>
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_improve"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/about_improve" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_privacy_policy"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/about_privacy_policy" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/about_credits"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/about_credits" />
<TextView
android:id="@+id/about_uploads_to"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:alpha="0.2"
android:gravity="center" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/drawer_pane"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white">
<FrameLayout
android:id="@+id/drawer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View file

@ -1,17 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/contributionsFragmentContainer"
>
android:layout_height="match_parent">
<fragment
android:name="fr.free.nrw.commons.contributions.ContributionsListFragment"
android:id="@+id/contributionsListFragment"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_contributions" />
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/contributionsFragmentContainer"
android:orientation="horizontal"
android:layout_below="@id/toolbar">
<fragment
android:id="@+id/contributionsListFragment"
android:name="fr.free.nrw.commons.contributions.ContributionsListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_contributions" />
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/drawer_pane"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white">
<FrameLayout
android:id="@+id/drawer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View file

@ -1,22 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_below="@id/toolbar">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/drawer_pane"
android:layout_width="320dp"
android:layout_height="match_parent"
>
</FrameLayout>
android:layout_gravity="start"
android:background="@android:color/white">
</LinearLayout>
<FrameLayout
android:id="@+id/drawer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment
android:id="@+id/settingsFragment"
android:name="fr.free.nrw.commons.settings.SettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@xml/preferences"
android:layout_below="@id/toolbar"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/drawer_pane"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white">
<FrameLayout
android:id="@+id/drawer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray">
<ImageView
android:id="@+id/pictureOfTheDay"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="140dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@android:color/black"/>
<TextView
android:id="@+id/upload_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_upload"/>
<TextView
android:id="@+id/nearby_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_nearby"/>
<TextView
android:id="@+id/about_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_about"/>
<TextView
android:id="@+id/settings_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_settings"/>
<TextView
android:id="@+id/feedback_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_feedback"/>
<TextView
android:id="@+id/logout_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text="@string/navigation_item_logout"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/colorPrimaryDark">
</android.support.v7.widget.Toolbar>

View file

@ -10,25 +10,25 @@
app:showAsAction="ifRoom|withText"
android:icon="?attr/iconPhoto"
/>
<item android:id="@+id/menu_nearby"
android:title="@string/menu_nearby"
app:showAsAction="never"
/>
<item android:id="@+id/menu_refresh"
android:title="@string/menu_refresh"
app:showAsAction="never"
/>
<item android:id="@+id/menu_about"
android:title="@string/menu_about"
app:showAsAction="never"
/>
<item android:id="@+id/menu_settings"
android:title="@string/menu_settings"
app:showAsAction="never"
/>
<item android:id="@+id/menu_feedback"
android:title="@string/menu_feedback"
app:showAsAction="never"
/>
<!--<item android:id="@+id/menu_nearby"-->
<!--android:title="@string/menu_nearby"-->
<!--app:showAsAction="never"-->
<!--/>-->
<!--<item android:id="@+id/menu_refresh"-->
<!--android:title="@string/menu_refresh"-->
<!--app:showAsAction="never"-->
<!--/>-->
<!--<item android:id="@+id/menu_about"-->
<!--android:title="@string/menu_about"-->
<!--app:showAsAction="never"-->
<!--/>-->
<!--<item android:id="@+id/menu_settings"-->
<!--android:title="@string/menu_settings"-->
<!--app:showAsAction="never"-->
<!--/>-->
<!--<item android:id="@+id/menu_feedback"-->
<!--android:title="@string/menu_feedback"-->
<!--app:showAsAction="never"-->
<!--/>-->
</menu>

View file

@ -184,4 +184,14 @@ Tap this message (or hit back) to skip this step.</string>
<string name="set_limit">Set Recent Upload Limit</string>
<string name="login_failed_2fa_not_supported">Two factor authentication is currently not supported.</string>
<string name="cancel">Cancel</string>
<string name="navigation_drawer_open">Open</string>
<string name="navigation_drawer_close">Close</string>
<string name="navigation_item_home">Home</string>
<string name="navigation_item_upload">Upload</string>
<string name="navigation_item_nearby">Nearby</string>
<string name="navigation_item_about">About</string>
<string name="navigation_item_settings">Settings</string>
<string name="navigation_item_feedback">Feedback</string>
<string name="navigation_item_logout">Logout</string>
</resources>

View file

@ -1,6 +1,6 @@
<resources>
<style name="DarkAppTheme" parent="Theme.AppCompat">
<style name="DarkAppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="mainBackground">@color/main_background_dark</item>
<item name="semitransparentText">@color/commons_app_blue_dark</item>
<item name="commonsAppBlue">@color/activity_welcome_background_dark</item>
@ -16,7 +16,7 @@
<item name="spinnerTheme">@style/DarkSpinnerTheme</item>
</style>
<style name="LightAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="mainBackground">@color/main_background_light</item>
<item name="semitransparentText">@color/commons_app_blue_light</item>
<item name="commonsAppBlue">@color/activity_welcome_background_light</item>