<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jens Klingenberg</title>
    <description>The latest articles on DEV Community by Jens Klingenberg (@foso).</description>
    <link>https://dev.to/foso</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F28282%2F2d9e6a4f-b1a2-4e22-9bcd-1262864a70b0.jpg</url>
      <title>DEV Community: Jens Klingenberg</title>
      <link>https://dev.to/foso</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/foso"/>
    <language>en</language>
    <item>
      <title>Planning poker with Showdown</title>
      <dc:creator>Jens Klingenberg</dc:creator>
      <pubDate>Sun, 26 Jul 2020 16:55:53 +0000</pubDate>
      <link>https://dev.to/foso/planning-poker-with-showdown-5ble</link>
      <guid>https://dev.to/foso/planning-poker-with-showdown-5ble</guid>
      <description>&lt;p&gt;In our team we are using planning poker to estimate our tickets. Before the Corona pandemic started, usually most people were at the office, so we used poker cards on paper or as an smartphone app. &lt;/p&gt;

&lt;p&gt;But with many people starting to work remote we had the challenge to do planning poker remotely. There are already existing websites or slack bots for this, but we wanted a solution that can be selfhosted and customized.&lt;/p&gt;

&lt;p&gt;So i‘ve created a selfhosted open source web app called &lt;a href="https://github.com/Foso/Showdown" rel="noopener noreferrer"&gt;Showdown&lt;/a&gt;.&lt;br&gt;
The server is written with Ktor and webpage is written with KotlinJs. You just need your browser to connect to the server. On the page you can see the other players and can see instant when someone has voted and of course the players votings at the end.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use it?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Deployment
&lt;/h2&gt;

&lt;p&gt;You can find a deployment instruction &lt;a href="https://github.com/Foso/Showdown#deployment" rel="noopener noreferrer"&gt;HERE&lt;/a&gt; or you can try the test instance on Heroku &lt;a href="http://shwdwn.herokuapp.com/#/" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;1) Choose a room name&lt;br&gt;
To play planning poker, you and your team needs the same room link. You can choose any room name. Let's say you want to join the room "devto", then the room link is : &lt;a href="//shwdwn.herokuapp.com/room/devto"&gt;shwdwn.herokuapp.com/room/devto&lt;/a&gt; (On your own server your domain would be different)&lt;/p&gt;

&lt;p&gt;2) Choose a player name&lt;br&gt;
3) Vote for an option&lt;br&gt;
&lt;a href="https://raw.githubusercontent.com/Foso/Showdown/master/docs/img/option.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FFoso%2FShowdown%2Fmaster%2Fdocs%2Fimg%2Foption.png"&gt;&lt;/a&gt;&lt;br&gt;
4) Show Votes&lt;br&gt;
&lt;a href="https://raw.githubusercontent.com/Foso/Showdown/master/docs/img/showvotes.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FFoso%2FShowdown%2Fmaster%2Fdocs%2Fimg%2Fshowvotes.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When everyone has voted you can click "&lt;strong&gt;Show Votes&lt;/strong&gt;" to reveal the votes or you can activate "&lt;strong&gt;Auto reveal&lt;/strong&gt;" in the settings menu.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roadmap
&lt;/h2&gt;

&lt;p&gt;I'm still working on adding additional features. When you find any bugs or have feature requests, feel free to let me know :) &lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>selfhosted</category>
      <category>agile</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Gradle: How to group Maven Repos in a list</title>
      <dc:creator>Jens Klingenberg</dc:creator>
      <pubDate>Mon, 23 Apr 2018 22:02:18 +0000</pubDate>
      <link>https://dev.to/foso/gradle-how-to-group-maven-repos-in-a-list-51ll</link>
      <guid>https://dev.to/foso/gradle-how-to-group-maven-repos-in-a-list-51ll</guid>
      <description>&lt;p&gt;In some of my Gradle based projects, i use libraries which have to be downloaded from many different Maven Repositories. To get a better overview of all used repos i wanted to group them in a list. Unfortunately it was a bit more complicated then i thought it would be. Because i couldn't find other blog posts with my approach, i wanted to share it with you. So here is my solution:&lt;/p&gt;

&lt;p&gt;This is how you add &lt;strong&gt;one&lt;/strong&gt; repository to your buildscript:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;When you want to add multiple repositories you have add a new &lt;strong&gt;maven{}&lt;/strong&gt; block per URL, something like &lt;strong&gt;this&lt;/strong&gt; :&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;and &lt;strong&gt;that&lt;/strong&gt;:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
doesn't work.
&lt;h1&gt;
  
  
  The solution
&lt;/h1&gt;

&lt;p&gt;First create a list in a Gradle(Groovy)&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I created this method, which you have to add in the &lt;strong&gt;buildscript{}&lt;/strong&gt; block:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now you can use the method &lt;strong&gt;buildMaven()&lt;/strong&gt; inside the &lt;strong&gt;repositories{}&lt;/strong&gt; block inside a &lt;strong&gt;.each{}&lt;/strong&gt; method of your repo list you want to add :&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I hope that this tip was useful for you.&lt;/p&gt;

</description>
      <category>android</category>
      <category>gradle</category>
      <category>development</category>
    </item>
    <item>
      <title>Higher Order Function in Kotlin </title>
      <dc:creator>Jens Klingenberg</dc:creator>
      <pubDate>Sat, 31 Mar 2018 19:52:02 +0000</pubDate>
      <link>https://dev.to/foso/higher-order-function-in-kotlin--1fhe</link>
      <guid>https://dev.to/foso/higher-order-function-in-kotlin--1fhe</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: This post was originally published on my &lt;a href="http://jensklingenberg.de/higher-order-functions-in-kotlin/"&gt;blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Higher Order Function?
