Skip to content

Commit 71d200e

Browse files
Fixes commons-app#2843 New main screen UI in v3.0 (commons-app#3891)
* Add additional classes from 2019 hackathon implementation * Make first tab work * Make explore tab work * Handle back button for contrib and nearby * Fix framelayout and nav bar allignment * Fix nav bar tint * Fix nearby card layout * Make contributions number visible * Change menu icon according to fragment * Make notification icon work and remove drawer * Make favourites accessible from nav bar * Turn bookmark and explore activities into fragments * Use bottom sheet instead of more fragment * Add actions * Remove unused classes * Fix indentation * remove more fragment title * Fix explore fragment indentation * Make toolbar settings as we wanted * Set card view styles * Make colors for explore actiivty * Remove drawer from achievements activity * Add back button to achievements activity * remove drawer from review activity * Remove drawer from settings activity * Remove drawer from about activity * Fix dagger injection of fragment * Implement skip login version * Add theme missing colors * Add style to moresheet * refactor name * call login with button * Remove all old bookmarks activity dependency * Make explore tab items clickable * Do nothing if same tab is selected * Fix notification icon color for dark theme * Fix wrong drawable colors * Handle back button after media details is visible from contrib and explore fragments * make favourites open media details * Fix profile icon * Make user name visible instead * Move user back to contrib fragment * Remove NavigationBaseAvticity * Fix typo in bookmark fragment * Fix menu button colors * Remove explore activity * remove drawer and dependencies * Make bookmark media details visible * Cleanup code * Code cleanup * Remove unused layout * Make contriblist UI look like in mockups * Change limited connecton toggle * Move list menu item to nearby fragment * Fix search button crash * Make media detail appear * Back button added * Fix back button npe * Change bookmark list view * Fix always the firs item displayed issue * Allign contrib list bottom line to simple drawee bottom * fix fragment string * Fix back button for mobile uploads * Make lists appear * Make fav item selected * Make favourites clickable * Add back button to media details * Add toolbar of notification activity * Change contributions icon * Fix card UI * Fix back button in explore * Make card views look similar to mockups * Solve campaign bug visible issue * Make borders a little softer
1 parent 5d82629 commit 71d200e

File tree

110 files changed

+2216
-1620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2216
-1620
lines changed

app/src/androidTest/java/fr/free/nrw/commons/ExploreActivityTest.kt

-19
This file was deleted.

app/src/main/AndroidManifest.xml

-10
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@
124124
android:label="@string/title_activity_featured_images"
125125
android:parentActivityName=".contributions.MainActivity" />
126126

127-
<activity
128-
android:name=".explore.ExploreActivity"
129-
android:label="@string/title_activity_explore"
130-
android:parentActivityName=".contributions.MainActivity"
131-
android:configChanges="orientation|screenSize|keyboard" />
132-
133127
<activity
134128
android:name=".explore.SearchActivity"
135129
android:label="@string/title_activity_search"
@@ -143,10 +137,6 @@
143137
android:configChanges="orientation|screenSize|keyboard"
144138
android:label="@string/Profile" />
145139

146-
<activity
147-
android:name=".bookmarks.BookmarksActivity"
148-
android:label="@string/title_activity_bookmarks" />
149-
150140
<activity
151141
android:name=".review.ReviewActivity"
152142
android:label="@string/title_activity_review" />

app/src/main/java/fr/free/nrw/commons/AboutActivity.java

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import android.content.Intent;
66
import android.net.Uri;
77
import android.os.Bundle;
8-
import android.text.SpannableString;
9-
import android.text.style.UnderlineSpan;
108
import android.view.Menu;
119
import android.view.MenuInflater;
1210
import android.view.MenuItem;
@@ -17,22 +15,21 @@
1715
import android.widget.TextView;
1816

1917
import androidx.annotation.NonNull;
20-
import java.lang.ref.SoftReference;
18+
import androidx.appcompat.widget.Toolbar;
19+
import fr.free.nrw.commons.theme.BaseActivity;
2120
import java.util.Collections;
2221
import java.util.List;
23-
import org.wikipedia.util.StringUtil;
2422

2523
import butterknife.BindView;
2624
import butterknife.ButterKnife;
2725
import butterknife.OnClick;
28-
import fr.free.nrw.commons.theme.NavigationBaseActivity;
2926
import fr.free.nrw.commons.ui.widget.HtmlTextView;
3027
import fr.free.nrw.commons.utils.ConfigUtils;
3128

