Skip to content

Commit e0bd00b

Browse files
neslihanturanmaskaravivek
authored andcommitted
Main screen ui changes, fixes #725 Main screen UI overhaul (#1922)
* Delete Contributions Activity content to rewrite it * Add layout for new Contributions Activity design * Bind views * Override auth cookie required * Add tabs and fragments method * Create ContributionsFragment which will hold ContributionsListFragment and MediaDetailsFragment * Add NearbyFragment which will hold NearbyMapFragment and NearbyListFragment * Add ContributionsActivityPagerAdapter inner class to manage view pager * Create strings will be written on tabs for contributions and nearby * Create setTabAndViewPagerSynchronisation method to sycn view pager and tab layout. If user swipe pages, tabs will also change (and vice versa) * Add theme dependent background color for Drawer Layout of activity_contributions layout file * Add theme dependent background color for tabs in main * Create Contributions Fragment structure which will hold Media Detail Fragment and Contributions List Fragment * Inifilate contributions list fragment view * Create variables and methods to reuse and create Media Detils Fragment and Contributions List Fragment which will be inside Contribution Fragment * Override cursor loader methods * set MediaDetilsView fragment or ContributionListFragment according to users state * Show details of an image when item is clicked * Add delete and retry functionality, note: not tested yet * Override media count methods * Implement onBack Pressed settings * Register and unregister datasetObservers * Add contributin list fragment * Add contribution list layout with FABs for camera and galerry * Make sure we called onAuthAcquired from fragment after is is attached * Create ContributionListViewUtils class to change visibility of views according to MediaDetailsFragment visiblity or their loading state * Make number of uploads visible if contribution list is visible and number of uploads is uploaded. Progress bar is visible if contribution list is visible and number of uploads are uploading. Both invisible if Media Details Fragment is visible * Return parent fragment instead of parent activity * GetPagerFragment instead of getActivity since currently ContributionsFragment take over responsibility from ContributionsActivity * Add contribution number next to tab text for contribution, as discussed in thread * Remove number of uploads from contributions fragment since we moved it text of tab layout * Add unread notifications asynctask to check unread notifications on background * Save latest time user notification activity viewed * Add shared preferences provider for latest notification activity visit time * Add shared preferences provider for latest notification activity visit time * Change notification icon (add blue dot) whenever a notification comes * Recover notifications state on come back to contributions list from media details fragment * Add date with year parameter to Notification class, because we will use it on comparasion of dates * Check if user visited noifications activity after last notification came * Add ation to notification icon * Add nearby custom card view class * Add card view to activity * Add a button which will be displayed when nearby permission is not granted thus closest point can't be displayed on main screen. Besides, theme dependent click styles are added to button * Add button click and permission request logic. Not: solve why location manager is null * Inject location manager to activity instead * Make card view dismissable with swip * Add preference to disable or display closest nearby location * Add a bugfix to set visibility of nearby notification cardview * Add UI modifier methods to display notifications * Modify getFromWikidataQuery method, so that based on the restunClosestResult boolean, we get only the closest nearby place, instead of fetching bunch of nearby places each time * Make inner class vaariables public to reach them out of package * Temporarily comment out icon setter methods since it crashes under API19 * Inject location manager * Register location manager accoring to permission is given, then call nearby card view updater methods * Change method calls loadAttractionsFromLocation by considering new parameter to decide between closest nearby call or an usual nearby call * Add progress bar to nearby cardview * Fix notifications string * Hide nearby card view when Media Details is visible * Change tab on nerby card view click * Add hardcoded strings to strings.xml * Move nearby activity to new nearby frament * Add fragments for nearby list and map into outer nearby fragment * Change options menu item according to tab view * Make nearby card view invisible on swipe to nearby tab * Use retained nearby fragment * Add action to list sheet button * This commit caused contrib list become invisible thus, Revert "Use retained nearby fragment" This reverts commit 86b3633. * Make sure retained fragments are used for -both- nearby and contrib fragments * Remove unrelated part added because of confusion, sorry * Make sure nearbyNotificationCardView visibility works corrent * Move nearby methods from nerby activity to nearby fragment, and add a lastLocationDuplicate variable to distinguish first time location from nearby fragment and nearby notification card on contributions activity * Change activity.findViewByID lines with parentFragment.view.findViewById * Remove toolbar from nearby fragment, since contributions activity already has * Disable view pager swipe, since using map is very hard with swipe option of view pager * Place progress bar inside nearby card notification to center * Make sure using retaied nearby map fragment and nearby list fragment inside nearby fragment * Update nearby notification content on slight location updates too, if it is first update after on resume. This prevented very long time loading progress bar * Add case for no nearest pleace found, to prevent bug * Prevent a possible bug can be caused from activity already killed * Add click actions to FAB buttons in contributions list fragment. And arrange FAB margins * Try to use a new location manager instance instead of using single object for both nearby map and nearby notification card view. Because location manager has a state mechanism which is designed to be called from a single point. When I call same methods from both nearby card view notification and nearby map, next update time of map etc. gets confused. * Set radius to initial value on getFromWikidataQuery (when it is called for getting closest result to be used in nearby card view notification). Normally, algorithm increase radius, this technique works for nearby map but when it comes to finding nearest point, it can return null * Add an enum to make card view visibility more stable, however, still there is a bug. * Prevent some more nearby card view visilbility bugs, however still there is a bug * Add some nullchecks for precaution * Check nearby permission and refresh nearby view if nearby tab selected, othervise do nothing * Send user to contrib tab if permission is denied after masrhmallow * Change nearby fragment background so that progress bar is visible now * Reduce code duplicate * request location and gps permission from contribution nearby car view too * Make sure using retained fragments * Make sure Contrib list fragment is retained on orientation change * Fix NPE at options menu * Make fragment flag fancier, define it per fragment instance, instead of activity * Fix Service leak and onsavedInstance NPE errrors both occured on orientation change * Refresh nearby map on orientation change * Remove unused imports, organise logs and add comments for NearbyMapFragment class * Remove all references of nearby activity, since we don't use it anymore * Remove unused imports, organise logs and add comments for Nearby Controller * Remove unused imports, organise logs and add comments for NearbyFragment * Remove unused imports, organise logs and add comments for NearbyNotificationCardView * Change class name from Contributions Activity to Main Activity. Remove unused imports, organise logs and add comments for MainAtivity * Remove extra spaces * Remove unused imports and logs * Remove unused imports, organise logs and add comments for LocationServiceManager * Remove unused imports, organise logs and add comments for NotificationsActivity * Remove unused imports, organise logs and add comments for Contributions Fragment * bug fix nearby notification card dismiss/restore issue * Change display_nearby_notification_summary varibale with Tap here to see the nearest place that needs pictures * Add nearest place notification card dismiss toast * Fix mistake made on previous commit, while fixing conflicts * Set no data yet message invisible after contributions list is loaded * Change FAB margins, according to Josephine's review * Change FAB margins, according to Josephine's review * Change contributions list background to white, to make FAB more visible * Add infobutton with popup window next to nearby tba, to explain what does this tab do * Change hambuger icon to back arrow when media details activity visible * On back button clicked from nearby fragment, switch back to contributions fragment, instead of closing the app * Check nearby card view visibility on coming back from media details activity * Change notification icon with default vector supplied by android vector repos. If we use the one I drawn on inkscape, produced vector is not compatible with API level 19 and below. I couldn't find a proper solution, and decided to change icon * Fix a possible NPE, caused by loation manager has Main activity reference after it is destroyed * Change hardcoded string with var from string xml * Make sure you listen storage permissions from contribution list framgent FABs * Make sure you listened storage permissions for Neaby fragment buttons too * Check NPEs causing crashes. Now it does not crash after coming back from settings activity * Make notification icon compatible with <API19 devices, by drawing and using .png images * Change back icon arrow vector with png * Attempt to solve location manager caused memory leak * Fix memory leaks and optimize imports * Merge 2.9 release
1 parent b3312a7 commit e0bd00b

