private void CreateListView() {
   listApps = new ListView(getActivity());
   listApps = (ListView) getActivity().findViewById(R.id.listApps);
   adapter = new AppListingAdapter();
   Map<String, AppHolder> faveApps = LessDroidApp.getDefault().getFaveApplications();
   if (faveApps.size() == 0) {
     if (PreferenceManager.getDefaultSharedPreferences(getActivity())
         .getBoolean(PREF_KEY_NO_FAVES, true)) {
       PreferenceManager.getDefaultSharedPreferences(getActivity())
           .edit()
           .putBoolean(PREF_KEY_NO_FAVES, false)
           .commit();
       Toast.makeText(getActivity(), "No favourite apps selected!", Toast.LENGTH_SHORT).show();
       return;
     }
   }
   adapter.setListItems(LessDroidApp.getDefault().getFaveApplications());
   listApps.setAdapter(adapter);
   listApps.setFastScrollEnabled(true);
   listApps.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           final AppHolder app = (AppHolder) parent.getItemAtPosition(position);
           LessDroidApp.getDefault().launchApp(app.appInfo.className, LessDroidApp.getContext());
         }
       });
 }
Exemplo n.º 2
0
  @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;
  }
  protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
    mView = inflateView(inflater, container);

    mListView = (ListView) mView.findViewById(android.R.id.list);
    if (mListView == null) {
      throw new RuntimeException(
          "Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
    }

    View emptyView = mView.findViewById(android.R.id.empty);
    if (emptyView != null) {
      mListView.setEmptyView(emptyView);
    }

    mListView.setOnItemClickListener(this);
    mListView.setOnFocusChangeListener(this);
    mListView.setOnTouchListener(this);
    mListView.setFastScrollEnabled(!isSearchMode());

    // Tell list view to not show dividers. We'll do it ourself so that we can *not* show
    // them when an A-Z headers is visible.
    mListView.setDividerHeight(0);

    // We manually save/restore the listview state
    mListView.setSaveEnabled(false);

    configureVerticalScrollbar();
    configurePhotoLoader();
  }
  /**
   * Enter/exit search mode. By design, a fragment enters search mode only when it has a non-empty
   * query text, so the mode must be tightly related to the current query. For this reason this
   * method must only be called by {@link #setQueryString}.
   *
   * <p>Also note this method doesn't call {@link #reloadData()}; {@link #setQueryString} does it.
   */
  protected void setSearchMode(boolean flag) {
    if (mSearchMode != flag) {
      mSearchMode = flag;
      setSectionHeaderDisplayEnabled(!mSearchMode);

      if (!flag) {
        mDirectoryListStatus = STATUS_NOT_LOADED;
        getLoaderManager().destroyLoader(DIRECTORY_LOADER_ID);
      }

      if (mAdapter != null) {
        mAdapter.setPinnedPartitionHeadersEnabled(flag);
        mAdapter.setSearchMode(flag);

        mAdapter.clearPartitions();
        if (!flag) {
          // If we are switching from search to regular display, remove all directory
          // partitions after default one, assuming they are remote directories which
          // should be cleaned up on exiting the search mode.
          mAdapter.removeDirectoriesAfterDefault();
        }
        mAdapter.configureDefaultPartition(false, flag);
      }

      if (mListView != null) {
        mListView.setFastScrollEnabled(!flag);
      }
    }
  }
Exemplo n.º 5
0
 protected ListView createAppListView() {
   ListView list = new ListView(getActivity());
   list.setFastScrollEnabled(true);
   list.setOnItemClickListener(this);
   list.setAdapter(getAppListAdapter());
   return list;
 }
  @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();
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.reorder_list_activity);
    mPackageManager = getPackageManager();
    mResolver = getContentResolver();

    mIntentList = getListView();
    mIntentList.setFastScrollEnabled(true);
    mIntentList.setOnItemLongClickListener(this);

    ((ReorderListView) mIntentList).setDropListener(mDropListener);

    if (mIntentAdapter == null) {
      mIntentAdapter = new IntentAdapter(this);
    }
    setListAdapter(mIntentAdapter);

    Button addButton = (Button) findViewById(R.id.lockscreen_button_add);
    addButton.setOnClickListener(this);
    mClearButton = (Button) findViewById(R.id.lockscreen_button_clear);
    mClearButton.setEnabled(!parseIntents().isEmpty());
    mClearButton.setOnClickListener(this);

    setupActionBar();
  }
