Пример #1
3
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.line_list);

    // Setup the list
    adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item);
    ListView list = (ListView) findViewById(R.id.list);
    list.setAdapter(adapter);
    list.setOnItemClickListener(this);

    // Load Directory
    if (savedInstanceState != null) {
      backStack = savedInstanceState.getParcelableArrayList("BACKSTACK");
    }

    if (backStack == null || backStack.size() == 0) {
      backStack = new ArrayList<BackStackItem>();
      String startPath =
          (startDirectory == null || startDirectory.isEmpty())
              ? Environment.getExternalStorageDirectory().getPath()
              : startDirectory;
      backStack.add(new BackStackItem(startPath, false));
    }

    wrapFiles();
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  }
  public void RefreshTweetList(final Activity act, final View v, final TweetListType mode) {
    LinearLayout ll = (LinearLayout) v;
    ListView lv = (ListView) ll.findViewById(android.R.id.list);

    final List<Tweet> tmpTweets = new ArrayList<Tweet>();
    final TweetListAdapter aa = new TweetListAdapter(act, R.layout.tweetlist_item, tmpTweets);
    getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS);

    lv.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 (visibleItemCount != 0) {
              final int GUESS_WANT_MORE = 1;
              if (firstVisibleItem + visibleItemCount + 1 + GUESS_WANT_MORE > totalItemCount) {
                getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS);
              }
            }
          }
        });

    TextView tv = (TextView) ll.findViewById(android.R.id.empty);
    if (aa.getCount() > 0) {
      tv.setVisibility(View.GONE);
    } else {
      tv.setVisibility(View.VISIBLE);
    }

    lv.setAdapter(aa);
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a SQLite database holding event info
    DatabaseOpener dbopenhelper = new DatabaseOpener(this);
    db = dbopenhelper.getWritableDatabase();

    setContentView(R.layout.event_list);

    this.lv = (ListView) findViewById(R.id.eventListView);
    // Subclass CursorAdapter to read data from the database into the
    // ListView
    Cursor c =
        db.query(
            "event",
            new String[] {"_id", "isfavorite", "name", "starttime", "endtime"},
            null,
            null,
            null,
            null,
            "starttime asc");
    dbadapter = new EventListCursorAdapter(this, c, false);
    lv.setAdapter(dbadapter);
  }
        @Override
        public void handleMessage(Message msg) {
          mylog.i(TAG, "msg  obj " + msg.obj);
          switch (msg.what) {
            case 0:
              Graphic[] graphics = (Graphic[]) msg.obj;
              mylog.i(TAG, "graphics msg" + (graphics == null ? "null " : graphics.length));

              List<String> mNames = new ArrayList<String>();
              for (int i = 0; i < graphics.length; i++) {
                mNames.add(graphics[i].getAttributeValue("OBJ_NAME_C").toString());
              }
              BaseDialogFragment dialogFragment = new BaseDialogFragment();
              AdvanceDialogViewBuild builder =
                  new AdvanceDialogViewBuild(dialogFragment, getActivity());
              dialogFragment.setViewBuilder(builder);
              View view = LayoutInflater.from(getActivity()).inflate(R.layout.compare_layout, null);
              dialogFragment.setView(view);
              ListView list = (ListView) view.findViewById(R.id.id_lstview_compare);
              myAdapter = new MyCompareAdapter(getActivity(), mNames);
              list.setAdapter(myAdapter);
              dialogFragment.show(getActivity());

              break;
          }
        }
  private void findFriends(String name) {
    listViewFriendsList = (ListView) findViewById(R.id.listViewFoundFriendList);
    try {
      friendList = httpClientHelper.getFriendsListByName(name);
    } catch (JSONException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    SharedPreferences sPref = getSharedPreferences("currentUser", Context.MODE_PRIVATE);
    Long fromUserId = sPref.getLong("id", 0);

    // addAvatarToFriends(friendList);
    friendListAdapter =
        new FoundFriendsAdapter(getApplicationContext(), friendList, fromUserId, this);
    listViewFriendsList.setAdapter(friendListAdapter);

    /*listViewFriendsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Long idFriend = friendListAdapter.getFriendItem(position).getId();
            listener.itemClick(position, idFriend);
        }
    }); */
  }
  @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);
    }
  }