File tree

67 files changed

+2939
-1176
lines changed

Some content is hidden

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

67 files changed

+2939
-1176
lines changed

app/src/main/AndroidManifest.xml

+5-10
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
</activity>
7070

7171
<activity
72-
android:name=".contributions.ContributionsActivity"
72+
android:name=".contributions.MainActivity"
7373
android:icon="@drawable/ic_launcher"
7474
android:label="@string/app_name" />
7575

@@ -80,17 +80,12 @@
8080
<activity
8181
android:name=".AboutActivity"
8282
android:label="@string/title_activity_about"
83-
android:parentActivityName=".contributions.ContributionsActivity" />
83+
android:parentActivityName=".contributions.MainActivity" />
8484

8585
<activity
8686
android:name=".auth.SignupActivity"
8787
android:label="@string/title_activity_signup" />
8888

89-
<activity
90-
android:name=".nearby.NearbyActivity"
91-
android:label="@string/title_activity_nearby"
92-
android:parentActivityName=".contributions.ContributionsActivity" />
93-
9489
<activity
9590
android:name=".notification.NotificationActivity"
9691
android:label="@string/navigation_item_notification" />
@@ -104,18 +99,18 @@
10499
<activity
105100
android:name=".category.CategoryImagesActivity"
106101
android:label="@string/title_activity_featured_images"
107-
android:parentActivityName=".contributions.ContributionsActivity" />
102+
android:parentActivityName=".contributions.MainActivity" />
108103

109104
<activity
110105
android:name=".category.CategoryDetailsActivity"
111106
android:label="@string/title_activity_featured_images"
112-
android:parentActivityName=".contributions.ContributionsActivity" />
107+
android:parentActivityName=".contributions.MainActivity" />
113108

114109
<activity
115110
android:name=".explore.SearchActivity"
116111
android:label="@string/title_activity_search"
117112
android:configChanges="orientation|keyboardHidden"
118-
android:parentActivityName=".contributions.ContributionsActivity"
113+
android:parentActivityName=".contributions.MainActivity"
119114
/>
120115

121116
<activity

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import fr.free.nrw.commons.Utils;
4444
import fr.free.nrw.commons.WelcomeActivity;
4545
import fr.free.nrw.commons.category.CategoryImagesActivity;
46-
import fr.free.nrw.commons.contributions.ContributionsActivity;
46+
import fr.free.nrw.commons.contributions.MainActivity;
4747
import fr.free.nrw.commons.di.ApplicationlessInjection;
4848
import fr.free.nrw.commons.mwapi.MediaWikiApi;
4949
import fr.free.nrw.commons.theme.NavigationBaseActivity;
@@ -415,7 +415,7 @@ public void emptySensitiveEditFields() {
415415
}
416416

417417
public void startMainActivity() {
418-
NavigationBaseActivity.startActivityWithFlags(this, ContributionsActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
418+
NavigationBaseActivity.startActivityWithFlags(this, MainActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
419419
finish();
420420
}
421421

0 commit comments

Comments
 (0)