Skip to content

Instantly share code, notes, and snippets.

View rajuashok's full-sized avatar
🌊
In Flow

Ashok rajuashok

🌊
In Flow
View GitHub Profile
@rajuashok
rajuashok / MyViewUsingDefaultRadioButton.swift
Last active January 17, 2020 02:47
View using DefaultRadioButton
class MyView: UIView, RadioButtonDelegate {
let radioButton = DefaultRadioButton()
override init(frame: CGRect) {
super.init(frame: frame)
radioButton.delegate = self
}
.
.
@rajuashok
rajuashok / MyViewUsingRadioButton.swift
Last active August 7, 2020 16:04
Example of RadioButton in use
class MyView: UIView, RadioButtonDelegate {
let radioButton = RadioButton()
override init(frame: CGRect) {
super.init(frame: frame)
radioButton.delegate = self
radioButton.checkedView = UIImageView.radioOn()
radioBUtton.uncheckedView = UIImageView.radioOff()
}
@rajuashok
rajuashok / DefaultRadioButton.swift
Last active January 17, 2020 02:47
Product specific extension of RadioButton
import UIKit
class DefaultRadioButton: RadioButton {
override init(frame: CGRect) {
super.init(frame: frame)
checkedView = UIImageView.radioOn()
uncheckedView = UIImageView.radioOff()
}
required init?(coder: NSCoder) {
@rajuashok
rajuashok / RadioButton.swift
Created January 14, 2020 16:15
Custom RadioButton for Swift 5
import UIKit
protocol RadioButtonDelegate {
func onClick(_ sender: UIView)
}
class RadioButton: UIButton {
var checkedView: UIView?
var uncheckedView: UIView?
public static String getPath(final Context context, final Uri uri) {
if (uri == null || context == null) {
return null;
}
if (uri.getPath().matches("file.*")) {
// This is a file Uri so we can use the path returned in getPath().
return uri.getPath();
}
@rajuashok
rajuashok / gist:8063748
Created December 21, 2013 00:29
Setting MediaPlayer WakeMode
mMediaPlayer = new MediaPlayer();
// ... other initialization here ...
mMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
@rajuashok
rajuashok / leapcastalias.bash
Created November 1, 2013 09:59
leapcast start command
leapcast -d --fullscreen --name [FRIENDLY_NAME] --chrome [PATH_TO_GOOGLE_CHROME]
@rajuashok
rajuashok / leapcastdefaults.py
Last active December 27, 2015 01:19
Creating new app in Leapcast
class YOUR_APP_ID_HERE(LEAPfactory):
url = "http://127.0.0.1:5000/chromecast/receiver"
@rajuashok
rajuashok / gist:7243840
Created October 31, 2013 03:07
Building HandlerThread for IntentService
public class GCMIntentService extends GCMBaseIntentService {
.
.
.
private Looper mServiceLooper;
public GCMIntentService() {
.
.