@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.stats_visitors_and_views_fragment, container, false);

    TextView titleTextView = (TextView) view.findViewById(R.id.stats_pager_title);
    titleTextView.setText(getTitle());

    mVisitorsToday =
        (TextView) view.findViewById(R.id.stats_visitors_and_views_today_visitors_count);
    mViewsToday = (TextView) view.findViewById(R.id.stats_visitors_and_views_today_views_count);
    mViewsBestEver =
        (TextView) view.findViewById(R.id.stats_visitors_and_views_best_ever_views_count);
    mViewsAllTime = (TextView) view.findViewById(R.id.stats_visitors_and_views_all_time_view_count);
    mCommentsAllTime =
        (TextView) view.findViewById(R.id.stats_visitors_and_views_all_time_comment_count);

    RadioGroup mRadioGroup = (RadioGroup) view.findViewById(R.id.stats_pager_tabs);
    mRadioGroup.setVisibility(View.VISIBLE);
    mRadioGroup.setOnCheckedChangeListener(this);

    for (int i = 0; i < TITLES.length; i++) {
      RadioButton rb =
          (RadioButton)
              LayoutInflater.from(getActivity()).inflate(R.layout.stats_radio_button, null, false);
      RadioGroup.LayoutParams params =
          new RadioGroup.LayoutParams(
              RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
      int dp8 = (int) Utils.dpToPx(8);
      params.setMargins(0, 0, dp8, 0);
      rb.setMinimumWidth((int) Utils.dpToPx(80));
      rb.setGravity(Gravity.CENTER);
      rb.setLayoutParams(params);
      rb.setText(TITLES[i]);
      mRadioGroup.addView(rb);

      if (i == mSelectedButtonIndex) rb.setChecked(true);
    }

    return view;
  }
Example #2
0
  private void TabloDoldur() {
    try {

      Integer count = 0;
      YeDatabase db = new YeDatabase(this);
      final ObDataBase yDb = new ObDataBase(this);
      db.open();
      final Cursor cursor = db.QueryTbDataBases();
      tlResults.removeAllViews();
      while (cursor.moveToNext()) {

        yDb.ID = cursor.getInt(0);
        yDb.Name = cursor.getString(1);
        yDb.Instance = cursor.getString(2);
        yDb.Ip = cursor.getString(3);
        yDb.Port = cursor.getString(4);
        yDb.User = cursor.getString(5);
        yDb.Pass = cursor.getString(6);
        yDb.InUse = cursor.getInt(7);
        yDb.Description = cursor.getString(8);

        LayoutInflater inflater =
            (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        TableRow tr = (TableRow) inflater.inflate(R.layout.satir, null);

        tr.setId(100 + count);
        tr.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

        TextView labelDesc = new TextView(this, null, R.style.BodyText);
        labelDesc.setId(200 + count);
        labelDesc.setText(yDb.Description);
        tr.addView(labelDesc);

        TextView labelIp = new TextView(this, null, R.style.BodyText);
        labelIp.setId(200 + count);
        labelIp.setText(yDb.Ip);
        tr.addView(labelIp);

        TextView labelName = new TextView(this);
        labelName.setId(200 + count);
        labelName.setText(yDb.Name);
        tr.addView(labelName);

        RadioButton labelInUse = new RadioButton(this);
        labelInUse.setId(200 + count);
        labelInUse.setTag(200 + "");
        labelInUse.setGravity(Gravity.CENTER_VERTICAL);
        labelInUse.setGravity(Gravity.CENTER_HORIZONTAL);
        labelInUse.setEnabled(false);

        // rdgActiveData.addView(labelInUse);
        if (yDb.InUse == 1) labelInUse.setChecked(true);
        else labelInUse.setChecked(false);

        tr.addView(labelInUse);

        tlResults.addView(
            tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        count++;

        tr.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View view) {
                DetayDoldur((TableRow) view);
              }
            });
        tr.setOnLongClickListener(
            new OnLongClickListener() {

              @Override
              public boolean onLongClick(View v) {
                SetAktifVeriTabani((TableRow) v);
                return true;
              }
            });
      }
    } catch (Exception e) {
      Toast.makeText(this, "detay göster" + e.getMessage(), Toast.LENGTH_LONG).show();
    }
  }