Instantly share code, notes, and snippets.

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>;
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'
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
}
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 = "";
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;
View SimpleLauncher.java
Intent intent = new Intent(getActivity(), HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finishActivity();
getActivity().startActivity(intent);