Skip to content

Instantly share code, notes, and snippets.

View grndvl1's full-sized avatar
Working From RV

John Matthews grndvl1

Working From RV
  • Chicago
View GitHub Profile
grndvl1 / WhiteNotificationBar_BlackIcons
Created February 20, 2018 19:15
Android Notification Bar White with Black Icons - Programatically
View WhiteNotificationBar_BlackIcons
Window window = this.getWindow();
// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
// finally change the color
grndvl1 / SectionWithHeader.txt
Last active March 26, 2019 04:08
Custom LinearLayout
View SectionWithHeader.txt
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
<?xml version="1.0" encoding="utf-8"?>
<declare-styleable name="DetailSectionHeaderText">
<attr name="title" format="string" />
grndvl1 / gist:8ab2fdea6e269726a253761571986665
Created April 2, 2019 16:36
Fix JobIntentService Crash for 8.x Phones
View gist:8ab2fdea6e269726a253761571986665
1. Create a new package in your app with name 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
grndvl1 / gist:57150b22f724006bb9303e25a161cc53
Created November 4, 2019 21:02
Marque Title of a Toolbar page
View gist:57150b22f724006bb9303e25a161cc53
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() {
val toolbarViewGroup = findViewById<ViewGroup>( // 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
grndvl1 / RecordVideoInAppium.txt
Last active March 18, 2020 17:55
Record Video Using Appium
View RecordVideoInAppium.txt
// 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) {
new AndroidStartScreenRecordingOptions()