com.handmark.pulltorefresh.library.PullToRefreshListView Java Examples

The following examples show how to use com.handmark.pulltorefresh.library.PullToRefreshListView. 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: PullToRefreshListActivity.java    From effective_android_sample with Apache License 2.0 6 votes vote down vote up
/**
 *  Activity生成時にシステムから呼ばれる
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ptr_list);

    // レイアウトからカスタムリストビューを取得
    mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);

    // リストを引っ張ったときの処理を記述
    mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            new GetDataTask().execute();
        }
    });

    // リストビューにアイテム追加
    mItemList = new LinkedList<String>();
    mItemList.addAll(Arrays.asList(INITIAL_LIST));
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemList);
    ListView actualListView = mPullRefreshListView.getRefreshableView();
    actualListView.setAdapter(mAdapter);
}
 
Example #2
Source File: HomePage.java    From fanfouapp-opensource with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化并添加四个页面的ListView
 */
private void setListViews() {
    final LayoutInflater inflater = LayoutInflater.from(this);
    for (int i = 0; i < this.views.length; i++) {
        this.views[i] = (PullToRefreshListView) inflater.inflate(
                R.layout.ptr_list, null);
        this.views[i].setOnRefreshListener(this);
        this.listViews[i] = this.views[i].getRefreshableView();
        this.listViews[i].setOnItemClickListener(this);
        if (i != 2) {
            this.listViews[i].setOnItemLongClickListener(this);
        }
        if (i == 3) {
            this.views[i].setMode(Mode.PULL_FROM_START);
        }
    }
}
 
Example #3
Source File: DailyNoteListActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void initView() {
    actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
    setNewActionBar(actionBar);
    setActionBarTitle(R.string.atom_ui_note_title_notebook);
    setActionBarRightText(R.string.atom_ui_btn_note_new);
    setActionBarRightTextClick(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showNoteDialogDialog();
        }
    });

    notelist_listview = (PullToRefreshListView) findViewById(R.id.note_listview);
    adapter = new DailyNoteListAdapter(this, dailyMindMains, R.layout.atom_ui_item_note);
    notelist_listview.getRefreshableView().setAdapter(adapter);
    notelist_listview.getRefreshableView().setOnItemClickListener(this);
    notelist_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_END);
    notelist_listview.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            showEditDialog(adapter.getItem(i-1));
            return true;
        }
    });
}
 
Example #4
Source File: TreeListViewAdapter.java    From imsdk-android with MIT License 5 votes vote down vote up
/**
 * @param mTree
 * @param context
 * @throws IllegalArgumentException
 * @throws IllegalAccessException
 */
public TreeListViewAdapter(final PullToRefreshListView mTree, Context context) throws IllegalArgumentException,
        IllegalAccessException {
    mContext = context;
    defaultMargin = Utils.dipToPixels(mContext, 16);
    mInflater = LayoutInflater.from(context);

    mTree.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {
            if (position == 1) {
                return;
            }
            Node clkNode = mNodes.get(position - 1);
            if (clkNode.isRoot()) {
                clkNode.setExpand(!clkNode.isExpand());
                expandOrCollapse(position - 1);
                mTree.getRefreshableView().setSelection(position - 1);
            }
            if (onTreeNodeClickListener != null) {
                onTreeNodeClickListener.onClick(clkNode,
                        position);
            }
        }

    });

}
 
Example #5
Source File: MyNewsfeedFragment.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
/**
 * A method which initializes all of our members pointing to layout {@link android.view.View View}s.
 * @param viewGroup  The {@link android.view.ViewGroup ViewGroup} representing this {@link android.support.v4.app.Fragment Fragment}'s screen.
 */
private void initUIConfig(ViewGroup viewGroup) {
   mUsername = (TextView)viewGroup.findViewById(R.id.myNewsFeedFragment_userName);
   mUserProfilePicture = (ProfilePictureView) viewGroup.findViewById(R.id.com_dhsoftware_android_myNewsfeedFragment_userProfilePicture);
   mUserLoginButton = (LoginButton) viewGroup.findViewById(R.id.com_dhsoftware_android_myNewsFeedFragment_userLoginButton);
   // we need this permission to access the user's Newsfeed
   mUserLoginButton.setReadPermissions(Arrays.asList("read_stream"));
   mUserNewsfeed = (PullToRefreshListView) viewGroup.findViewById(R.id.myNewsfeedFragment_userNewsfeed);
   mUserNewsfeed.setAdapter(mAdapter);
   mUserNewsfeed.setOnRefreshListener(mRefreshListener);
}
 