Exemplo n.º 8
0
  public void populateSonglist() {
    SWITCH_VIEW = SONG_VIEW;
    pb.setVisibility(View.VISIBLE);
    Log.i("LIST FRAG", "POPULATING SONG LIST");
    songlist_header_textview.setText("Songs");
    database.open();
    songList = database.getFullList();
    // database.close();

    detector = new GestureDetector(this, this);

    adapter = new ReadLisstAdapter(this, songList, lv);
    lv.setTextFilterEnabled(true);

    lv.setAdapter(adapter);
    lv.setSelection(StaticMusic.smoothScrollTo);
    lv.setFastScrollEnabled(true);
    lv.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View view, MotionEvent e) {
            detector.onTouchEvent(e);
            return false;
          }
        });
    adapter.imageLoader.loadImage(StaticMusic.smoothScrollTo, StaticMusic.smoothScrollTo + 8);
    pb.setVisibility(View.INVISIBLE);
    Log.i("INSTANT", "registered content observer");
    if (Math.abs(previousTime - System.currentTimeMillis()) / 1000 > 10) {
      previousTime = System.currentTimeMillis();
      databaseUpdateThread = new DatabaseUpdateThread(this, this);
      databaseUpdateThread.setPriority(Thread.MIN_PRIORITY);
      databaseUpdateThread.start();
      Log.i("Song list fragment", "After update thread creation");
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView =
        getActivity().getLayoutInflater().inflate(R.layout.cuc_multi_selection_layout, null);
    mDirectoriesMap = new HashMap<String, Boolean>();
    mRefreshBtn = (ImageView) rootView.findViewById(R.id.cuc_multi_selection_refresh_iv);
    mRefreshBtn.setVisibility(View.INVISIBLE);
    mListView = (ListView) rootView.findViewById(R.id.cuc_multi_selection_lv);
    mListView.setFastScrollEnabled(true);
    mUpLayout = (RelativeLayout) rootView.findViewById(R.id.cuc_multi_selection_up_layout);
    mCurrentDirText =
        (TextView) rootView.findViewById(R.id.cuc_multi_selection_current_directory_txt);
    mUpLayout.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            try {
              getDir(new File(mCurrentDir).getParentFile().getCanonicalPath());
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    mRootDir = Environment.getExternalStorageDirectory().getAbsolutePath().toString();
    mCurrentDir = mRootDir;

    // Get a list of all the selected directory paths (will be empty if this is the first run).
    mSelectedDirList = CameraUploadDBHelper.getInstance().getCustomDirList();

    // Get a list of all the directory paths that are currently stored in the DB.
    for (int i = 0; i < mSelectedDirList.size(); i++) {

      // Filter out any double slashes.
      String path = mSelectedDirList.get(i);
      if (path.contains("//")) {
        path.replace("//", "/");
      }

      mDirectoriesMap.put(path, true);
    }

    // Get the folder hierarchy of the selected directory.
    getDir(mRootDir);

    mListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
            String newPath = mDirectoryPathsList.get(index);
            getDir(newPath);
          }
        });

    return rootView;
  }
Exemplo n.º 10
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mAdapter =
        new SimpleCursorAdapter(
            this.getActivity(),
            R.layout.tag_view,
            null,
            new String[] {Tag.Name, Tag.Count},
            new int[] {R.id.tag_name, R.id.tag_count},
            0);

    setListAdapter(mAdapter);

    getLoaderManager().initLoader(0, null, this);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setFastScrollEnabled(true);
    lv.setOnItemClickListener(clickListener);

    lv.setItemsCanFocus(false);
    lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  }
