Closed Bug 1045921 Opened 10 years ago Closed 10 years ago

Clean up Clipboard.java

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 34

People

(Reporter: rnewman, Assigned: rnewman)

References

Details

Attachments

(1 file)

There are a few oddities hanging around here:


    private static android.content.ClipboardManager getClipboardManager(Context context) {
        // In API Level 11 and above, CLIPBOARD_SERVICE returns android.content.ClipboardManager,
        // which is a subclass of android.text.ClipboardManager.
        return (android.content.ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
    }

... why use mContext when there's a context argument?!

And mContext should probably be tidied up some.
This patch does the following:

* Eliminate access to enclosing private members by making some package-scoped, and by inlining two methods...
* Inlines the two one-liner methods. They're nice for explanation, but not hugely valuable, and this avoids having two one-liner package-scoped methods!
* Other changes as commented.
Attachment #8464358 - Flags: review?(wjohnston)
Comment on attachment 8464358 [details] [diff] [review]
Clean up Clipboard.java. v1

Review of attachment 8464358 [details] [diff] [review]:
-----------------------------------------------------------------

I kinda like the helper methods, but I agree there are probably better ways to deal with them as well.
Attachment #8464358 - Flags: review?(wjohnston) → review+
https://hg.mozilla.org/mozilla-central/rev/71b099257951
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: