[android] Fix copied to clipboard not showing when on lock screen #7246

Merged
arjundevasi merged 6 commits from copy-to-clipboard-toast into master 2024-02-04 21:35:05 +00:00
arjundevasi commented 2024-01-25 18:26:17 +00:00 (Migrated from github.com)

The issue stated that the app does not show any visual feedback when copied place name, description or wikipedia from lock screen.

Made code changes at three places which will fix the issue.

Fixes #6938

The issue stated that the app does not show any visual feedback when copied place name, description or wikipedia from lock screen. Made code changes at three places which will fix the issue. Fixes #6938
rtsisyk reviewed 2024-01-25 18:26:17 +00:00
biodranik (Migrated from github.com) reviewed 2024-01-27 14:43:22 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
biodranik (Migrated from github.com) commented 2024-01-27 14:43:21 +00:00

isDeviceLocked available starting from LOLLIPOP_MR1 (API 22), while Organic Maps works from LOLLIPOP (API 21). Why is TIRAMISU (API 33) check needed here?

isDeviceLocked available starting from LOLLIPOP_MR1 (API 22), while Organic Maps works from LOLLIPOP (API 21). Why is TIRAMISU (API 33) check needed here?
vng (Migrated from github.com) reviewed 2024-01-27 14:45:24 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
vng (Migrated from github.com) commented 2024-01-27 14:44:51 +00:00

Please, put braces, the conditions order is not obvious here:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU && keyguardManager.isDeviceLocked())

  • What's wrong with Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU? It doesn't support a snack bar at all?
  • Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU supports a snack bar in locked mode only?
Please, put braces, the conditions order is not obvious here: ```if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU && keyguardManager.isDeviceLocked())``` - What's wrong with ```Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU```? It doesn't support a snack bar at all? - ```Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU``` supports a snack bar in locked mode only?
arjundevasi (Migrated from github.com) reviewed 2024-01-27 15:17:53 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
arjundevasi (Migrated from github.com) commented 2024-01-27 15:17:53 +00:00

apologies, working on the fix.

Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU for android version Tiramisu and higher, a copy preview pop is shown by default. see this https://developer.android.com/develop/ui/views/touch-and-input/copy-paste#Feedback

apologies, working on the fix. ``` Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU ``` for android version Tiramisu and higher, a copy preview pop is shown by default. see this [https://developer.android.com/develop/ui/views/touch-and-input/copy-paste#Feedback](url)
arjundevasi (Migrated from github.com) reviewed 2024-01-27 15:25:47 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
arjundevasi (Migrated from github.com) commented 2024-01-27 15:25:46 +00:00

the snack bar should be shown only on lockscreen for android version 13 and higher, when unlocked the preview popup is shown by default.

for android version lower than 13, the snackbar should be shown regardless of device is locked or not.

The if condition needs fixing, working on it.

the snack bar should be shown only on lockscreen for android version 13 and higher, when unlocked the preview popup is shown by default. for android version lower than 13, the snackbar should be shown regardless of device is locked or not. The if condition needs fixing, working on it.
arjundevasi (Migrated from github.com) reviewed 2024-01-27 17:42:39 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
arjundevasi (Migrated from github.com) commented 2024-01-27 17:42:39 +00:00

how about this modification:

if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
      {
        Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view,
                                ctx.getString(R.string.copied_to_clipboard, phoneNumber));
      }
      else if (keyguardManager.isDeviceLocked())
      {
        Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view,
                                ctx.getString(R.string.copied_to_clipboard, phoneNumber));
      }
how about this modification: ``` if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view, ctx.getString(R.string.copied_to_clipboard, phoneNumber)); } else if (keyguardManager.isDeviceLocked()) { Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view, ctx.getString(R.string.copied_to_clipboard, phoneNumber)); } ```
Jean-BaptisteC (Migrated from github.com) reviewed 2024-01-27 17:54:39 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
Jean-BaptisteC (Migrated from github.com) commented 2024-01-27 17:54:38 +00:00
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || keyguardManager.isDeviceLocked())
      {
        Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view,
                                ctx.getString(R.string.copied_to_clipboard, phoneNumber));
      }
``` if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || keyguardManager.isDeviceLocked()) { Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view, ctx.getString(R.string.copied_to_clipboard, phoneNumber)); } ```
arjundevasi (Migrated from github.com) reviewed 2024-01-27 18:02:13 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
arjundevasi (Migrated from github.com) commented 2024-01-27 18:02:12 +00:00

this is so much concise, you should create this pull request.

this is so much concise, you should create this pull request.
rtsisyk requested changes 2024-01-28 09:04:45 +00:00

Please merge conditions into one if block.

Please merge conditions into one `if` block.

Please remove unrelated changes.

Please remove unrelated changes.
@ -88,7 +89,9 @@ public class PlacePhoneAdapter extends RecyclerView.Adapter<PlacePhoneAdapter.Vi
final String phoneNumber = mPhone.getText().toString();
final Context ctx = view.getContext();
Utils.copyTextToClipboard(ctx, phoneNumber);

Please merge conditions into one if block.

Please merge conditions into one `if` block.
arjundevasi (Migrated from github.com) reviewed 2024-01-28 09:42:55 +00:00
arjundevasi (Migrated from github.com) commented 2024-01-28 09:42:55 +00:00

understood, working on it.

understood, working on it.
arjundevasi (Migrated from github.com) reviewed 2024-01-28 14:02:51 +00:00
arjundevasi (Migrated from github.com) commented 2024-01-28 14:02:51 +00:00

The change on this part was done by IDE when I clicked on Reformat Code

The change on this part was done by IDE when I clicked on Reformat Code
biodranik (Migrated from github.com) reviewed 2024-01-28 20:23:59 +00:00
biodranik (Migrated from github.com) commented 2024-01-28 20:23:58 +00:00

We do not merge any random ide changes. Please learn how to amend and rebase commits to fix them. Or add newer commits on top so we can squash it into one commit later.

We do not merge any random ide changes. Please learn how to amend and rebase commits to fix them. Or add newer commits on top so we can squash it into one commit later.
biodranik (Migrated from github.com) reviewed 2024-01-29 07:23:33 +00:00
@ -70,2 +76,4 @@
throw new AssertionError("Unsupported state detected: " + state);
}
}
biodranik (Migrated from github.com) commented 2024-01-29 06:28:19 +00:00

Commenting on obvious lines of code does not make any sense.

Commenting on obvious lines of code does not make any sense.
biodranik (Migrated from github.com) commented 2024-01-29 07:05:00 +00:00
    // Starting from API 33, the automatic system control that shows copied text is displayed.
```suggestion // Starting from API 33, the automatic system control that shows copied text is displayed. ```
biodranik (Migrated from github.com) approved these changes 2024-02-04 21:34:28 +00:00
biodranik (Migrated from github.com) left a comment

Thank you for the contribution!

Thank you for the contribution!
This repo is archived. You cannot comment on pull requests.
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#7246
No description provided.