Пример #7
0
  /** Called when the activity is first created */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "LoaderActivity created");
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.content);

    // Instantiate custom adapter
    mAdapter = new LoaderAdapter();

    // Handle listview and assign adapter
    mListView = (ListView) findViewById(R.id.content_list_view);
    mListView.setAdapter(mAdapter);
    mListView.setVisibility(View.GONE);
    mListView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          public boolean onItemLongClick(AdapterView parent, View view, int position, long id) {
            selectItem(position);
            return true;
          }
        });

    mStatusLabel = (TextView) findViewById(R.id.content_status_label);
    mStatusLabel.setVisibility(View.VISIBLE);

    String userHash = NavigineApp.Settings.getString("user_hash", "");
    if (userHash.length() == 0) showUserHashDialog();
    else refreshMapList();
  }
 public DropdownContainer(
     Context context,
     int layout_id,
     Drawable background,
     DropdownAdapter adapter,
     OnItemClickListener listener) {
   super(context);
   int m = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
   AbsListView content = (AbsListView) LayoutInflater.from(context).inflate(layout_id, null);
   if (content instanceof ListView) {
     ((ListView) content).setAdapter((BaseAdapter) adapter);
   } else if (content instanceof GridView) {
     ((GridView) content).setAdapter((BaseAdapter) adapter);
   }
   content.setOnItemClickListener(listener);
   content.measure(m, m);
   if (adapter.getRows() > adapter.getWrapRow()) {
     init(
         content,
         LayoutParams.WRAP_CONTENT,
         content.getMeasuredHeight() * adapter.getWrapRow(),
         R.style.drop_down_anim,
         background);
   } else {
     init(
         content,
         LayoutParams.WRAP_CONTENT,
         LayoutParams.WRAP_CONTENT,
         R.style.drop_down_anim,
         background);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(layout, container, false);

    listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            onListItemClick((ListView) parent, v, position);
          }
        });
    listView.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            // We don't actually do anything differently on long-clicks, but setting the listener
            // enables the selector transition that we have for visual consistency with the
            // Facebook app's pickers.
            return false;
          }
        });
    listView.setOnScrollListener(onScrollListener);

    activityCircle = (ProgressBar) view.findViewById(R.id.com_facebook_picker_activity_circle);

    setupViews(view);

    listView.setAdapter(adapter);

    return view;
  }
 /** Updates the display */
 private void updateDisplay() {
   if (borrowedBooks != null) {
     adapter =
         new BookAdapter(getActivity(), R.layout.item_bookborrowrequest, borrowedBooks, this);
     list.setAdapter(adapter);
   }
 }
Пример #11
0
 BookmarksAdapter(ListView listView, List<Bookmark> bookmarks, boolean currentBook) {
   myBookmarks = bookmarks;
   myCurrentBook = currentBook;
   listView.setAdapter(this);
   listView.setOnItemClickListener(this);
   listView.setOnCreateContextMenuListener(this);
 }
 void invalidateView() {
   if (!myAndroidViews.isEmpty()) {
     myAndroidViews.clear();
     myListView.setAdapter(new ViewAdapter());
     myListView.invalidate();
   }
 }
Пример #13
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    PackageManager pm = getPackageManager();
    ComponentName pluggedReceiver =
        new ComponentName(getApplicationContext(), PluggedReceiver.class);
    ComponentName unpluggedReceiver = new ComponentName(getApplication(), UnpluggedReceiver.class);
    pm.setComponentEnabledSetting(
        pluggedReceiver,
        PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
        PackageManager.DONT_KILL_APP);

    pm.setComponentEnabledSetting(
        unpluggedReceiver,
        PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
        PackageManager.DONT_KILL_APP);

    myListView = (ListView) findViewById(R.id.contactView);
    listItems = new ArrayList<String>();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    Map<String, ?> keys = prefs.getAll();
    for (Map.Entry<String, ?> entry : keys.entrySet()) {
      listItems.add(entry.getKey().toString());
    }

    adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, listItems);
    myListView.setAdapter(adapter);
  }
 /** Updates the display */
 protected void updateDisplay() {
   // Use BookAdapter to display the data
   if (borrowedBooks != null) {
     adapter = new BookAdapter(getActivity(), R.layout.item_book_image, borrowedBooks);
     list.setAdapter(adapter); // assign the adapter to the listview
   }
   swipe.setRefreshing(false);
 }