Example #6
Source File: PostListFragment.java    From Broadsheet.ie-Android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = super.onCreateView(inflater, container, savedInstanceState);

    // Get original ListView and Frame
    ListView originalLv = (ListView) layout.findViewById(android.R.id.list);
    ViewGroup frame = (ViewGroup) originalLv.getParent();

    // Remove old ListView
    frame.removeView(originalLv);

    // Create new PullToRefreshListView and add to Frame
    mPullRefreshListView = new PullToRefreshListView(getActivity());
    frame.addView(mPullRefreshListView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            fetchPosts(null);
        }
    });

    boolean pauseOnScroll = false;
    boolean pauseOnFling = true;
    PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll,
            pauseOnFling);
    mPullRefreshListView.setOnScrollListener(listener);

    return layout;
}
 
Example #7
Source File: UserListPage.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
private void setLayout() {
    setContentView(R.layout.list_users);

    setActionBar();

    this.mEmptyView = (ViewGroup) findViewById(R.id.empty);

    this.mEditText = (EditText) findViewById(R.id.choose_input);
    this.mEditText.addTextChangedListener(new MyTextWatcher());

    this.mPullToRefreshListView = (PullToRefreshListView) findViewById(R.id.list);
    this.mPullToRefreshListView.setOnRefreshListener(this);
    this.mListView = this.mPullToRefreshListView.getRefreshableView();

    this.mCursorAdapter = new UserCursorAdapter(this.mContext, this.mCursor);
    this.mCursorAdapter.setFilterQueryProvider(this);

    this.mListView.setOnItemClickListener(this);
    this.mListView.setAdapter(this.mCursorAdapter);
    registerForContextMenu(this.mListView);

    this.mListView.post(new Runnable() {

        @Override
        public void run() {
            UserListPage.this.mListView.setSelection(1);
        }
    });
}
 
Example #8
Source File: BaseTimelineActivity.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
private void setLayout() {
    setContentView(R.layout.list_ptr);
    setActionBar();
    this.mEmptyView = (ViewGroup) findViewById(R.id.empty);
    this.mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.list);
    this.mPullRefreshListView.setOnRefreshListener(this);
    this.mListView = this.mPullRefreshListView.getRefreshableView();
    this.mListView.setOnItemLongClickListener(this);
    this.mListView.setOnItemClickListener(this);
    this.mListView.setAdapter(this.mCursorAdapter);
}
 
Example #9
Source File: AndroidPullToRefreshSampleActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_android_pull_to_refresh_sample);
    final PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.list_view);
    listView.setMode(Mode.PULL_FROM_START);
    final List<String> items = new ArrayList<String>() {
        private static final long serialVersionUID = 1L;
        {
            this.add("red");
            this.add("yellow");
            this.add("green");
        }
    };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, android.R.id.text1, items);
    listView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
            // リスト更新処理。一般的には通信処理や、データベースアクセスをする為別スレッドで実行する。
            // ここではHandlerを使って1秒後にリストを更新する様にしている。
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    items.add("No." + (items.size() + 1));
                    refreshView.onRefreshComplete();
                }
            }, 1000);
        }
    });
    listView.setAdapter(adapter);
}
 
Example #10
Source File: CustomListFragment.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View page = inflater.inflate(R.layout.fragment_list, container, false);
    Bundle args = getArguments();
    int fragmentIndex = args.getInt(ADAPTER_INDEX);
    PullToRefreshListView listView = getListView(page);
    ListAdapter adapter = getListAdapter(fragmentIndex);
    listView.setAdapter(adapter);
    listView.setOnScrollListener(this);
    listView.setOnRefreshListener(this);
    listView.setMode(getRefreshMode());
    return page;
}
 
