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
fun View.clipToRounded(curveRadius: Float) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
outlineProvider = object : ViewOutlineProvider() { | |
override fun getOutline(view: View?, outline: Outline?) { | |
view?.let { | |
outline?.setRoundRect(0, 0, it.width, (view.height), curveRadius) | |
} | |
} | |
} | |
clipToOutline = true |
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
var syncContext = SynchronizationContext.Current; // UI Thread | |
Task.Run(() => | |
{ | |
LatLon result = HeavyFunction(); // Run synchronously on background | |
syncContext.Post(state => | |
{ | |
// Run on UI Thread | |
map.Pins.Add(new Pin(…)); // Add pin or few pins | |
}, null); |
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
func setUpMenuButton(){ | |
let menuBtn = UIButton(type: .custom) | |
menuBtn.frame = CGRect(x: 0.0, y: 0.0, width: 20, height: 20) | |
menuBtn.setImage(UIImage(named:"menuIcon"), for: .normal) | |
menuBtn.addTarget(self, action: #selector(vc.onMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside) | |
let menuBarItem = UIBarButtonItem(customView: menuBtn) | |
let currWidth = menuBarItem.customView?.widthAnchor.constraint(equalToConstant: 24) | |
currWidth?.isActive = true | |
let currHeight = menuBarItem.customView?.heightAnchor.constraint(equalToConstant: 24) |
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
(Color) App.Current.Resources["textColor"]; |
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 event PropertyChangedEventHandler PropertyChanged; | |
protected void OnPropertyChanged([CallerMemberName] string propertyName = "") | |
{ | |
var changed = PropertyChanged; | |
if (changed == null) | |
return; | |
changed.Invoke(this, new PropertyChangedEventArgs(propertyName)); | |
} |
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
if (pageAdapter != null && viewpager != null && pageAdapter.instantiateItem(viewpager, viewpager.getCurrentItem()) instanceof Reloadable) { | |
((Reloadable) pageAdapter.get().instantiateItem(viewpager, viewpager.getCurrentItem())).reload(); | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |