private void initViews() {
   myTitleBarHelper =
       new MyTitleBarHelper(this, getWindow().getDecorView().findViewById(android.R.id.content));
   myTitleBarHelper.setLeftImgVisible(false);
   myTitleBarHelper.resetState();
   myTitleBarHelper.setMiddleText("查询历史");
   myTitleBarHelper.setRightImgVisible(false);
   myTitleBarHelper.setLeftImag(R.mipmap.btn_back);
   refreshLayout_no_receive = (SwipeRefreshLayout) findViewById(R.id.swipe_no_receive_layout);
   refreshLayout_no_receive.setColorSchemeResources(R.color.repair_line_color);
   refreshLayout_received = (SwipeRefreshLayout) findViewById(R.id.swipe_received_layout);
   refreshLayout_received.setColorSchemeResources(R.color.repair_line_color);
   express_no_receive = (Button) findViewById(R.id.express_no_receive);
   btn_express_received = (Button) findViewById(R.id.btn_express_received);
   empty_list_view = (TextView) findViewById(R.id.empty_list_view);
   lv_no_receive = (ListView) findViewById(R.id.lv_no_receive);
   lv_no_receive.setEmptyView(empty_list_view);
   lv_received = (ListView) findViewById(R.id.lv_received);
   lv_received.setEmptyView(empty_list_view);
   footBar = LayoutInflater.from(this).inflate(R.layout.item_progressbar, null);
   lv_no_receive.addFooterView(footBar);
   lv_received.addFooterView(footBar);
   mFootBarView = new FootBarHelper(footBar, this);
   mFootBarView.hideFooter();
 }
 @Override
 public void addFooterView(View v, Object data, boolean isSelectable) {
   if (vExtraFooter != null) {
     removeFooterView(vExtraFooter);
     super.addFooterView(v, data, isSelectable);
     super.addFooterView(vExtraFooter);
   } else {
     super.addFooterView(v, data, isSelectable);
   }
 }
예제 #3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    Log.d(DEBUG_TAG, "AccountsActivity.onCreate is called");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.start);

    accountsActivity = this;
    accountsView = (ListView) findViewById(R.id.account_list_view);

    accountManager = new AccountManager(this);

    Button addAccount = new Button(this);
    addAccount.setText(R.string.add_account);

    Button skipAccount = new Button(this);
    skipAccount.setText(R.string.skip_account);

    accountsView.addFooterView(addAccount, null, true);
    accountsView.setFooterDividersEnabled(false);

    accountsView.addFooterView(skipAccount, null, true);
    accountsView.setFooterDividersEnabled(false);

    adapter = new AccountAdapter(this);
    accountsView.setAdapter(adapter);

    addAccount.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View btn) {
            new CreateAccountChoiceDialog().show(getSupportFragmentManager(), "Choose a server");
          }
        });

    skipAccount.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View btn) {
            // 无网的情况
            Account account = new Account(default_server, default_email, default_password);
            startFilesActivity(account);
          }
        });

    accountsView.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Account account = accounts.get(position);
            startFilesActivity(account);
          }
        });
    registerForContextMenu(accountsView);
  }
예제 #4
0
 protected void loadVista() {
   setContentView(R.layout.activity_chat);
   Bundle extras = getIntent().getExtras();
   final String value = extras.getString("user_id");
   TextView txtView = (TextView) findViewById(R.id.textView2);
   txtView.setText(value);
   data = new ArrayList<Mensaje>();
   adapter = new MensajeAdapter(this, R.layout.activity_chat_item, data);
   listView = (ListView) findViewById(R.id.chatlistView);
   View footer = (View) getLayoutInflater().inflate(R.layout.activity_chat_footer_row, null);
   listView.addFooterView(footer);
   enviarButton = (Button) findViewById(R.id.enviarButton);
   enviarButton.setOnClickListener(
       new Button.OnClickListener() {
         public void onClick(View v) {
           progressBar.show();
           String text = ((EditText) findViewById(R.id.txtTextoEnviar)).getText().toString();
           Mensaje mensaje = new Mensaje();
           mensaje.setIdUsuario(0);
           mensaje.setMessage(text);
           data.add(mensaje);
           adapter.notifyDataSetChanged();
           EnviarAsyncTask task = new EnviarAsyncTask();
           task.execute(new String[] {text, value});
         }
       });
   listView.setAdapter(adapter);
   registerReceiver(
       mHandleMessageReceiver,
       new IntentFilter("com.google.android.gcm.demo.app.DISPLAY_MESSAGE"));
 }
