Beispiel #1
0
  public static void clearAllData() {

    listArtSelClp.clear();
    adapterListArtClp.notifyDataSetChanged();

    globalDepozSel = "";
    globalCodDepartSelectetItem = "";
    CreareClp.codClient = " ";
    CreareClp.codJudet = " ";
    CreareClp.oras = " ";
    CreareClp.strada = " ";
    CreareClp.persCont = " ";
    CreareClp.telefon = " ";
    CreareClp.codFilialaDest = " ";
    CreareClp.comandaFinala = " ";
    CreareClp.dataLivrare = " ";
    CreareClp.tipTransport = "TRAP";
    CreareClp.tipPlata = "B";

    CLPFragment1.clearClientData();

    for (int i = 0; i < objArticol.length; i++) {
      objArticol[i] = null;
    }

    slidingDrawerSaveClp.close();
    textValoareGreutate.setText("");
    textTotalGreutate.setText("");
  }
  /**
   * fills the list with stops from the local database
   *
   * @param db the database adapter to use
   */
  private void fillList(BusDbAdapter db) {
    Cursor c;
    if (listType == FAVORITES) {
      c = db.getFavoriteDest(NUM_ENTRIES_TO_FETCH);
    } else { // listType == MAJOR
      c = db.getMajorDest(NUM_ENTRIES_TO_FETCH);
    }
    int stopIDIndex = c.getColumnIndex("stop_id");
    int stopDescIndex = c.getColumnIndex("stop_desc");
    int routeIDIndex = c.getColumnIndex("route_id");
    int routeDescIndex = c.getColumnIndex("route_desc");
    if (c != null) {
      for (int i = 0; i < c.getCount(); i++) {
        HashMap<String, String> item = new HashMap<String, String>();

        String stopID = c.getString(stopIDIndex);
        String stopName = c.getString(stopDescIndex);
        String route = c.getString(routeIDIndex);
        String routeDesc = c.getString(routeDescIndex);
        Log.v(TAG, "PUT");
        Log.v(TAG, "stopID " + stopID + " stopName " + stopName);
        Log.v(TAG, "routeID " + route + " routeDesc" + routeDesc);
        item.put("stopID", stopID);
        item.put("stopName", stopName);
        item.put("routeID", route);
        item.put("routeDesc", routeDesc);
        c.moveToNext();
        locationList.add(item);
      }
      listAdapter.notifyDataSetChanged();
    }
  }
Beispiel #3
0
  @Override
  public void callBack(String TAG, String str) {
    // TODO 自動生成されたメソッド・スタブ

    JSONArray json;
    try {
      json = new JSONArray(str);
      data.clear();
      for (int i = 0; i < json.length(); i++) {
        JSONObject plan = json.getJSONObject(i).getJSONObject("plan");

        // 一行の複数項目を HashMap で詰め込む
        map = new HashMap<String, String>();
        map.put("member_id", plan.getString("member_id"));
        map.put("plan_id", plan.getString("plan_id"));
        map.put("plan_name", "プラン名:" + plan.getString("plan_name"));

        JSONArray categories = plan.getJSONArray("plan_categories");
        String cate = "カテゴリ:";
        for (int j = 0; j < categories.length(); j++) {
          JSONObject categ = (JSONObject) categories.get(j);
          cate = cate + " " + categ.getString("category_id");
        }

        map.put("categories", cate);
        data.add(map);
      }
      adapter.notifyDataSetChanged();
    } catch (JSONException e) {
      // TODO 自動生成された catch ブロック
      e.printStackTrace();
    }
  }
  private void showDirectoryContentsUI() {
    // Fijamos el directorio actual.

    iCurrentPath = iLoadingPathname;

    // Visualizamos el nombre del directorio actual.

    iFolderNameText.setText(iCurrentPath + "/");

    // Eliminamos la lista de ficheros antiguos.

    iFilesList.clear();

    // Si no estamos en el directorio raíz, añadimos como primer elemento
    // ir al directorio anterior.

    if (!iCurrentPath.equals("")) {
      iFilesList.add(
          createListViewItem(getResources().getString(R.string.folder_up), R.drawable.folder_up));
    }

    // Inicializamos la lista de ficheros.

    for (MyFile child : iChilds)
      iFilesList.add(
          createListViewItem(
              child.getName(), child.isDirectory() ? R.drawable.folder : R.drawable.file));

    // Visualizamos la lista.

    iAdapterList.notifyDataSetChanged();
    iListView.setAdapter(iAdapterList);
  }