Example #11
Source File: UserListFragment.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View page = inflater.inflate(R.layout.fragment_userlist, container, false);
    PullToRefreshListView listView = getListView(page);
    UserListListAdapter adapter = getListAdapter((MainActivity) getActivity());
    listView.setAdapter(adapter);
    listView.setOnScrollListener(this);
    listView.setOnRefreshListener(this);
    listView.setMode(getRefreshMode());
    ImageButton buttonUserLists = getUserListsButton(page);
    buttonUserLists.setOnClickListener(this);
    textListName = getTextListName(page);
    textListName.setText(adapter.getListFullName());
    return page;
}
 
Example #12
Source File: VideosFilesScanTask.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
public VideosFilesScanTask(Context context, ArrayList<String> listItem, TextView emptyNoteView,
           PullToRefreshListView pullRefreshListView, ListAdapter adapter) {
	mContext = context;
	mListItem = listItem;
	mPullRefreshListView = pullRefreshListView;
	mAdapter = adapter;
	mEmptyNoteTextView = emptyNoteView;
}
 
Example #13
Source File: GifProductsScanTask.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
public GifProductsScanTask(Context context, ArrayList<String> listItem, TextView emptyNoteView,
		                  PullToRefreshListView pullRefreshListView, GifProductsListAdapter adapter, boolean simulate) {
	mContext = context;
	mListItem = listItem;
	mPullRefreshListView = pullRefreshListView;
	mAdapter = adapter;
	mEmptyNoteTextView = emptyNoteView;
	mSimulateSleepThread = simulate;
}
 
Example #14
Source File: DeptFragment.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.atom_ui_fragment_contacts, container, false);
    pullToRefreshView = (PullToRefreshListView) view.findViewById(R.id.pull_to_refresh_listview);
    empty = (TextView) view.findViewById(R.id.empty);
    initViews();
    return view;
}
 
Example #15
Source File: AllChatRankFragment.java    From Social with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.all_chat_rank_fragment_lalyout, container, false);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_CHAT_RANK:
                    handleCharRank(msg);
                    break;
            }
        }
    };

    listView = (PullToRefreshListView)view.findViewById(R.id.id_all_chat_rank_fg_listview);

    listView.setMode(PullToRefreshBase.Mode.BOTH);
    listView.getLoadingLayoutProxy(false, true).setPullLabel(
            getString(R.string.pull_to_load));
    listView.getLoadingLayoutProxy(false, true).setRefreshingLabel(
            getString(R.string.loading));
    listView.getLoadingLayoutProxy(false, true).setReleaseLabel(
            getString(R.string.release_to_load));
    listView.setOnRefreshListener(this);
    listView.setOnItemClickListener(this);

    list_chat_rank_item = new ArrayList<>();

    listView.setVisibility(View.GONE);

    return view;
}
 
Example #16
Source File: LocalChatRecordActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.atom_ui_activity_local_chat_record);
    recors_of_chat = (PullToRefreshListView) findViewById(R.id.recors_of_chat);
    injectExtras();
    if (fromCloud) {
        localChatRecordPresenter = new ShowSearchDetailsPresenter();
    } else {
        localChatRecordPresenter = new LocalChatRecordPresenter();
    }
    localChatRecordPresenter.setLocalChatRecordView(this);
    iniViews();
}
 
Example #17
Source File: ChatroomInvitationActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void bindViews() {

        hlv_selected_contacts = (com.qunar.im.ui.view.HorizontalListView) findViewById(R.id.hlv_selected_contacts);
        lv_all_contacts = (com.handmark.pulltorefresh.library.PullToRefreshListView) findViewById(R.id.lv_all_contacts);
        btn_create = (TextView) findViewById(R.id.btn_create);
        search_panel = (LinearLayout) findViewById(R.id.search_panel);
        lv_search_contacts = (ListView) findViewById(R.id.lv_search_contacts);
        btn_create.setOnClickListener(this);
    }
 
Example #18
Source File: CustomListFragment.java    From SmileEssence with MIT License 4 votes vote down vote up
protected PullToRefreshListView getListView(View page) {
    return (PullToRefreshListView) page.findViewById(R.id.fragment_list_listview);
}
 
Example #19
Source File: SimpleTreeAdapter.java    From imsdk-android with MIT License 4 votes vote down vote up
public SimpleTreeAdapter(PullToRefreshListView mTree, Context context) throws IllegalArgumentException,
        IllegalAccessException {
    super(mTree, context);
    mContext = context;
}
 
