@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.aboutfrag3, container, false);
    ListView lv1 = (ListView) v.findViewById(R.id.listView1);
    ListView lv2 = (ListView) v.findViewById(R.id.listView2);
    Level weather_data[] =
        new Level[] {
          // new Level(R.drawable.sachin1,"                          Batting Statistics
          // ",R.drawable.play_button),
          new Level("ODI Matches:", "463"),
          new Level("ODI Runs", "18426"),
          new Level("ODI High Score", "200"),
          new Level("ODI Average", "44.83"),
          new Level("ODI Strike Rate", "86.23"),
          new Level("ODI 100s", "49"),
          new Level("ODI 50s", "96"),
          new Level("Test Matches", "198"),
          new Level("Test Runs", "15837"),
          new Level("Test High Score", "248"),
          new Level("Test Average", "53.87"),
          new Level("Test Strike Rate", "54.06"),
          new Level("Test 100s", "51"),
          new Level("Test 50s", "67")
        };
    Level weather_data2[] =
        new Level[] {
          new Level("ODI Matches", "463"),
          new Level("ODI Wickets", "154"),
          new Level("ODI Best", "5-32"),
          new Level("ODI Economy", "5.11"),
          new Level("Test Matches", "198"),
          new Level("Test Wickets", "45"),
          new Level("Test Best", "3-10"),
          new Level("Test Economy", "3.52")
        };
    LevelAdapter3 adapter = new LevelAdapter3(getActivity(), R.layout.list_item_new, weather_data);
    LevelAdapter3 adapter2 =
        new LevelAdapter3(getActivity(), R.layout.list_item_new, weather_data2);

    View header = inflater.inflate(R.layout.header2, null);
    // View header2 = inflater.inflate(R.layout.header, null);
    View header3 = inflater.inflate(R.layout.header3, null);
    lv1.addHeaderView(header);
    lv2.addHeaderView(header3);
    lv1.setAdapter(adapter);
    lv2.setAdapter(adapter2);
    Utility.setListViewHeightBasedOnChildren(lv1);
    Utility.setListViewHeightBasedOnChildren(lv2);
    return v;
  }
Example #2
0
  @SuppressWarnings("rawtypes")
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.hosts);

    HostsLoadAndSave hostFiles = new HostsLoadAndSave();
    intentToMain = new Intent(this, AndiXActivity.class);

    listView = (ListView) findViewById(R.id.listHosts);
    View header = (View) getLayoutInflater().inflate(R.layout.listview_header_row, null);
    listView.addHeaderView(header);

    if (hostFiles.loadData() == null) {
      adapterEmpty = new ArrayAdapter(this, R.layout.listview_item_row);
      listView.setAdapter(adapterEmpty);
    } else {

      adapterFill = new HostListAdapter(this, R.layout.listview_item_row, hostFiles.loadData());
      listView.setAdapter(adapterFill);
    }

    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position != 0) {
              HostAccount hostToConnect = (HostAccount) listView.getItemAtPosition(position);

              intentToMain.putExtra("hostToConnect", hostToConnect);
              startActivity(intentToMain);
            }
          }
        });
  }
  /**
   * Display Surah title in the header. We inflate the header layout and add the right details to
   * it. Font type is important to display Arabic Surah titles in the right form
   */
  private void displaySurahHeader() {
    Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/bsml.ttf");
    Cursor cur =
        db.rawQuery(
            "SELECT _id, surahNameChar FROM qSurah WHERE surahID = ?", new String[] {"" + surahID});
    cur.moveToFirst();
    String surahName = cur.getString(1);

    // Inflate header to add Surah title to the list view
    View header = getLayoutInflater().inflate(R.layout.display_surah_header, null);
    TextView surahtitle = (TextView) header.findViewById(R.id.surahNameDisplay);

    // set font type to textview and then set the text
    surahtitle.setTypeface(tf);
    surahtitle.setText(surahName + "\\");

    // Hide Besmellah in case of al-Tawbah Surah and al-Fatiha
    if (surahID == 9 || surahID == 1) {
      ImageView Besemallah = (ImageView) header.findViewById(R.id.SurahBismallah);
      Besemallah.setVisibility(View.GONE);
    }

    // get the list view and display the header
    ayahList.addHeaderView(header, null, false);
    return;
  }
