コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO 自動生成されたメソッド・スタブ
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    // コンポーネントの関連付け
    layout = (RelativeLayout) this.findViewById(R.id.main_layout);
    listView = (ListView) this.findViewById(R.id.listView1);

    // リストビューのスクロールキャッシュ無効(色がおかしくなるので)
    listView.setScrollingCacheEnabled(false);

    // リスナーの設定
    listView.setOnItemClickListener(this);

    // アダプター作成
    adapter = new TaskArrayAdapter(this, setItem());

    // リストビューに項目データ(アダプタ)をセット
    listView.setAdapter(adapter);

    // 何もタスクが無いのなら新規作成のダイアログが開く
    int i = 0;
    editText = new EditText(this);
    editText.setInputType(InputType.TYPE_CLASS_TEXT);
    for (int j = 0; j < 10; j++) {
      i += adapter.getList().get(j).getTask().length();
      if (j == 9 && i == 0) {
        showYesDialog(
            ListActivity.this, "何かタスクを作ってみよう", "あなたがよく行う習慣を登録して時間を計りましょう", editText, this, 1);
        break;
      }
    }
  }
コード例 #2
0
ファイル: FolderList.java プロジェクト: fernandocoello/k-9
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.folder_list);
    mListView = getListView();
    mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
    mListView.setLongClickable(true);
    mListView.setFastScrollEnabled(true);
    mListView.setScrollingCacheEnabled(true);
    mListView.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onOpenFolder(((FolderInfoHolder) mAdapter.getItem(id)).name);
          }
        });
    registerForContextMenu(mListView);

    mListView.setSaveEnabled(true);

    mInflater = getLayoutInflater();

    onNewIntent(getIntent());

    context = this;
  }
コード例 #3
0
  @Override
  protected void onBindDialogView(View view) {
    super.onBindDialogView(view);
    lv = (ListView) view.findViewById(R.id.appsList);
    lv.setOnItemClickListener(this);
    lv.setFastScrollEnabled(true);
    lv.setFadingEdgeLength(1);
    lv.setDivider(null);
    lv.setDividerHeight(0);
    lv.setScrollingCacheEnabled(false);
    pb = (ProgressBar) view.findViewById(R.id.progressBar);
    if (isSearch) {
      search = (EditText) view.findViewById(R.id.searchApp);
      search.setVisibility(View.VISIBLE);
      createList();
      search.addTextChangedListener(
          new TextWatcher() {

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
              appListAdapter.getFilter().filter(s);
            }

            @Override
            public void afterTextChanged(Editable s) {}
          });
    } else {
      createList();
    }
  }
コード例 #4
0
  private void initView(LayoutInflater inflater) {
    mDialogView = inflater.inflate(R.layout.renren_dialog_layout, null);
    mContentView = mDialogView.findViewById(R.id.renren_dialog_content_layout);
    mButtonView = mDialogView.findViewById(R.id.button_view);
    mTitleView = (TextView) mDialogView.findViewById(R.id.renren_dialog_title_view);
    mMessageView = (TextView) mDialogView.findViewById(R.id.renren_dialog_message_view);
    mEditText = (SearchEditText) mDialogView.findViewById(R.id.renren_dialog_edit_text);
    mCheckView = mDialogView.findViewById(R.id.renren_dialog_check_layout);
    mCheckBox = (CheckBox) mDialogView.findViewById(R.id.renren_dialog_check_box);
    mCheckMessageView = (TextView) mDialogView.findViewById(R.id.renren_dialog_check_message_view);
    mCancelBtn = (Button) mDialogView.findViewById(R.id.renren_dialog_cancel_btn);
    mOkBtn = (Button) mDialogView.findViewById(R.id.renren_dialog_ok_btn);

    mBtnDivider = mDialogView.findViewById(R.id.renren_dialog_btn_divider);
    mDiliver = mDialogView.findViewById(R.id.renren_dialog_divider);
    mListView = (ListView) mDialogView.findViewById(R.id.renren_dialog_list_view);
    mListView.setVerticalFadingEdgeEnabled(false);
    mListView.setScrollingCacheEnabled(false);
    mListView.setCacheColorHint(0);

    mEditText.setIsShowLeftIcon(false);
    mCancelBtn.setOnClickListener(
        new android.view.View.OnClickListener() {

          @Override
          public void onClick(View v) {
            AppMethods.hideSoftInputMethods(mEditText);
            dismiss();
            if (mNegativeBtnClickListener != null) {
              mNegativeBtnClickListener.onClick(v);
            }
            if (mNegativeBinderOnClickListener != null && mBinder != null) {
              mNegativeBinderOnClickListener.OnClick(v, mBinder);
            }
          }
        });

    mOkBtn.setOnClickListener(
        new android.view.View.OnClickListener() {

          @Override
          public void onClick(View v) {
            AppMethods.hideSoftInputMethods(mEditText);
            dismiss();
            if (mPositiveBtnClickListener != null) {
              mPositiveBtnClickListener.onClick(v);
            }
            if (mPositiveBinderOnClickListener != null && mBinder != null) {
              mPositiveBinderOnClickListener.OnClick(v, mBinder);
            }
          }
        });
  }
