Skip to content

Instantly share code, notes, and snippets.

@vahid-m
vahid-m / git-tag-delete-local-and-remote.sh
Created February 11, 2025 06:10 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
class RootFragment: KeyedFragment(R.layout.root_fragment) {
private val binding by viewBinding(RootFragmentBinding::bind)
private lateinit var firstFragment: FirstFragment
private lateinit var secondFragment: SecondFragment
private lateinit var thirdFragment: ThirdFragment
private val fragments: Array<Fragment> get() = arrayOf(firstFragment, secondFragment, thirdFragment)
private var selectedIndex = 0
@vahid-m
vahid-m / GitConfigHttpProxy.md
Created June 1, 2024 18:25 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@vahid-m
vahid-m / NestedScrollableHost
Created May 26, 2024 15:20 — forked from micer/NestedScrollableHost
Fixes issue with nested scrolling elements with the same scroll direction inside ViewPager2. https://issuetracker.google.com/issues/123006042
package com.betvictor.casino.presentation.views
/*
* Copyright 2019 The Android Open Source Project
*
* 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
@vahid-m
vahid-m / java
Created March 19, 2024 13:24 — forked from yiranshaxiao/java
A simple drawable wrapper with scale animation on Android
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.graphics.drawable.DrawableWrapper;
import android.util.Property;
import android.view.animation.BounceInterpolator;
import android.view.animation.LinearInterpolator;
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.app.FragmentTransaction
import android.app.Activity
import android.app.AlertDialog
import android.app.Fragment
import android.app.NotificationManager
import android.app.ProgressDialog
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.NestedScrollingChild3
import androidx.core.view.NestedScrollingChildHelper
class NestedCoordinatorLayout @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : CoordinatorLayout(context, attrs, defStyleAttr), NestedScrollingChild3 {
/*
* Copyright 2019 Google LLC
*
* 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
@vahid-m
vahid-m / MaterialDialogFragment.kt
Last active January 18, 2024 16:02
DialogFragment with MaterialAlertDialog
import android.app.Dialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
open class MaterialDialogFragment : DialogFragment() {
private var dialogView: View? = null
@vahid-m
vahid-m / Android: Tiled Background
Created September 30, 2023 07:29 — forked from codeswimmer/Android: Tiled Background
Android: How to display a tiled bitmap background
// ============================================================================================
// Code
//
// Example showing how to set a View's background to a tiled bitmap.
// assumes: res/drawable/pattern01.png - The bitmap representing an individual tile
public void setViewTiledBackground(View view, Resources resources) {
Bitmap tile = BitmapFactory.decodeResource(resources, R.drawable.pattern02);
BitmapDrawable tiledBitmapDrawable = new BitmapDrawable(resources, tile);
tiledBitmapDrawable.setTileModeX(Shader.TileMode.REPEAT);