예제 #5
0
 protected void setAdapterTwo() {
   if (mListTwo.size() > 6) {
     mListTwo.remove(mListTwo.size() - 1);
   }
   mAdapterTwo =
       new MyAdapter(mListTwo, context) {
         @Override
         public View getView(int position, View convertView, ViewGroup parent) {
           View view = View.inflate(context, R.layout.layout_listview_text_item, null);
           TextView mTv = (TextView) view.findViewById(R.id.tv_item);
           mTv.setText(mListTwo.get(position));
           return view;
         }
       };
   mHistoryTwo.setAdapter(mAdapterTwo);
   if (mBoolean) {
     mHistoryTwo.addFooterView(mViewFooter);
     mBoolean = false;
   }
   mNosearch.setVisibility(View.GONE);
   mHistoryTwo.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           int mLastPosition = mHistoryTwo.getLastVisiblePosition();
           if (mLastPosition == position) {
             deleteTwo();
           } else {
             newStartInterface(RentActivity.class, "two", mListTwo.get(position));
           }
         }
       });
 }
예제 #6
0
 protected void setAdapterOne() {
   if (mListOne.size() > 6) {
     mListOne.remove(mListOne.size() - 1);
   }
   // Log.e("TAG", "mListOne===" + mListOne.size());
   mAdapterOne =
       new MyAdapter(mListOne, context) {
         @Override
         public View getView(int position, View convertView, ViewGroup parent) {
           View view = View.inflate(context, R.layout.layout_listview_text_item, null);
           TextView mTv = (TextView) view.findViewById(R.id.tv_item);
           mTv.setText(mListOne.get(position));
           return view;
         }
       };
   if (b) {
     mHistoryOne.addFooterView(mViewFooter);
     b = false;
   }
   mHistoryOne.setAdapter(mAdapterOne);
   mNosearch.setVisibility(View.GONE);
   mHistoryOne.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           int mLastPosition = mHistoryOne.getLastVisiblePosition();
           if (mLastPosition == position) {
             deleteOne();
           } else {
             newStartInterface(RetalActivity.class, "one", mListOne.get(position));
             // finish();
           }
         }
       });
 }
예제 #7
0
 // set the footer of the ListView with a ProgressBar in it
 public void setFooterView(int layoutId) {
   mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
   mListViewFooter = LayoutInflater.from(getContext()).inflate(layoutId, null, false);
   ensureListView();
   mListView.addFooterView(mListViewFooter);
   mListView.setFooterDividersEnabled(false);
 }
예제 #8
0
  public void setLoadingMore(boolean loading) {
    isLoading = loading;
    if (loading) {

      if (isRefreshing()) {
        return;
      }
      if (mListView.getFooterViewsCount() == 0) {
        mListView.addFooterView(mListViewFooter);
      }
      mListView.setSelection(mListView.getAdapter().getCount() - 1);
      showMaterialProgressBar();
      //            if (isRefreshing()) {
      //                setRefreshing(false);
      //            }
      //            if (mListView.getFooterViewsCount() == 0) {
      //                mListView.addFooterView(mListViewFooter);
      //                mListView.setSelection(mListView.getAdapter().getCount() - 1);
      //            } else {
      //                mListViewFooter.setVisibility(VISIBLE);
      //                showMaterialProgressBar();
      //                //mListView.addFooterView(mListViewFooter);
      //            }
    } else {
      //            if (mListView.getAdapter() instanceof HeaderViewListAdapter) {
      //                mListView.removeFooterView(mListViewFooter);
      //            } else {
      //                mListViewFooter.setVisibility(View.GONE);
      //            }
      mListView.removeFooterView(mListViewFooter);
      mYDown = 0;
      mLastY = 0;
    }
  }