Example #4
0
  public void updateOnBroadcast() {
    LinkedList<Tag> tagList = tags.getTags();

    if (getActivity() == null) return;

    if (tagList.size() > 0) {
      noTagsMsg.setVisibility(View.GONE);
    } else {
      noTagsMsg.setVisibility(View.VISIBLE);
    }

    if (tagListView.getAdapter() == null) {
      adapter = new TagListAdapter(getActivity(), tagList);

      // get and set an ad for the tag list
      LayoutInflater inflater = getActivity().getLayoutInflater();
      header = (ViewGroup) inflater.inflate(R.layout.ad_layout, tagListView, false);
      tagListView.addHeaderView(header, null, false);
      header.requestFocus();
      WebserviceClient.getAnAd(getActivity(), new AdRespHandler());

      tagListView.setAdapter(adapter);
    } else {
      adapter.updateAdapterContents(tagList);
    }
    // hide progress bar
    ((MainActivity) getActivity()).showProgBar(false);
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   mDrawerListView =
       (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
   View view = inflater.inflate(R.layout.activity_home, container, false);
   mDrawerListView.addHeaderView(view, container, false);
   mDrawerListView.setOnItemClickListener(
       new AdapterView.OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           selectItem(position);
         }
       });
   mDrawerListView.setAdapter(
       new ArrayAdapter<String>(
           getActionBar().getThemedContext(),
           android.R.layout.simple_list_item_activated_1,
           android.R.id.text1,
           new String[] {
             getString(R.string.title_section1),
             getString(R.string.title_section2),
             getString(R.string.title_section3),
             getString(R.string.title_section4),
             getString(R.string.title_section5)
           }));
   mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
   return mDrawerListView;
 }
