Skip to content

Instantly share code, notes, and snippets.

Mohit Kanwal creativepsyco

Block or report user

Report or block creativepsyco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@creativepsyco
creativepsyco / LocationInputScreen.java
Created Jan 19, 2016
Get account info from the phone. Requires ACCOUNT Permission in the manifest.
View LocationInputScreen.java
Account[] accounts = AccountManager.get(getView().getContext()).getAccounts();
Set<String> emailSet = new HashSet<>();
for (Account account : accounts) {
if (EMAIL_PATTERN.matcher(account.name).matches()) {
emailSet.add(account.name);
}
}
getView().txtPlaceName.setAdapter(new ArrayAdapter<>(getView().getContext(),
android.R.layout.simple_dropdown_item_1line, new ArrayList<>(emailSet)));
View issue127.diff
diff --git i/app/src/main/java/org/fossasia/openevent/activities/MainActivity.java w/app/src/main/java/org/fossasia/openevent/activities/MainActivity.java
index 1c80d92..9b01b7f 100644
--- i/app/src/main/java/org/fossasia/openevent/activities/MainActivity.java
+++ w/app/src/main/java/org/fossasia/openevent/activities/MainActivity.java
@@ -35,35 +35,30 @@ import org.fossasia.openevent.OpenEventApp;
import org.fossasia.openevent.R;
import org.fossasia.openevent.dbutils.DataDownload;
import org.fossasia.openevent.dbutils.DbSingleton;
-import org.fossasia.openevent.events.CantDownloadEvent;
-import org.fossasia.openevent.events.CounterEvent;
View SimpleTest.java
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.not;
View BaseMigration.java
package com.example.sample.orm.migration;
import com.google.common.base.Preconditions;
import com.example.sample.framework.base.ui.AppLogger;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import io.realm.Realm;
View headers
Delivered-To: xxx@gmail.com
Received: by 10.107.151.212 with SMTP id z203csp338871iod;
Thu, 9 Apr 2015 05:00:50 -0700 (PDT)
X-Received: by 10.194.235.71 with SMTP id uk7mr59805915wjc.13.1428580848509;
Thu, 09 Apr 2015 05:00:48 -0700 (PDT)
Return-Path: <sputty@012.net.il>
Received: from mtaout20.012.net.il (mtaout20.012.net.il. [80.179.55.166])
by mx.google.com with ESMTP id fu19si23795394wjc.14.2015.04.09.05.00.47
for <xxx@gmail.com>;
@creativepsyco
creativepsyco / apktool.rb
Last active Aug 29, 2015
Apktool Brew 2.0.0rc4
View apktool.rb
require 'formula'
class Apktool < Formula
homepage 'http://android-apktool.googlecode.com/'
url 'https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.0.0rc4.jar'
sha1 '61123bcc472fa76907d405d82afda1c6e40c46bf'
resource 'exes' do
url 'https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/osx/apktool'
sha1 '508f031c81b42386ddc5fff304fee3ae11fd765b'
@creativepsyco
creativepsyco / build.gradle
Created Feb 18, 2015
Automatically add Git revision information when building SNAPSHOT versions of an App
View build.gradle
Integer VERSION_CODE = 16
String VERSION_NAME = getVersionName("0.4-SNAPSHOT")
def getVersionName(String preferredVersionName) {
if (preferredVersionName.contains("-SNAPSHOT")) {
return getGitStatus(preferredVersionName)
} else {
return preferredVersionName
}
@creativepsyco
creativepsyco / BatchAuthorizer.java
Created Jan 28, 2015
Batch Authorizer for Pusher Java Client.
View BatchAuthorizer.java
class BatchAuthorizer extends HttpAuthorizer {
private final Collection<String> channelsToSub;
private Map<String, JSONObject> cachedAuthMap = new HashMap<>();
/**
* We need the socket id to know when to refresh the batch auth data
*/
private String authSocketId = "";
@creativepsyco
creativepsyco / BaseButton.java
Last active Jun 1, 2018
Custom Button Widget which applies a ripple onto buttons above API > 21 and normal state list selectors for API < 21. Also you can set the corner radius.
View BaseButton.java
package com.mohitkanwal.framework.control.base;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
@creativepsyco
creativepsyco / SimpleLauncher.java
Created Nov 24, 2014
How to launch a restart intent.
View SimpleLauncher.java
Intent intent = new Intent(getActivity(), HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finishActivity();
getActivity().startActivity(intent);
You can’t perform that action at this time.