예제 #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;
    onInflate(savedInstanceState);
    if (isFinishing()) return;
    Collection<String> groups;
    Collection<String> selected;
    if (savedInstanceState != null) {
      groups = savedInstanceState.getStringArrayList(SAVED_GROUPS);
      selected = savedInstanceState.getStringArrayList(SAVED_SELECTED);
    } else {
      groups = getInitialGroups();
      selected = getInitialSelected();
    }

    listView = getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listView.setOnItemClickListener(this);
    arrayAdapter =
        new ArrayAdapter<>(
            this, android.R.layout.simple_list_item_multiple_choice, new ArrayList<String>());
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.add_item, listView, false);
    ((TextView) view.findViewById(android.R.id.message)).setText(R.string.group_add);
    listView.addFooterView(view, null, true);
    setListAdapter(arrayAdapter);
    setGroups(groups, selected);
  }
예제 #10
0
 private void init() {
   // TODO Auto-generated method stub
   // 线性布局
   LinearLayout layout = new LinearLayout(this);
   // 设置布局 水平方向
   layout.setOrientation(LinearLayout.HORIZONTAL);
   // 进度条
   progressBar = new ProgressBar(this);
   // 进度条显示位置
   progressBar.setPadding(0, 0, 15, 0);
   // 把进度条加入到layout中
   layout.addView(progressBar, mLayoutParams);
   // 文本内容
   TextView textView = new TextView(this);
   textView.setText("加载中...");
   textView.setGravity(Gravity.CENTER_VERTICAL);
   // 把文本加入到layout中
   layout.addView(textView, FFlayoutParams);
   // 设置layout的重力方向,即对齐方式是
   layout.setGravity(Gravity.CENTER);
   // 设置ListView的页脚layout
   loadingLayout = new LinearLayout(this);
   loadingLayout.addView(layout, mLayoutParams);
   loadingLayout.setGravity(Gravity.CENTER);
   // 得到一个ListView用来显示条目
   listView = (ListView) findViewById(R.id.tv);
   // 添加到脚页显示
   listView.addFooterView(loadingLayout);
   // 给ListView添加适配器
   listView.setAdapter(adapter);
   // 给ListView注册滚动监听
   listView.setOnScrollListener(this);
 }