Пример #15
0
 private void setAdapterForDir(File file) {
   File[] files = file.listFiles();
   if (files == null) {
     files = new File[0];
   }
   ArrayAdapter<File> adapter = new FileAdapter(this, files);
   dirList.setAdapter(adapter);
 }
  private void refreshRollsListView(int[] rollResults) {
    if (rollResults != null) {
      String[] rollResultStrings = new String[rollResults.length];
      for (int i = 0; i < rollResults.length; i++)
        rollResultStrings[i] = Integer.toString(rollResults[i]);

      ArrayAdapter<String> adapter =
          new ArrayAdapter<String>(
              getContext(), android.R.layout.simple_list_item_1, rollResultStrings);
      m_rollResultList.setAdapter(adapter);
    } else {
      String[] emptyArray = new String[0];
      ArrayAdapter<String> adapter =
          new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, emptyArray);
      m_rollResultList.setAdapter(adapter);
    }
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreateView(inflater, container, savedInstanceState);
   mListView = new ListView(getActivity());
   mListView.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, items));
   mListView.setOnItemClickListener(this);
   return mListView;
 }
	protected void setListAdapter() {
		// TODO Auto-generated method stub

		
		ListView listView = (ListView) leftSideListView.findViewById(R.id.list);
		listView.setAdapter(new NavigationDrawerListAdapter(this,  Typeface.createFromAsset(getAssets(), IAppConstants.CommonConstants.FONT_PATH_PREFIX + IAppConstants.ROBOTO_MEDIUM_FONTS), mPresenter.getScreenIcons()));
		mClickListener =  mPresenter.getListItemClickListenerInstance(mSliderView, leftSideListView, menuOut);
		listView.setOnItemClickListener(mClickListener);
	}
  @Override
  public void onDetach() {
    super.onDetach();

    listView.setOnScrollListener(null);
    listView.setAdapter(null);

    loadingStrategy.detach();
    sessionTracker.stopTracking();
  }
Пример #20
0
  private void setupArchiveList() {
    archiveAdapter = new ArchiveListAdapter(this, fileController);
    archiveList = (ListView) findViewById(R.id.archiveList);
    archiveList.setAdapter(archiveAdapter);
    archiveAdapter.sort(new FileComparator(fileController));

    quickActionMenu = new QuickActionMenu(this);
    setListItemListeners();
    showEmptyLayoutIfNoTrips();
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.showsearched);

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

    context = getApplicationContext();

    Intent intent = getIntent();
    Bundle b = intent.getExtras();
    if (b != null) {
      result = (String) b.get("result");
    }

    try {

      JSONArray array = new JSONArray(result);
      for (int i = 0; i < array.length(); i++) {
        JSONObject data = array.getJSONObject(i);
        Flower kwiat =
            new Flower(
                data.getLong("gatunek_id"),
                data.getString("nazwa_rodz"),
                data.getString("nazwa_gat"),
                data.getString("nazwa_reg"),
                data.getString("nazwa_pok"),
                data.getString("nazwa_typ"),
                data.getString("nazwa_stan"),
                data.getString("temp"),
                data.getString("kolor_kwiatow"),
                data.getString("foto"));
        flowerList.add(kwiat);
      }
    } catch (JSONException e) {
      e.printStackTrace();
    }

    ArrayAdapter<Flower> adapter =
        new ArrayAdapter<Flower>(context, R.layout.adapterlayout, flowerList);
    list.setAdapter(adapter);

    list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(context, DisplayFlowerActivity.class);
            Flower temp = flowerList.get(position);

            i.putExtra("name", temp.toString());
            i.putExtra("values", temp.getValues());
            i.putExtra("fotka", temp.getFoto());
            startActivity(i);
          }
        });
  }
  /**
   * Retrieves the folder hierarchy for the specified folder (this method is NOT recursive and
   * doesn't go into the parent folder's subfolders.
   */
  private void getDir(String dirPath) {

    mDirectoryNamesList = Lists.newArrayList();
    mDirectoryPathsList = Lists.newArrayList();
    mDirectorySizesList = Lists.newArrayList();

    File f = new File(dirPath);
    File[] files = f.listFiles();
    Arrays.sort(files);

    if (files != null) {
      for (int i = 0; i < files.length; i++) {
        File file = files[i];
        if (!file.isHidden() && file.canRead()) {
          if (file.isDirectory()) {
            /* Starting with Android 4.2, /storage/emulated/legacy/...
             * is a symlink that points to the actual directory where
             * the user's files are stored. We need to detect the
             * actual directory's file path here.
             **/
            String filePath;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
              filePath = getRealFilePath(file.getAbsolutePath());
            else filePath = file.getAbsolutePath();

            mDirectoryPathsList.add(filePath);
            mDirectoryNamesList.add(file.getName());

            File[] listOfFiles = file.listFiles();

            if (listOfFiles != null) {
              mDirectorySizesList.add(
                  getResources()
                      .getQuantityString(
                          R.plurals.settings_cuc_local_dir_items,
                          listOfFiles.length,
                          listOfFiles.length));
            }
          }
        }
      }
    }

    boolean dirChecked = false;
    if (getLocalDirHashMap().get(dirPath) != null) dirChecked = getLocalDirHashMap().get(dirPath);

    LocalDirSelectionAdapter adapter =
        new LocalDirSelectionAdapter(getActivity(), this, dirChecked);

    mListView.setAdapter(adapter);
    adapter.notifyDataSetChanged();

    mCurrentDir = dirPath;
    setCurrentDirText();
  }
