Java Code Examples for android.widget.ListView#setVisibility()

The following examples show how to use android.widget.ListView#setVisibility() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryDetailScene.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public void setDialog(@Nullable Dialog dialog, String url) {
    mDialog = dialog;
    mProgressView = (ProgressView) ViewUtils.$$(dialog, R.id.progress);
    mErrorText = (TextView) ViewUtils.$$(dialog, R.id.text);
    mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
    mListView.setOnItemClickListener(this);

    Context context = getContext2();
    if (context != null) {
        if (mArchiveList == null) {
            mErrorText.setVisibility(View.GONE);
            mListView.setVisibility(View.GONE);
            mRequest = new EhRequest().setMethod(EhClient.METHOD_ARCHIVE_LIST)
                    .setArgs(url, mGid, mToken)
                    .setCallback(this);
            EhApplication.getEhClient(context).execute(mRequest);
        } else {
            bind(mArchiveList);
        }
    }
}
 
Example 2
Source File: GalleryDetailScene.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public void setDialog(@Nullable Dialog dialog, String url) {
    mDialog = dialog;
    mProgressView = (ProgressView) ViewUtils.$$(dialog, R.id.progress);
    mErrorText = (TextView) ViewUtils.$$(dialog, R.id.text);
    mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
    mListView.setOnItemClickListener(this);

    Context context = getContext2();
    if (context != null) {
        if (mTorrentList == null) {
            mErrorText.setVisibility(View.GONE);
            mListView.setVisibility(View.GONE);
            mRequest = new EhRequest().setMethod(EhClient.METHOD_GET_TORRENT_LIST)
                    .setArgs(url, mGid, mToken)
                    .setCallback(this);
            EhApplication.getEhClient(context).execute(mRequest);
        } else {
            bind(mTorrentList);
        }
    }
}
 
Example 3
Source File: DonationsDialog.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(List<SkuDetails> skuDetails) {
    super.onPostExecute(skuDetails);
    DonationsDialog dialog = donationDialogWeakReference.get();
    if (dialog == null) return;

    if (skuDetails == null || skuDetails.isEmpty()) {
        dialog.dismiss();
        return;
    }

    View customView = ((MaterialDialog) dialog.getDialog()).getCustomView();
    //noinspection ConstantConditions
    customView.findViewById(R.id.progress_container).setVisibility(View.GONE);
    ListView listView = customView.findViewById(R.id.list);
    listView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails));
    listView.setVisibility(View.VISIBLE);
}
 
Example 4
Source File: MainActivity.java    From MalwareBuster with Apache License 2.0 6 votes vote down vote up
private void refreshGlobalHookControls() {
    boolean currentStatus = prefs.getBoolean(Common.GLOBALHOOK, false);

    ImageButton glbHookbtn = (ImageButton)findViewById(R.id.btnGlobalHook);
    ListView list = (ListView) findViewById(R.id.lstApps);
    TextView globalWarningTextView = (TextView) findViewById(R.id.globalWarningTextView);
    SearchView searchApp = (SearchView) findViewById(R.id.searchApp);

    if (currentStatus) {
        glbHookbtn.setBackgroundColor(0xff34bcf1);
        list.setVisibility(View.GONE);
        globalWarningTextView.setVisibility(View.VISIBLE);
        searchApp.setEnabled(false);
    }
    else {
        glbHookbtn.setBackgroundColor(Color.DKGRAY);
        list.setVisibility(View.VISIBLE);
        globalWarningTextView.setVisibility(View.GONE);
        searchApp.setEnabled(true);
    }
}
 
Example 5
Source File: DonationsDialog.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(List<SkuDetails> skuDetails) {
    super.onPostExecute(skuDetails);
    DonationsDialog dialog = donationDialogWeakReference.get();
    if (dialog == null) return;

    if (skuDetails == null || skuDetails.isEmpty()) {
        dialog.dismiss();
        return;
    }

    View customView = ((MaterialDialog) dialog.getDialog()).getCustomView();
    //noinspection ConstantConditions
    customView.findViewById(R.id.progress_container).setVisibility(View.GONE);
    ListView listView = ButterKnife.findById(customView, R.id.list);
    listView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails));
    listView.setVisibility(View.VISIBLE);
}
 