Example #6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wall_comments);

    final ListView ListView = (ListView) findViewById(R.id.listView2);

    View profileHeader = getLayoutInflater().inflate(R.layout.wall_post, null);
    ListView.addHeaderView(profileHeader); // и используем в качестве Header"а

    final String id = getIntent().getExtras().getString("id");
    final String text = getIntent().getExtras().getString("text");
    final String like = getIntent().getExtras().getString("like");
    final String comment = getIntent().getExtras().getString("comment");
    final String repost = getIntent().getExtras().getString("repost");

    TextView textView9 = (TextView) profileHeader.findViewById(R.id.textView9);
    textView9.setText(text);

    TextView textView12 = (TextView) profileHeader.findViewById(R.id.textView12);
    textView12.setText(comment);

    TextView textView11 = (TextView) profileHeader.findViewById(R.id.textView11);
    textView11.setText(repost);

    TextView textView10 = (TextView) profileHeader.findViewById(R.id.textView10);
    textView10.setText(like);

    account.restore(this);
    if (account.access_token != null) {
      api = Api.get();
    } else {
      Toast.makeText(this, R.string.fail, Toast.LENGTH_LONG).show();
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_personal_info, container, false);
    mHeaderView = rootView.findViewById(R.id.header);
    mTopImageView = (ImageView) rootView.findViewById(R.id.theme_top_image);
    mTopImageView.setOnLongClickListener(this);
    displayThemeImages();
    mAvatarImage = (ImageView) rootView.findViewById(R.id.avatar_image);
    MiscUtils.showAvatarThumb(
        mAvatarManager,
        mSettingHelper.getAccountAvatarThumb(),
        mAvatarImage,
        R.drawable.contact_single);
    mAvatarImage.setOnClickListener(this);
    mListView = (ListView) rootView.findViewById(R.id.list);
    View listHeader = inflater.inflate(R.layout.personal_info_list_header, mListView, false);
    mListHeaderView = listHeader;
    mListView.addHeaderView(listHeader);
    mListView.setAdapter(mInfoAdapter);
    mListView.setOnItemClickListener(mInfoAdapter);
    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            ViewHelper.setTranslationY(
                mHeaderView, Math.max(-getScrollY(), -mHeaderView.getMeasuredHeight()));
          }
        });
    return rootView;
  }
 private static void addDetectedValueHeader(
     @NonNull ListView listView,
     @StringRes int labelRes,
     @NonNull String labelKey,
     @NonNull String labelValue,
     @NonNull String value,
     @NonNull Icon icon) {
   final TextView textView =
       (TextView)
           LayoutInflater.from(listView.getContext())
               .inflate(R.layout.edx_selectable_list_item, listView, false);
   {
     final SpannableString labelValueSpan = new SpannableString(labelValue);
     labelValueSpan.setSpan(
         new ForegroundColorSpan(
             listView.getResources().getColor(R.color.edx_grayscale_neutral_dark)),
         0,
         labelValueSpan.length(),
         Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
     textView.setText(
         ResourceUtil.getFormattedString(
             listView.getContext().getResources(), labelRes, labelKey, labelValueSpan));
   }
   Context context = textView.getContext();
   TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
       textView,
       new IconDrawable(context, icon)
           .sizeRes(context, R.dimen.edx_base)
           .colorRes(context, R.color.edx_grayscale_neutral_light),
       null,
       null,
       null);
   listView.addHeaderView(textView, new FormOption(labelValue, value), true);
 }
  private void addBlogSpinner(String[] blogNames) {
    LayoutInflater layoutInflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout spinnerWrapper =
        (LinearLayout) layoutInflater.inflate(R.layout.blog_spinner, null);

    spinnerWrapper.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (mBlogSpinner != null) {
              mBlogSpinner.performClick();
            }
          }
        });

    mBlogSpinner = (IcsSpinner) spinnerWrapper.findViewById(R.id.blog_spinner);
    mBlogSpinner.setOnItemSelectedListener(mItemSelectedListener);
    SpinnerAdapter mSpinnerAdapter =
        new ArrayAdapter<String>(
            getSupportActionBar().getThemedContext(),
            R.layout.sherlock_spinner_dropdown_item,
            blogNames);
    mBlogSpinner.setAdapter(mSpinnerAdapter);
    mListView.addHeaderView(spinnerWrapper);
  }
  private void init() {
    // 取得诸控件
    // initTopBarForLeft(good.getTitle());
    bar = (ActionBar) findViewById(R.id.headbar);
    bar.setTitleAndLeftButton(R.drawable.back, "详情");
    bar.setOnLeftButtonClickListener(
        new onLeftButtonClickListener() {

          @Override
          public void onClick() {
            finish();
          }
        });

    // btnchat = (Button) findViewById(R.id.chat);
    chat = (LinearLayout) findViewById(R.id.chat);
    comment = (LinearLayout) findViewById(R.id.ping);
    comment_text = (EditText) findViewById(R.id.good_pinglun);
    commentlist = (ListView) findViewById(R.id.pinglun);
    data = new ArrayList<Comment>();
    adapter = new GoodsCommentAdapter(getApplication(), data);
    commentlist.addHeaderView(createListHeadView());
    commentlist.setAdapter(adapter);
    nickname.setText(good.getUser().getNick()); // 昵称
    good_createtime.setText(good.getCreatedAt()); // 物品发表时间
    gallery.setAdapter(galleryAdpter = new GalleryAdpter(mApplication, good.getPicture()));
    user = good.getUser(); // 获得商品的发表用户
    goodTitle.setText(good.getTitle());
    goodPrice.setText("   ¥" + good.getPrice());
    goodContent.setText(good.getContent());
    head.setImageUrl(good.getUser().getAvatar());
    gridViewPic.setAdapter(new myAdapter(this, good.getPicture()));
    getComment();
  }
 private void setAdapter(String subcategory) {
   BaseAdapter adapter = null;
   boolean addHeaderView =
       false; // You can request list view header by setting this variable to true
   String title = "";
   if (subcategory.equals(ANIMALS_CATEGORY)) {
     adapter =
         new ImageGalleryCategoryAdapter(
             this, DummyContent.getImageGalleryAnimalCategories(), false);
     addHeaderView = true;
     title = ANIMALS_CATEGORY;
   } else if (subcategory.equals(MUSIC_CATEGORY)) {
     adapter =
         new ImageGalleryCategoryAdapter(
             this, DummyContent.getImageGalleryMusicCategories(), true);
     addHeaderView = false;
     title = MUSIC_CATEGORY;
   }
   if (addHeaderView) {
     View headerView =
         getLayoutInflater().inflate(R.layout.header_image_gallery, mListView, false);
     ((TextView) headerView.findViewById(R.id.header_title)).setText(title);
     mListView.addHeaderView(headerView);
   } else {
     setTitle(title);
   }
   mListView.setAdapter(adapter);
 }
  @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
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_list_view, container, false);
    mListView = (ListView) view.findViewById(R.id.listview);
    View placeHolderView = inflater.inflate(R.layout.header_placeholder, mListView, false);
    mListView.addHeaderView(placeHolderView);

    mPosition = getArguments().getInt(ARG_POSITION);

    setAdapter();

    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (mScrollTabHolder != null) {
              mScrollTabHolder.onListViewScroll(
                  view, firstVisibleItem, visibleItemCount, totalItemCount, mPosition);
            }
          }
        });

    return view;
  }
