This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2017, Andrey Makeev | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package productmeister.com.productmeister.view; | |
| import android.annotation.TargetApi; | |
| import android.os.Build; | |
| import android.support.design.widget.AppBarLayout; | |
| import android.support.v4.view.ViewCompat; | |
| import android.support.v7.app.ActionBar; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.support.v7.widget.Toolbar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.compose.animation.core.* | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.foundation.shape.CircleShape | |
| import androidx.compose.material.MaterialTheme | |
| import androidx.compose.material.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.getValue | |
| import androidx.compose.ui.Alignment | |
| import androidx.compose.ui.Modifier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // We should have this 2 permissions to get the recent app | |
| <uses-permission android:name="android.permission.GET_TASKS" /> | |
| <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> | |
| // we should register our service in manifest file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code is inside the recycler view adapter class | |
| @Override | |
| public void onBindViewHolder(final ViewHolder holder, int position) { | |
| if (position + 1 == getItemCount()) { | |
| // It is the last item of the list | |
| // Set bottom margin to 72dp | |
| setBottomMargin(holder.itemView, (int) (72 * Resources.getSystem().getDisplayMetrics().density)); | |
| } else { | |
| // Reset bottom margin back to zero |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For Android | |
| // Get the URL of the current page in the Google Chrome browser | |
| // Needs to be in a class that extends AccessibilityService | |
| // A version of this code is used in PorNo!, a porn-blocker I wrote | |
| // https://github.com/mrvivacious/PorNo-_Porn_Blocker/ | |
| // | |
| // Have fun ~ | |
| String TAG = "Get Chrome URL: "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.annotation.SuppressLint | |
| import android.content.Context | |
| import android.content.SharedPreferences | |
| import com.hardiktrivedi.gdg_pune_kotlin_workshop.R | |
| import kotlin.reflect.KProperty | |
| class PreferenceExtension<T>(val context: Context, val key: String, val defaultValue: T) { | |
| val prefs: SharedPreferences by lazy { context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) } | |
| operator fun getValue(thisRef: Any?, property: KProperty<*>): T { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <application | |
| android:allowBackup="true" | |
| android:fullBackupContent="@xml/backup_rules" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import androidx.appcompat.app.AppCompatActivity | |
| import androidx.fragment.app.DialogFragment | |
| import androidx.fragment.app.Fragment | |
| import androidx.lifecycle.DefaultLifecycleObserver | |
| import androidx.lifecycle.Lifecycle | |
| import androidx.lifecycle.LifecycleOwner | |
| import androidx.viewbinding.ViewBinding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TextViewDrawableSize extends TextView { | |
| private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1; | |
| private int compoundDrawableWidth; | |
| private int compoundDrawableHeight; | |
| public TextViewDrawableSize(Context context) { | |
| this(context, null); | |
| } | |
| public TextViewDrawableSize(Context context, AttributeSet attrs) { |
NewerOlder