Beispiel #5
0
 // 刷新图片
 @Override
 public void onResume() {
   super.onResume();
   if (!TextUtils.isEmpty(pathImage)) {
     Bitmap addbmp = BitmapFactory.decodeFile(pathImage);
     HashMap<String, Object> map = new HashMap<String, Object>();
     map.put("itemImage", addbmp);
     imageItem.add(map);
     simpleAdapter =
         new SimpleAdapter(
             getActivity(),
             imageItem,
             R.layout.item_upload_image_grid,
             new String[] {"itemImage"},
             new int[] {R.id.imageView1});
     simpleAdapter.setViewBinder(
         new SimpleAdapter.ViewBinder() {
           @Override
           public boolean setViewValue(View view, Object data, String textRepresentation) {
             // TODO Auto-generated method stub
             if (view instanceof ImageView && data instanceof Bitmap) {
               ImageView i = (ImageView) view;
               i.setImageBitmap((Bitmap) data);
               return true;
             }
             return false;
           }
         });
     mGridView.setAdapter(simpleAdapter);
     simpleAdapter.notifyDataSetChanged();
     // 刷新后释放防止手机休眠后自动添加
     pathImage = null;
   }
 }
 private void updateList() {
   mCardsAdapter.notifyDataSetChanged();
   int count = mCards.size();
   UIUtils.setActionBarSubtitle(
       this,
       getResources()
           .getQuantityString(R.plurals.card_browser_subtitle, count, count, mAllCards.size()));
 }
 private void updateList() {
   mCardsAdapter.notifyDataSetChanged();
   int count = mCards.size();
   setTitle(
       getResources()
           .getQuantityString(
               R.plurals.card_browser_title, count, mDeck.getDeckName(), count, mAllCards.size()));
 }
 @Override
 public void onRefresh() {
   a = 34;
   data.clear();
   data = getdata();
   simpleAdapter.notifyDataSetChanged();
   swipeRefreshLayout.setRefreshing(false);
 }
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 100:
       adapter.notifyDataSetChanged();
       mRestoreList.onRefreshFinish();
       break;
   }
   super.handleMessage(msg);
 }
 /**
  * 显示更多加载的数据
  *
  * @param moreData
  */
 public void printMoreData(List<HashMap<String, String>> moreData) {
   data.addAll(moreData);
   // 刷新数据
   adapter.notifyDataSetChanged();
   // 按钮可见
   btnFoot.setVisibility(View.VISIBLE);
   // 进度不可见
   pbFoot.setVisibility(View.GONE);
 }
 @Override
 public void handleMessage(Message msg) {
   super.handleMessage(msg);
   switch (msg.what) {
     case DATACHANGED:
       progressDialog.dismiss();
       simpleAdapter.notifyDataSetChanged();
   }
 }
 /*
  * Updates the ListView according to the observers.
  */
 private void updateList() {
   TransferObserver observer = null;
   HashMap<String, Object> map = null;
   for (int i = 0; i < observers.size(); i++) {
     observer = observers.get(i);
     map = transferRecordMaps.get(i);
     Util.fillMap(map, observer, i == checkedIndex);
   }
   simpleAdapter.notifyDataSetChanged();
 }
Beispiel #13
0
  @Override
  protected void onResume() {
    super.onResume();
    // DatabaseOpenHelperを取得
    DatabaseOpenHelper databaseOpenHelper = new DatabaseOpenHelper(this);

    SQLiteDatabase database = null;
    Cursor cursor = null;

    try {
      // 読み取り専用でSQLiteDatabaseを取得
      database = databaseOpenHelper.getWritableDatabase();
      // databaseOpenHelper.onCreate(database);
      // databaseOpenHelper.onInsert(database);
      ArrayList<HashMap<String, Object>> outputArray = new ArrayList<HashMap<String, Object>>();
      HashMap<String, Object> item = null;
      // クエリーを投げて、検索して取得結果のカーソルを取得
      cursor = database.query("MIMICRY", null, null, null, null, null, null);

      startManagingCursor(cursor);

      int i = 0;
      while (cursor.moveToNext()) {

        item = new HashMap<String, Object>();
        item.put("img", Constant.images[i]);
        item.put("title", cursor.getString(cursor.getColumnIndex("TITLE")));
        item.put("challenge", cursor.getString(cursor.getColumnIndex("CHALLENGE_LEVEL")));
        item.put("rating", cursor.getString(cursor.getColumnIndex("RATING")));
        outputArray.add(item);
        i++;
      }
      SimpleAdapter myAdapter =
          new SimpleAdapter(
              this,
              outputArray,
              R.layout.mimicry_row, // ここがポイント2
              new String[] {"img", "title", "challenge", "rating"}, // ここがポイント3-1
              new int[] {
                R.id.imageView, R.id.rowtitle, R.id.change_level, R.id.rating
              } // ここがポイント3-2
              );

      setListAdapter(myAdapter);
      myAdapter.notifyDataSetChanged();

      setSelection(ps);

    } finally {
      if (database != null) {
        database.close();
        Log.v("RssListActivity", "Succeeded in close the database.");
      }
    }
  }