예제 #11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a new TodoListAdapter for this ListActivity's ListView
    mAdapter = new ToDoListAdapter(getApplicationContext());

    // Put divider between ToDoItems and FooterView
    ListView listView = getListView();

    listView.setFooterDividersEnabled(true);
    TextView footerView = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null);

    footerView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {

            log("Entered footerView.OnClickListener.onClick()");

            Intent intent = new Intent(ToDoManagerActivity.this, AddToDoActivity.class);
            startActivityForResult(intent, ADD_TODO_ITEM_REQUEST);
          }
        });

    listView.addFooterView(footerView);
    listView.setAdapter(mAdapter);
  }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle args) {
    View root = inflater.inflate(R.layout.fragment_aggregate_report, container, false);

    mProgressBar = (SmoothProgressBar) root.findViewById(R.id.progress_bar);
    mCategoriesList = (ListView) root.findViewById(R.id.categories_list_view);

    View header =
        inflater.inflate(R.layout.fragment_aggregate_report_header, mCategoriesList, false);
    View footer =
        inflater.inflate(R.layout.fragment_aggregate_report_footer, mCategoriesList, false);
    mOrgUnitButton = (CardTextViewButton) header.findViewById(R.id.unit_button);
    mDataSetButton = (CardTextViewButton) header.findViewById(R.id.dataset_button);
    mPeriodButton = (CardTextViewButton) header.findViewById(R.id.period_button);
    mButton = (CardDetailedButton) footer.findViewById(R.id.data_entry_button);

    mOrgUnitButton.setOnClickListener(this);
    mDataSetButton.setOnClickListener(this);
    mPeriodButton.setOnClickListener(this);
    mDataSetButton.setOnClickListener(this);

    mCategoriesList.addHeaderView(header, null, false);
    mCategoriesList.addFooterView(footer, null, false);

    return root;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_view);

    setTitle("ListView");

    final ListView listView = (ListView) findViewById(R.id.list_view);

    LayoutInflater layoutInflater = getLayoutInflater();

    View header = layoutInflater.inflate(R.layout.list_item_header_footer, null);
    View footer = layoutInflater.inflate(R.layout.list_item_header_footer, null);
    TextView txtHeaderTitle = (TextView) header.findViewById(R.id.txt_title);
    TextView txtFooterTitle = (TextView) footer.findViewById(R.id.txt_title);
    txtHeaderTitle.setText("THE HEADER!");
    txtFooterTitle.setText("THE FOOTER!");

    listView.addHeaderView(header);
    listView.addFooterView(footer);

    final SampleAdapter adapter = new SampleAdapter(this, R.id.txt_line1);
    listView.setAdapter(adapter);

    final List<String> sampleData = SampleData.generateSampleData();
    for (String data : sampleData) {
      adapter.add(data);
    }
  }
예제 #14
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Set title
    getDialog().setTitle(SUMMARY_TITLE);
    View v = inflater.inflate(R.layout.order_dialog, container, false);

    ListView list = (ListView) v.findViewById(R.id.summary_list);
    double totalPrice = getOrderSummary();

    SimpleAdapter adapter =
        new SimpleAdapter(
            getActivity(),
            mOrderSummary,
            R.layout.order_dialog_row,
            new String[] {"category", "items"},
            new int[] {R.id.category, R.id.items});
    View footer = inflater.inflate(R.layout.order_dialog_footer, null, false);
    list.addFooterView(footer);
    list.setAdapter(adapter);

    mTotalOrderPrice = (TextView) footer.findViewById(R.id.order_dialog_total_price);
    mTotalOrderPrice.setText("" + new DecimalFormat("#.##").format(totalPrice) + " RON");

    mBtnOrder = (Button) footer.findViewById(R.id.btn_order);
    mBtnOrder.setOnClickListener(this);
    mBtnCancel = (Button) footer.findViewById(R.id.btn_cancel);
    mBtnCancel.setOnClickListener(this);

    return v;
  }
예제 #15
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // Find Views
    mListView = (ListView) findViewById(R.id.listView1);
    /** 用mLinear做为load-progress的容器。 */
    LinearLayout mLinear = new LinearLayout(this);
    mLinear.setOrientation(LinearLayout.HORIZONTAL);
    mProgressBar = new ProgressBar(this);
    mProgressBar.setPadding(0, 0, 15, 0);
    mLinear.addView(mProgressBar, WClayoutParams);

    TextView textView = new TextView(this);
    textView.setText("加载中...");
    textView.setGravity(Gravity.CENTER_VERTICAL);
    mLinear.addView(textView, FFlayoutParams);

    mLinear.setGravity(Gravity.CENTER);

    registerForContextMenu(mListView);
    // 将load-progress加进ListView的最底行
    mListView.addFooterView(mLinear);
    mAdapter = new PageAdapter();
    mListView.setAdapter(mAdapter);
    mListView.setOnScrollListener(this);
  }
