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

The following examples show how to use android.widget.ListView#setRecyclerListener() . 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: UserListAdapter.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
public UserListAdapter(Fragment activity, List<UserBean> bean, ListView listView) {
    this.bean = bean;
    this.commander = TimeLineBitmapDownloader.getInstance();
    this.inflater = activity.getActivity().getLayoutInflater();
    this.listView = listView;
    this.activity = activity;

    defaultBG = activity.getResources().getColor(R.color.transparent);
    checkedBG = ThemeUtility.getColor(R.attr.listview_checked_color);

    listView.setRecyclerListener(new AbsListView.RecyclerListener() {
        @Override
        public void onMovedToScrapHeap(View view) {
            ViewHolder holder = (ViewHolder) view.getTag();
            if (holder == null) {
                return;
            }
            holder.avatar.setImageDrawable(null);
        }
    });
}
 
Example 2
Source File: UserListAdapter.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
public UserListAdapter(Fragment activity, List<UserBean> bean, ListView listView) {
    this.bean = bean;
    this.commander = TimeLineBitmapDownloader.getInstance();
    this.inflater = activity.getActivity().getLayoutInflater();
    this.listView = listView;
    this.activity = activity;

    defaultBG = activity.getResources().getColor(R.color.transparent);
    checkedBG = ThemeUtility.getColor(R.attr.listview_checked_color);

    listView.setRecyclerListener(new AbsListView.RecyclerListener() {
        @Override
        public void onMovedToScrapHeap(View view) {
            ViewHolder holder = (ViewHolder) view.getTag();
            if (holder == null) {
                return;
            }
            holder.avatar.setImageDrawable(null);
        }
    });
}
 
Example 3
Source File: MyStatusesActivity.java    From YiBo with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvMicroBlog);
	ThemeUtil.setListViewStyle(lvMicroBlog);
	
	user = (User)this.getIntent().getSerializableExtra("USER");
	if (user == null) {
		return;
	}

	TextView tvTitle = (TextView)this.findViewById(R.id.tvTitle);
	tvTitle.setText(user.getScreenName());

	adapter = new MyStatusesListAdapter(this, sheJiaoMao.getCurrentAccount());
	showMoreFooter();
	lvMicroBlog.setAdapter(adapter);
	lvMicroBlog.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	setBack2Top(lvMicroBlog);
	
	recyclerListener = new StatusRecyclerListener();
	lvMicroBlog.setRecyclerListener(recyclerListener);
}
 
Example 4
Source File: PublicTimelineActivity.java    From YiBo with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvMicroBlog);
	ThemeUtil.setListViewStyle(lvMicroBlog);
	
       TextView tvTitle = (TextView) this.findViewById(R.id.tvTitle);
	tvTitle.setText(R.string.title_public_timeline);

	showMoreFooter();
	lvMicroBlog.setAdapter(adapter);
	lvMicroBlog.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	lvMicroBlog.setOnScrollListener(new StatusScrollListener());
       setBack2Top(lvMicroBlog);
       
	recyclerListener = new StatusRecyclerListener();
	lvMicroBlog.setRecyclerListener(recyclerListener);
}
 
Example 5
Source File: MyFavoritesActivity.java    From YiBo with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvMicroBlog = (ListView) this.findViewById(R.id.lvMicroBlog);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvMicroBlog);
	ThemeUtil.setListViewStyle(lvMicroBlog);
	
	TextView tvTitle = ((TextView) this.findViewById(R.id.tvTitle));
	tvTitle.setText(R.string.title_favorites);

	lvMicroBlog.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	showMoreFooter();
	lvMicroBlog.setAdapter(adapter);
	setBack2Top(lvMicroBlog);
	
	recyclerListener = new StatusRecyclerListener();
	lvMicroBlog.setRecyclerListener(recyclerListener);
}
 
Example 6
Source File: ThemeActivity.java    From YiBo with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvTheme = (ListView) findViewById(R.id.lvTheme);
	TextView tvTitle = (TextView) findViewById(R.id.tvTitle);
	
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvTheme);
	ThemeUtil.setListViewStyle(lvTheme);
	tvTitle.setText(R.string.title_theme);
	
	Intent intent = this.getIntent();
	account = (LocalAccount)intent.getSerializableExtra("ACCOUNT");
       if (account == null) {
       	account = sheJiaoMao.getCurrentAccount();
       }
       
	adapter = new ThemeListAdapter(this, account);
	
	lvTheme.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	//showLoadingFooter();
	lvTheme.setAdapter(adapter);

	themeRecyclerListener = new ThemeRecyclerListener();
	lvTheme.setRecyclerListener(themeRecyclerListener);
}
 
