Skip to content

Instantly share code, notes, and snippets.

private boolean isValidPassword(CharSequence value) {
return value.toString().matches("^(?=.*\\d).{4,8}$");
}
private boolean isValidLogin(CharSequence value) {
return value.toString().matches("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])");
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
public class MainActivity extends AppCompatActivity {
@BindView(R.id.login_et)
EditText mLogin;
@BindView(R.id.password_et)
EditText mPassword;
@BindView(R.id.login_bt)
Button mLoginButton;
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity"
android:background="@color/colorPrimary">
<LinearLayout
android:orientation="vertical"
Subscription buttonSub = RxView.clicks(mLoginButton).subscribe(aVoid -> {
//handle on click here
});
@mplacona
mplacona / gist:614ffdacc7da223f8a6121cd4b7a2eee
Last active October 27, 2023 08:22 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

mPicasso = new Picasso.Builder(getApplicationContext())
.downloader(new OkHttp3Downloader(okClient))
.loggingEnabled(true)
.build();
if (BuildConfig.DEBUG) {
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:0.9.0'
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://github.com/uPhyca/stetho-realm/raw/master/maven-repo" }
}
}