예제 #16
0
  /** 初始化控件 */
  private void initView() {
    listView = (ListView) this.findViewById(R.id.listview);

    // item数据
    List<DownloadFile> files = new ArrayList<DownloadFile>();
    DownloadFile file1 = new DownloadFile(getFileName(Constant.URL1), Constant.URL1);
    files.add(file1);
    DownloadFile file2 = new DownloadFile(getFileName(Constant.URL2), Constant.URL2);
    files.add(file2);

    LayoutInflater inflater = LayoutInflater.from(this);
    View footerView = inflater.inflate(R.layout.list_item_footeview, null);
    listView.addFooterView(footerView);

    adapter = new ListAdapter(this, files);
    listView.setAdapter(adapter);

    Button btn_manage = (Button) footerView.findViewById(R.id.btn_manage);
    btn_manage.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // 跳转到下载管理界面
            Intent intent = new Intent(MainActivity.this, DownloadManageActivity.class);
            startActivity(intent);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_hot, container, false);
    mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeRefresh);
    mSwipeRefreshLayout.setColorScheme(
        R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3, R.color.swipe_color_4);
    mSwipeRefreshLayout.setOnRefreshListener(this);

    mListView = (ListView) rootView.findViewById(R.id.listView);

    mLoadingFooter = new LoadingFooter(getActivity());
    mListView.addFooterView(mLoadingFooter.getView());

    mAdapter = new FavoriteAdapter(topics, getActivity());
    AnimationAdapter animationAdapter = new ItemAnimationAdapter(mAdapter);
    animationAdapter.setAbsListView(mListView);
    mListView.setAdapter(animationAdapter);

    type = getArguments().getString(ARG_TYPE_KEY);
    url = getArguments().getString(ARG_URL_KEY);

    loadData(1);
    return rootView;
  }
  @Override
  public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final ListView listView = getListView();
    final View loaderView =
        LayoutInflater.from(getActivity()).inflate(R.layout.list_item_loader, null);
    loaderView.setEnabled(false);
    loaderView.setClickable(false);
    loaderView.setFocusable(false);
    loaderView.setFocusableInTouchMode(false);

    addOnScrollListener(
        new OnScrollListener() {
          @Override
          public void onScrollStateChanged(final AbsListView view, final int scrollState) {}

          @Override
          public void onScroll(
              final AbsListView view,
              final int firstVisibleItem,
              final int visibleItemCount,
              final int totalItemCount) {
            final int lastInScreen = firstVisibleItem + visibleItemCount;
            if ((lastInScreen == totalItemCount) && listView.getAdapter() != null) {
              onLoadMoreItems();
            }
          }
        });

    listView.addFooterView(loaderView);
  }
 private void addFoot() {
   haveAddFoot = true;
   LayoutInflater inflater = LayoutInflater.from(this);
   LinearLayout llMore = (LinearLayout) inflater.inflate(R.layout.more_data_bar, null);
   pbMore = (ProgressBar) llMore.findViewById(R.id.pbMore);
   tvMore = (TextView) llMore.findViewById(R.id.tvMore);
   lv_base.addFooterView(llMore);
 }
 public void showLoadingFooter() {
   if (listFooter != null) {
     lvUser.removeFooterView(listFooter);
   }
   listFooter = getLayoutInflater().inflate(R.layout.list_item_loading, null);
   ThemeUtil.setListViewLoading(listFooter);
   lvUser.addFooterView(listFooter);
 }
  @Override
  public void addFooterView(View v, Object data, boolean isSelectable) {
    super.addFooterView(v, data, isSelectable);

    mFooterHeights.add(getViewHeight(v));

    mFootersTotalHeight += mFooterHeights.get(mFooterHeights.size() - 1);
  }
 public void setAdapter(ListAdapter adapter) {
   // make sure XListViewFooter is the last footer view, and only add once.
   if (mIsFooterReady == false) {
     mIsFooterReady = true;
     mListView.addFooterView(mFooterView);
   }
   mListView.setAdapter(adapter);
 }
 @Override
 public void addFooterView(View v) {
   super.addFooterView(v);
   if (footerViews == null) {
     footerViews = new ArrayList<View>();
   }
   footerViews.add(v);
 }
