Skip to content

Instantly share code, notes, and snippets.

View kingsleyadio's full-sized avatar

Kingsley Adio kingsleyadio

View GitHub Profile
class DebugActivity : AppCompatActivity(R.layout.a_debug)
class DebugFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = ComposeView(requireContext()).apply {
setContent {
@kingsleyadio
kingsleyadio / SearchReplaceScript.groovy
Created April 20, 2018 07:29
Enhanced structural search and replace script in IJ/AS using PSI based groovy code snippet
// $symbol$ => defines a matcher for the identifier being replaced
import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl as ReferenceExpression
import com.intellij.psi.impl.source.tree.java.PsiLocalVariableImpl as LocalVariable
import com.intellij.psi.impl.source.PsiFieldImpl as Field
symbol instanceof Field || symbol instanceof ReferenceExpression || symbol instanceof LocalVariable
@kingsleyadio
kingsleyadio / DeepLinkPOC.kt
Last active August 30, 2022 17:47
Deeplinks POC
package com.hellofresh.deeplinker
// This will map relative/absolute URLs with respective activities
interface SimpleDeepLinkInterface {
@DeepLink("user/login", "user/register")
fun provideLoginActivity(): LoginActivity
// we can request that some specific query parameters be included in the extras bundle
// we can even describe the type we'd like the extra presented as. Int in this case
@kingsleyadio
kingsleyadio / BaseFragment.java
Last active February 22, 2017 06:37
Fix for crashes caused when screen is rotated more than once while fragment back stack is not empty
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
/**
* @author ADIO Kingsley O.
* @since 06 Jun, 2015
*/
public class BaseFragment extends Fragment {
@kingsleyadio
kingsleyadio / BaseFragment.java
Created October 5, 2015 02:49
Fix for fragments:
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
/**
* @author ADIO Kingsley O.
* @since 06 Jun, 2015
*/
public class BaseFragment extends Fragment {
/**
* An example of adding these transitions to a Fragment. This simple
* version just applies opposite transitions to any Fragment whether it is
* entering or exiting view. You can also inspect the transit mode parameter
* (i.e. TRANSIT_FRAGMENT_OPEN, TRANSIT_FRAGMENT_CLOSE) in combination to do
* different animations for, say, adding a fragment versus popping the back stack.
*
* Transactions without an explicit transit mode set, in this example, will not
* animate. Allowing the initial fragment add, for example, to simply appear.
*/