Exemplo n.º 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.select_recipients_list_screen);

    if (savedInstanceState != null) {
      mMode = savedInstanceState.getInt(MODE);
    } else {
      mMode = getIntent().getIntExtra(MODE, MODE_INFO);
    }

    if (mMode == MODE_INFO || mMode == MODE_VCARD) {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      prefs.edit().putBoolean(PREF_SHOW_GROUPS, false).commit();
    } else {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      prefs.edit().putBoolean(PREF_SHOW_GROUPS, true).commit();
    }

    switch (mMode) {
      case MODE_INFO:
        setTitle(R.string.attach_add_contact_as_text);
        break;
      case MODE_VCARD:
        setTitle(R.string.attach_add_contact_as_vcard);
        break;
      default:
        // leave it be
    }

    mProgressSpinner = findViewById(R.id.progress_spinner);

    // List view
    ListView listView = getListView();
    if (mMode == MODE_VCARD) {
      listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    } else {
      listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
    }
    listView.setFastScrollEnabled(true);
    listView.setFastScrollAlwaysVisible(true);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setEmptyView(findViewById(R.id.empty));
    listView.setOnItemClickListener(this);

    // Get things ready
    mCheckedPhoneNumbers = new HashSet<PhoneNumber>();
    mLocalGroups = new HashSet<Group>();
    getLoaderManager().initLoader(0, null, this);

    ActionBar mActionBar = getActionBar();
    if (mActionBar != null) {
      mActionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
Exemplo n.º 12
0
  @Override
  public void onViewCreated(final View view, final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mList.setFastScrollEnabled(true);
    mList.setTextFilterEnabled(true);
    mList.setSelector(android.R.color.transparent);
    mList.setOnItemClickListener(oiclLibraryClick);

    mList.setEmptyView(mEmptyLibrary);
  }
  @Override
  protected void configureList(Activity activity, ListView listView) {
    super.configureList(activity, listView);

    listView.setFastScrollEnabled(true);
    listView.setDividerHeight(0);

    getListAdapter()
        .addHeader(activity.getLayoutInflater().inflate(R.layout.checkins_list_item_labels, null));
  }
Exemplo n.º 14
0
 @Override
 public void onStart() {
   getMyMembersData();
   gson = new Gson();
   myMembersListAdapter = new MyMembersListAdapter(getActivity());
   listView = (ListView) getActivity().findViewById(R.id.my_members_list);
   listView.setAdapter(myMembersListAdapter);
   listView.setFastScrollEnabled(true);
   //        showLoading(true);
   super.onStart();
 }
    public View build(LayoutInflater inflater, ViewGroup contentParent, View contentChild) {
      if (mRootView != null) {
        return mRootView;
      }

      mInflater = inflater;
      mRootView =
          inflater.inflate(
              mListType == LIST_TYPE_RUNNING
                  ? R.layout.manage_applications_running
                  : R.layout.manage_applications_apps,
              null);
      mRootView.setLayoutDirection(
          mRootView.getResources().getConfiguration().getLayoutDirection());
      mLoadingContainer = mRootView.findViewById(R.id.loading_container);
      mLoadingContainer.setVisibility(View.VISIBLE);
      mListContainer = mRootView.findViewById(R.id.list_container);
      if (mListContainer != null) {
        // Create adapter and list view here
        View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
        ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
        if (emptyView != null) {
          lv.setEmptyView(emptyView);
        }
        lv.setOnItemClickListener(this);
        lv.setSaveEnabled(true);
        lv.setItemsCanFocus(true);
        lv.setTextFilterEnabled(true);
        lv.setFastScrollEnabled(true);
        mListView = lv;
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
        mListView.setAdapter(mApplications);
        mListView.setRecyclerListener(mApplications);
        mColorBar = (LinearColorBar) mListContainer.findViewById(R.id.storage_color_bar);
        mStorageChartLabel = (TextView) mListContainer.findViewById(R.id.storageChartLabel);
        mUsedStorageText = (TextView) mListContainer.findViewById(R.id.usedStorageText);
        mFreeStorageText = (TextView) mListContainer.findViewById(R.id.freeStorageText);
        Utils.prepareCustomPreferencesList(contentParent, contentChild, mListView, false);
        if (mFilter == FILTER_APPS_SDCARD) {
          mStorageChartLabel.setText(mOwner.getActivity().getText(R.string.sd_card_storage));
        } else {
          mStorageChartLabel.setText(mOwner.getActivity().getText(R.string.internal_storage));
        }
        applyCurrentStorage();
      }
      mRunningProcessesView = (RunningProcessesView) mRootView.findViewById(R.id.running_processes);
      if (mRunningProcessesView != null) {
        mRunningProcessesView.doCreate(mSavedInstanceState);
      }

      return mRootView;
    }
  private void initListView() {
    mPatchesAdapter = new PatchesAdapter(mContext);
    mPatchList = (ListView) findViewById(R.id.patch_list);

    TextView emptyView = new TextView(mContext);
    LinearLayout.LayoutParams lparam =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    lparam.weight = 1;
    emptyView.setLayoutParams(lparam);
    emptyView.setText(getString(R.string.empty));
    emptyView.setVisibility(View.GONE);
    ((ViewGroup) mPatchList.getParent()).addView(emptyView, 2);
    mPatchList.setEmptyView(emptyView);

    mPatchList.setFastScrollEnabled(true);
    mPatchList.setDivider(new ColorDrawable(0xff777777));
    mPatchList.setDividerHeight(1);
    mPatchList.setAdapter(mPatchesAdapter);
    mPatchList.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            FPatch p = mPatchesAdapter.getItem(position);
            mInfoDialog.show(
                getFragmentManager(),
                p.packageName,
                "apkPath=" + p.apkPath + "\ntargetJar=" + p.targetJar);
          }
        });

    mPatchList.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            FPatch p = mPatchesAdapter.getItem(position);
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(android.net.Uri.fromParts("package", p.packageName, null));
            startActivity(intent);
            return true;
          }
        });

    refreshList();

    //		mPatchesAdapter.sort(new java.util.Comparator<FPatch>() {
    //			@Override
    //			public int compare(FPatch lhs, FPatch rhs) {
    //				return lhs.appName.compareTo(rhs.appName);
    //			}
    //		});
  }