예제 #24
0
 @Test
 public void addFooterView_ShouldRecordHeaders() throws Exception {
   View view0 = new View(null);
   View view1 = new View(null);
   listView.addFooterView(view0);
   listView.addFooterView(view1);
   assertThat(shadowOf(listView).getFooterViews().get(0), sameInstance(view0));
   assertThat(shadowOf(listView).getFooterViews().get(1), sameInstance(view1));
 }
예제 #25
0
  @Override
  protected void onCreate(Bundle state) {
    super.onCreate(state);

    setContentView(R.layout.tile_picker);

    ListView list = (ListView) findViewById(R.id.tile_picker_tile_list);

    if (state != null && state.containsKey(TILE_ARRAY_BUNDLE_KEY)) {
      _tile_array = state.getStringArray(TILE_ARRAY_BUNDLE_KEY);

      if (_tile_array.length == 0) {
        _tile_array = Assets.apkListTiles(this);
      }
    } else {
      _tile_array = Assets.apkListTiles(this);
    }

    list.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = getIntent();
            i.putExtra(
                StyleEditorActivity.TILE_EXTRA,
                StyleData.DEFAULT_TILE_LOCATION_PREFIX + view.getTag().toString());
            setResult(Activity.RESULT_OK, i);
            finish();
          }
        });

    Button open_gallery = new Button(this);
    open_gallery.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(
                Intent.createChooser(intent, getString(R.string.tile_picker_open_gallery)),
                TILE_GALLERY_RESULT);
          }
        });

    open_gallery.setText(R.string.tile_picker_open_gallery);

    list.addFooterView(open_gallery);

    _adapter =
        new TilePickerAdapter(this); // Don't use array in the constructor to avoid caching problems
    list.setAdapter(_adapter);

    for (String tile : _tile_array) {
      _adapter.add(tile);
    }
  }
예제 #26
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    if (mainView == null) {
      Log.i(TAG, "Inflating view...");
      mainView = inflater.inflate(R.layout.activity_search_results_list, container, false);
      list = (ListView) mainView.findViewById(R.id.game_list);

      // LoadMore button
      moreResultsButton = new Button(a);
      moreResultsButton.setText("Load More");
      moreResultsButton.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
              RetrieveAdditionalResultsTask task =
                  new RetrieveAdditionalResultsTask(a, cache, searchResultsTask);
              task.execute();
            }
          });

      // Adding Load More button to listview at bottom
      list.addFooterView(moreResultsButton);

      // Click event for single list row
      list.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              Log.i(TAG, "onChildClick: position: " + position + " id: " + id);
              Game game = (Game) list.getAdapter().getItem(position);
              GameInfoFragment.setGame(game);
              Fragment gameFragment = new GameInfoFragment();
              FragmentTools.transitionToFragment(a, gameFragment, null);
            }
          });
      searchQuery = (TextView) mainView.findViewById(R.id.search_query);
      searchQuery.setVisibility(View.VISIBLE);

      if (savedInstanceState != null) {
        // restore previous state
        restoreInstanceState(savedInstanceState);
      }

      Log.i(TAG, "Current Query: " + query);

      if (query != null) {
        searchResultsTask = new RetrieveSearchResultsTask(this, list, cache, query);
        searchResultsTask.doPostExecute(TaskResult.TRUE); // set up everything
      }
    }

    return mainView;
  }
