Exemplo n.º 1
0
  protected ContextDialog(
      final Context context,
      final String[] row,
      final String nickname,
      int width,
      final int defaultBgColor,
      final int defaultFoColor) {
    super(context);
    setCustomTitle(null);
    TableLayout parent = new TableLayout(context);
    parent.setStretchAllColumns(true);
    parent.setBackgroundColor(Color.WHITE);

    TableRow[] trs = new TableRow[7];
    TextView[] tvs = new TextView[7];
    String[] prefix = new String[] {"TYPE ", "ID   ", "CMD   ", "TIME ", "NG   ", "NUM  ", ""};
    for (int i = 0; i < 7; i++) {
      if (row[i] != null) {
        tvs[i] = new TextView(context);
        trs[i] = new TableRow(context);
        tvs[i].setText(prefix[i] + row[i]);
        tvs[i].setTextColor(Color.BLACK);
        trs[i].addView(tvs[i]);
        parent.addView(trs[i], new LinearLayout.LayoutParams(-1, -2));
      }
    }
    tvs[6].setWidth(width / 3 * 2);
    parent.setLayoutParams(new TableLayout.LayoutParams(-1, -1));
    parent.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.cancel();
            new HandleNamePicker(
                    (Activity) context,
                    new ColorPickerView.OnColorChangedListener() {
                      @Override
                      public void colorChanged(int color) {
                        // 色が選択されるとcolorに値が入る OKボタンで確定するので未使用
                        int R = Color.red(color);
                        int G = Color.green(color);
                        int B = Color.blue(color);
                      }
                    },
                    defaultBgColor,
                    defaultFoColor,
                    row[1],
                    nickname,
                    true)
                .show();
          }
        });
    this.setView(parent);
  }
Exemplo n.º 2
0
  public void loadComponents() {
    // set header components
    catalogsTL = (TableLayout) findViewById(R.id.catalogsTL);
    catalogsTL.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.i(LOG_TAG, "catalogsTL.onClick()...");
            showWindow(v);
          }
        });
    catalogsTV = (TextView) findViewById(R.id.header_tv_catalogs);

    questionTV = (TextView) findViewById(R.id.questionTV);
    questionTV.setMovementMethod(ScrollingMovementMethod.getInstance());

    listView = (ListView) findViewById(R.id.choicesListView);
    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapter, View view, int arg2, long arg3) {
            List<Choice> choices = question.getChoices();
            List<Choice> updChoices = new ArrayList<Choice>();
            for (Choice choice : choices) {
              if (choice.getIndex() == (arg2 + 1)) {
                choice.setSelect(!choice.isSelect());
              } else {
                if (question.getType() == 2) { // single choices
                  choice.setSelect(false);
                }
              }
              updChoices.add(choice);
            }
            question.setChoices(updChoices);
            //        		choiceAdapter.refresh(updChoices);

            saveAnswer();

            Message msg = new Message();
            msg.what = 0;
            handler.sendMessage(msg);
          }
        });

    // set footer components
    backArrow = (ImageView) findViewById(R.id.backArrow);
    backArrow.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (qId > 1) {
              changeQuestion(cId, qId - 1);
            }
          }
        });
    pendQueNumber = (Button) findViewById(R.id.pendQueNumber);
    pendQueNumber.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (pendQuestions.size() > 0) {
              go2PendingQuestion(mContext);
            } else {
              ShowDialog(
                  mContext.getResources().getString(R.string.dialog_note),
                  mContext.getResources().getString(R.string.message_tv_no_question));
            }
          }
        });
    nextArrow = (ImageView) findViewById(R.id.nextArrow);
    nextArrow.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int maxQuestion = ExamParse.getMaxQuestion(exam, cId);
            Log.i(
                LOG_TAG,
                "maxQuestion of catalog "
                    + String.valueOf(cId)
                    + ":"
                    + String.valueOf(maxQuestion));
            if (qId < maxQuestion) {
              changeQuestion(cId, qId + 1);
            }
          }
        });
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setTitle(R.string.playback_view);

    SharedPreferences settings = PlaybackService.getSettings(this);
    int displayMode = Integer.parseInt(settings.getString(PrefKeys.DISPLAY_MODE, "2"));
    mDisplayMode = displayMode;

    int layout = R.layout.full_playback;
    int coverStyle;

    switch (displayMode) {
      default:
        Log.w("VanillaMusic", "Invalid display mode given. Defaulting to widget mode.");
        // fall through
      case DISPLAY_INFO_WIDGETS:
        coverStyle = CoverBitmap.STYLE_NO_INFO;
        layout = R.layout.full_playback_alt;
        break;
      case DISPLAY_INFO_OVERLAP:
        coverStyle = CoverBitmap.STYLE_OVERLAPPING_BOX;
        break;
      case DISPLAY_INFO_BELOW:
        coverStyle = CoverBitmap.STYLE_INFO_BELOW;
        break;
    }

    setContentView(layout);

    CoverView coverView = (CoverView) findViewById(R.id.cover_view);
    coverView.setup(mLooper, this, coverStyle);
    coverView.setOnClickListener(this);
    coverView.setOnLongClickListener(this);
    mCoverView = coverView;

    mControlsBottom = findViewById(R.id.controls_bottom);
    View previousButton = findViewById(R.id.previous);
    previousButton.setOnClickListener(this);
    mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause);
    mPlayPauseButton.setOnClickListener(this);
    View nextButton = findViewById(R.id.next);
    nextButton.setOnClickListener(this);

    TableLayout table = (TableLayout) findViewById(R.id.info_table);
    if (table != null) {
      table.setOnClickListener(this);
      table.setOnLongClickListener(this);
      mInfoTable = table;
    }

    mTitle = (TextView) findViewById(R.id.title);
    mAlbum = (TextView) findViewById(R.id.album);
    mArtist = (TextView) findViewById(R.id.artist);

    mControlsTop = findViewById(R.id.controls_top);
    mElapsedView = (TextView) findViewById(R.id.elapsed);
    mDurationView = (TextView) findViewById(R.id.duration);
    mSeekBar = (SeekBar) findViewById(R.id.seek_bar);
    mSeekBar.setMax(1000);
    mSeekBar.setOnSeekBarChangeListener(this);
    mQueuePosView = (TextView) findViewById(R.id.queue_pos);

    mGenreView = (TextView) findViewById(R.id.genre);
    mTrackView = (TextView) findViewById(R.id.track);
    mYearView = (TextView) findViewById(R.id.year);
    mComposerView = (TextView) findViewById(R.id.composer);
    mFormatView = (TextView) findViewById(R.id.format);

    mShuffleButton = (ImageButton) findViewById(R.id.shuffle);
    mShuffleButton.setOnClickListener(this);
    registerForContextMenu(mShuffleButton);
    mEndButton = (ImageButton) findViewById(R.id.end_action);
    mEndButton.setOnClickListener(this);
    registerForContextMenu(mEndButton);

    setControlsVisible(settings.getBoolean(PrefKeys.VISIBLE_CONTROLS, true));
    setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, false));
    setDuration(0);
  }