Example 6
Source File: UserSkillsFragment.java    From intra42 with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_user_skills, container, false);

    ListView listViewSkills = rootView.findViewById(R.id.listViewSkills);
    TextView textViewNothingToShow = rootView.findViewById(R.id.textViewNothingToShow);

    if (activity != null && activity.selectedCursus != null && !activity.selectedCursus.skills.isEmpty()) {
        ListAdapterSkills adapterSkills = new ListAdapterSkills(getActivity(), activity.selectedCursus.skills);
        listViewSkills.setAdapter(adapterSkills);
        textViewNothingToShow.setVisibility(View.GONE);
        listViewSkills.setVisibility(View.VISIBLE);
    } else {
        textViewNothingToShow.setVisibility(View.VISIBLE);
        listViewSkills.setVisibility(View.GONE);
    }

    return rootView;
}
 
Example 7
Source File: MaterialSearchView.java    From talk-android with MIT License 6 votes vote down vote up
private void initiateView() {
    LayoutInflater.from(mContext).inflate(R.layout.search_view, this, true);
    mSearchLayout = findViewById(R.id.search_layout);

    mSearchTopBar = (RelativeLayout) mSearchLayout.findViewById(R.id.search_top_bar);
    mSuggestionsListView = (ListView) mSearchLayout.findViewById(R.id.suggestion_list);
    mSearchSrcTextView = (EditText) mSearchLayout.findViewById(R.id.searchTextView);
    mBackBtn = (ImageButton) mSearchLayout.findViewById(R.id.action_up_btn);
    mEmptyBtn = (ImageButton) mSearchLayout.findViewById(R.id.action_empty_btn);
    mTintView = mSearchLayout.findViewById(R.id.transparent_view);

    mSearchSrcTextView.setOnClickListener(mOnClickListener);
    mBackBtn.setOnClickListener(mOnClickListener);
    mEmptyBtn.setOnClickListener(mOnClickListener);
    mTintView.setOnClickListener(mOnClickListener);

    allowVoiceSearch = false;

    initSearchView();

    mSuggestionsListView.setVisibility(GONE);
}
 
Example 8
Source File: SearchShareesFragment.java    From Cirrus_depricated with GNU General Public License v2.0 6 votes vote down vote up
private void updateListOfUserGroups() {
    // Update list of users/groups
    // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
    mUserGroupsAdapter = new ShareUserListAdapter(
            getActivity().getApplicationContext(),
            R.layout.share_user_item, mShares, this
    );

    // Show data
    ListView usersList = (ListView) getView().findViewById(R.id.searchUsersListView);

    if (mShares.size() > 0) {
        usersList.setVisibility(View.VISIBLE);
        usersList.setAdapter(mUserGroupsAdapter);

    } else {
        usersList.setVisibility(View.GONE);
    }
}
 
Example 9
Source File: PeliasSearchViewTest.java    From open with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void setAutoCompleteListView_shouldHideListViewWhenQueryLosesFocus() throws Exception {
    ListView listView = new ListView(ACTIVITY);
    listView.setVisibility(VISIBLE);
    peliasSearchView.setAutoCompleteListView(listView);
    AutoCompleteTextView queryText = getQueryTextView();
    shadowOf(queryText).setViewFocus(false);
    assertThat(listView).isGone();
}
 
Example 10
Source File: AppListActivity.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_list);
    context = AppListActivity.this;
    appList = (ListView)findViewById(R.id.appList);
    btnMobileApps = (TextView)findViewById(R.id.btnMobileApps);
    btnWebApps = (TextView)findViewById(R.id.btnWebApps);
    txtError = (TextView)findViewById(R.id.txtError);
    txtNoAppsFound = (TextView)findViewById(R.id.txtNoAppsFound);
    btnSignOut = (TextView)findViewById(R.id.btnSignOut);
    etSearch = (EditText)findViewById(R.id.etSearch);
    spinner = (Spinner)findViewById(R.id.spinner);
    mobileApps = new ArrayList<>();
    webApps = new ArrayList<>();
    appList.setVisibility(View.GONE);
    txtError.setVisibility(View.GONE);
    txtNoAppsFound.setVisibility(View.GONE);
    mobileAppCategories = new ArrayList<>();
    webAppCategories = new ArrayList<>();
    mobileAppCategories.add(getResources().getString(R.string.filter_hint));
    webAppCategories.add(getResources().getString(R.string.filter_hint));
    btnMobileApps.setVisibility(View.GONE);
    btnMobileApps.setTag(TAG_BTN_MOBILE_APPS);
    btnMobileApps.setOnClickListener(onClickListener);

    btnWebApps.setVisibility(View.GONE);
    btnWebApps.setTag(TAG_BTN_WEB_APPS);
    btnWebApps.setOnClickListener(onClickListener);

    if (CommonUtils.isNetworkAvailable(context)) {
        getAppList();
    } else {
        CommonDialogUtils.showNetworkUnavailableMessage(AppListActivity.this);
    }
}
 