コード例 #5
0
ファイル: Friends.java プロジェクト: ksrpraneeth/blood
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onActivityCreated(savedInstanceState);
   list = getListView();
   list.setScrollingCacheEnabled(true);
   list.setFastScrollEnabled(true);
   ContactsFetch fetch = new ContactsFetch(getActivity());
   fetch.execute();
   ContactNames = fetch.getContactNames();
   PhoneNumber = fetch.getPhoneNumbers();
   list.setAdapter(new CustomListAdapter(getActivity(), ContactNames, PhoneNumber));
 }
コード例 #6
0
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   MainUi.BtnStatus sta = _mainui.new BtnStatus();
   sta.visible = View.INVISIBLE;
   sta.text = "их╗п";
   _mainui.setLeft(sta);
   sta.visible = View.VISIBLE;
   sta.text = "╩ж┐Р";
   _mainui.setRight(sta);
   mListView = new ListView(this.getActivity());
   mListView.setOnItemClickListener(this);
   mListView.setScrollingCacheEnabled(false);
   BookHistory history = new BookHistory(this.getActivity());
   BookAdapter adapter = new BookAdapter(this.getActivity(), history.getHistory());
   mListView.setAdapter(adapter);
   return mListView;
 }
コード例 #7
0
  @Override
  public void loadMain() {
    ResponseList<Status> result = null;
    List<ListItem> list = new ArrayList<ListItem>();

    //
    ListItem AD = getMessageItem(getAD());
    list.add(AD);

    try {
      result = getTwitter().getUserListStatuses(lid, new Paging(1));
    } catch (Exception e) {
      errorHandling(e);
    }

    if (result == null || result.isEmpty()) {
      String comment = "NO DATA";
      if (!myAdapter.getItem(myAdapter.getCount() - 1).comment.equals(comment)) {
        myAdapter.add(getMessageItem(comment));
      }
    } else {

      for (Status tweet : result) {
        ListItem item1 = toListItem(tweet);
        list.add(item1);

        downloadIdList.add("" + item1.id);
      }

      //
      itemMessLoading = getMessageItem("Loading...");
      list.add(itemMessLoading);

      itemEmpty = getMessageItem("");
      list.add(itemEmpty);

      adapter = new ListItemAdapter(activity, 0, list, R.layout.list_item10, true);

      listView = (ListView) activity.findViewById(R.id.ListView01);
      ((AdapterView<ListAdapter>) listView).setAdapter(adapter);

      listView.setScrollingCacheEnabled(false);
      listView.setSelection(0);

      if (!BaseActivity.fast) {
        listView.setOnItemLongClickListener(
            new AdapterView.OnItemLongClickListener() {
              public boolean onItemLongClick(
                  AdapterView<?> parent, View view, int position, long id) {
                final ListItem item = (ListItem) listView.getItemAtPosition(position);
                ArrayList<String> entries = getEntries(activity, item);

                if (entries.size() > 0) {
                  final String[] ITEM = toArray(entries);
                  new AlertDialog.Builder(activity)
                      .setTitle("")
                      .setItems(
                          ITEM,
                          new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                              controlTag(activity, ITEM, which, item);
                            }
                          })
                      .create()
                      .show();
                }

                return true;
              }
            });
      }

      listView.setOnScrollListener(
          new OnScrollListener() {
            private boolean doing;

            @Override
            public void onScroll(
                AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
              try {
                if (firstVisibleItem + visibleItemCount == totalItemCount) {
                  Log.d(TAG, "LASTTTTTTTTTTTTT");

                  //
                  if (doing) return;
                  doing = true;

                  //
                  myAdapter = (ListItemAdapter) view.getAdapter();

                  if (!myAdapter
                      .getItem(myAdapter.getCount() - 1)
                      .comment
                      .equals("NO DATA")) { // NO DATA

                    mHandler.post(
                        new Runnable() {
                          @Override
                          public void run() {
                            paging.setPage(paging.getPage() + 1);

                            myAdapter.remove(itemMessLoading);
                            myAdapter.remove(itemEmpty);

                            ResponseList<Status> result = null;

                            try {
                              result = getTwitter().getUserListStatuses(lid, paging);
                            } catch (Exception e) {
                              errorHandling(e);
                            }

                            if (result == null || result.isEmpty()) {
                              String comment = "NO DATA";
                              if (!myAdapter
                                  .getItem(myAdapter.getCount() - 1)
                                  .comment
                                  .equals(comment)) {
                                myAdapter.add(getMessageItem(comment));
                              }
                            } else {
                              for (Status tweet : result) {
                                ListItem item1 = toListItem(tweet);

                                if (!downloadIdList.contains("" + item1.id)) { //
                                  myAdapter.add(item1);
                                  downloadIdList.add("" + item1.id);
                                }
                              }

                              myAdapter.add(itemMessLoading);
                              myAdapter.add(itemEmpty);
                            }

                            //
                            doing = false;
                          }
                        });
                  }
                }
              } catch (Throwable t) {
              }
            }

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {}
          });
    }
  }