Example #20
Source File: InviteTreeAdapter.java    From imsdk-android with MIT License 4 votes vote down vote up
public InviteTreeAdapter(PullToRefreshListView mTree, Context context, ChatroomInvitationActivity.ICheckboxClickedListener checkboxClickedListener) throws IllegalArgumentException,
        IllegalAccessException {
    super(mTree, context);
    mContext = context;
    mCheckboxClickedListener = checkboxClickedListener;
}
 
Example #21
Source File: PullToRefreshCustomActivity.java    From effective_android_sample with Apache License 2.0 4 votes vote down vote up
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ptr_list);

    mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);

    // Set a listener to be invoked when the list should be refreshed.
    mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        // ひっぱりきって指をはなしたとき?
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            String label = DateUtils.formatDateTime(getApplicationContext(),
                    System.currentTimeMillis(),
                    DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE
                            | DateUtils.FORMAT_ABBREV_ALL);

            // Update the LastUpdatedLabel
            refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);

            // Do work to refresh the list here.
            new GetDataTask().execute();
        }
    });

    /**
     * customize
     */
    mPullRefreshListView.setMode(Mode.BOTH);

    // LoadingLayoutに関してカスタマイズ(主に文言)
    ILoadingLayout iLoadingLayout = mPullRefreshListView.getLoadingLayoutProxy(true, true);
    iLoadingLayout.setLastUpdatedLabel("");
    iLoadingLayout.setReleaseLabel("離してください、更新します");
    iLoadingLayout.setPullLabel("さらに下に引いて下さい");
    iLoadingLayout.setRefreshingLabel("更新中です");

    // Add an end-of-list listener
    mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {

        @Override
        public void onLastItemVisible() {
            Toast.makeText(PullToRefreshCustomActivity.this, "End of List!", Toast.LENGTH_SHORT)
                    .show();
        }
    });

    /**
     *  リスト表示
     */
    mIemsList = new LinkedList<String>();
    mIemsList.addAll(Arrays.asList(INITIAL_LIST));
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mIemsList);

    ListView actualListView = mPullRefreshListView.getRefreshableView();
    actualListView.setAdapter(mAdapter);
}
 
