GboardFakeEditText.java 2.58 KB
package com.bitstrips.imoji.onboarding.gboard;

import android.content.Context;
import android.os.Bundle;
import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat.OnCommitContentListener;
import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.support.v7.widget.AppCompatEditText;
import android.text.InputFilter;
import android.text.Spanned;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

public class GboardFakeEditText
  extends AppCompatEditText
  implements InputFilter
{
  private static final String[] a = { "image/png", "image/webp" };
  private OnImageEnterredListener b;
  
  public GboardFakeEditText(Context paramContext)
  {
    this(paramContext, null);
  }
  
  public GboardFakeEditText(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, 16842862);
  }
  
  public GboardFakeEditText(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    setFilters(new InputFilter[] { this });
  }
  
  public CharSequence filter(CharSequence paramCharSequence, int paramInt1, int paramInt2, Spanned paramSpanned, int paramInt3, int paramInt4)
  {
    return "";
  }
  
  public InputConnection onCreateInputConnection(EditorInfo paramEditorInfo)
  {
    InputConnection localInputConnection = super.onCreateInputConnection(paramEditorInfo);
    EditorInfoCompat.setContentMimeTypes(paramEditorInfo, a);
    InputConnectionCompat.createWrapper(localInputConnection, paramEditorInfo, new InputConnectionCompat.OnCommitContentListener()
    {
      public final boolean onCommitContent(InputContentInfoCompat paramAnonymousInputContentInfoCompat, int paramAnonymousInt, Bundle paramAnonymousBundle)
      {
        if (GboardFakeEditText.a(GboardFakeEditText.this) != null) {
          GboardFakeEditText.a(GboardFakeEditText.this).onImageEnterred();
        }
        return true;
      }
    });
  }
  
  public void setOnImageEnterredListener(OnImageEnterredListener paramOnImageEnterredListener)
  {
    this.b = paramOnImageEnterredListener;
  }
  
  public static abstract interface OnImageEnterredListener
  {
    public abstract void onImageEnterred();
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/onboarding/gboard/GboardFakeEditText.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */