Esempio n. 1
0
  public void onResume() {
    super.onResume();

    // Log.i("WaveLoop", "onStart");

    if (PlayerProxy.instance() == null) {
      // mNowPlayingMain.setEnabled(false);
      // mNowPlayingMain.setVisibility(View.INVISIBLE);

      mWaveLoopMain.removeView(mNowPlayingMain);
      return;
    }

    final AudioInfo audioInfo = PlayerProxy.getAudioInfo();
    if (audioInfo != null) {
      mWaveLoopMain.removeView(mNowPlayingMain);
      mWaveLoopMain.addView(mNowPlayingMain);

      // mNowPlayingMain.setEnabled(true);
      // mNowPlayingMain.setVisibility(View.VISIBLE);

      mNowPlayingArtist.setText(audioInfo.artist);
      mNowPlayingAlbum.setText(audioInfo.album);
      mNowPlayingTitle.setText(audioInfo.title);

      mNowPlayingPlayBtn.setImageResource(
          (PlayerProxy.isPlaying()) ? R.drawable.pause_bkgnd : R.drawable.play_bkgnd);

      mNowPlayingPlayBtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (PlayerProxy.isPlaying()) PlayerProxy.pause();
              else PlayerProxy.play();

              mNowPlayingPlayBtn.setImageResource(
                  (PlayerProxy.isPlaying()) ? R.drawable.pause_bkgnd : R.drawable.play_bkgnd);
            }
          });

      mNowPlayingBtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent i = new Intent(WaveLoopActivity.this, player_main.class);
              i.putExtra("오디오파일경로", (int) audioInfo.dataRowId);
              startActivity(i);
            }
          });
    } else {
      mWaveLoopMain.removeView(mNowPlayingMain);
      // mNowPlayingMain.setEnabled(false);
      // mNowPlayingMain.setVisibility(View.INVISIBLE);
    }
  }
Esempio n. 2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.codelayout);

    LinearLayout MyLinear = (LinearLayout) findViewById(R.id.mylinear);
    MyLinear.setOrientation(LinearLayout.HORIZONTAL);

    Button MyBtn = (Button) findViewById(R.id.mybutton);
    MyBtn.setTextSize(40);

    EditText MyEdit = (EditText) findViewById(R.id.myedit);
    MyEdit.setBackgroundColor(0xff00ff00);
  }
Esempio n. 3
0
  public void onCreate(Bundle savedIntanceState) {
    super.onCreate(savedIntanceState);
    LinearLayout ll = new LinearLayout(this);
    setContentView(ll);
    sv = new SampleView(this);
    ll.addView(sv);

    timer.scheduleAtFixedRate(
        new TimerTask() {

          @Override
          public void run() {
            // TODO 自動生成されたメソッド・スタブ
            try {
              XmlPullParserFactory factory;
              factory = XmlPullParserFactory.newInstance();
              factory.setNamespaceAware(true);
              XmlPullParser xpp = factory.newPullParser();
              String ur =
                  "http://192.168.2.102:8080/otsu/yotsu?zahyou="
                      + aa
                      + "&jikoku="
                      + bb
                      + "&dareka="
                      + cc;
              URL url = new URL(ur);

              URLConnection connection = url.openConnection();
              xpp.setInput(connection.getInputStream(), "UTF-8");

              int eventType = xpp.getEventType();
              String tag = "";

              for (int type = xpp.getEventType();
                  type != XmlPullParser.END_DOCUMENT;
                  type = xpp.next()) {
                switch (type) {
                  case XmlPullParser.START_TAG:
                    tag = xpp.getName();
                    break;
                  case XmlPullParser.TEXT:
                    value = xpp.getText(); // 空白で取得したものは全て処理対象外とする
                    if (value.trim().length() != 0) {
                      if (tag.equals("boody")) {
                        if (value == "n") {
                          // ゲームを停止
                        }
                      }
                    }
                    break;
                  case XmlPullParser.END_TAG: // 終了タグ
                    break;
                }
              } // for終わり
            } catch (XmlPullParserException e) {
              e.printStackTrace();
            } catch (IOException e) {
              e.printStackTrace();
            }

            Time time = new Time("Asia/Tokyo");
            time.setToNow();
            date = time.second;
            co1 = SampleView.x;
            co2 = SampleView.y;

            int co01 = (int) co1;

            aa = String.valueOf(co01);
            bb = String.valueOf(date);
            cc = String.valueOf(dareka);

            try {
              Thread.sleep(0);
            } catch (InterruptedException e) {

            }
          }
        },
        0,
        100);
  }