コード例 #8
0
  @SuppressWarnings("unchecked")
  @Override
  public View createView(Context context) {
    actionBar.setBackgroundColor(0xff333333);
    actionBar.setItemsBackground(R.drawable.bar_selector_picker);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setActionBarMenuOnItemClick(
        new ActionBar.ActionBarMenuOnItemClick() {
          @Override
          public void onItemClick(int id) {
            if (id == -1) {
              if (Build.VERSION.SDK_INT < 11) {
                listView.setAdapter(null);
                listView = null;
                listAdapter = null;
              }
              finishFragment();
            } else if (id == 1) {
              if (delegate != null) {
                finishFragment(false);
                delegate.startPhotoSelectActivity();
              }
            } else if (id == item_photos) {
              if (selectedMode == 0) {
                return;
              }
              selectedMode = 0;
              dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
              emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
              listAdapter.notifyDataSetChanged();
            } else if (id == item_video) {
              if (selectedMode == 1) {
                return;
              }
              selectedMode = 1;
              dropDown.setText(LocaleController.getString("PickerVideo", R.string.PickerVideo));
              emptyView.setText(LocaleController.getString("NoVideo", R.string.NoVideo));
              listAdapter.notifyDataSetChanged();
            }
          }
        });

    ActionBarMenu menu = actionBar.createMenu();
    menu.addItem(1, R.drawable.ic_ab_other);

    fragmentView = new FrameLayout(context);

    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(0xff000000);

    if (!singlePhoto) {
      selectedMode = 0;

      dropDownContainer = new ActionBarMenuItem(context, menu, R.drawable.bar_selector_picker);
      dropDownContainer.setSubMenuOpenSide(1);
      dropDownContainer.addSubItem(
          item_photos, LocaleController.getString("PickerPhotos", R.string.PickerPhotos), 0);
      dropDownContainer.addSubItem(
          item_video, LocaleController.getString("PickerVideo", R.string.PickerVideo), 0);
      actionBar.addView(dropDownContainer);
      FrameLayout.LayoutParams layoutParams =
          (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
      layoutParams.height = LayoutHelper.MATCH_PARENT;
      layoutParams.width = LayoutHelper.WRAP_CONTENT;
      layoutParams.rightMargin = AndroidUtilities.dp(40);
      layoutParams.leftMargin =
          AndroidUtilities.isTablet() ? AndroidUtilities.dp(64) : AndroidUtilities.dp(56);
      layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
      dropDownContainer.setLayoutParams(layoutParams);
      dropDownContainer.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              dropDownContainer.toggleSubMenu();
            }
          });

      dropDown = new TextView(context);
      dropDown.setGravity(Gravity.LEFT);
      dropDown.setSingleLine(true);
      dropDown.setLines(1);
      dropDown.setMaxLines(1);
      dropDown.setEllipsize(TextUtils.TruncateAt.END);
      dropDown.setTextColor(0xffffffff);
      dropDown.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
      dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
      dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
      dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
      dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
      dropDownContainer.addView(dropDown);
      layoutParams = (FrameLayout.LayoutParams) dropDown.getLayoutParams();
      layoutParams.width = LayoutHelper.WRAP_CONTENT;
      layoutParams.height = LayoutHelper.WRAP_CONTENT;
      layoutParams.leftMargin = AndroidUtilities.dp(16);
      layoutParams.gravity = Gravity.CENTER_VERTICAL;
      dropDown.setLayoutParams(layoutParams);
    } else {
      actionBar.setTitle(LocaleController.getString("Gallery", R.string.Gallery));
    }

    listView = new ListView(context);
    listView.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), AndroidUtilities.dp(4));
    listView.setClipToPadding(false);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setVerticalScrollBarEnabled(false);
    listView.setSelector(new ColorDrawable(0));
    listView.setDividerHeight(0);
    listView.setDivider(null);
    listView.setDrawingCacheEnabled(false);
    listView.setScrollingCacheEnabled(false);
    frameLayout.addView(listView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    listView.setLayoutParams(layoutParams);
    listView.setAdapter(listAdapter = new ListAdapter(context));
    AndroidUtilities.setListViewEdgeEffectColor(listView, 0xff333333);

    emptyView = new TextView(context);
    emptyView.setTextColor(0xff808080);
    emptyView.setTextSize(20);
    emptyView.setGravity(Gravity.CENTER);
    emptyView.setVisibility(View.GONE);
    emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
    frameLayout.addView(emptyView);
    layoutParams = (FrameLayout.LayoutParams) emptyView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    emptyView.setLayoutParams(layoutParams);
    emptyView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    progressView = new FrameLayout(context);
    progressView.setVisibility(View.GONE);
    frameLayout.addView(progressView);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    progressView.setLayoutParams(layoutParams);

    ProgressBar progressBar = new ProgressBar(context);
    progressView.addView(progressBar);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.WRAP_CONTENT;
    layoutParams.height = LayoutHelper.WRAP_CONTENT;
    layoutParams.gravity = Gravity.CENTER;
    progressView.setLayoutParams(layoutParams);

    pickerBottomLayout = new PickerBottomLayout(context);
    frameLayout.addView(pickerBottomLayout);
    layoutParams = (FrameLayout.LayoutParams) pickerBottomLayout.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = AndroidUtilities.dp(48);
    layoutParams.gravity = Gravity.BOTTOM;
    pickerBottomLayout.setLayoutParams(layoutParams);
    pickerBottomLayout.cancelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            finishFragment();
          }
        });
    pickerBottomLayout.doneButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            sendSelectedPhotos();
            finishFragment();
          }
        });

    if (loading && (albumsSorted == null || albumsSorted != null && albumsSorted.isEmpty())) {
      progressView.setVisibility(View.VISIBLE);
      listView.setEmptyView(null);
    } else {
      progressView.setVisibility(View.GONE);
      listView.setEmptyView(emptyView);
    }
    pickerBottomLayout.updateSelectedCount(selectedPhotos.size() + selectedWebPhotos.size(), true);

    return fragmentView;
  }