Exemplo n.º 17
0
 @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));
 }
Exemplo n.º 18
0
 public void onViewCreated(View paramView, Bundle paramBundle) {
   super.onViewCreated(paramView, paramBundle);
   ListView localListView = getListView();
   localListView.setFastScrollEnabled(true);
   FragmentActivity localFragmentActivity = getActivity();
   FrameLayout localFrameLayout = new FrameLayout(localFragmentActivity);
   this.mPlayTutorialHeader = localFrameLayout;
   ViewGroup localViewGroup = this.mPlayTutorialHeader;
   localListView.addHeaderView(localViewGroup, null, false);
   updateCardHeader();
   if (Build.VERSION.SDK_INT < 11) return;
   localListView.setScrollBarStyle(16777216);
   localListView.setFastScrollAlwaysVisible(true);
 }
Exemplo n.º 19
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ListView lv = getListView();
    lv.setFastScrollEnabled(true);
    lv.setOnItemClickListener(mItemClickListener);
    lv.setOnItemLongClickListener(mItemLongClickListener);
    lv.setOnScrollListener(this);
    lv.setFocusable(true);

    MusubiBaseActivity.getInstance().setOnKeyListener(this);
    // int color = Feed.colorFor(feedName, Feed.BACKGROUND_ALPHA);
    // getListView().setCacheColorHint(color);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = getActivity().getApplicationContext();
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_artists_music_library_editor, null);

    cursor = mApp.getDBAccessHelper().getAllUniqueArtists("");
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorArtistsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new PlaylistEditorArtistsMultiselectAdapter(getActivity(), cursor));

    listView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.artistCheckboxMusicLibraryEditor);
            checkbox.performClick();

            /* Since we've performed a software-click (checkbox.performClick()), all we have
             * to do now is determine the *new* state of the checkbox. If the checkbox is checked,
             * that means that the user tapped on it when it was unchecked, and we should add
             * the artist's songs to the HashSet. If the checkbox is unchecked, that means the user
             * tapped on it when it was checked, so we should remove the artist's songs from the
             * HashSet.
             */
            if (checkbox.isChecked()) {
              view.setBackgroundColor(0xCC0099CC);
              AsyncGetArtistSongIds task =
                  new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
              task.execute(new String[] {"ADD"});
            } else {
              view.setBackgroundColor(0x00000000);
              AsyncGetArtistSongIds task =
                  new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
              task.execute(new String[] {"REMOVE"});
            }
          }
        });

    instructions = (TextView) rootView.findViewById(R.id.artists_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(
        instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    return rootView;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;

    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mLoadingContainer.setVisibility(View.VISIBLE);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
      // Create adapter and list view here
      View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
      ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
      if (emptyView != null) {
        lv.setEmptyView(emptyView);
      }
      lv.setOnItemClickListener(this);
      lv.setSaveEnabled(true);
      lv.setItemsCanFocus(true);
      lv.setTextFilterEnabled(true);
      lv.setFastScrollEnabled(true);
      mListView = lv;
      mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
      if (savedInstanceState != null) {
        mApplications.mHasReceivedLoadEntries =
            savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
      }
      mListView.setAdapter(mApplications);
      mListView.setRecyclerListener(mApplications);

      Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
    }

    // We have to do this now because PreferenceFrameLayout looks at it
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
      ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }

    createHeader();

    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);

    return mRootView;
  }
