This file contains 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
Window window = this.getWindow(); | |
// clear FLAG_TRANSLUCENT_STATUS flag: | |
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); | |
// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); | |
// finally change the color |
This file contains 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
This is how you set up a custom layout in kotlin, with a linearlayout and 3 textviews but these are embedded so a little | |
trick here to get the properties setters and getters needs to be done. May not be the most efficient way but it works | |
attrs.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<declare-styleable name="DetailSectionHeaderText"> | |
<attr name="title" format="string" /> |
This file contains 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
1. Create a new package in your app with name android.support.v4.app This is a workaround to override package-private methods. | |
2. Create or Edit your Own ServiceClass to Override dequeueWork() method and surround super.dequeueWork() call with try/catch block like the coming snippet. | |
Any code that uses JobIntent Service override with this class | |
(Important Note: This fix should be tracked from time to time as any change in the support libraries might break it.) | |
public abstract class MyServiceImpl extends JobIntentService { | |
// This method is the main reason for the bug and crash | |
// the dequeueWork method is called only when the worker service is done |
This file contains 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
Most code I saw for this was to create custom layout. Project I did not want to do this but do it for only a specific activity. Here is how to do it in the activity in onStart() | |
override fun onStart() { | |
super.onStart() | |
val toolbarViewGroup = findViewById<ViewGroup>(R.id.action_bar) // standard action layout from theme | |
toolbarViewGroup?.let{ viewGroup -> | |
// find the textview title since its in combined layout | |
val textView = viewGroup.children.find { (it is TextView) } as TextView |
This file contains 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
// So I found out that its not easy to do this without the right code. | |
// Funny thing is that it puts a recording on the phone with some random name.mp4 | |
// The hard thing was actually saving it locally. | |
// When you stop the recording its in a string 64 base you have to decode and then write that byte array to a file. | |
protected void screenRecordVideo() throws InterruptedException, IOException { | |
if (platform == OperatingSystem.ANDROID) { | |
((CanRecordScreen)driver).startRecordingScreen( | |
new AndroidStartScreenRecordingOptions() | |
.withVideoSize("1280x720") |
This file contains 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
#!/bin/bash | |
# when makeing a curl command you can call them asyncly and not have to wait for each one to finish. | |
# its very simple and took a bit to find by googling it. The searches turned up garbage until I | |
# stumbled on this solution. | |
# the '&' sign at the end is what make its run in its own space, daemon if you will | |
for ((i=0; i<30; i++)); do | |
curl -X 'POST' \ | |
'https://some url' \ |
This file contains 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
# CircleCI I had a time where I wanted the UI tests to not stop the build because I would run another script to do some | |
# Test case management and report the findings but I still wanted a build to diagnose or triage the issue for devs. | |
# I finally found out how to do so by making the gradlew build/run tests command always return 0 by a simple | |
# CircleCI option | |
commands: | |
test_ui: | |
steps: | |
# running a gradle managed device that by this command starts the emulator and runs the UI tests | |
# adding the '|| true' makes it always return true |
This file contains 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
#!/bin/bash | |
echo "Validating code format" | |
./gradlew app:ktlintCheck --daemon | |
STATUS=$? | |
# Exit with an error if the linter didn't pass | |
[ $STATUS -ne 0 ] && exit 1 |
This file contains 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
plugins { | |
id("java") | |
id("application") | |
} | |
version = "1.0.0" | |
repositories { | |
mavenCentral() | |
maven { setUrl("https://jitpack.io") } |