Example 11
Source File: SearchableActivity.java    From RhymeMusic with Apache License 2.0 5 votes vote down vote up
private void initComponents()
    {
        application = (MusicApplication) getApplication();

        /*搜索结果为空时,显示的提示信息*/
        textTips = (TextView) findViewById(R.id.text_tips);

        /*按钮类组件初始化*/
        searchBack = (ImageButton) findViewById(R.id.image_search_back);
        searchOption = (ImageButton) findViewById(R.id.image_search_option);
        searchBack.setOnClickListener(this);
        searchOption.setOnClickListener(this);

        /*列表组件初始化*/
        listView = (ListView) findViewById(R.id.list_search_result);
        listView.setOnItemClickListener(this);
        listView.setVisibility(View.INVISIBLE);
        loadData();

        /*搜索组件初始化*/
        searchView = (SearchView) findViewById(R.id.view_search);
        searchView.setOnQueryTextListener(this);
        searchView.onActionViewExpanded(); // 默认出现点击输入状态
        searchView.setFocusable(false);
        searchView.clearFocus();
//        searchView.setSubmitButtonEnabled(true);

    }
 
Example 12
Source File: GenericExplanationActivity.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    Intent intent = getIntent();
    String message = intent.getStringExtra(MESSAGE); 
    ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
    ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);
    
    setContentView(R.layout.generic_explanation);
    
    if (message != null) {
        TextView textView = (TextView) findViewById(R.id.message);
        textView.setText(message);
        textView.setMovementMethod(new ScrollingMovementMethod());
    }
    
    ListView listView = (ListView) findViewById(R.id.list);
    if (list != null && list.size() > 0) {
        //ListAdapter adapter = new ArrayAdapter<String>(this,
        // android.R.layout.simple_list_item_1, list);
        ListAdapter adapter = new ExplanationListAdapterView(this, list, list2);
        listView.setAdapter(adapter);
    } else {
        listView.setVisibility(View.GONE);
    }
}
 
Example 13
Source File: ShareFileFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
private void updateListOfUserGroups() {
    // Update list of users/groups
    // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
    mUserGroupsAdapter = new ShareUserListAdapter(
            getActivity(),
            R.layout.share_user_item,
            mPrivateShares,
            this
    );

    // Show data
    TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
    ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList);

    if (mPrivateShares.size() > 0) {
        noShares.setVisibility(View.GONE);
        usersList.setVisibility(View.VISIBLE);
        usersList.setAdapter(mUserGroupsAdapter);
        setListViewHeightBasedOnChildren(usersList);
    } else {
        noShares.setVisibility(View.VISIBLE);
        usersList.setVisibility(View.GONE);
    }

    // Set Scroll to initial position
    ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll);
    scrollView.scrollTo(0, 0);
}
 
Example 14
Source File: QuizFragment.java    From android-topeka with Apache License 2.0 5 votes vote down vote up
public void showSummary() {
    @SuppressWarnings("ConstantConditions")
    final ListView scorecardView = (ListView) getView().findViewById(R.id.scorecard);
    mScoreAdapter = getScoreAdapter();
    scorecardView.setAdapter(mScoreAdapter);
    scorecardView.setVisibility(View.VISIBLE);
    mQuizView.setVisibility(View.GONE);
}
 
Example 15
Source File: MainActivity.java    From external-nfc-api with Apache License 2.0 5 votes vote down vote up
private void hideRecords() {
	ListView listView = (ListView) findViewById(R.id.recordListView);
	View ndefRecords = findViewById(R.id.ndefRecords);
	
	listView.setVisibility(View.GONE);
	ndefRecords.setVisibility(View.GONE);
}
 
Example 16
Source File: SearchActivity.java    From java-unified-sdk with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(Resources.layout.search_activity(this));
    setupActionBar();
    listView = (ListView) findViewById(Resources.id.search_result_listview(this));
    loadingView =
        LayoutInflater.from(this).inflate(Resources.layout.search_loading(this), null);
    emtpyResult = findViewById(Resources.id.search_emtpy_result(this));
    listView.addFooterView(loadingView);
    loadingView.setVisibility(View.INVISIBLE);
    if (this.getIntent().getExtras() != null) {
        String searchString =
            getIntent().getExtras().getString(AVSearchQuery.DATA_EXTRA_SEARCH_KEY);
        searchQuery = JSON.parseObject(searchString, AVSearchQuery.class);
    }
    if (null != searchQuery) {
        searchCallback = new FindCallback<AVObject>() {

            @Override
            public void done(List<AVObject> avObjects, AVException avException) {
                if (avException == null) {
                    searchResults.addAll(avObjects);
                    if (adapter == null) {
                        adapter = new SearchResultAdapter();
                        listView.setAdapter(adapter);
                        listView.setOnScrollListener(adapter);
                    } else {
                        adapter.notifyDataSetChanged();
                        hideLoadingView();
                    }
                    if (searchResults.size() == 0) {
                        emtpyResult.setVisibility(View.VISIBLE);
                        listView.setVisibility(View.GONE);
                    } else {
                        emtpyResult.setVisibility(View.GONE);
                        listView.setVisibility(View.VISIBLE);
                    }

                }
            }
        };
        searchQuery.findInBackground().subscribe(ObserverBuilder.buildSingleObserver(searchCallback));
    }
}
 