Exemplo n.º 22
0
  @SuppressLint("NewApi")
  public ListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (context instanceof Activity) {
      setActivity((Activity) context);
    }
    if (HoloEverywhere.DISABLE_OVERSCROLL_EFFECT && VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
      setOverScrollMode(OVER_SCROLL_NEVER);
    }

    mOnItemLongClickListenerWrapper = new OnItemLongClickListenerWrapper();
    super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper);
    setLongClickable(false);

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
      super.setFastScrollAlwaysVisible(false);
    }
    super.setFastScrollEnabled(false);
    super.setChoiceMode(CHOICE_MODE_NONE);
    TypedArray a =
        context.obtainStyledAttributes(
            attrs,
            new int[] {
              android.R.attr.fastScrollEnabled,
              android.R.attr.fastScrollAlwaysVisible,
              android.R.attr.choiceMode,
              android.R.attr.overScrollFooter,
              android.R.attr.overScrollHeader
            },
            defStyle,
            R.style.Holo_ListView);
    setFastScrollEnabled(a.getBoolean(0, false));
    setFastScrollAlwaysVisible(a.getBoolean(1, false));
    setChoiceMode(a.getInt(2, CHOICE_MODE_NONE));
    if (!a.hasValue(3) && VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
      super.setOverscrollFooter(null);
    }
    if (!a.hasValue(4) && VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
      super.setOverscrollHeader(null);
    }
    a.recycle();
  }
  private void configureVerticalScrollbar() {
    boolean hasScrollbar = isVisibleScrollbarEnabled() && isSectionHeaderDisplayEnabled();

    if (mListView != null) {
      mListView.setFastScrollEnabled(hasScrollbar);
      mListView.setFastScrollAlwaysVisible(hasScrollbar);
      mListView.setVerticalScrollbarPosition(mVerticalScrollbarPosition);
      mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
      int leftPadding = 0;
      int rightPadding = 0;
      if (mVerticalScrollbarPosition == View.SCROLLBAR_POSITION_LEFT) {
        leftPadding =
            mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding);
      } else {
        rightPadding =
            mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding);
      }
      mListView.setPadding(
          leftPadding, mListView.getPaddingTop(), rightPadding, mListView.getPaddingBottom());
    }
  }
  /* Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LinkedList<String> mLinked = new LinkedList<String>();
    for (int i = 0; i < COUNTRIES.length; i++) {
      mLinked.add(COUNTRIES[i]);
    }

    setListAdapter(new MyListAdaptor(this, mLinked));

    ListView lv = getListView();
    lv.setFastScrollEnabled(true);

    lv.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // When clicked, show a toast with the TextView text
            Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT)
                .show();
          }
        });
  }
 /** {@inheritDoc} */
 @Override
 public View onCreateView(
     final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
   // The View for the fragment's UI
   mRootView = (ViewGroup) inflater.inflate(R.layout.list_base, null);
   // Initialize the list
   mListView = (ListView) mRootView.findViewById(R.id.list_base);
   // Set the data behind the list
   mListView.setAdapter(mAdapter);
   // Release any references to the recycled Views
   mListView.setRecyclerListener(new RecycleHolder());
   // Listen for ContextMenus to be created
   mListView.setOnCreateContextMenuListener(this);
   // Play the selected song
   mListView.setOnItemClickListener(this);
   // To help make scrolling smooth
   mListView.setOnScrollListener(new VerticalScrollListener(null, mProfileTabCarousel, 0));
   // Remove the scrollbars and padding for the fast scroll
   mListView.setVerticalScrollBarEnabled(false);
   mListView.setFastScrollEnabled(false);
   mListView.setPadding(0, 0, 0, 0);
   return mRootView;
 }
