Skip to content

Instantly share code, notes, and snippets.

@Joisar
Joisar / Code.java
Created October 26, 2017 15:57 — forked from Dogesmith/Code.java
Android Multi-line EditText which prevents newline characters from being added
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText);
mContent.setText(mContentInit);
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT);
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE);
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE);
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event == null) {
@Joisar
Joisar / CountingFileRequestBody.java
Last active August 29, 2015 14:27 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
public class AspectImageView extends ImageView {
private static final int DEFAULT_XRATIO = 1;
private static final int DEFAULT_YRATIO = 1;
package no.nsb.ombord;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import org.apache.http.util.ExceptionUtils;
package jp.noxi.sample;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;