Example 7
Source File: DirectoryFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final Context context = inflater.getContext();
       final Resources res = context.getResources();
	final View view = inflater.inflate(R.layout.fragment_directory, container, false);

       mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);

	mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);

	mListView = (ListView) view.findViewById(R.id.list);
	mListView.setOnItemClickListener(mItemListener);
	mListView.setMultiChoiceModeListener(mMultiListener);
	mListView.setRecyclerListener(mRecycleListener);

       // Indent our list divider to align with text
       final Drawable divider = mListView.getDivider();
       final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
       final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
       if (insetLeft) {
           mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
       } else {
           mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
       }

	mGridView = (GridView) view.findViewById(R.id.grid);
	mGridView.setOnItemClickListener(mItemListener);
	mGridView.setMultiChoiceModeListener(mMultiListener);
	mGridView.setRecyclerListener(mRecycleListener);

	return view;
}
 
Example 8
Source File: DirectoryFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final Context context = inflater.getContext();
       final Resources res = context.getResources();
	final View view = inflater.inflate(R.layout.fragment_directory, container, false);

       mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);

	mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);

	mListView = (ListView) view.findViewById(R.id.list);
	mListView.setOnItemClickListener(mItemListener);
	mListView.setMultiChoiceModeListener(mMultiListener);
	mListView.setRecyclerListener(mRecycleListener);

       // Indent our list divider to align with text
       final Drawable divider = mListView.getDivider();
       final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
       final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
       if (insetLeft) {
           mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
       } else {
           mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
       }

	mGridView = (GridView) view.findViewById(R.id.grid);
	mGridView.setOnItemClickListener(mItemListener);
	mGridView.setMultiChoiceModeListener(mMultiListener);
	mGridView.setRecyclerListener(mRecycleListener);

	return view;
}
 
Example 9
Source File: DirectoryFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final Context context = inflater.getContext();
       final Resources res = context.getResources();
	final View view = inflater.inflate(R.layout.fragment_directory, container, false);

       mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);

	mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);

	mListView = (ListView) view.findViewById(R.id.list);
	mListView.setOnItemClickListener(mItemListener);
	mListView.setMultiChoiceModeListener(mMultiListener);
	mListView.setRecyclerListener(mRecycleListener);

       // Indent our list divider to align with text
       final Drawable divider = mListView.getDivider();
       final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
       final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
       if (insetLeft) {
           mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
       } else {
           mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
       }

	mGridView = (GridView) view.findViewById(R.id.grid);
	mGridView.setOnItemClickListener(mItemListener);
	mGridView.setMultiChoiceModeListener(mMultiListener);
	mGridView.setRecyclerListener(mRecycleListener);

	return view;
}
 
Example 10
Source File: DataEntryActivity.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void setupListView() {
    dataEntryListView = (ListView) findViewById(R.id.list_of_fields);
    dataEntryListView.setRecyclerListener(new AbsListView.RecyclerListener() {
        @Override
        public void onMovedToScrapHeap(View view) {
            if ( view.hasFocus()){
                view.clearFocus();
                if ( view instanceof EditText) {
                    InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
                }
            }
        }
    });
}
 
Example 11
Source File: HotStatusesActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvMicroBlog);
	ThemeUtil.setListViewStyle(lvMicroBlog);
	
	Intent intent = this.getIntent();
	type = intent.getIntExtra("STATUS_CATALOG", StatusCatalog.Hot_Retweet.getCatalogNo());

	TextView tvTitle = (TextView)this.findViewById(R.id.tvTitle);
	int titleId = R.string.title_hot_retweets;
	if (type == StatusCatalog.Hot_Comment.getCatalogNo()) {
		titleId = R.string.title_hot_comments;
	}
	tvTitle.setText(titleId);

	adapter = new HotStatusesListAdapter(this, sheJiaoMao.getCurrentAccount());
	showMoreFooter();
	lvMicroBlog.setAdapter(adapter);
	lvMicroBlog.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	lvMicroBlog.setOnScrollListener(new StatusScrollListener());
       setBack2Top(lvMicroBlog);
       
	recyclerListener = new StatusRecyclerListener();
	lvMicroBlog.setRecyclerListener(recyclerListener);
}
 
Example 12
Source File: SocialGraphActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvUser = (ListView) findViewById(R.id.lvUser);
	TextView tvTitle = (TextView) findViewById(R.id.tvTitle);
	
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvUser);
	ThemeUtil.setListViewStyle(lvUser);
	
	Intent intent = this.getIntent();
	socialGraphType = intent.getIntExtra("SOCIAL_GRAPH_TYPE", socialGraphType);
	user = (User)intent.getSerializableExtra("USER");
       if (user == null) {
       	return;
       }
	account = (LocalAccount)intent.getSerializableExtra("ACCOUNT");
       if (account == null) {
       	account = sheJiaoMao.getCurrentAccount();
       }
       
	adapter = new SocialGraphListAdapter(this, account, socialGraphType);
	
	
	lvUser.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	showLoadingFooter();
	lvUser.setAdapter(adapter);

	userRecyclerListener = new UserRecyclerListener();
	lvUser.setRecyclerListener(userRecyclerListener);
	setBack2Top(lvUser);
	
	if (socialGraphType == SocialGraphTask.TYPE_FOLLOWERS) {
		tvTitle.setText(R.string.title_followers);
	} else if (socialGraphType == SocialGraphTask.TYPE_FRIENDS) {
		tvTitle.setText(R.string.title_friends);
	} else if (socialGraphType == SocialGraphTask.TYPE_BLOCKS) {
		tvTitle.setText(R.string.title_blocks);
	}
}
 