Example #14
0
  private void action_man() {
    nav_drawer = (ListView) findViewById(R.id.list_view_nav_drawer);
    String[] list = {
      "Devotional", "Publications", "Praise Reports", "Notifications", "About", "Log Out"
    };
    content = new FeaturedAdapterListNav(this, pictures, list);
    View v = getLayoutInflater().inflate(R.layout.header, null);
    nav_drawer.addHeaderView(v);
    nav_drawer.setAdapter(content);

    name = (TextView) v.findViewById(R.id.usernameprofile);
    emailadd = (TextView) v.findViewById(R.id.emailaddressprofile);
    imgView = (ImageView) v.findViewById(R.id.profilepicturea);
    name.setText(username1);
    emailadd.setText(email_address1);
    Picasso.with(this)
        .load("http://www.samuelagbede.com/coza_social/pictures/ic_launcher.png")
        .into(imgView);

    nav_drawer.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            displayFragment(position);
          }
        });
  }
Example #15
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.movie_fragment_vp, container, false);
    Bundle bundle = getArguments();
    int i = bundle.getInt("id");
    lv = (ListView) view.findViewById(R.id.movie_list);

    ;
    final View head = inflater.inflate(R.layout.movie_listhead, null);
    lv.addHeaderView(head);
    HttpUtils.getResult(
        url + i,
        new StringGetData() {
          @Override
          public void getStringData(String s) {
            list = ParseJson.getListItem(s);
            Movie_List_Adapter adapter = new Movie_List_Adapter(getActivity(), list);
            lv.setAdapter(adapter);
            initHead(head);
          }
        });

    return view;
  }
Example #16
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    context = getActivity();
    listview_bottom = (ListView) view.findViewById(R.id.listview_bottom);
    header = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.viewpager, null);
    viewPager1 = (ViewPager) header.findViewById(R.id.viewpager1);
    listview_bottom.addHeaderView(header);

    Thread thread = new Thread(new MyRunable(list));
    thread.start();

    listview_bottom.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(context, ContentActivity.class);
            intent.putExtra("contentUrl", list.get(position).getContentUrl());
            context.startActivity(intent);
          }
        });
  }
  private void initViews(View view) {
    lvProfile = (ListView) view.findViewById(R.id.lvProfile);

    View header =
        ((Activity) context).getLayoutInflater().inflate(R.layout.cell_profile_header, null);
    lvProfile.addHeaderView(header);
  }