Exemplo n.º 26
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    setHasOptionsMenu(true);

    mAdapter =
        new SimpleCursorAdapter(
            this.getActivity(),
            R.layout.note_view,
            null,
            new String[] {Note.Title},
            new int[] {R.id.note_title},
            0);

    setListAdapter(mAdapter);

    getLoaderManager().initLoader(0, null, this);

    final ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setFastScrollEnabled(true);

    lv.setItemsCanFocus(false);
    lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    lv.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final Cursor c = (Cursor) lv.getItemAtPosition(position);
            Note n = NoteManager.CursorToNote(c);

            viewNote(n);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mActivity = (CameraUploadConfigActivity) getActivity();
    Intent intent = mActivity.getIntent();
    avatarManager = new AvatarManager();
    Account account = intent.getParcelableExtra("account");
    if (account == null) {
      canChooseAccount = true;
    } else {
      mAccount = account;
    }
    onlyShowWritableRepos = intent.getBooleanExtra(ONLY_SHOW_WRITABLE_REPOS, true);
    encryptedRepoId = intent.getStringExtra(ENCRYPTED_REPO_ID);
    isOnlyChooseRepo = true;

    View rootView =
        getActivity().getLayoutInflater().inflate(R.layout.cuc_multi_selection_layout, null);
    mFoldersListView = (ListView) rootView.findViewById(R.id.cuc_multi_selection_lv);
    mFoldersListView.setFastScrollEnabled(true);
    mUpLayout = (RelativeLayout) rootView.findViewById(R.id.cuc_multi_selection_up_layout);
    mCurrentFolderText =
        (TextView) rootView.findViewById(R.id.cuc_multi_selection_current_directory_txt);
    mEmptyText = (TextView) rootView.findViewById(R.id.cuc_multi_selection_empty_msg);
    mErrorText = (TextView) rootView.findViewById(R.id.cuc_multi_selection_error_msg);
    mRefreshBtn = (ImageView) rootView.findViewById(R.id.cuc_multi_selection_refresh_iv);
    mProgressContainer = rootView.findViewById(R.id.cuc_multi_selection_progress_container);
    mListContainer = rootView.findViewById(R.id.cuc_multi_selection_list_container);
    mRefreshBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            refreshList(true);
          }
        });

    mUpLayout.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            try {
              stepBack();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    mFoldersListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onListItemClick(parent, position, id);
          }
        });

    if (canChooseAccount) {
      chooseAccount();
    } else {
      chooseRepo();
    }

    return rootView;
  }