Пример #23
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

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

    AboutItemAdapter adapter = new AboutItemAdapter(this, R.layout.about_2_line_text_item);
    list.setAdapter(adapter);

    list.setOnItemClickListener(mListListener);
  }
  @AfterViews
  void init() {

    progressDlg = new ProgressDialog(getActivity());
    progressDlg.setTitle(R.string.wait_for_moment);

    adapter.setCheckInCallback(proposedVenuesCallback);
    venuesList.setOnItemClickListener(this);
    venuesList.setAdapter(adapter);
    getDialog().setTitle(R.string.checkin_notif_title);
  }
Пример #25
0
  public final void onItemClick(AdapterView adapterview, View view, int i, long l) {
    b.dismiss();
    Cursor cursor = (Cursor) adapterview.getItemAtPosition(i);
    if (c != 1) {
      HotelSearchActivity.e(a, cursor.getString(2));
      HotelSearchActivity.n(a).setText(HotelSearchActivity.o(a));
      HotelSearchActivity.f(a, cursor.getString(1));
      ((MyApplication) a.getApplication()).p(com.ll.ctirp.ui.HotelSearchActivity.p(a));
      ((MyApplication) a.getApplication()).m(HotelSearchActivity.o(a));
      HotelSearchActivity.q(a);
    } else {
      HotelSearchActivity hotelsearchactivity = a;
      String s = cursor.getString(1);
      if (hotelsearchactivity.b != null) {
        hotelsearchactivity.b.close();
        hotelsearchactivity.b = null;
      }
      if (hotelsearchactivity.c != null) {
        hotelsearchactivity.c.close();
        hotelsearchactivity.c = null;
      }
      Object obj = LayoutInflater.from(hotelsearchactivity).inflate(0x7f03000d, null);
      ((View) (obj)).findViewById(0x7f080058);
      Object obj1 = (EditText) ((View) (obj)).findViewById(0x7f080059);
      ListView listview = (ListView) ((View) (obj)).findViewById(0x7f08005a);
      TextView textview1 = (TextView) ((View) (obj)).findViewById(0x7f08005d);
      TextView textview = (TextView) ((View) (obj)).findViewById(0x7f08005b);
      ListView listview1 = (ListView) ((View) (obj)).findViewById(0x7f08005c);
      obj =
          (new android.app.AlertDialog.Builder(hotelsearchactivity))
              .setTitle("选择入住的城市")
              .setView(((View) (obj)))
              .create();
      ((AlertDialog) (obj)).show();
      ((EditText) (obj1)).setVisibility(8);
      textview1.setVisibility(8);
      textview.setVisibility(8);
      listview1.setVisibility(8);
      obj1 = new ArrayList();
      int j = ((MyApplication) hotelsearchactivity.getApplication()).d().size();
      for (int k = 0; k < j; k++)
        if (((HashMap) ((MyApplication) hotelsearchactivity.getApplication()).d().get(k))
            .containsValue(s))
          ((ArrayList) (obj1))
              .add((HashMap) ((MyApplication) hotelsearchactivity.getApplication()).d().get(k));

      listview.setAdapter(new p(hotelsearchactivity, ((ArrayList) (obj1))));
      listview.setOnItemClickListener(
          new r(hotelsearchactivity, ((ArrayList) (obj1)), ((AlertDialog) (obj))));
    }
    cursor.close();
  }
Пример #26
0
 private void updateList() {
   View footerView = getFooterView();
   if (mListView.getFooterViewsCount() == 0) {
     mListView.addFooterView(footerView);
   }
   if (mSongAdapter == null) {
     mSongAdapter = new SongAdapter();
     mListView.setEmptyView(getEmptyView());
     mListView.setAdapter(mSongAdapter);
   } else {
     mSongAdapter.notifyDataSetChanged();
   }
 }