Example 17
Source File: MessageDetailDialogFragment.java    From SmileEssence with MIT License 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MainActivity activity = (MainActivity) getActivity();
    final Account account = activity.getAccount();
    final Consumer consumer = activity.getConsumer();
    Twitter twitter = TwitterApi.getTwitter(consumer, account);

    DirectMessage selectedMessage = DirectMessageCache.getInstance().get(getMessageID());
    if (selectedMessage == null) {
        Notificator.publish(getActivity(), R.string.notice_error_get_messages);
        return new DisposeDialog(getActivity());
    }
    View header = getTitleView(activity, account, selectedMessage);
    ListView listView = (ListView) header.findViewById(R.id.listview_status_detail_reply_to);
    final MessageListAdapter adapter = new MessageListAdapter(getActivity());
    listView.setAdapter(adapter);
    long replyToMessageId = -1;
    ArrayList<DirectMessage> allMessages = Lists.newArrayList(DirectMessageCache.getInstance().all());
    Collections.sort(allMessages, new Comparator<DirectMessage>() {
        @Override
        public int compare(DirectMessage lhs, DirectMessage rhs) {
            return rhs.getCreatedAt().compareTo(lhs.getCreatedAt());
        }
    });
    for (DirectMessage directMessage : allMessages) {
        if (selectedMessage.getId() == directMessage.getId()) {
            continue;
        }
        if (directMessage.getCreatedAt().getTime() > selectedMessage.getCreatedAt().getTime()) {
            continue;
        }
        if (directMessage.getSenderId() == selectedMessage.getRecipientId() && directMessage.getRecipientId() == selectedMessage.getSenderId()) {
            replyToMessageId = directMessage.getId();
            break;
        }
    }

    if (replyToMessageId == -1) {
        listView.setVisibility(View.GONE);
    } else {
        TwitterUtils.tryGetMessage(twitter, account, replyToMessageId, new TwitterUtils.MessageCallback() {
            @Override
            public void success(DirectMessage message) {
                adapter.addToTop(new MessageViewModel(message, account));
                adapter.updateForce();
            }

            @Override
            public void error() {

            }
        });
    }
    return new AlertDialog.Builder(getActivity()).setView(header).create();
}
 
Example 18
Source File: SearchActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	hasSearchResultDataFetched = false;
	setContentView(R.layout.activity_search);
	searchHistoryListView = (ListView) findViewById(R.id.search_history_listview);
	searchResultListView = (ListView) findViewById(R.id.search_result_listview);
	// set adapter

	if (null == UserCenter.instance().getSearchHistoryList(SearchActivity.this)) {
		searchResultListView.setVisibility(View.GONE);
	} else {
		ArrayList<String> historyList = UserCenter.instance().getSearchHistoryList(SearchActivity.this);
		SearchHistoryListViewAdapter adapter = new SearchHistoryListViewAdapter(this, historyList);
		searchHistoryListView.setAdapter(adapter);
		isSearch = true;
	}

	contentEditText = (EditText) findViewById(R.id.search_content_edittext);
	contentEditText.addTextChangedListener(this);

	searchHistoryListView.setOnItemClickListener(this);
	searchResultListView.setOnItemClickListener(this);

	contentEditText.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(View v, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_ENTER) {// 修改回车键功能
				if (contentEditText.getText().toString().trim().length() > 0) {
					((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(SearchActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
					UserCenter.instance().addSearchHistoryList(contentEditText.getText().toString(), SearchActivity.this);
					SearchDetailViewModel viewModel = (SearchDetailViewModel) ViewModelManager.manager().newViewModel(SearchListActivity.class.getName());
					viewModel.wd = contentEditText.getText().toString().trim();
					Route.route().nextController(SearchActivity.this, viewModel, Route.WITHOUT_RESULTCODE);
				}
			}
			return false;
		}
	});
}
 