Exemplo n.º 28
0
  private void buildListView() {
    // TODO Auto-generated method stub
    String fname = getApplicationContext().getResources().getString(R.string.nab_filename);
    try {
      Object o = FileIO.retrieveFromFile(getFilesDir() + fname);
      if (o instanceof AddressBook) {
        AddressBook a = (AddressBook) o;
        allContacts.addAll(a.entries);
        allGroups = a.groups;
      }
    } catch (FileNotFoundException fne) {
      // TODO prompt to download contacts
    }

    allContacts.addAll(new WebtextUtilities().getPhoneContactsWithMobileNumber(m));

    allContacts = removeDuplicatesAndSort(allContacts);

    final ListView contacts = (ListView) findViewById(R.id.contacts_list_view);
    final ContactsListAdapter contactsListAdapter =
        new ContactsListAdapter(m, R.layout.contacts_list_row, allContacts);
    List<Integer> selectedContactRows = new ArrayList<Integer>();
    List<Integer> selectedGroupRows = new ArrayList<Integer>();

    for (Contact x : allContacts) {
      if (selectedContacts.contains(x)) {
        selectedContactRows.add(Integer.valueOf(allContacts.indexOf(x)));
      }
    }

    if (selectedContactRows.size() > 0) {
      contactsListAdapter.setSelectedRows(selectedContactRows);
    }

    contacts.setAdapter(contactsListAdapter);
    contacts.setFastScrollEnabled(true);
    contacts.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) {
            contactsListAdapter.toggleSelected(position);
            toggleContactedSelected((Contact) adapter.getItemAtPosition(position));
            updateStatusBar();
          }
        });

    ListView groups = (ListView) findViewById(R.id.groups_list_view);
    final GroupsListAdapter groupsListAdapter =
        new GroupsListAdapter(m, R.layout.groups_list_row, allGroups);
    groups.setAdapter(groupsListAdapter);
    for (Group x : allGroups) {
      if (selectedGroups.contains(x)) {
        selectedGroupRows.add(Integer.valueOf(allGroups.indexOf(x)));
      }
    }

    if (selectedGroupRows.size() > 0) {
      groupsListAdapter.setSelectedRows(selectedGroupRows);
    }
    groups.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) {
            groupsListAdapter.toggleSelected(position);
            toggleGroupSelected((Group) adapter.getItemAtPosition(position));
            updateStatusBar();
          }
        });
  }
 private void populateFacebookFeedList(ArrayList<HashMap<String, String>> feedData) {
   ListView lv = (ListView) findViewById(R.id.vdf_list);
   lv.setAdapter(new FacebookFeedItemAdapter(this, feedData));
   lv.setTextFilterEnabled(true);
   lv.setFastScrollEnabled(true);
 }
  private void initComponents() {
    LinearLayout llRoot = (LinearLayout) this.findViewById(R.id.llRoot);
    LinearLayout llHeaderBase = (LinearLayout) this.findViewById(R.id.llHeaderBase);

    LinearLayout llHeaderUserSelector = (LinearLayout) this.findViewById(R.id.llHeaderUserSelector);
    EditText etFilterName = (EditText) this.findViewById(R.id.etFilterName);
    Button btnSearch = (Button) findViewById(R.id.btnSearch);
    btnFollowing = (Button) findViewById(R.id.btnFollowing);
    btnRecentContact = (Button) findViewById(R.id.btnRecentContact);
    lvUser = (ListView) this.findViewById(R.id.lvUser);

    LinearLayout llToolbar = (LinearLayout) this.findViewById(R.id.llToolbar);
    Button btnConfirm = (Button) this.findViewById(R.id.btnConfirm);
    Button btnCancel = (Button) this.findViewById(R.id.btnCancel);

    ThemeUtil.setRootBackground(llRoot);
    ThemeUtil.setSecondaryHeader(llHeaderBase);

    llHeaderUserSelector.setBackgroundDrawable(theme.getDrawable("bg_header_corner_search"));
    int padding6 = theme.dip2px(6);
    int padding8 = theme.dip2px(8);
    llHeaderUserSelector.setPadding(padding6, padding8, padding6, padding8);
    etFilterName.setBackgroundDrawable(theme.getDrawable("bg_input_frame_left_half"));
    btnSearch.setBackgroundDrawable(theme.getDrawable("selector_btn_search"));
    btnFollowing.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_left"));
    btnFollowing.setPadding(0, 0, 0, 0);
    ColorStateList selectorBtnTab = theme.getColorStateList("selector_btn_tab");
    btnFollowing.setTextColor(selectorBtnTab);
    btnFollowing.setGravity(Gravity.CENTER);
    btnRecentContact.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_right"));
    btnRecentContact.setPadding(0, 0, 0, 0);
    btnRecentContact.setTextColor(selectorBtnTab);
    btnRecentContact.setGravity(Gravity.CENTER);

    ThemeUtil.setListViewStyle(lvUser);
    llToolbar.setBackgroundDrawable(theme.getDrawable("bg_toolbar"));
    ThemeUtil.setBtnActionPositive(btnConfirm);
    ThemeUtil.setBtnActionNegative(btnCancel);

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

    selectorAdapter = new UserQuickSelectorListAdapter(this, account, selectMode);
    showLoadingFooter();
    lvUser.setAdapter(selectorAdapter);
    lvUser.setFastScrollEnabled(yibo.isSliderEnabled());
    setBack2Top(lvUser);

    recyclerListener = new UserSelectorRecyclerListener();
    lvUser.setRecyclerListener(recyclerListener);

    lvUser.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == parent.getCount() - 1) {
              view.performClick();
            } else {
              CheckBox checkBox = (CheckBox) view.findViewById(R.id.cbUser);
              checkBox.performClick();
              UserQuickSelectorActivity.this.updateButtonState();
            }
          }
        });
  }