Beispiel #14
0
  private void loadData() {

    for (int i = 0; i < titles.length; i++) {
      Map<String, String> map = new HashMap<>();
      map.put("title", titles[i]);
      map.put("clazz", classNames[i]);
      data.add(map);
    }

    adapter.notifyDataSetChanged();
  }
Beispiel #15
0
 @Override
 public void handleMessage(Message msg) {
   if (msg.what != REFRESH_LOCAL_USERS) {
     users.clear();
     for (NetUser netUser : communication.getNetUserList().userListToArray()) {
       HashMap<String, String> userMap = new HashMap<String, String>();
       userMap.put(USERNAME, netUser.getName());
       userMap.put(IP, netUser.getIp().getHostAddress());
       users.add(userMap);
     }
     adapter.notifyDataSetChanged();
   }
 }
 @Override
 public void trackChanged(MPDStatus mpdStatus, int oldTrack) {
   if (isPlayQueue) {
     // Mark running track...
     for (HashMap<String, Object> song : songlist) {
       if (((Integer) song.get("songid")).intValue() == mpdStatus.getSongId())
         song.put("play", android.R.drawable.ic_media_play);
       else song.put("play", 0);
     }
     final SimpleAdapter adapter = (SimpleAdapter) getListAdapter();
     if (adapter != null) adapter.notifyDataSetChanged();
   }
 }
Beispiel #17
0
 private void updateList() {
   userData.clear();
   userList = dbHelper.getAllUser();
   for (UserEntity user : userList) {
     HashMap<String, Object> map = new HashMap<String, Object>();
     map.put("name", user.getName());
     map.put("ip_addr", dbHelper.getUserAddrByUUID(user.getUuid()));
     map.put("unread_message", dbHelper.getUnreadMessageCountByUUID(user.getUuid()));
     map.put("uuid", user.getUuid());
     userData.add(map);
   }
   userListAdapter.notifyDataSetChanged();
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == RESULT_OK && requestCode == INDIVIDUAL_REQUEST) {
     Bundle b = data.getExtras();
     Log.i(TAG, "Name: " + b.getString("bName"));
     Log.i(TAG, "For: " + b.getInt("bFor"));
     Log.i(TAG, "Against: " + b.getInt("bAgainst"));
     HashMap<String, Object> hm = listItem.get(chosenPosition);
     hm.put("ItemFor", b.getInt("bFor"));
     hm.put("ItemAgainst", b.getInt("bAgainst"));
     listItemAdapter.notifyDataSetChanged();
   }
 }
 @Override
 protected void onPostExecute(List<Map<String, String>> mapping) {
   super.onPostExecute(mapping);
   SimpleAdapter adapter =
       new SimpleAdapter(
           activity,
           mapping,
           android.R.layout.simple_list_item_1,
           new String[] {"Name"},
           new int[] {android.R.id.text1});
   activity.mState.mapping = mapping;
   activity.setListAdapter(adapter);
   adapter.notifyDataSetChanged();
   activity.stopProgressDialog();
 }
 private void fillItem(ArrayList<TvStationProgram> tvs) {
   for (int i = 0; i < tvs.size(); i++) {
     Log.d(TAG, "fillItem loop");
     HashMap<String, Object> map = new HashMap<String, Object>();
     // map.put("imgtv",tvId2ResId.get(tvs.get(i).getTvIndex()));
     map.put("imgtv", tvId2ResId.get(1));
     map.put("channel_name", tvs.get(i).getTvName());
     if (tvs.get(i).getPrograms().size() != 0)
       map.put("current_program", tvs.get(i).getPrograms().get(0).getProgramName());
     else map.put("current_program", "节目已结束");
     listItem.add(map);
   }
   mTvs.addAll(tvs);
   listItemAdapter.notifyDataSetChanged();
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK)
     switch (requestCode) {
       case AddContactActivity.ADD_CONTACT:
         String name = data.getStringExtra(Contact.NAME);
         String phone = data.getStringExtra(Contact.PHONE);
         String email = data.getStringExtra(Contact.EMAIL);
         Contact c = new Contact(name, phone, email);
         contactsHash.add(createMapFromContact(c));
         contacts.add(c);
         adapter.notifyDataSetChanged();
         break;
     }
 }
