Skip to content

Instantly share code, notes, and snippets.

@v-mas
v-mas / ScrollViewBehaviorFix
Last active November 30, 2020 01:30 — forked from MaciejKaras/ScrollViewBehaviorFix
#Android #Behavior #AppBarLayout Scrolling behavior that removes/restores SCROLL flag on AppBarLayout children if this content is smaller than remaining space below appbar
package com.github.v_mas.ui.behavior
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.core.view.forEach
import androidx.core.view.updateLayoutParams
import com.google.android.material.appbar.AppBarLayout
@noln
noln / MainActivity.java
Last active August 27, 2022 19:25
A basic activity that listens to zen_mode state (Android's "do not disturb" volume/vibration muting feature) and dumps the current value to log. There are two ways included; the first is an observer and doesn't work in every case (I think there's a separate preference for priority messages), the second may is a manual check by hitting a button.
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;