Пример #27
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.c09_overscroll);

    for (int i = 1001; i <= 1003; i++) {
      mItem.add(Integer.toString(i));
    }

    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItem);

    mList = (ListView) findViewById(R.id.list);
    mList.setAdapter(mAdapter);
  }
Пример #28
0
  private void iniAction() {
    //  bookArrayAdapter  = new ArrayAdapter<Book>(this, android.R.layout.simple_list_item_1,
    // bookList);
    listViewBooks.setAdapter(bookArrayAdapter);

    listViewBooks.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(
              AdapterView<?> adapterView, View view, final int position, long l) {

            AlertDialog mDialog = new AlertDialog.Builder(AllBooksActivity.this).create();

            mDialog.setButton(
                DialogInterface.BUTTON_POSITIVE,
                "Update",
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {

                    Book book = bookArrayAdapter.getItem(position);

                    updateBooks(book);
                  }
                });

            mDialog.setButton(
                DialogInterface.BUTTON_NEGATIVE,
                "Delete",
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                    Book book = bookArrayAdapter.getItem(position);

                    Loader<Cursor> loader = getLoaderManager().getLoader(BOOK_LOADER);

                    DbHelper.getInstance(getApplicationContext())
                        .delete(
                            DbHelper.TABLE_BOOK,
                            DbHelper.COLUMN_BOOK_ID + " =?",
                            new String[] {String.valueOf(book.getId())},
                            loader);

                    dialogInterface.dismiss();
                  }
                });

            mDialog.show();
          }
        });
  }
Пример #29
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View view = inflater.inflate(R.layout.profile_fragment, container, false);
    mProfilePictureView = (ProfilePictureView) view.findViewById(R.id.profile_Picture);
    mProfilePictureView.setCropped(true);
    mUserInfo = (TextView) view.findViewById(R.id.user_info);

    mAlbumButton = (Button) view.findViewById(R.id.album_button);
    mAlbumButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, AlbumActivity.class);
            context.startActivity(intent);
          }
        });

    mLocationButton = (Button) view.findViewById(R.id.location_button);
    mLocationButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, GMSMapActivity.class);
            context.startActivity(intent);
          }
        });

    mGCMMessageButton = (Button) view.findViewById(R.id.gcm_message_button);
    mGCMMessageButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, NotificationEntryActivity.class);
            context.startActivity(intent);
          }
        });

    mStatusListView = (ListView) view.findViewById(R.id.status_list);
    View header = LayoutInflater.from(getActivity()).inflate(R.layout.status_list_header, null);
    mStatusListView.addHeaderView(header, null, false);
    mStatusListAdapter = new StatusListAdapter(getActivity());
    mStatusListView.setAdapter(mStatusListAdapter);

    return view;
  }
Пример #30
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_swipe);
    initView();
    for (int i = 0; i < 20; i++) {
      HashMap<String, Object> itemData = new HashMap<String, Object>();
      itemData.put("ManName", "阿根廷球迷" + i);
      itemData.put("LastTime", "最近发言:十分钟以前");
      data.add(itemData);
    }

    baseAdapter =
        new BaseAdapter() {
          @Override
          public int getCount() {
            return data.size();
          }

          @Override
          public Object getItem(int position) {
            return data.get(position);
          }

          @Override
          public long getItemId(int position) {
            return position;
          }

          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
              LayoutInflater layoutInflater = getLayoutInflater();
              convertView =
                  layoutInflater.inflate(R.layout.manager_group_list_item_parent, parent, false);
            }
            Map<String, Object> itemData = (Map<String, Object>) getItem(position);
            ImageView ManImg = (ImageView) convertView.findViewById(R.id.ManImg);
            TextView ManName = (TextView) convertView.findViewById(R.id.ManName);
            TextView LastTime = (TextView) convertView.findViewById(R.id.LastTime);
            ManName.setText(itemData.get("ManName").toString());
            LastTime.setText(itemData.get("LastTime").toString());
            return convertView;
          }
        };
    GroupManList.setAdapter(baseAdapter);
    final ListViewSwipeGesture touchListener =
        new ListViewSwipeGesture(GroupManList, swipeListener, this);
    touchListener.SwipeType = ListViewSwipeGesture.Double; // 设置两个选项列表项的背景
    GroupManList.setOnTouchListener(touchListener);
  }