Example #18
0
  @Override
  protected final ListView createRefreshableView(Context context, AttributeSet attrs) {
    ListView lv = new InternalListView(context, attrs);

    // Get Styles from attrs
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PullToRefresh);

    // Create Loading Views ready for use later
    FrameLayout frame = new FrameLayout(context);
    mHeaderLoadingView = new LoadingLayout(context, Mode.PULL_DOWN_TO_REFRESH, a);
    frame.addView(
        mHeaderLoadingView,
        FrameLayout.LayoutParams.MATCH_PARENT,
        FrameLayout.LayoutParams.WRAP_CONTENT);
    mHeaderLoadingView.setVisibility(View.GONE);
    lv.addHeaderView(frame, null, false);

    mLvFooterLoadingFrame = new FrameLayout(context);
    mFooterLoadingView = new LoadingLayout(context, Mode.PULL_UP_TO_REFRESH, a);
    mLvFooterLoadingFrame.addView(
        mFooterLoadingView,
        FrameLayout.LayoutParams.MATCH_PARENT,
        FrameLayout.LayoutParams.WRAP_CONTENT);
    mFooterLoadingView.setVisibility(View.GONE);

    a.recycle();

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
  }
Example #19
0
  private void addHeader() {
    View viewauth = View.inflate(DetailActivity.this, R.layout.authinfo, null);
    ImageView imageView = (ImageView) viewauth.findViewById(R.id.imageView);
    TextView tv_author_name = (TextView) viewauth.findViewById(R.id.tv_author_name);
    TextView tv_author_date = (TextView) viewauth.findViewById(R.id.tv_author_date);
    TextView tv_reply = (TextView) viewauth.findViewById(R.id.tv_reply);
    TextView tv_title = (TextView) viewauth.findViewById(R.id.tv_title);
    TextView tv_content = (TextView) viewauth.findViewById(R.id.tv_content);

    loader.displayImage("http:" + topic.member.avatar_large, imageView);
    imageView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            anotherActivity(topic.member.username);
          }
        });
    tv_author_name.setText(topic.member.username);
    String beforeLong = TimeUtils.getStandardDate(topic.created + "");
    tv_author_date.setText(beforeLong);
    tv_reply.setText(topic.replies + "个回复");
    tv_title.setText(topic.title);
    tv_content.setText(topic.content);

    linkiFy(tv_content);

    listView.addHeaderView(viewauth);
  }
  @Override
  protected void banderDataAndListner() {
    Glide.with(this)
        .load(CommonCache.get().getImageUrl(childTypeId))
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .into(imageView);
    mListView.addHeaderView(imageView);
    articleListAdapter = new ArticleListAdapter(articleList, getActivity());
    mListView.setAdapter(articleListAdapter);

    mPullToRefreshLayout.setOnRefreshListener(
        new PullToRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
            page = 1;
            getArticleListByNet();
          }

          @Override
          public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
            getArticleListByNet();
          }
        });

    mPullToRefreshLayout.setHfBackgroundColor(CommonCache.get().getColorByType(childTypeId));
  }
  private void createListView() {
    root = (FrameLayout) inflater.inflate(R.layout.qrh__listview_container, null);
    root.addView(content);

    listView.getViewTreeObserver().addOnGlobalLayoutListener(this);
    ListViewScrollObserver observer = new ListViewScrollObserver(listView);
    // listView.setOnScrollListener(this);
    observer.setOnScrollUpAndDownListener(
        new OnListViewScrollListener() {
          @Override
          public void onScrollUpDownChanged(int delta, int scrollPosition, boolean exact) {
            onNewScroll(delta);
            snap(headerTop == scrollPosition);
          }

          @Override
          public void onScrollIdle() {
            QuickReturnHeaderHelper.this.onScrollIdle();
          }
        });

    root.addView(realHeader, realHeaderLayoutParams);

    dummyHeader = new View(context);
    AbsListView.LayoutParams params =
        new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, headerHeight);
    dummyHeader.setLayoutParams(params);
    listView.addHeaderView(dummyHeader);
  }
