@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);
  }
示例#2
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();
  }
示例#3
0
 BookmarksAdapter(ListView listView, List<Bookmark> bookmarks, boolean currentBook) {
   myBookmarks = bookmarks;
   myCurrentBook = currentBook;
   listView.setAdapter(this);
   listView.setOnItemClickListener(this);
   listView.setOnCreateContextMenuListener(this);
 }
  /** 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);
  }
示例#5
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);
  }
示例#6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    Thread.currentThread().setUncaughtExceptionHandler(this);
    setContentView(R.layout.main);

    inputView = (EditText) findViewById(R.id.input_view);
    inputView.setOnEditorActionListener(this);

    listAdapter = new ArrayAdapter<String>(this, R.layout.row);
    listAdapter.setNotifyOnChange(true);

    resultsView = (ListView) this.findViewById(R.id.results_view);
    resultsView.setAdapter(listAdapter);
    resultsView.setOnItemClickListener(this);
  }
  public void setMeatToppingsView() {

    ListView list = (ListView) findViewById(R.id.meatToppingsView);
    String[] meat = {"Pepperoni", "Chicken", "Ground Beef", "Anchovies", "Bacon Bits"};
    List<String> meatList = Arrays.asList(meat);
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, meatList);
    list.setAdapter(adapter);
    list.setClickable(true);
    list.setChoiceMode(list.CHOICE_MODE_MULTIPLE);
    list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            CheckedTextView item = (CheckedTextView) view;
            if (item.isChecked()) {
              numMeatToppings++;
            } else {
              numMeatToppings--;
            }
          }
        });
  }
示例#8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_drawer);
    CONTENT_VIEW_ID = R.id.content_frame;

    Utils.showUserGuardIfNeed(this, UserGuideActivity.START_FROM_SPLASH);

    mTitle = mDrawerTitle = getTitle();
    //        mDrawerItems = getResources().getStringArray(R.array.drawer_items_array);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener
    drawerListAdapter = new DrawerListAdapter(getApplicationContext());
    drawerItemArrayList = new ArrayList<Object>();
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_DASHBOARD, getString(R.string.menu_item_dashboard)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_PUSHUPS, getString(R.string.menu_item_pushup)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_MULTI, getString(R.string.menu_item_multi)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_WRIST, getString(R.string.menu_item_wrist)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_GOOGLE, getString(R.string.menu_item_google)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_LEADERBOARD, getString(R.string.menu_item_leaderboard)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_ARCHIEVEMENT, getString(R.string.menu_item_archievement)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_HELPER, getString(R.string.menu_item_helper)));
    drawerItemArrayList.add(
        new DrawerListAdapter.DrawerItem(
            Constants.DRAWER_ITEM_ABOUT, getString(R.string.menu_item_about)));

    drawerListAdapter.setDataList(drawerItemArrayList);
    mDrawerList.setAdapter(drawerListAdapter);

    //        mDrawerList.setAdapter(new ArrayAdapter<String>(this,
    //                R.layout.drawer_list_item, mDrawerItems));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBarImpl().setDisplayHomeAsUpEnabled(true);
    getActionBarImpl().setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle =
        new ActionBarDrawerToggle(
            this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */) {
          public void onDrawerClosed(View view) {
            getActionBarImpl().setTitle(mTitle);
            supportInvalidateOptionsMenu();
            //                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
          }

          public void onDrawerOpened(View drawerView) {
            getActionBarImpl().setTitle(mDrawerTitle);
            supportInvalidateOptionsMenu();
            //                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
          }
        };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
      selectItem((DrawerListAdapter.DrawerItem) drawerListAdapter.getItem(0));
    } else {
      selectItem((DrawerListAdapter.DrawerItem) drawerListAdapter.getItem(0));
    }

    bus = ServiceProvider.getBus();
    bus.register(this);

    appPreference = AppPreference.getInstance(getApplicationContext());
    titlebarHelper =
        new TitlebarHelper(
            MainActivity.this,
            new TitlebarHelper.OnTitlebarClickListener() {
              @Override
              public void onClickIcon() {}

              @Override
              public void onClickTitle() {}
            });

    userIcon = (ImageView) findViewById(R.id.user_icon);
    userInfo = (TextView) findViewById(R.id.user_info);
    share = (TextView) findViewById(R.id.share_textview);

    userInfo.setOnClickListener(this);
    userIcon.setOnClickListener(this);
    share.setOnClickListener(this);
    findViewById(R.id.button_sign_in).setOnClickListener(this);
    findViewById(R.id.button_sign_out).setOnClickListener(this);

    getGamesClient()
        .registerConnectionCallbacks(
            new GooglePlayServicesClient.ConnectionCallbacks() {
              @Override
              public void onConnected(Bundle bundle) {
                submitScore();
              }

              @Override
              public void onDisconnected() {
                showAlert("Connect", "Disconnected!");
              }
            });

    getGamesClient().connect();

    //        if (!isSignedIn()) {
    //            beginUserInitiatedSignIn();
    //        }

    //        showDashboardFragment();
    initWeChat();
  }
示例#9
0
 BookmarksAdapter(ListView listView, boolean showAddBookmarkItem) {
   myShowAddBookmarkItem = showAddBookmarkItem;
   listView.setAdapter(this);
   listView.setOnItemClickListener(this);
   listView.setOnCreateContextMenuListener(this);
 }