Example 13
Source File: StatusSubscribeActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvMicroBlog);
	ThemeUtil.setListViewStyle(lvMicroBlog);
	
	int temp = getIntent().getIntExtra("STATUS_CATALOG", 
		StatusCatalog.News.getCatalogNo());
	catalog = StatusCatalog.getStatusCatalog(temp);
	if (catalog == null) {
		return;
	}
       
	int titleId = getIntent().getIntExtra("TITLE_ID", R.string.label_app_daily);
	TextView tvTitle = (TextView)this.findViewById(R.id.tvTitle);
	tvTitle.setText(titleId);

	adapter = new StatusSubscribeListAdapter(this, sheJiaoMao.getCurrentAccount());
	showMoreFooter();
	lvMicroBlog.setAdapter(adapter);
	lvMicroBlog.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	lvMicroBlog.setOnScrollListener(new StatusScrollListener());
	setBack2Top(lvMicroBlog);
	
	recyclerListener = new StatusRecyclerListener();
	lvMicroBlog.setRecyclerListener(recyclerListener);
}
 
Example 14
Source File: GroupActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
	LinearLayout llRoot = (LinearLayout)this.findViewById(R.id.llRoot);
	LinearLayout llHeaderBase = (LinearLayout)this.findViewById(R.id.llHeaderBase);
	LinearLayout llTabHeader = (LinearLayout)this.findViewById(R.id.llTabHeader);
	lvUser = (ListView)this.findViewById(R.id.lvUser);
	ThemeUtil.setRootBackground(llRoot);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setHeaderToggleTab(llTabHeader);
	ThemeUtil.setListViewStyle(lvUser);
	
	Intent intent = this.getIntent();
	user = (User)intent.getSerializableExtra("USER");
       if (user == null) {
       	return;
       }
       tabType = intent.getIntExtra("TAB_TYPE", TAB_TYPE_ALL);

	TextView tvTitle = (TextView)this.findViewById(R.id.tvTitle);
	String title = this.getString(R.string.title_group, user.getFriendsCount());
	tvTitle.setText(title);

	btnTabLeft = (Button) this.findViewById(R.id.btnTabLeft);
	btnTabLeft.setText(R.string.label_tab_all);
	btnTabRight = (Button) this.findViewById(R.id.btnTabRight);
	btnTabRight.setText(R.string.label_tab_group);

	lvUser.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	userRecyclerListener = new UserRecyclerListener();
	lvUser.setRecyclerListener(userRecyclerListener);
       setBack2Top(lvUser);
}
 
Example 15
Source File: ConversationActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
	LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase);
	lvDirectMessage = (ListView)this.findViewById(R.id.lvDirectMessage);
	LinearLayout llFooterAction = (LinearLayout)findViewById(R.id.llFooterAction);
	EditText etText = (EditText)findViewById(R.id.etText);
	Button btnSend = (Button)this.findViewById(R.id.btnSend);
	ThemeUtil.setSecondaryHeader(llHeaderBase);
	ThemeUtil.setContentBackground(lvDirectMessage);
	ThemeUtil.setListViewStyle(lvDirectMessage);
	ThemeUtil.setFooterAction(llFooterAction);
	ThemeUtil.setBtnActionPositive(btnSend);
	ThemeUtil.setEditText(etText);
	
	setBack2Top(lvDirectMessage);
	
	Intent intent = this.getIntent();
	user = (User)intent.getSerializableExtra("USER");
       if (user == null) {
       	return;
       }
       if (account == null) {
       	account = sheJiaoMao.getCurrentAccount();
       }

	adapter = new ConversationListAdapter(this, account, user);

	lvDirectMessage.setFastScrollEnabled(sheJiaoMao.isSliderEnabled());
	lvDirectMessage.setAdapter(adapter);
       lvDirectMessage.setOnItemClickListener(new ConversationItemClickListener(this));
       
	directMessageRecyclerListener = new DirectMessageRecyclerListener();
	lvDirectMessage.setRecyclerListener(directMessageRecyclerListener);

	TextView tvTitle = (TextView)this.findViewById(R.id.tvTitle);
	tvTitle.setText(user.getScreenName());
}