Beispiel #22
0
  protected void FillPackageList() {
    synchronized (mListViewItems) {
      mInstalledPackageInfo = mMarket.GetInstalledOpenCVPackages();
      mListViewItems.clear();

      for (int i = 0; i < mInstalledPackageInfo.length; i++) {
        // Convert to Items for package list view
        HashMap<String, String> temp = new HashMap<String, String>();
        String PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);

        int idx = 0;
        String OpenCVersion = "unknown";
        String HardwareName = "";
        StringTokenizer tokenizer = new StringTokenizer(mInstalledPackageInfo[i].packageName, "_");
        while (tokenizer.hasMoreTokens()) {
          if (idx == 1) {
            // version of OpenCV
            OpenCVersion = tokenizer.nextToken().substring(1);
          } else if (idx >= 2) {
            // hardware options
            HardwareName += tokenizer.nextToken() + " ";
          } else {
            tokenizer.nextToken();
          }
          idx++;
        }

        String ActivePackagePath;
        ActivePackagePath = mActivePackageMap.get(OpenCVersion);
        Log.d(TAG, OpenCVersion + " -> " + ActivePackagePath);

        if (null != ActivePackagePath
            && ActivePackagePath.indexOf(mInstalledPackageInfo[i].packageName) >= 0) {
          temp.put("Activity", "y");
          PublicName += " (in use)";
        } else {
          temp.put("Activity", "n");
        }

        temp.put("Name", PublicName);
        temp.put("Version", NormalizeVersion(OpenCVersion, mInstalledPackageInfo[i].versionName));
        temp.put("Hardware", HardwareName);
        mListViewItems.add(temp);
      }

      mInstalledPacksAdapter.notifyDataSetChanged();
    }
  }
 private void addData() {
   for (int i = a + 1; i < a + 10; i++) {
     Map<String, Object> map = new HashMap<>();
     map.put("one", i);
     data.add(map);
     isLoadingOver = true;
   }
   a += 9;
   if (isLoadingOver) {
     Log.i("onScrollStateChanged", "=======2======");
     listview.removeFooterView(FootView);
     simpleAdapter.notifyDataSetChanged();
     isLoadingOver = false;
     isLoadingMore = false;
   }
 }
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case 7:
              HashMap<String, Object> tempmap = new HashMap<String, Object>();
              tempmap = (HashMap<String, Object>) msg.obj;

              listItem.add(tempmap);

              mSimpleAdapter.notifyDataSetChanged();
              break;
            default:
              break;
          }

          super.handleMessage(msg);
        }
