This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<style name="SplashTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> | |
<item name="android:windowBackground">@drawable/splash_background</item> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
<item name="android:statusBarColor">@color/colorAccent</item> | |
</style> | |
</resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="<http://schemas.android.com/apk/res/android>" | |
android:shape="rectangle" > | |
<gradient | |
android:type="linear" | |
android:angle="135" | |
android:startColor="#ff1b49" | |
android:endColor="#e67d20" /> | |
</shape> | |
<!--You can choose your own color --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="<http://schemas.android.com/apk/res/android>"> | |
<item | |
android:drawable="@drawable/bg_gradient"/> | |
<item> | |
<bitmap android:gravity="center" | |
android:src="@drawable/app_logo"/> | |
</item> | |
</layer-list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SplashScreenActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_splash_screen) | |
Handler().postDelayed(Runnable { //This method will be executed once the timer is over | |
// Start your app main activity | |
val i = Intent(this@SplashScreenActivity, MainActivity::class.java) | |
startActivity(i) | |
// close this activity | |
finish() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchView = (SearchView) findViewById(R.id.search); | |
EditText searchEditText = (EditText) searchView.findViewById(androidx.appcompat.R.id.search_src_text); | |
searchEditText.setTextColor(getResources().getColor(R.color.white)); | |
searchEditText.setHintTextColor(getResources().getColor(R.color.white)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
<item name="searchViewStyle">@style/SearchStyle</item> | |
</style> | |
<style name="SearchStyle" parent="Theme.AppCompat.Light.NoActionBar"> | |
<item name="editTextColor">#FFFFFF</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onBackPressed() { | |
if (!searchView.isIconified()) { | |
searchView.onActionViewCollapsed(); | |
} else { | |
super.onBackPressed(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreateOptionsMenu(menu: Menu): Boolean { | |
menuInflater.inflate(R.menu.search_menu, menu) | |
val searchItem: MenuItem = menu.findItem(R.id.action_search) | |
if (searchItem != null) { | |
searchView = MenuItemCompat.getActionView(searchItem) as SearchView | |
searchView.setOnCloseListener(object : SearchView.OnCloseListener { | |
override fun onClose(): Boolean { | |
return true | |
} | |
}) |