// Path: TryGank/app/src/main/java/com/gypsophila/trygank/base/AppSwipeBackActivity.java
// public abstract class AppSwipeBackActivity extends SwipeBackActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         ThemeUtil.changTheme(this, ThemeUtil.getCurrentTheme(this));
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onResume() {
//         super.onResume();
//         UmengEvent.onResume(this);
//     }
// 
//     @Override
//     protected void onPause() {
//         super.onPause();
//         UmengEvent.onPause(this);
//     }
// }
// 
// Path: TryGank/app/src/main/java/com/gypsophila/trygank/listener/SearchTextWatcher.java
// public class SearchTextWatcher implements TextWatcher {
// 
// 
// 
//     @Override
//     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// 
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence s, int start, int before, int count) {
// 
//     }
// 
//     @Override
//     public void afterTextChanged(Editable s) {
//         EventBus.getDefault().post(new FinishInputEvent(s.toString()));
//     }
// }
// 
// Path: TryGank/app/src/main/java/com/gypsophila/trygank/systemevent/FinishInputEvent.java
// public class FinishInputEvent {
// 
//     public final String mKeyWord;
//     public FinishInputEvent(String keyword) {
//         mKeyWord = keyword;
//     }
// }


import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.gypsophila.trygank.R;
import com.gypsophila.trygank.base.AppSwipeBackActivity;
import com.gypsophila.trygank.listener.SearchTextWatcher;
import com.gypsophila.trygank.systemevent.FinishInputEvent;
import org.greenrobot.eventbus.EventBus;
            public void onClick(View v) {
                finish();
            }
        });
        mSearchEt = (EditText) findViewById(R.id.search_et);
        if (mInputManager != null) {
            mSearchEt.requestFocus();
            mInputManager.showSoftInput(mSearchEt, 0);
        }
        mSearchEt.addTextChangedListener(mTextWatcher);
        mSearchEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                boolean bool = false;
                //如果是搜索动作
                if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                    if (!TextUtils.isEmpty(mSearchEt.getText().toString())) {
                        EventBus.getDefault().post(new FinishInputEvent(mSearchEt.getText().toString()));
                        bool = true;
                    } else {
                        getSupportFragmentManager().beginTransaction()
                                .replace(R.id.search_content, SearchListFragment.newInstance(), SearchListFragment.TAG)
                                .commit();
                    }
                    if (mInputManager != null) {
                        mInputManager.hideSoftInputFromWindow(mSearchEt.getWindowToken(), 0);
                    }
                }
                return bool;
            }
// Path: TryGank/app/src/main/java/com/gypsophila/trygank/base/AppSwipeBackActivity.java
// public abstract class AppSwipeBackActivity extends SwipeBackActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         ThemeUtil.changTheme(this, ThemeUtil.getCurrentTheme(this));
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onResume() {
//         super.onResume();
//         UmengEvent.onResume(this);
//     }
// 
//     @Override
//     protected void onPause() {
//         super.onPause();
//         UmengEvent.onPause(this);
//     }
// }
// 
// Path: TryGank/app/src/main/java/com/gypsophila/trygank/listener/SearchTextWatcher.java
// public class SearchTextWatcher implements TextWatcher {
// 
// 
// 
//     @Override
//     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// 
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence s, int start, int before, int count) {
// 
//     }
// 
//     @Override
//     public void afterTextChanged(Editable s) {
//         EventBus.getDefault().post(new FinishInputEvent(s.toString()));
//     }
// }
// 
// Path: TryGank/app/src/main/java/com/gypsophila/trygank/systemevent/FinishInputEvent.java
// public class FinishInputEvent {
// 
//     public final String mKeyWord;
//     public FinishInputEvent(String keyword) {
//         mKeyWord = keyword;
//     }
// }


// Path: TryGank/app/src/main/java/com/gypsophila/trygank/business/gank/view/SearchActivity.java
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.gypsophila.trygank.R;
import com.gypsophila.trygank.base.AppSwipeBackActivity;
import com.gypsophila.trygank.listener.SearchTextWatcher;
import com.gypsophila.trygank.systemevent.FinishInputEvent;
import org.greenrobot.eventbus.EventBus;

            public void onClick(View v) {
                finish();
            }
        });
        mSearchEt = (EditText) findViewById(R.id.search_et);
        if (mInputManager != null) {
            mSearchEt.requestFocus();
            mInputManager.showSoftInput(mSearchEt, 0);
        }
        mSearchEt.addTextChangedListener(mTextWatcher);
        mSearchEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                boolean bool = false;
                //如果是搜索动作
                if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                    if (!TextUtils.isEmpty(mSearchEt.getText().toString())) {
                        EventBus.getDefault().post(new FinishInputEvent(mSearchEt.getText().toString()));
                        bool = true;
                    } else {
                        getSupportFragmentManager().beginTransaction()
                                .replace(R.id.search_content, SearchListFragment.newInstance(), SearchListFragment.TAG)
                                .commit();
                    }
                    if (mInputManager != null) {
                        mInputManager.hideSoftInputFromWindow(mSearchEt.getWindowToken(), 0);
                    }
                }
                return bool;
            }
        });