3229
/**
3330
* Represents about screen of this app
3431
*/
35-
public class AboutActivity extends NavigationBaseActivity {
32+
public class AboutActivity extends BaseActivity {
3633
@BindView(R.id.about_version) TextView versionText;
3734
@BindView(R.id.about_license) HtmlTextView aboutLicenseText;
3835
@BindView(R.id.about_faq) TextView faqText;
@@ -41,6 +38,7 @@ public class AboutActivity extends NavigationBaseActivity {
4138
@BindView(R.id.about_privacy_policy) TextView privacyPolicyText;
4239
@BindView(R.id.about_translate) TextView translateText;
4340
@BindView(R.id.about_credits) TextView creditsText;
41+
@BindView(R.id.toolbar) Toolbar toolbar;
4442
/**
4543
* This method helps in the creation About screen
4644
*
@@ -53,7 +51,8 @@ public void onCreate(Bundle savedInstanceState) {
5351
setContentView(R.layout.activity_about);
5452

5553
ButterKnife.bind(this);
56-
54+
setSupportActionBar(toolbar);
55+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
5756
String aboutText = getString(R.string.about_license);
5857
aboutLicenseText.setHtmlText(aboutText);
5958

@@ -68,8 +67,12 @@ public void onCreate(Bundle savedInstanceState) {
6867
Utils.setUnderlinedText(privacyPolicyText, R.string.about_privacy_policy, getApplicationContext());
6968
Utils.setUnderlinedText(translateText, R.string.about_translate, getApplicationContext());
7069
Utils.setUnderlinedText(creditsText, R.string.about_credits, getApplicationContext());
70+
}
7171

72-
initDrawer();
72+
@Override
73+
public boolean onSupportNavigateUp() {
74+
onBackPressed();
75+
return true;
7376
}
7477

7578
@OnClick(R.id.facebook_launch_icon)

app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import com.google.android.material.textfield.TextInputLayout;
3131

32+
import fr.free.nrw.commons.utils.ActivityUtils;
3233
import org.wikipedia.AppAdapter;
3334
import org.wikipedia.dataclient.ServiceFactory;
3435
import org.wikipedia.dataclient.WikiSite;
@@ -51,9 +52,7 @@
5152
import fr.free.nrw.commons.WelcomeActivity;
5253
import fr.free.nrw.commons.contributions.MainActivity;
5354
import fr.free.nrw.commons.di.ApplicationlessInjection;
54-
import fr.free.nrw.commons.explore.ExploreActivity;
5555
import fr.free.nrw.commons.kvstore.JsonKvStore;
56-
import fr.free.nrw.commons.theme.NavigationBaseActivity;
5756
import fr.free.nrw.commons.utils.ConfigUtils;
5857
import fr.free.nrw.commons.utils.SystemThemeUtils;
5958
import fr.free.nrw.commons.utils.ViewUtil;
@@ -318,7 +317,7 @@ private void showPasswordResetPrompt() {
318317
*/
319318
private void performSkipLogin() {
320319
applicationKvStore.putBoolean("login_skipped", true);
321-
ExploreActivity.startYourself(this);
320+
MainActivity.startYourself(this);
322321
finish();
323322
}
324323

@@ -412,7 +411,7 @@ public void showSuccessAndDismissDialog() {
412411
}
413412

414413
public void startMainActivity() {
415-
NavigationBaseActivity.startActivityWithFlags(this, MainActivity.class, Intent.FLAG_ACTIVITY_SINGLE_TOP);
414+
ActivityUtils.startActivityWithFlags(this, MainActivity.class, Intent.FLAG_ACTIVITY_SINGLE_TOP);
416415
finish();
417416
}
418417

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package fr.free.nrw.commons.bookmarks;
2+
3+
import android.os.Bundle;
4+
import android.view.LayoutInflater;
5+
import android.view.View;
6+
import android.view.ViewGroup;
7+
import android.widget.AdapterView;
8+
9+
import android.widget.FrameLayout;
10+
import androidx.annotation.NonNull;
11+
import androidx.annotation.Nullable;
12+
import androidx.fragment.app.FragmentManager;
13+
import androidx.viewpager.widget.ViewPager;
14+
15+
import com.google.android.material.tabs.TabLayout;
16+
17+
import fr.free.nrw.commons.contributions.MainActivity;
18+
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
19+
import fr.free.nrw.commons.theme.BaseActivity;
20+
import javax.inject.Inject;
21+
22+
import butterknife.BindView;
23+
import butterknife.ButterKnife;
24+
import fr.free.nrw.commons.Media;
25+
import fr.free.nrw.commons.R;
26+
import fr.free.nrw.commons.category.CategoryImagesCallback;
27+
import fr.free.nrw.commons.contributions.ContributionController;
28+
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
29+
30+
public class BookmarkFragment extends CommonsDaggerSupportFragment {
31+
32+
private FragmentManager supportFragmentManager;
33+
private BookmarksPagerAdapter adapter;
34+
@BindView(R.id.viewPagerBookmarks)
35+
ViewPager viewPager;
36+
@BindView(R.id.tab_layout)
37+
TabLayout tabLayout;
38+
@BindView(R.id.fragmentContainer)
39+
FrameLayout fragmentContainer;
40+
41+
@Inject
42+
ContributionController controller;
43+
44+
@NonNull
45+
public static BookmarkFragment newInstance() {
46+
BookmarkFragment fragment = new BookmarkFragment();
47+
fragment.setRetainInstance(true);
48+
return fragment;
49+
}
50+
51+
@Override
52+
public void onCreate(@Nullable final Bundle savedInstanceState) {
53+
super.onCreate(savedInstanceState);
54+
}
55+
56+
@Nullable
57+
@Override
58+
public View onCreateView(@NonNull final LayoutInflater inflater,
59+
@Nullable final ViewGroup container,
60+
@Nullable final Bundle savedInstanceState) {
61+
super.onCreateView(inflater, container, savedInstanceState);
62+
View view = inflater.inflate(R.layout.fragment_bookmarks, container, false);
63+
ButterKnife.bind(this, view);
64+
65+
// Activity can call methods in the fragment by acquiring a
66+
// reference to the Fragment from FragmentManager, using findFragmentById()
67+
supportFragmentManager = getChildFragmentManager();
68+
69+
adapter = new BookmarksPagerAdapter(supportFragmentManager, getContext());
70+
viewPager.setAdapter(adapter);
71+
tabLayout.setupWithViewPager(viewPager);
72+
return view;
73+
}
74+
75+
public void onBackPressed() {
76+
((BookmarkListRootFragment) (adapter.getItem(tabLayout.getSelectedTabPosition())))
77+
.backPressed();
78+
((BaseActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
79+
}
80+
}

0 commit comments

Comments
 (0)