Example #22
Source File: PbChatActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
/**
     * 绑定View
     */
    protected void bindViews() {
        edit_region = (LinearLayout) findViewById(R.id.edit_region);
        left_btn = (IconView) findViewById(R.id.left_btn);
        voice_switch_btn = (IconView) findViewById(R.id.voice_switch_btn);
        voice_prompt = (TextView) findViewById(R.id.voice_prompt);
        input_container = (LinearLayout) findViewById(R.id.input_container);
        total_bottom_layout = (LinearLayout) findViewById(R.id.total_bottom_layout);
        atom_bottom_frame = (RelativeLayout) findViewById(R.id.atom_bottom_frame);
        edit_msg = (EmojiconEditText) findViewById(R.id.edit_msg);
        tv_options_btn = (IconView) findViewById(R.id.tv_options_btn);
        send_btn = (TextView) findViewById(R.id.send_btn);

        chating_view = (RelativeLayout) findViewById(R.id.chating_view);
        chat_region = (com.handmark.pulltorefresh.library.PullToRefreshListView) findViewById(R.id.chat_region);
        new_msg_prompt = (TextView) findViewById(R.id.new_msg_prompt);//更新消息条目数有关
        emotion_btn = (IconView) findViewById(R.id.tv_emojicon);
        outter_msg_prompt = (LinearLayout) findViewById(R.id.outter_msg_prompt);
        outter_msg = (TextView) findViewById(R.id.outter_msg);

        emoticonRainView = (EmoticonRainView) findViewById(R.id.emoticonRainView);


        no_prompt = (TextView) findViewById(R.id.no_prompt);
        close_prompt = (TextView) findViewById(R.id.close_prompt);
        relativeLayout = (KPSwitchRootLinearLayout) findViewById(R.id.resizelayout);
//        line = findViewById(line);
        new_msg_prompt.setOnClickListener(this);

        tv_options_btn.setOnClickListener(this);
        left_btn.setOnClickListener(this);
        voice_switch_btn.setOnClickListener(this);
        send_btn.setOnClickListener(this);
        emotion_btn.setOnClickListener(this);
        edit_msg.setOnFocusChangeListener(this);
        no_prompt.setOnClickListener(this);
        close_prompt.setOnClickListener(this);
        outter_msg.setOnClickListener(this);
        chating_view.setOnClickListener(this);
        qtNewActionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
        setNewActionBar(qtNewActionBar);

        mPanelRoot = (KPSwitchPanelLinearLayout) findViewById(R.id.panel_root);
        linearlayout_tab = (OperationView) findViewById(R.id.linearlayout_tab);
        record = (RecordView) findViewById(R.id.record);
        linearlayout_tab2 = (LinearLayout) findViewById(R.id.linearlayout_tab2);
        atom_bottom_more = (LinearLayout) findViewById(R.id.atom_bottom_more);
        faceView = (EmotionLayout) findViewById(R.id.faceView);
        quickreply_tab = (LinearLayout) findViewById(R.id.quickreply_tab);
        quickReplyLayout = (QuickReplyLayout) findViewById(R.id.quickreplyView);

        shareMessgeBtn = (ImageView) findViewById(R.id.txt_share_message);
        deleteMessageBtn = (ImageView) findViewById(R.id.txt_del_msgs);
        collectMsgBtn = (ImageView) findViewById(R.id.txt_collect_msg);
        emailMsgBtn = (ImageView) findViewById(R.id.txt_email_msg);

        atom_ui_refence_layout = (LinearLayout) findViewById(R.id.atom_ui_refence_layout);
        atom_ui_refence_text = (TextView) findViewById(R.id.atom_ui_refence_text);
        atom_ui_refence_close = (ImageView) findViewById(R.id.atom_ui_refence_close);
        atom_ui_refence_close.setOnClickListener((view)-> {
            refrenceString = "";
            atom_ui_refence_text.setText("");
            atom_ui_refence_layout.setVisibility(View.GONE);
        });

        shareMessgeBtn.setOnClickListener(this);
        deleteMessageBtn.setOnClickListener(this);
        emailMsgBtn.setOnClickListener(this);
        collectMsgBtn.setOnClickListener(this);

        //+号图标下更多更能设置为不可见
        linearlayout_tab.setVisibility(View.GONE);
        //+号下疑似视频功能设置为不可见
        linearlayout_tab2.setVisibility(View.GONE);

        addEvents();


    }
 
Example #23
Source File: AtListActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
private void bindViews()
{
    menber_of_chatroom_at = (PullToRefreshListView) findViewById(R.id.menber_of_chatroom_at);
}
 
Example #24
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_ptr_list);

	mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);

	// Set a listener to be invoked when the list should be refreshed.
	mPullRefreshListView
			.setOnRefreshListener(new OnRefreshListener<ListView>() {
				@Override
				public void onRefresh(
						PullToRefreshBase<ListView> refreshView) {
					String label = DateUtils.formatDateTime(
							getApplicationContext(),
							System.currentTimeMillis(),
							DateUtils.FORMAT_SHOW_TIME
									| DateUtils.FORMAT_SHOW_DATE
									| DateUtils.FORMAT_ABBREV_ALL);

					// Update the LastUpdatedLabel
					refreshView.getLoadingLayoutProxy()
							.setLastUpdatedLabel(label);

					// Do work to refresh the list here.
					new GetDataTask().execute();
				}
			});

	// Add an end-of-list listener
	mPullRefreshListView
			.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {

				@Override
				public void onLastItemVisible() {
					Toast.makeText(MainActivity.this, "End of List!",
							Toast.LENGTH_SHORT).show();
				}
			});

	ListView actualListView = mPullRefreshListView.getRefreshableView();

	// Need to use the Actual ListView when registering for Context Menu
	registerForContextMenu(actualListView);

	mListItems = new LinkedList<String>();
	mListItems.addAll(Arrays.asList(mStrings));

	mAdapter = new ArrayAdapter<String>(this,
			android.R.layout.simple_list_item_1, mListItems);
	// You can also just use setListAdapter(mAdapter) or
	// mPullRefreshListView.setAdapter(mAdapter)
	actualListView.setAdapter(mAdapter);
}
 
