{"id":15830035,"url":"https://github.com/hellofaizan/splashscreen","last_synced_at":"2025-04-01T11:13:41.350Z","repository":{"id":151050811,"uuid":"417051181","full_name":"hellofaizan/SplashScreen","owner":"hellofaizan","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-12T04:26:34.000Z","size":117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-12T11:11:55.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/hellofaizan.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":"2021-10-14T08:32:28.000Z","updated_at":"2021-10-17T10:10:34.000Z","dependencies_parsed_at":"2023-05-05T04:47:43.605Z","dependency_job_id":null,"html_url":"https://github.com/hellofaizan/SplashScreen","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"6ccef3f1b961e98eaaa0173e703402fb94556abb"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellofaizan%2FSplashScreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellofaizan%2FSplashScreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellofaizan%2FSplashScreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellofaizan%2FSplashScreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellofaizan","download_url":"https://codeload.github.com/hellofaizan/SplashScreen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628229,"owners_count":20808106,"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-05T11:04:17.839Z","updated_at":"2025-04-01T11:13:41.329Z","avatar_url":"https://github.com/hellofaizan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SplashScreen Concept by Curious Faizan\n# How to use a Splash screen correctly\n\nWell, there are a lot of blog tutorials teaching how to create a splash screen like this:\n\n```java\npublic class SplashActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        \n        ...\n        new Handler().postDelayed(new Runnable() {\n            @Override\n            public void run() {\n                startActivity(new Intent(SplashActivity.this, MainActivity.class));\n                finish();\n            }\n        }, 3000); // But it gives fuc**ng white or black screen on App Open before this activity\n    }\n}\n```\n\nThe thing is, this is nothing but a 3 seconds waisting of the user's time! But it gives fuc**ng white or black screen on App Open before this activity\n\n##### As you can notice, Google has gotten their opinion in favor of Splash Screens on their [Official Material Design Documentation](https://material.io/guidelines/patterns/launch-screens.html)\n\n###### But, is this something you just put anyway on your app to make the user waste his time?\n\n##### No. And Google advocated against splash screens like this, and even called it an anti-pattern [on this video](https://www.youtube.com/watch?v=pEGWcMTxs3I\u0026feature=youtu.be\u0026t=1434).\n\n##### So, is there a way to make use of this pattern on the right way? The answer is, Yes!\n\n## So, how could one do to create a Splash Screen just for the amount of time the App needs to open the Main Activity?\n\n##### Well, actually, it's easy. The ingredients are:\n\n* An Activity for the Splash Screen (without the layout file)\n* Your Manifest: to declare you Splash Screen as the Launcher\n* One drawable file to customize the splash screen a little\n\n *The splash view has to be ready immediately, even before you can inflate a layout file in your splash activity.*\n\n## The recipe:\n\n###### Create your Splash Screen Activity without layout file\n\n```java\npublic class SplashActivity extends AppCompatActivity {\n    \n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        \n        /** START - this is the purpose of this Activity */\n        Intent intent = new Intent(this, MainActivity.class);\n        startActivity(intent);\n        finish();\n        /** END - everything more than this is time consuming */\n    }\n}\n```\n\n###### Create a drawable file \n**splash_bg.xml\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003clayer-list xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n\n    \u003citem android:drawable=\"@color/colorGrey\"/\u003e \u003c!-- Color you want foe background --\u003e\n\n    \u003citem\u003e\n        \u003cbitmap android:gravity=\"center\" android:src=\"@mipmap/ic_launcher\"/\u003e \u003c!-- Your logo image. Ration should be 200 * 200 --\u003e\n    \u003c/item\u003e\n\n\u003c/layer-list\u003e\n```\n\n###### and your Manifest should look something like this\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.andyfriends.showcase\"\u003e\n\n    \u003capplication\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:roundIcon=\"@mipmap/ic_launcher_round\"\n        android:theme=\"@style/AppTheme\"\u003e\n        \u003cactivity\n            android:name=\".activities.SplashActivity\"\n            android:label=\"@string/app_name\"\n            android:theme=\"@style/SplashScreen\"\u003e\n            \u003cintent-filter\u003e\n                \u003caction android:name=\"android.intent.action.MAIN\" /\u003e\n                \u003ccategory android:name=\"android.intent.category.LAUNCHER\" /\u003e\n            \u003c/intent-filter\u003e\n        \u003c/activity\u003e\n        \u003cactivity android:name=\".activities.MainActivity\"\n            android:label=\"@string/app_name\"\n                  android:theme=\"@style/AppTheme\" \u003e\n            \u003cintent-filter\u003e\n                \u003caction android:name=\"android.intent.action.MAIN\" /\u003e\n                \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n            \u003c/intent-filter\u003e\n        \u003c/activity\u003e\n    \u003c/application\u003e\n\n\u003c/manifest\u003e\n```\n\n###### we've set a different Theme for the SplashActivity, so we can call our drawable resource on it\n\n```xml\n\u003cstyle name=\"SplashScreen\" parent=\"Theme.AppCompat.NoActionBar\"\u003e\n    \u003citem name=\"android:windowBackground\"\u003e@drawable/splash_bg\u003c/item\u003e\n\u003c/style\u003e\n```\n\nThat is it. You can clone the project using Android Studio and take a look.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellofaizan%2Fsplashscreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellofaizan%2Fsplashscreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellofaizan%2Fsplashscreen/lists"}