예제 #27
0
  private void initView() {
    // TODO Auto-generated method stub
    // ListVIew
    mAdapter = new SNoticeListAdapter(getActivity(), mList);
    // 填充listview头尾空间
    View view1 = new View(getActivity());
    view1.setMinimumHeight((int) getResources().getDimension(R.dimen.view_smallsmallsmall_margin));
    mNoticeListView.addHeaderView(view1);
    View view2 = new View(getActivity());
    view2.setMinimumHeight((int) getResources().getDimension(R.dimen.view_smallsmallsmall_margin));
    mNoticeListView.addFooterView(view2);

    mNoticeListView.setAdapter(mAdapter);

    // PullToRefreshView
    mPullToRefreshView.setOnHeaderRefreshListener(
        new OnHeaderRefreshListener() {

          @Override
          public void onHeaderRefresh(PullToRefreshView view) {
            // TODO Auto-generated method stub
            mCurrentPage = 0;
            postNoticeList();

            ((SystemMessageActivity) getActivity()).postUnreadNum();
          }
        });
    mPullToRefreshView.setOnFooterRefreshListener(
        new OnFooterRefreshListener() {

          @Override
          public void onFooterRefresh(PullToRefreshView view) {
            // TODO Auto-generated method stub
            postNoticeList();
            ((SystemMessageActivity) getActivity()).postUnreadNum();
          }
        });

    noticeService =
        new NoticeService(getActivity()) {

          @Override
          public void getBBSpaceDataFailure() {
            // TODO Auto-generated method stub
            mPullToRefreshView.onHeaderRefreshComplete();
            mPullToRefreshView.onFooterRefreshComplete();
            progress.setVisibility(View.GONE);
          }

          @Override
          public void getBBSpaceData(String content) {
            // TODO Auto-generated method stub
            parseSNoticeList(content);
          }
        };
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View contentView = inflater.inflate(R.layout.activity_list_outlets, null, false);
    mDrawerLayout.addView(contentView, 0);
    tempposition = (Integer) getIntent().getSerializableExtra("position");
    roomid = (Integer) getIntent().getSerializableExtra("roomid");
    connectionClass = new ConnectionClass();
    ImageView image = (ImageView) findViewById(R.id.listImage);

    MakeListData();
    ListView lv = (ListView) findViewById(R.id.listViewOutlets);
    FrameLayout addoutletfooter =
        (FrameLayout) getLayoutInflater().inflate(R.layout.addoutletfooter, null);
    (addoutletfooter.findViewById(R.id.btnAddOutlet))
        .setOnClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                gotoAddOutlet(v);
              }
            });
    addoutletfooter.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            gotoAddOutlet(v);
          }
        });
    Button addNewRoom = (Button) findViewById(R.id.btnAddRoom);
    TextView AddRoom = (TextView) findViewById(R.id.textViewAddRoom);
    final OutletListAdapter adapter = new OutletListAdapter(this, outlets);
    lv.addFooterView(addoutletfooter);
    lv.setAdapter(adapter);
    registerForContextMenu(lv);
    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            adapter.notifyDataSetChanged();
            adapter.setNotifyOnChange(true);

            // added by mathias
            int outletid = outlets.get(position).getId();

            Intent i = new Intent(ListOutlets.this, OutletDetails.class);
            i.putExtra("outlet_id", outletid);
            i.putExtra("room_id", roomid);
            startActivity(i);
          }
        });
  }
 @Override
 public void initComponents(View currentView) {
   articlesDataProvider = new IcmsArticlesDataProvider(getActivity());
   listArticle = (ListView) currentView.findViewById(R.id.icmsListArticle);
   listArticle.setDivider(null);
   listFooter = LayoutInflater.from(getActivity()).inflate(R.layout.ijoomer_list_footer, null);
   listArticle.addFooterView(listFooter, null, false);
   ID_ARRAY = new ArrayList<String>();
   androidAQuery = new AQuery(getActivity());
 }
예제 #30
0
 /** 展示搜索到的词书列表 */
 private void showResultList(SearchResultBooksInfo booksInfo) {
   mHasMeasured = false;
   ResultBooksAdapter resultBooksAdapter = new ResultBooksAdapter(this, booksInfo);
   if (mResultBooksListView.getFooterViewsCount() == 0) {
     mResultBooksListView.addFooterView(
         View.inflate(SearchActivity.this, R.layout.footer_search_result, null));
   }
   mResultBooksListView.setAdapter(resultBooksAdapter);
   mResultBooksCountTextView.setText(booksInfo.getBooksCount() + "条搜索结果");
 }