Example #25
Source File: CloudChatRecordActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
private void bindViews()
{
    recors_of_chat = (PullToRefreshListView) findViewById(R.id.recors_of_chat);
}
 
Example #26
Source File: CameraListActivity.java    From Viewer with Apache License 2.0 4 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.camera_list);
		mUserInfo = UserInfo.getUserInfo(this);
		mLayoutInflater = LayoutInflater.from(this);
		mUserLayout = (DrawerLayout) findViewById(R.id.user_layout);
		mCameraListView = (PullToRefreshListView) findViewById(R.id.cameraList);
		mCameraListView.setOnRefreshListener(this);
		
		findViewById(R.id.help).setOnClickListener(this);
		findViewById(R.id.feedback).setOnClickListener(this);
		findViewById(R.id.about).setOnClickListener(this);
		findViewById(R.id.disclaimer).setOnClickListener(this);
		findViewById(R.id.business).setOnClickListener(this);
		Button logout = (Button) findViewById(R.id.logout);
		logout.setOnClickListener(this);
		if(!mUserInfo.isLogin) logout.setVisibility(View.INVISIBLE);
		
		TextView userNameView = (TextView) findViewById(R.id.user_name);
		String name = getResources().getString(R.string.not_login);
		userNameView.setText(StringUtils.isEmpty(mUserInfo.name) ? name : mUserInfo.name);
//		mToolbar = (Toolbar) findViewById(R.id.toolbar);
//		mToolbar.setTitle(R.string.app_name);
//		setSupportActionBar(mToolbar);
//		mToolbar.setOnMenuItemClickListener(this);
//		mToolbar.setNavigationIcon(R.drawable.navigation_icon);
//		mToolbar.setNavigationOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				if(!mUserLayout.isDrawerOpen(Gravity.LEFT))
//					mUserLayout.openDrawer(Gravity.LEFT);
//			}
//		});
		
		mViewer = Viewer.getViewer();
		mMyViewerHelper = MyViewerHelper.getInstance(getApplicationContext());
		mMyViewerHelper.addCameraStateListener(this);
		mCameraDefaulThumb = BitmapFactory.decodeResource(getResources(), R.drawable.avs_type_android);
		
		mCameraInfoManager = new CameraInfoManager(this);
		mCameraInfos = mMyViewerHelper.getAllCameraInfos();
		for (CameraInfo info : mCameraInfos) {
			addStreamer(info.getCid(), info.getCameraUser(), info.getCameraPwd());
		}
		mCameraListAdapter = new CameraListAdapter(this, mCameraInfos);
		mCameraListView.setAdapter(mCameraListAdapter);
		mCameraListView.setOnItemClickListener(this);
//        mCameraListView.setOnScrollChangeListener(new OnScrollChangeListener() {
//            
//            @Override
//            public void onScrollChange(View v, int scrollX, int scrollY,
//                    int oldScrollX, int oldScrollY) {
//                mCameraListAdapter.closeAllItems();
//            }
//        });

		mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());
		
		mCameraListHandler = new CameraListHandler(this, mHandler);
		mCameraListHandler.doThing(CameraListHandler.SYNC_CID_REQUEST);
		mAddCidHandler = new AddCidHandler(this, mHandler);
		mEditCidHandler = new EditCidHandler(this, mHandler);
		
		//update
		UmengUpdateAgent.setUpdateOnlyWifi(false);
		UmengUpdateAgent.update(this);
		findViewById(R.id.back_linlayout).setOnClickListener(this);
		findViewById(R.id.titlebar_back_image).setBackgroundResource(R.drawable.navigation_icon);
		titlebar_back_text = (TextView) findViewById(R.id.titlebar_back_text);
		titlebar_back_text.setText(R.string.app_name);
		titlebar_opt_image = (ImageView) findViewById(R.id.titlebar_opt_image);
		titlebar_opt_image.setBackgroundResource(R.drawable.add_icon);//(getResources().getDrawable(R.drawable.add_icon));
		findViewById(R.id.opt_linlayout).setOnClickListener(this);
		add_layout = (LinearLayout) findViewById(R.id.add_layout);
