Skip to content

Instantly share code, notes, and snippets.

View plastiv's full-sized avatar

Sergii Pechenizkyi plastiv

View GitHub Profile
@plastiv
plastiv / InputManager.java
Created September 7, 2015 09:09
show or hide keyboard manually from code
import android.app.Activity;
import android.content.Context;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import timber.log.Timber;
@plastiv
plastiv / rxandroid-tuts.md
Created July 4, 2015 11:27
Links for android developers
@plastiv
plastiv / LogObserver.java
Created May 15, 2015 08:19
RxLogObserver
public class LogObserver<T> implements Observer<T> {
private final String tag;
public LogObserver(String tag) {
this.tag = tag;
}
@Override public void onCompleted() {
System.out.println(tag + " onCompleted");
@plastiv
plastiv / SegmentedEditText.java
Created May 7, 2015 12:33
SegmentedEditText
// SegmentedEditText is horizontal linear layout contains 6 edit texts
public class SegmentedEditText extends LinearLayout {
public SegmentedEditText(Context context) {
super(context);
LayoutInflater inflater = LayoutInflater.from(context);
for (int i = 0; i < 6; i++) {
// have to do next:
EditText editText = (EditText) inflater.inflate(R.layout.partial_segmented_edittext, this, false);
addView(editText);
@plastiv
plastiv / Article.java
Created April 22, 2015 08:04
Retrofit multipart convertor
@MultipartBody
public class Article {
String author;
File photo;
}
def publishDropboxTask = project.tasks.create("publishDropbox")
android.applicationVariants.all { variant ->
TODO: made dropbox task work with new variant output API
variant.outputs.each { output ->
def publishDropboxVariantTask = project.tasks.create("publishDropbox${variant.name.capitalize()}", Copy)
publishDropboxVariantTask.from(output.outputFile)
publishDropboxVariantTask.into(file(PUBLISH_FOLDER))
publishDropboxVariantTask.dependsOn variant.assemble
publishDropboxTask.dependsOn publishDropboxVariantTask
androidTestCompile("com.android.support.test.espresso:espresso-core:2.0"){
// avoid conflict with dagger transitive dependency
exclude group: 'javax.inject'
}
public class Vim430TestCase extends TestCase {
private ObjectMapper objectMapper;
@Override protected void setUp() throws Exception {
super.setUp();
objectMapper = ObjectMapperFactory.create();
}
public void testMapping() {
@plastiv
plastiv / .gitignore
Last active December 25, 2015 22:59
Android .gitignore file for projects folder.
#
# https://gist.github.com/plastiv/7053530
#
# Base configuration taken from https://github.com/github/gitignore/blob/master/Android.gitignore
#
# Eclipse project files
.classpath
.project
.settings/
.metadata/