コード例 #9
0
  /**
   * Creates a new ListView component.
   *
   * @param container container that the component will be placed in
   */
  public ListView(ComponentContainer container) {
    super(container);
    this.container = container;
    items = YailList.makeEmptyList();
    // initialize selectionIndex which also sets selection
    SelectionIndex(0);
    view = new android.widget.ListView(container.$context());
    view.setOnItemClickListener(this);
    view.setChoiceMode(android.widget.ListView.CHOICE_MODE_SINGLE);
    view.setScrollingCacheEnabled(false);
    listViewLayout = new LinearLayout(container.$context());
    listViewLayout.setOrientation(LinearLayout.VERTICAL);

    txtSearchBox = new EditText(container.$context());
    txtSearchBox.setSingleLine(true);
    txtSearchBox.setWidth(Component.LENGTH_FILL_PARENT);
    txtSearchBox.setPadding(10, 10, 10, 10);
    txtSearchBox.setHint("Search list...");

    // set up the listener
    txtSearchBox.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
            // When user changed the Text
            adapter.getFilter().filter(cs);
          }

          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            // no-op. Required method
          }

          @Override
          public void afterTextChanged(Editable arg0) {
            // no-op. Required method
          }
        });

    if (showFilter) {
      txtSearchBox.setVisibility(View.VISIBLE);
    } else {
      txtSearchBox.setVisibility(View.GONE);
    }

    // set the colors and initialize the elements
    // note that the TextColor and ElementsFromString setters
    // need to have the textColor set first, since they reset the
    // adapter

    Width(Component.LENGTH_FILL_PARENT);
    BackgroundColor(DEFAULT_BACKGROUND_COLOR);
    SelectionColor(DEFAULT_SELECTION_COLOR);

    textColor = DEFAULT_TEXT_COLOR;
    TextColor(textColor);
    textSize = DEFAULT_TEXT_SIZE;
    TextSize(textSize);
    ElementsFromString("");

    listViewLayout.addView(txtSearchBox);
    listViewLayout.addView(view);
    listViewLayout.requestLayout();
    container.$add(this);
  };
