SCHLIESSEN
SCHLIESSEN

THE SWISS-DEV


BLOGBOOK


WE SHARE OUR KNOW-HOW.

Es gibt viele Möglichkeiten an ein Ziel zu kommen. Manchmal fällt es jedoch schwer eine gute und schnelle Lösung zu finden. 
Hier schreiben wir über Tipps und Erfahrungen, welche wir gerne mit der Welt teilen möchten. 

Android PickerView

Wed 12.08.2020 13:00 von Jeremy

Announcing our first open source library.

 

Why develop this library?

I found existing Pickers to be quite limiting.

 

DatePicker and TimePicker

They can be found in the official Pickers documentation.

The name already gives it away. They only work with either date or time data.

 

Hacking the NumberPicker

The official NumberPicker can be hacked to display custom strings instead. To do this you have to use the setDisplayedValues method.

However, styling is practically impossible.

 

Existing Libraries

I haven't been able to find a library which fulfills all my criteria. Either they were:

  • not very well maintained
  • very iOS-looking
  • not comptatible with lower android versions
  • not customizable

 

What does our PickerView do better?

  • minSdk 14 (Android 4.0)
  • works vertically AND horizontally
  • beautiful color fading
  • support for text and images

 

Example usages

Minimal configuration

<ch.swissdev.pickerview.PickerView
    app:orientation="vertical" />

 

With fading color

<ch.swissdev.pickerview.PickerView
    app:fadeColor="@android:color/black"
    app:orientation="vertical" />

 

With highlighting color

<ch.swissdev.pickerview.PickerView
    app:selectedItemColor="#6200EE"
    app:fadeColor="@android:color/black"
    app:orientation="vertical" />

 

Oriented horizontally

<ch.swissdev.pickerview.PickerView
    app:selectedItemColor="#6200EE"
    app:fadeColor="@android:color/black"
    app:orientation="horizontal" />

 

With images

<ch.swissdev.pickerview.PickerView
    app:applyColorFilterToImageViews="true"
    app:selectedItemColor="#6200EE"
    app:fadeColor="#03DAC5"
    app:orientation="horizontal" />

 

Where can I get it?

https://github.com/swissdevch/android-pickerview

Tipps & Tricks for Android Development #1

Thu 09.07.2020 14:59 von Jeremy

Enable DOM storage for web views

web_view.settings.domStorageEnabled = true

Avoid firebase version conflicts with the firebase bill of materials

implementation platform('com.google.firebase:firebase-bom:24.6.0')

implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'

Source: https://firebase.google.com/docs/android/setup#firebase-bom

Restart an app without causing a crash notification

val intent = packageManager.getLaunchIntentForPackage(packageName)
finishAffinity()
startActivity(intent)
exitProcess(0)

Enable TLS 1.2 on Android 4

ProviderInstaller.installIfNeeded(context)

Source: https://developer.android.com/training/articles/security-gms-provider

Find the cause of dependency mismatches by creating a dependency tree

./gradlew app:dependencies > tree.txt

Show the "real" share sheet by createing a chooser intent

val intent = Intent(Intent.ACTION_SEND)
intent.putExtra(Intent.EXTRA_TEXT, content)
intent.type = "text/plain"

startActivity(Intent.createChooser(intent, title))

Source: https://developer.android.com/reference/android/content/Intent#createChooser(android.content.Intent,%20java.lang.CharSequence)

Access the google play console and firebase using any language you like

This is particularly useful if you are using someone elses account. Just add the query parameter `hl`. For example: `hl=en`.