//		findViewById(R.id.add_cid).setOnClickListener(this);
//		findViewById(R.id.add_cid_by_qr).setOnClickListener(this);
	}
 
Example #27
Source File: SearchChatingActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
private void bindViews() {
    emptyView = (TextView) findViewById(R.id.emptyView);
    search_result = (com.handmark.pulltorefresh.library.PullToRefreshListView) findViewById(R.id.search_result);
}
 
Example #28
Source File: SearchFragment.java    From SmileEssence with MIT License 4 votes vote down vote up
@Override
protected PullToRefreshListView getListView(View page) {
    return (PullToRefreshListView) page.findViewById(R.id.listview_search);
}
 
Example #29
Source File: UserListFragment.java    From SmileEssence with MIT License 4 votes vote down vote up
@Override
protected PullToRefreshListView getListView(View page) {
    return (PullToRefreshListView) page.findViewById(R.id.listview_userlist);
}
 
Example #30
Source File: UserDetailDialogFragment.java    From SmileEssence with MIT License 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MainActivity activity = (MainActivity) getActivity();
    View v = activity.getLayoutInflater().inflate(R.layout.dialog_user_detail, null);
    View menu = v.findViewById(R.id.imageview_user_detail_menu);
    menu.setOnClickListener(this);
    textViewScreenName = (TextView) v.findViewById(R.id.textview_user_detail_screenname);
    textViewScreenName.setOnClickListener(this);
    textViewName = (TextView) v.findViewById(R.id.textview_user_detail_name);
    textViewURL = (TextView) v.findViewById(R.id.textview_user_detail_url);
    textViewLocate = (TextView) v.findViewById(R.id.textview_user_detail_locate);
    textViewFollowed = (TextView) v.findViewById(R.id.textview_user_detail_followed);
    textViewProtected = (TextView) v.findViewById(R.id.texttview_user_detail_protected);
    textViewDescription = (TextView) v.findViewById(R.id.textview_user_detail_description);
    textViewTweetCount = (TextView) v.findViewById(R.id.textview_user_detail_tweet_count);
    textViewTweetCount.setOnClickListener(this);
    textViewFriendCount = (TextView) v.findViewById(R.id.textview_user_detail_friend_count);
    textViewFriendCount.setOnClickListener(this);
    textViewFollowerCount = (TextView) v.findViewById(R.id.textview_user_detail_follower_count);
    textViewFollowerCount.setOnClickListener(this);
    textViewFavoriteCount = (TextView) v.findViewById(R.id.textview_user_detail_favorite_count);
    textViewFavoriteCount.setOnClickListener(this);
    imageViewIcon = (NetworkImageView) v.findViewById(R.id.imageview_user_detail_icon);
    imageViewIcon.setOnClickListener(this);
    imageViewHeader = (NetworkImageView) v.findViewById(R.id.imageview_user_detail_header);
    buttonFollow = (Button) v.findViewById(R.id.button_user_detail_follow);
    buttonFollow.setOnClickListener(this);
    listViewTimeline = (PullToRefreshListView) v.findViewById(R.id.listview_user_detail_timeline);

    tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
    tabHost.setup();
    TabHost.TabSpec tab1 = tabHost.newTabSpec("tab1").setContent(R.id.tab1).setIndicator(getString(R.string.user_detail_tab_info));
    tabHost.addTab(tab1);
    TabHost.TabSpec tab2 = tabHost.newTabSpec("tab2").setContent(R.id.tab2).setIndicator(getString(R.string.user_detail_tab_timeline));
    tabHost.addTab(tab2);
    tabHost.setCurrentTab(0);

    final Account account = activity.getAccount();
    final Consumer consumer = activity.getConsumer();
    final Twitter twitter = TwitterApi.getTwitter(consumer, account);

    TwitterUtils.tryGetUser(twitter, account, getUserID(), new TwitterUtils.UserCallback() {
        @Override
        public void success(User user) {
            try {
                initUserData(user, twitter, account);
            } catch (Exception e) {
                Logger.error(e);
                error();
            }
        }

        @Override
        public void error() {
            dismiss();
        }
    });
    return new AlertDialog.Builder(activity)
            .setView(v)
            .setCancelable(true)
            .create();
}