コード例 #10
0
ファイル: ShowAll.java プロジェクト: nemil17/trails_repo
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.showall);

    b = getIntent().getExtras();
    listItemss = b.getStringArray("list");
    imagess = b.getIntArray("image");
    data = b.getStringArray("data");

    listview = (ListView) findViewById(R.id.listView1);
    listview.setScrollingCacheEnabled(false);
    listview.setDividerHeight(0);
    listview.setCacheColorHint(R.color.blue);
    listview.setFadingEdgeLength(0);

    search = (EditText) findViewById(R.id.search);
    search.setHint("Filter Result");
    search.setSelected(false);

    search.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (search.getText().toString().trim().length() == 0) {
              listview.setAdapter(
                  new ImageAdapter(
                      ShowAll.this,
                      R.layout.clistview,
                      R.id.text1,
                      R.id.image1,
                      b.getStringArray("list"),
                      b.getIntArray("image"),
                      b.getStringArray("data"),
                      1));
            } else {
              int newcount = 0;
              for (int i = 0; i < listItemss.length; i++) {
                try {
                  String temp = listItemss[i].toLowerCase();
                  String tempsearch = search.getText().toString().toLowerCase();
                  if (temp.contains(tempsearch)) {
                    newcount++;
                  }

                } catch (Exception e) {
                  System.out.println(e.toString());
                }
              }
              String[] newlist = new String[newcount];
              String[] newdata = new String[newcount];
              newcount = 0;
              for (int i = 0; i < listItemss.length; i++) {
                try {
                  String temp = listItemss[i].toLowerCase();
                  String tempsearch = search.getText().toString().toLowerCase();
                  if (temp.contains(tempsearch)) {
                    newlist[newcount] = listItemss[i];
                    newdata[newcount] = data[i];
                    newcount++;
                  }

                } catch (Exception e) {
                  System.out.println(e.toString());
                }
              }
              // listview.setAdapter(new ImageAdapter(ShowAll.this,
              // R.layout.clistview, R.id.text1, R.id.image1,newlist
              // ,Arrays.copyOf(imagess, newcount),newdata ,1 ));

            }
          }
        });

    new ProgressTask().execute();
  }