Skip to content

Instantly share code, notes, and snippets.

View shishirthedev's full-sized avatar

Ahidul Islam shishirthedev

View GitHub Profile
configurations.all {
resolutionStrategy.eachDependency{
DependencyResolveDetails details ->
def requested=details.requested
if(requested.group=="com.android.support"){
if(!requested.name.startsWith("multidex")){
details.useVersion("26.0.1")
}
}
public class PermissionManager {
private Context context;
private SessionManager sessionManager;
public PermissionManager(Context context){
this.context = context;
sessionManager = new SessionManager(context);
}
public class SessionManager {
private static final String PREFERENCE_NAME = "my_preference.";
private SharedPreferences mPref;
private SharedPreferences.Editor mEditor;
public SessionManager(Context context) {
mPref = context.getSharedPreferences(PREFERENCE_NAME + context.getApplicationContext().getPackageName(),
Context.MODE_PRIVATE);
import UIKit
class TestViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var dataList: [String] = [String]()
var fromIndex: Int = 0
let totalEntries: Int = 100
let limit: Int = 20
API SIDE:
1. Server needs to accept two paramters fromIndex and itemsLimit in the API url as query params.
2. Server response will provide an extra key totalItems to identify all items received or not.
And and array of items from fromIndex to itemsLimit.
APP SIDE:
1. First loadItem() will be called with fromIndex = 0 and batchSize = 20 (for example in viewDidLoad()
import UIKit
public protocol SSTextFieldDelegate {
public func texfieldShouldBeginEditing (textField: UITextField) -> Bool
public func textFieldShouldEndEditing (textField: UITextField) -> Bool
public func textFieldShouldReturn (textField: UITextField) -> Bool
import Foundation
import UIKit
protocol SSToolbarDatePickerViewDelegate: class {
func didTapDone(date: Date)
func didTapCancel()
}
class SSToolbarDatePickerView: UIDatePicker {
func randomString(length: Int) -> String {
let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
let len = UInt32(letters.length)
var randomString = ""
for _ in 0 ..< length {
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
import Foundation
import UIKit
protocol ToolbarPickerViewDelegate: class {
func didTapDone()
func didTapCancel()
}