Beispiel #25
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {

    int menuItemIndex = item.getItemId();

    if (menuItemIndex == 0) // stergere
    {
      listArtSelClp.remove(listViewSelPos);
      adapterListArtClp.notifyDataSetChanged();
      listViewSelPos = -1;

      refreshListViewItems();

      if (listArtSelClp.size() == 0) layoutSaveClp.setVisibility(View.INVISIBLE);
    }

    return true;
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.trackdetail_menu_save:
        String enteredName = etName.getText().toString().trim();
        if ((enteredName.length() > 0) && (!enteredName.equals(trackNameInDB))) {
          DataHelper.setTrackName(trackId, enteredName, getContentResolver());
        }

        // All done
        finish();
        break;
      case R.id.trackdetail_menu_cancel:
        finish();
        break;
      case R.id.trackdetail_menu_display:
        Intent i;
        boolean useOpenStreetMapBackground =
            PreferenceManager.getDefaultSharedPreferences(this)
                .getBoolean(
                    OSMTracker.Preferences.KEY_UI_DISPLAYTRACK_OSM,
                    OSMTracker.Preferences.VAL_UI_DISPLAYTRACK_OSM);
        if (useOpenStreetMapBackground) {
          i = new Intent(this, DisplayTrackMap.class);
        } else {
          i = new Intent(this, DisplayTrack.class);
        }
        i.putExtra(Schema.COL_TRACK_ID, trackId);
        startActivity(i);
        break;
      case R.id.trackdetail_menu_export:
        new ExportTrackTask(this, trackId).execute();
        // Pick last list item (Exported date) and update it
        SimpleAdapter adapter = ((SimpleAdapter) lv.getAdapter());
        @SuppressWarnings("unchecked")
        Map<String, String> data = (Map<String, String>) adapter.getItem(adapter.getCount() - 1);
        data.put(
            ITEM_VALUE,
            DateFormat.getDateTimeInstance().format(new Date(System.currentTimeMillis())));
        adapter.notifyDataSetChanged();
        break;
    }
    return super.onOptionsItemSelected(item);
  }
  /** actions for the context menu */
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int id = (int) getListAdapter().getItemId(info.position);

    // sets an alarm for the selected stop
    switch (item.getItemId()) {
      case SET_STOP_OPTION:
        Intent i = new Intent(getApplicationContext(), ConfirmationPage.class);
        HashMap<String, String> busItem = locationList.get(id);
        DataFetcher df = new DataFetcher();
        try {
          BusStop b = df.getStopById(Integer.parseInt(busItem.get("stopID").split("_")[1]));
          i.putExtra("busstop", b);
          i.putExtra("busroute", busItem.get("routeID"));
          i.putExtra("busroutedesc", busItem.get("routeDesc"));
          startActivity(i);
          finish();
          // if an exception occurs, nothing happens (for now).
        } catch (NumberFormatException e) {
          Log.v(TAG, "Error parsing stop id!");
          e.printStackTrace();
        } catch (IOException e) {
          Log.v(TAG, "Error fetching info!");
          e.printStackTrace();
        }
        break;
        // removes the selected stop from the list
      case REMOVE_STOP_OPTION:
        HashMap<String, String> itemToRemove = locationList.get(id);
        mBusDbHelper.open();
        mBusDbHelper.deleteDest(itemToRemove.get("routeID"), itemToRemove.get("stopID"));
        mBusDbHelper.close();
        locationList.remove(id);
        listAdapter.notifyDataSetChanged();
        break;
      case CANCEL:
        break;
      default:
        break;
    }
    return true;
  }
Beispiel #28
0
 public boolean updateData() {
   if (topicPageList.size() > showedPage) {
     TopicPage page = topicPageList.get(showedPage++);
     for (int i = 0; i < page.getTopicList().size(); i++) {
       Topic temp = page.getTopicList().get(i);
       HashMap<String, Object> map;
       map = new HashMap<String, Object>();
       map.put(MapKey.MESSAGE_TITLE, temp.getMessageTitle());
       map.put(MapKey.AUTHOR_NAME, temp.getAutherName());
       map.put(MapKey.TOTAL_REPLIES, temp.getTotalReplies());
       map.put(MapKey.RATING, temp.getRatingStr());
       map.put(MapKey.MESSAGE_ID, temp.getMessageId());
       map.put(MapKey.LAST_REPLY_DATE, temp.getLastReplayDate());
       hashMaplist.add(map);
     }
     adapter.notifyDataSetChanged();
     return true;
   } else {
     return false;
   }
 }
  /** Gets all relevant transfers from the Transfer Service for populating the UI */
  private void initData() {
    transferRecordMaps.clear();
    // Use TransferUtility to get all upload transfers.
    observers = transferUtility.getTransfersWithType(TransferType.UPLOAD);
    TransferListener listener = new UploadListener();
    for (TransferObserver observer : observers) {

      // For each transfer we will will create an entry in
      // transferRecordMaps which will display
      // as a single row in the UI
      HashMap<String, Object> map = new HashMap<String, Object>();
      Util.fillMap(map, observer, false);
      transferRecordMaps.add(map);

      // Sets listeners to in progress transfers
      if (TransferState.WAITING.equals(observer.getState())
          || TransferState.WAITING_FOR_NETWORK.equals(observer.getState())
          || TransferState.IN_PROGRESS.equals(observer.getState())) {
        observer.setTransferListener(listener);
      }
    }
    simpleAdapter.notifyDataSetChanged();
  }
Beispiel #30
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 0:
       try {
         Thread.sleep(3000);
       } catch (InterruptedException e) {
         e.printStackTrace();
       }
       loadMoreData();
       adapter.notifyDataSetChanged();
       moreView.setVisibility(View.GONE);
       if (count > 30) {
         Toast.makeText(MyActivity.this, "没有更多数据!", Toast.LENGTH_LONG).show();
         listView.removeFooterView(moreView);
       }
       Log.i(TAG, "加载更多数据...");
     case 1:
       break;
     default:
       break;
   }
 }