{"id":17928439,"url":"https://github.com/buffermet/why-android-development-sucks","last_synced_at":"2025-04-03T09:43:45.013Z","repository":{"id":144282586,"uuid":"193738277","full_name":"buffermet/why-android-development-sucks","owner":"buffermet","description":"You can take this to your psychiatrist","archived":false,"fork":false,"pushed_at":"2021-04-24T11:27:39.000Z","size":35,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T23:15:41.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buffermet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-25T15:48:43.000Z","updated_at":"2025-01-31T17:59:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"f75fe4cf-3054-4284-80bc-f3b9c7debd6d","html_url":"https://github.com/buffermet/why-android-development-sucks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffermet%2Fwhy-android-development-sucks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffermet%2Fwhy-android-development-sucks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffermet%2Fwhy-android-development-sucks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffermet%2Fwhy-android-development-sucks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buffermet","download_url":"https://codeload.github.com/buffermet/why-android-development-sucks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246981151,"owners_count":20863825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T21:02:48.742Z","updated_at":"2025-04-03T09:43:44.990Z","avatar_url":"https://github.com/buffermet.png","language":null,"readme":"You can take this to your psychiatrist.\n\n# 1. APIs\n\n## 1.1 Screen size\n\n### Browsers\n\nDeveloper: \"What's the height of my display?\"\n\nCommon sense: \"100vh\"\n\n### Android\n\nDeveloper: \"Simple question: what is the height of my device's display?\"\n\nGoogle: \"This is how to get the height of your display:\"\n\n```java\nfinal WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\nfinal Display display = windowManager.getDefaultDisplay();\nfinal Point size = new Point();\ndisplay.getSize(size);\n\nfinal int displayHeight = size.y;\n```\n\nDeveloper: \"Ok, let me give that a try. Nope! It's about 80dp short, what's going on Google?\"\n\nGoogle: \"Well, please describe what display you are talking about. You could be talking about the physical height of the display, but what if you mean the display height minus the status bar height, minus the navigation bar height? Did you perhaps mean the REAL display height?\"\n\nDeveloper: \"Jesus Christ...\"\n\nGoogle: \"Ok, fine, here you go, this is how to get the REAL display height:\"\n\n```java\nfinal WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\nfinal Display display = windowManager.getDefaultDisplay();\nfinal Point size = new Point();\ndisplay.getRealSize(size);\n\nfinal int realDisplayHeight = size.y;\n```\n\nDeveloper: \"Google, WTF! Why do you differentiate display.getSize() and display.getRealSize() ??\"\n\nGoogle: \"Well, we're not sure if you're competent enough to subtract the status bar height and the navigation bar height yourself, so we prechewed that for you :D cool right?!\"\n\nDeveloper: \"What the... Whatever. Speaking of the status bar and navigation bar, how do I get the height of those?\"\n\nGoogle: \"It's quite simple, all you need to do is this:\"\n\n```java\nint statusBarHeight = 0;\nfinal int resourceId = getResources().getIdentifier(\"status_bar_height\", \"dimen\", \"android\");\nif (resourceId \u003e 0) {\n    statusBarHeight = getResources().getDimensionPixelSize(resourceId);\n}\n```\n\n```java\nint navigationBarHeight = 0;\nfinal WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\nfinal Display display = windowManager.getDefaultDisplay();\nfinal Point displaySize = new Point();\nfinal Point realDisplaySize = new Point();\ndisplay.getSize(displaySize);\ndisplay.getRealSize(realDisplaySize);\n\nif (displaySize.x \u003c realDisplaySize.x) {\n    navigationBarHeight = new Point(realDisplaySize.x - displaySize.x, displaySize.y).y;\n}\nif (displaySize.y \u003c realDisplaySize.y) {\n    navigationBarHeight = new Point(displaySize.x, realDisplaySize.y - displaySize.y).y;\n}\n```\n\nDeveloper: \\*vomits on keyboard\\*\n\n# 1.2 Soft keyboard\n\nActually this one's not that bad, except hiding the keyboard should simply take `ic.hideKeyboard()` or a global `hideKeyboard()` instead of a combination of hacks...\n\n# 1.3 What the fuck\n\nEver heard of word wrap?\n\nThis top voted answer is unbelievable: https://stackoverflow.com/questions/19197958/android-textview-break-line-behaviour-how-to-split-the-last-word/19209617#19209617\n\n# 1.4 English vocabulary and grammar\n\nDear google, this `_` is horizontal and this `|` is vertical.\n\nWhen we are talking about horizontal or vertical alignment, we are talking about alignment along the horizontal or vertical **axis**. We're not talking about _sliding the items along a vertical/horiztonal axis so that they align along its perpendicular axis_.\n\n# 1.5 The Quantum State\n\nAndroid has mastered the art of quantum computing.\n\n```java\nfinal TextWatcher textWatcher = new TextWatcher(){\n    @Override\n    public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n        // do stuff\n    }\n    @Override\n    public void onTextChanged(CharSequence s, int start, int before, int count) {\n        // do magic\n    }\n    @Override\n    public void afterTextChanged(Editable arg0) {\n        // do stuff\n    }\n};\n```\n\nUse `onTextChanged` if you don't feel like using `beforeTextChanged` or `afterTextChanged` but you do feel like reading Android's shitty documentation in an attempt to make sense of exactly when your code would run.\n\nThis is no way to solve a problem/teach asynchronous method calling.\n\n# 2. SDK\n\nHow much time I have wasted changing this:\n\n![Screenshot from 2019-07-24 22-40-11](https://user-images.githubusercontent.com/29265684/61794774-3a075600-ae65-11e9-9398-b531011b8680.png)\n\nBack to this:\n\n![Screenshot from 2019-07-24 22-41-25](https://user-images.githubusercontent.com/29265684/61794787-455a8180-ae65-11e9-98bc-e223e66ba663.png)\n\nAnd who thought XML was a good idea? Just take 1 glimpse at CSS and you see that none of this bullshit was ever necessary.\n\n# 3. DOCS\n\n\u003cimg alt=\"depressing android docs\" src=\"https://user-images.githubusercontent.com/29265684/60115639-b6047480-97b9-11e9-81b6-849641f66156.png\"\u003e\n\nIt surprises me how Google can do so well writing GoDoc, and fail so miserably at writing Android Documentation.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuffermet%2Fwhy-android-development-sucks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuffermet%2Fwhy-android-development-sucks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuffermet%2Fwhy-android-development-sucks/lists"}