Example #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    RowHolder holder = null;

    if (row == null) {
      LayoutInflater inflater = ((Activity) activity).getLayoutInflater();
      row = inflater.inflate(layoutResourceId, parent, false);

      holder = new RowHolder();
      holder.imgIcon = (ImageView) row.findViewById(R.id.imgIcon);
      holder.txtTitle = (TextView) row.findViewById(R.id.txtTitle);
      holder.imgIcon.setOnClickListener(
          new BookmarkListener(row, data, position, activity, this.listfragment));

      row.setTag(holder);
    } else {
      holder = (RowHolder) row.getTag();
    }

    ParsedRow rowItem = data.get(position);
    holder.txtTitle.setText(rowItem.getTitle());
    holder.imgIcon.setImageResource(rowItem.getIcon());

    return row;
  }
Example #2
0
  @Override
  public void onListItemClick(ListView parent, View v, int position, long id) {
    //	        Toast.makeText(this, this.currentEntries.get(position).getView(),
    // Toast.LENGTH_SHORT).show();
    ParsedRow clickedRow = EmpsiAdapter.currentData.get(position);
    int view = Integer.parseInt(clickedRow.getView());
    String title = clickedRow.getTitle();
    String scroll = clickedRow.getScroll();

    FileList fl = new FileList();
    String url = fl.getURL(view);

    Intent i = new Intent(getActivity(), MainActivity.class);

    i.putExtra("view", url);
    i.putExtra("title", title);
    i.putExtra("scroll", scroll);
    i.setData(Uri.parse(url));

    Log.d(TAG, "INTENT: " + title);
    Log.d(TAG, "INTENT: " + url);
    Log.d(TAG, "INTENT: " + scroll);

    //	        Toast.makeText(this, url, Toast.LENGTH_SHORT).show();

    startActivity(i);
  }
  private RowModel mapsParsedRowToRowModel(
      List<ParsedColumnMetadata> metaData,
      ParsedRow parsedRow,
      ComparatorType keyType,
      GenericTypeEnum[] typesBelongingCompositeTypeForKeyType,
      ComparatorType comparatorType,
      GenericTypeEnum[] typesBelongingCompositeTypeForComparatorType,
      ComparatorType subComparatorType,
      ComparatorType defaultColumnValueType) {
    RowModel row = new RowModel();

    row.setKey(
        TypeExtractor.constructGenericType(
            parsedRow.getKey(), keyType, typesBelongingCompositeTypeForKeyType));

    row.setColumns(
        mapParsedColumnsToColumnsModel(
            metaData,
            parsedRow.getColumns(),
            comparatorType,
            typesBelongingCompositeTypeForComparatorType,
            defaultColumnValueType));
    row.setSuperColumns(
        mapParsedSuperColumnsToSuperColumnsModel(
            metaData,
            parsedRow.getSuperColumns(),
            comparatorType,
            subComparatorType,
            defaultColumnValueType));
    return row;
  }