Example #22
0
  public void doShortcut() {

    setContentView(R.layout.activity_setup_widget);
    setupAppBar(R.id.toolbar, "New shortcut", true, true);
    header = getLayoutInflater().inflate(R.layout.shortcut_header, null);
    ListView list = (ListView) findViewById(R.id.subs);

    list.addHeaderView(header);

    final ArrayList<String> sorted = UserSubscriptions.getSubscriptionsForShortcut(Shortcut.this);
    final SubChooseAdapter adapter =
        new SubChooseAdapter(this, sorted, UserSubscriptions.getAllSubreddits(this));
    list.setAdapter(adapter);

    (header.findViewById(R.id.sort)).clearFocus();
    ((EditText) header.findViewById(R.id.sort))
        .addTextChangedListener(
            new TextWatcher() {
              @Override
              public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

              @Override
              public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

              @Override
              public void afterTextChanged(Editable editable) {
                final String result = editable.toString();
                adapter.getFilter().filter(result);
              }
            });
  }
  /**
   * method to populate one menu list
   *
   * @param menuList
   * @param listTitle
   * @param menuNames
   * @param menuIcons
   */
  private ListView setupList(String listTitle, String[] menuNames, int[] menuIcons) {
    SimpleAdapter menuAdapter = new SimpleAdapter(getActivity());
    for (int i = 0; i < menuNames.length; i++) {
      listObject menuObject = new listObject();
      menuObject.setText(menuNames[i]);
      menuObject.setResID(menuIcons[i]);
      menuAdapter.add(menuObject);
    }

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    View headerview = layoutInflater.inflate(R.layout.sliding_menu_list_header, null);
    TextView listHeaderName = (TextView) headerview.findViewById(R.id.sliding_menu_list_name);
    listHeaderName.setTypeface(font);
    listHeaderName.setText(listTitle);
    ListView menuList = new ListView(parentActivity);
    menuList.setLayoutParams(params);

    int sizeInPx = 10;
    float scale = getResources().getDisplayMetrics().density;
    int sizeInDp = (int) (sizeInPx * scale + 0.5f);
    menuList.setPadding(sizeInDp, 0, sizeInDp, 0);
    // menuList.setPadding(R.dimen.list_padding, 0, R.dimen.list_padding, 0);

    menuList.addHeaderView(headerview);
    menuList.setAdapter(menuAdapter);
    listRoot.addView(menuList, params);
    return menuList;
  }
  @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);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (DEBUG_LIFECYCLE) logger.debug("onCreateView()");
    View v = inflater.inflate(R.layout.chatview_main, container, false);

    uiLines = (ListView) v.findViewById(R.id.chatview_lines);
    uiInput = (EditText) v.findViewById(R.id.chatview_input);
    uiSend = (ImageButton) v.findViewById(R.id.chatview_send);
    uiTab = (ImageButton) v.findViewById(R.id.chatview_tab);

    uiSend.setOnClickListener(this);
    uiTab.setOnClickListener(this);
    uiInput.setOnKeyListener(this); // listen for hardware keyboard
    uiInput.addTextChangedListener(
        this); // listen for software keyboard through watching input box text
    uiInput.setOnEditorActionListener(
        this); // listen for software keyboard's “send” click. see onEditorAction()

    uiLines.setFocusable(false);
    uiLines.setFocusableInTouchMode(false);

    CopyPaste cp = new CopyPaste(activity, uiInput);
    uiInput.setOnLongClickListener(cp);
    uiLines.setOnItemLongClickListener(cp);

    uiMore = (ViewGroup) inflater.inflate(R.layout.more_button, null);
    uiMoreButton = (Button) uiMore.findViewById(R.id.button_more);
    uiMoreButton.setOnClickListener(this);
    uiLines.addHeaderView(uiMore);
    status = Buffer.LINES.CAN_FETCH_MORE;

    online = true;
    return v;
  }