Example 19
Source File: FragmentStatusList.java    From Rumble with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    Bundle args = getArguments();
    if(args != null) {
        this.filter_gid = args.getString("GroupID");
        this.filter_uid = args.getString("ContactID");
        this.filter_hashtag = args.getString("Hashtag");
        this.noCoordinatorLayout = args.getBoolean("noCoordinatorLayout");
    }

    /*
     * This fragment is shown in three activities: the HomeActivity, the GroupDetail activity
     * and the ContactDetail activity. For HomeActivity and GroupDetail, I need the floating
     * action button to compose message and I need it to disappear when I scroll down so I need
     * this fragment to embeds it in a CoordinatorLayout to enable this effect.
     *
     * However for ContactDetail activity, I need a CoordinatorLayout for the whole activity
     * in order to hide the collapsingtoolbar whenever I scroll down. Unfortunately it conflicts
     * with the coordinatorlayout I use for this very fragmentStatusList. Because I don't need
     * the compose button to display the status to a specific contact, I created two different
     * layout to avoid conflicts and use the argument noCoordinatorLayout to decide which one.
     */
    if(noCoordinatorLayout) {
        mView = inflater.inflate(R.layout.fragment_status_list_no_coordinatorlayout, container, false);
    } else {
        mView = inflater.inflate(R.layout.fragment_status_list, container, false);
    }

    // the filters
    filters = (ListView) (mView.findViewById(R.id.filter_list));
    filterListAdapter = new FilterListAdapter(getActivity(), this);
    filters.setAdapter(filterListAdapter);
    filters.setClickable(false);
    filters.setVisibility(View.GONE);

    // refreshing the list of status by pulling down, disabled for ContactDetail
    swipeLayout = (SwipeRefreshLayout) mView.findViewById(R.id.swipe_container);
    if(noCoordinatorLayout)
        swipeLayout.setEnabled(false);
    else
        swipeLayout.setOnRefreshListener(this);


    /*
    final float density = getResources().getDisplayMetrics().density;
    final int swipeDistance = Math.round(64 * density);
    swipeLayout.setProgressViewOffset(true, 10, 10+swipeDistance);
    */

    // the compose button, disabled for ContactDetail
    composeFAB = (FloatingActionButton) mView.findViewById(R.id.compose_fab);
    if(noCoordinatorLayout)
        composeFAB.setVisibility(View.GONE);
    else
        composeFAB.setOnClickListener(onFabClicked);

    // the list of status
    mRecyclerView = (RecyclerView) mView.findViewById(R.id.status_list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    statusRecyclerAdapter = new StatusRecyclerAdapter(getActivity(), this);
    mRecyclerView.setAdapter(statusRecyclerAdapter);
    mRecyclerView.addOnScrollListener(loadMore);

    // now get the latest status
    loadingMore = false;
    noMoreStatusToLoad = false;
    refreshStatuses();

    EventBus.getDefault().register(this);

    return mView;
}
 
Example 20
Source File: SearchActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	hasSearchResultDataFetched = false;
	setContentView(R.layout.activity_search);
	searchHistoryListView = (ListView) findViewById(R.id.search_history_listview);
	searchResultListView = (ListView) findViewById(R.id.search_result_listview);
	// set adapter

	if (null == UserCenter.instance().getSearchHistoryList(SearchActivity.this)) {
		searchResultListView.setVisibility(View.GONE);
	} else {
		ArrayList<String> historyList = UserCenter.instance().getSearchHistoryList(SearchActivity.this);
		SearchHistoryListViewAdapter adapter = new SearchHistoryListViewAdapter(this, historyList);
		searchHistoryListView.setAdapter(adapter);
		isSearch = true;
	}

	contentEditText = (EditText) findViewById(R.id.search_content_edittext);
	contentEditText.addTextChangedListener(this);

	searchHistoryListView.setOnItemClickListener(this);
	searchResultListView.setOnItemClickListener(this);

	contentEditText.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(View v, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_ENTER) {// 修改回车键功能
				if (contentEditText.getText().toString().trim().length() > 0) {
					((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(SearchActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
					UserCenter.instance().addSearchHistoryList(contentEditText.getText().toString(), SearchActivity.this);
					SearchDetailViewModel viewModel = (SearchDetailViewModel) ViewModelManager.manager().newViewModel(SearchListActivity.class.getName());
					viewModel.wd = contentEditText.getText().toString().trim();
					Route.route().nextController(SearchActivity.this, viewModel, Route.WITHOUT_RESULTCODE);
				}
			}
			return false;
		}
	});
}