Example #4
0
    @Override
    public void onClick(View v) {
      Log.d(TAG, String.format("Position clicked = %d", this.position));
      Log.d(TAG, String.format("bmIndex clicked = %d", this.data.get(position).getIndex()));

      try {
        /* Our PlistHandler now provides the parsed data to us. */
        //                this.entries = myHandler.getListOfRows();
        List<ParsedRow> bookmarkList = new ArrayList<ParsedRow>();
        int icon = android.R.drawable.ic_menu_delete;
        //    			int icon = android.R.drawable.ic_menu_close_clear_cancel;
        String bmCount = LoadPreference("bmCount", "-1");

        /* Saves Bookmarks without the deleted one. */
        Log.d(TAG, "---------Delete--------");
        Log.d(TAG, "bmCount: " + bmCount);
        for (int i = 0; i <= Integer.parseInt(bmCount); i++) {
          String bmTitle = LoadPreference("bmTitle" + i, "bmTitle");
          String bmScroll = LoadPreference("bmScroll" + i, "bmScroll");

          if (i < this.position) {
            this.editBookmark(bmTitle, bmScroll, i);
          } else if (i == this.position) {
            Log.d(TAG, "editBookmark " + bmTitle + "[" + i + "] =" + bmScroll);
          } else if (i > this.position) {
            this.editBookmark(bmTitle, bmScroll, i - 1);
          } else {

          }
        }

        int theCount = Integer.parseInt(bmCount) - 1;
        Log.d(TAG, "theCount = " + theCount);
        SavePreference("bmCount", String.valueOf(theCount));

        /* Loads the Preference for Number of Bookmarks */
        Log.d(TAG, "----------Load----------");
        Log.d(TAG, "bmCount: " + bmCount);
        for (int i = 0; i <= Integer.parseInt(bmCount); i++) {
          String bmTitle = LoadPreference("bmTitle" + i, "bmTitle");
          String bmScroll = LoadPreference("bmScroll" + i, "bmScroll");

          ParsedRow bmRow = new ParsedRow();
          bmRow.setTitle(bmTitle + "(" + bmScroll + ")" + " " + i + " of " + bmCount);
          bmRow.setView("5");
          bmRow.setScroll(bmScroll);
          bmRow.setIcon(icon);
          bmRow.setIndex(i);
          bookmarkList.add(bmRow);
        }

        ParsedRow row1 = new ParsedRow();
        row1.setTitle("Application Tutorial");
        row1.setView("5");
        row1.setScroll("0");
        bookmarkList.add(row1);

        ParsedRow row2 = new ParsedRow();
        row2.setTitle("Bookmark Tutorial");
        row2.setView("6");
        row2.setScroll("0");
        bookmarkList.add(row2);

        ParsedRow row3 = new ParsedRow();
        row3.setTitle("Navigation Tutorial");
        row3.setView("7");
        row3.setScroll("0");
        bookmarkList.add(row3);

        /* Set the result to be displayed in our GUI. */
        BookmarkAdapter adapter =
            new BookmarkAdapter(
                this.context, R.layout.bookmark_custom_row, bookmarkList, this.frag);
        this.frag.setListAdapter(adapter);

      } catch (Exception e) {
        /* Display any Error to the GUI. */
        Log.e(TAG, "XMLQueryError", e);
      }

      //    		BookmarkAdapter.prevData.add(this.data);
      //    		this.nextData = this.data.get(position).getChildren();
      /* Set the result to be displayed in our GUI. */
      //    		BookmarkAdapter adapter = new BookmarkAdapter(this.context, R.layout.empsi_custom_row,
      // this.nextData, this.frag);
      //    		this.frag.setListAdapter(adapter);

      //    			EmpsiAdapter.prevTitle.add(this.data.get(position).getTitle());
      //    			((MainListActivity)
      // this.context).actionBar.setTitle(this.data.get(position).getTitle());
    }
Example #5
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    /* Sets variable so that Preferences can be loaded and saved as in JavaScriptInterface */
    mContext = getActivity();

    try {
      /* Our PlistHandler now provides the parsed data to us. */
      //                this.entries = myHandler.getListOfRows();
      List<ParsedRow> bookmarkList = new ArrayList<ParsedRow>();
      int icon = android.R.drawable.ic_menu_delete;
      //			int icon = android.R.drawable.ic_menu_close_clear_cancel;

      /* Loads the Preference for Number of Bookmarks */
      String bmCount = LoadPreference("bmCount", "-1");
      Log.d(TAG, "----------------------------");
      Log.d(TAG, "bmCount: " + bmCount);
      for (int i = 0; i <= Integer.parseInt(bmCount); i++) {
        String bmTitle = LoadPreference("bmTitle" + i, "bmTitle");
        String bmScroll = LoadPreference("bmScroll" + i, "bmScroll");

        ParsedRow bmRow = new ParsedRow();
        bmRow.setTitle(bmTitle + "(" + bmScroll + ")" + " " + i + " of " + bmCount);
        bmRow.setView("3");
        bmRow.setScroll(bmScroll);
        bmRow.setIcon(icon);
        bmRow.setIndex(i);
        bookmarkList.add(bmRow);
      }

      ParsedRow row1 = new ParsedRow();
      row1.setTitle("Application Tutorial");
      row1.setView("5");
      row1.setScroll("0");
      bookmarkList.add(row1);

      ParsedRow row2 = new ParsedRow();
      row2.setTitle("Bookmark Tutorial");
      row2.setView("6");
      row2.setScroll("0");
      bookmarkList.add(row2);

      ParsedRow row3 = new ParsedRow();
      row3.setTitle("Navigation Tutorial");
      row3.setView("7");
      row3.setScroll("0");
      bookmarkList.add(row3);

      /* Set the result to be displayed in our GUI. */
      BookmarkAdapter adapter =
          new BookmarkAdapter(getActivity(), R.layout.bookmark_custom_row, bookmarkList, this);
      setListAdapter(adapter);

    } catch (Exception e) {
      /* Display any Error to the GUI. */
      Log.e(TAG, "XMLQueryError", e);
    }
  }