&lt;/h2&gt;

&lt;p&gt;A higher-order function is a function that can take other functions as parameters and returns other functions.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;You can create a higher order function like any other function in Kotlin, but you need to create an parameter that has a function as the type. As you can see above my &lt;strong&gt;printIt()&lt;/strong&gt; method has a parameter named &lt;strong&gt;“passedFunction”&lt;/strong&gt; of the type &lt;strong&gt;“()”&lt;/strong&gt;, which means that it’s a function. &lt;strong&gt;“→ Unit”&lt;/strong&gt; is the return value of the function that is passed in &lt;strong&gt;printIt()&lt;/strong&gt;. For a example if you would have a function with the parameter &lt;strong&gt;“function: ()→Boolean”&lt;/strong&gt; you could only pass in functions which return an Boolean Value.&lt;/p&gt;

&lt;p&gt;To execute &lt;strong&gt;“passedFunction”&lt;/strong&gt; you need to use round brackets after the function name, so &lt;strong&gt;“passedFunction()“&lt;/strong&gt;. Without the brackets the “passedFunction” will still be of type function and can be passed to further functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to call a Higher Order Function?
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;You use the function like any other Kotlin function, but you use braces instead of round brackets. Everything that is inside &lt;strong&gt;printIt{}&lt;/strong&gt; will then be passed to the method &lt;strong&gt;printIt()&lt;/strong&gt; and will be executed wherever the passed function is called.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Example:
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;On Android i’m using this function in combination with RxJava to run functions outside of the MainThread. I just need to wrap &lt;strong&gt;runInBackground{}&lt;/strong&gt; around the functions, that should run in the background and i can avoid using things like AsyncTask.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://kotlinlang.org/docs/reference/lambdas.html"&gt;Kotlin Reference Higher Order Functions&lt;/a&gt;&lt;br&gt;
 You can try the first example in a browser on&lt;a href="https://try.kotlinlang.org/#/UserProjects/adkuohd8i9m5v06okrnm35t0pn/tcdh6qkcaf0o4nn3sam6pl905k"&gt; Try Kotlin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>android</category>
    </item>
    <item>
      <title>How to use a SearchView with an empty query text submit</title>
      <dc:creator>Jens Klingenberg</dc:creator>
      <pubDate>Tue, 16 Jan 2018 20:58:54 +0000</pubDate>
      <link>https://dev.to/foso/how-to-use-a-searchview-with-an-empty-query-text-submit-4afh</link>
      <guid>https://dev.to/foso/how-to-use-a-searchview-with-an-empty-query-text-submit-4afh</guid>
      <description>&lt;p&gt;At the moment i’m working on an App with a search function. This alone is nothing special. Every second App has a search function. As a standard component the Android SDK offers the class &lt;a href="https://developer.android.com/reference/android/widget/SearchView.html" rel="noopener noreferrer"&gt;SearchView&lt;/a&gt;. You can add an &lt;a href="https://developer.android.com/reference/android/widget/SearchView.OnQueryTextListener.html" rel="noopener noreferrer"&gt;SearchView.OnQueryTextListener&lt;/a&gt; to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29hcys3hmptesymzuxlm.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29hcys3hmptesymzuxlm.jpeg" alt="SearchView"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvfhv98sqdhk7uk32almw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvfhv98sqdhk7uk32almw.png" alt="SearchView.OnQueryTextListener()"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Where is the problem?
&lt;/h3&gt;

&lt;p&gt;The App has a function that gets called when the user presses the search button on the keyboard and there is no text in the SearchView. But this is not possible with the standard SearchView.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxqhpqi5sh2bi24zya8l.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxqhpqi5sh2bi24zya8l.jpeg" alt="Keyboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;onQueryTextSubmit()&lt;/strong&gt; gets not called when the query is empty. A look in the source code tells us why:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The listener gets called in &lt;strong&gt;onSubmitQuery()&lt;/strong&gt; of SearchView, but the if-statement checks before if the query length is longer than zero.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  How does the SearchView detect when the search button was pressed?
&lt;/h3&gt;

&lt;p&gt;When you take a look which methods call &lt;strong&gt;onSubmitQuery()&lt;/strong&gt; you can see that it gets called inside an &lt;strong&gt;OnEditorActionListener&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And this listener is added to the SearchAutoComplete class:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;SearchAutoComplete informs SearchView with this listener about the key press. Unfortunately SearchView doesn’t offer a possibility to replace SearchAutoComplete with an custom implementation. But let’s take a look in the constructor of SearchView to see how SearchAutoComplete gets created:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  What now?
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;SearchView is nothing more than an extended LinearLayout. With findViewById the SearchAutoComplete inside the layout gets inflated. So it should be possible to also inflate the layout to get at the SearchAutoComplete.&lt;/p&gt;

&lt;p&gt;I created a class that extends SearchView. Then i’ve overridden the &lt;strong&gt;setOnQueryTextListener()&lt;/strong&gt; method. Since the listener already has the methods i need and I don’t have to make special changes to my existing code.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The listener gets passed to the original SearchView, but in this method I also set a listener to the SearchAutoComplete as explained above. Now every time the user clicks the search button I get the query from the SearchView and pass it to the listener. Except that &lt;strong&gt;onQueryTextSubmit()&lt;/strong&gt; will also get called when the query is empty.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://github.com/Foso/Notes/blob/master/Android/EmptySubmitSearchView.java" rel="noopener noreferrer"&gt;Source Code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>development</category>
      <category>appdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