Example #26
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(tag, "onCreate");
    SharedPreferences settings = getSharedPreferences("PREFS", 0);
    Boolean r = settings.getBoolean("firstRun", false);
    if (r == false) {
      Log.i(tag, "Run firstRun");
      firstRun();
    } else {

      setContentView(R.layout.main);

      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      uName = prefs.getString("userName", "user");
      TextView w = (TextView) findViewById(R.id.welcomeText);
      w.setText(
          getResources().getString(R.string.hello)
              + " "
              + uName
              + getResources().getString(R.string.hello2));
      Log.i(tag, "Set name in welcome message to" + " " + uName);

      Log.i(tag, "Set up ListView");

      Devs devs_data[] =
          new Devs[] {
            new Devs(
                R.drawable.dev_scar45, getResources().getString(R.string.scar45), "Motto here"),
            new Devs(
                R.drawable.dev_remicks, getResources().getString(R.string.remicks), "Motto here"),
            new Devs(
                R.drawable.dev_cr5315,
                getResources().getString(R.string.cr5315),
                "I won\'t eat until when I\'m explode"),
            new Devs(
                R.drawable.dev_sixstringsg,
                getResources().getString(R.string.sixstringsg),
                "Motto here")
          };

      DevsAdapter adapter = new DevsAdapter(this, R.layout.listitem, devs_data);

      ListView listView = (ListView) findViewById(R.id.listView1);

      View header = (View) getLayoutInflater().inflate(R.layout.listheader, null);

      listView.addHeaderView(header);

      listView.setAdapter(adapter);

      listView.setOnItemClickListener(
          new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

              devClick(position);
            }
          });
    }
  }
Example #27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.city_list);

    mCityLit = (ListView) findViewById(R.id.city_list);
    // mCityLit.setmHeaderViewVisible(true);
    //        mCityLit.setPinnedHeaderView(this, R.layout.title,
    //                R.id.contactitem_catalog);
    letterListView = (MyLetterListView) findViewById(R.id.cityLetterListView);
    DBManager dbManager = new DBManager(this);
    dbManager.openDateBase();
    dbManager.closeDatabase();
    database =
        SQLiteDatabase.openOrCreateDatabase(DBManager.DB_PATH + "/" + DBManager.DB_NAME, null);
    Log.e("x", "存储路径=" + DBManager.DB_PATH + "/" + DBManager.DB_NAME);
    mCityNames = getCityNames();
    database.close();
    letterListView.setOnTouchingLetterChangedListener(new LetterListViewListener());
    alphaIndexer = new HashMap<String, Integer>();
    handler = new Handler();
    overlayThread = new OverlayThread();
    initOverlay();

    mCityLit.addHeaderView(getHeadView());

    setAdapter(mCityNames);
    mCityLit.setOnItemClickListener(new CityListOnItemClick());
  }
  @Override
  public void addHeaderView(View v, Object data, boolean isSelectable) {
    super.addHeaderView(v, data, isSelectable);

    mHeaderHeights.add(getViewHeight(v));

    mHeadersTotalHeight += mHeaderHeights.get(mHeaderHeights.size() - 1);
  }
  private void addHeadView() {
    View viewHead = getLayoutInflater().inflate(R.layout.settings_item_imagecenter, null);
    imageUser = (ImageView) viewHead.findViewById(R.id.imageUser);

    user = MyApplication.getUser();
    ImageDownloader.getInstance().download(user.getUser_image(), imageUser);
    mListView.addHeaderView(viewHead);
  }
Example #30
0
 private void inDrawerLayout() {
   drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
   View view = getLayoutInflater().inflate(R.layout.activity_drower_head, null);
   drawerList = (ListView) findViewById(R.id.left_drawer);
   drawerList.addHeaderView(view);
   drawerList.setAdapter(new LtAdapter());
   drawerList.setOnItemClickListener(this);
   initialDrawerListener();
 }