Ejemplo n.º 1
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.folderex);

    Intent gintent = getIntent();
    getPath = gintent.getStringExtra("path");
    dbPath = gintent.getStringExtra("dbpath");

    FileList _FileList = new FileList(this);
    _FileList.setOnPathChangedListener(_OnPathChanged);
    _FileList.setOnFileSelected(_OnFileSelected);

    LinearLayout layout = (LinearLayout) findViewById(R.id.LinearLayout01);
    layout.addView(_FileList);

    Util.print("getPath = " + getPath);
    String path = " ";

    if (getPath.equals("empty")) {
      File root = Environment.getExternalStorageDirectory();
      _FileList.setPath(root.getAbsolutePath());
      path = root.getAbsolutePath();
    } else {
      _FileList.setPath(getPath);
      path = getPath;
    }

    Util.print("path = " + path);

    _FileList.setFocusable(true);
    _FileList.setFocusableInTouchMode(true);

    ((TextView) findViewById(R.id.TextView01)).setSelected(true);
  }
Ejemplo n.º 2
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);
    }
  }
 @Override
 public void onFinishInflate() {
   super.onFinishInflate();
   View view = inflate(getContext(), R.layout.cover_anim_view, (ViewGroup) this);
   Arpan_ßløødy_CoverImages = new ImageView[2];
   Arpan_ßløødy_CoverImages[0] = (ImageView) view.findViewById(R.id.image0);
   Arpan_ßløødy_CoverImages[1] = (ImageView) view.findViewById(R.id.image1);
 }
 @Override
 public void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   ßløødy_ßadßøy_Handler.removeCallbacks(Arpan_Bløødy_ßãdboy);
 }
 @Override
 public void onAttachedToWindow() {
   super.onAttachedToWindow();
   startCoverAnimation();
 }
Ejemplo n.º 6
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this));
    Colors.updateColors(this);
    startService(new Intent(this, JTalkService.class));
    service = JTalkService.getInstance();
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);

    setContentView(R.layout.roster);

    LinearLayout roster = (LinearLayout) findViewById(R.id.roster_linear);
    roster.setBackgroundColor(Colors.BACKGROUND);

    getActionBar().setHomeButtonEnabled(true);

    statusArray = getResources().getStringArray(R.array.statusArray);
    rosterAdapter = new RosterAdapter(this);
    simpleAdapter = new NoGroupsAdapter(this);
    searchAdapter = new SearchAdapter(this);

    int cols = 1;
    if (!prefs.getBoolean("ShowGroups", true) && !prefs.getBoolean("ShowMucGroup", false)) {
      try {
        cols = Integer.parseInt(prefs.getString("RosterColumns", "1"));
      } catch (Exception e) {
        cols = 1;
      }
    }
    gridView = (GridView) findViewById(R.id.users);
    gridView.setNumColumns(cols);
    gridView.setCacheColorHint(0x00000000);
    gridView.setOnItemClickListener(this);
    gridView.setOnItemLongClickListener(this);
    gridView.setAdapter(rosterAdapter);

    if (getIntent().getBooleanExtra("status", false)) {
      RosterDialogs.changeStatusDialog(this, null, null);
    }

    if (getIntent().getBooleanExtra("password", false)) {
      String account = getIntent().getStringExtra("account");
      RosterDialogs.passwordDialog(this, account);
    }

    if (getIntent().getBooleanExtra("subscribtion", false)) {
      String account = getIntent().getStringExtra("account");
      String jid = getIntent().getStringExtra("jid");
      RosterDialogs.subscribtionRequestDialog(this, account, jid);
    }

    File table = new File(Constants.PATH_SMILES + "/default/table.xml");
    if (!table.exists()) {
      new CreateDefaultSmiles().execute();
    } else {
      Cursor cursor =
          getContentResolver()
              .query(
                  JTalkProvider.ACCOUNT_URI,
                  null,
                  AccountDbHelper.ENABLED + " = '" + 1 + "'",
                  null,
                  null);
      if (cursor == null || cursor.getCount() < 1) startActivity(new Intent(this, Accounts.class));
    }

    if (prefs.getBoolean("BUG", false)) {
      new ErrorDialog(this).show();
    }

    String action = getIntent().getAction();
    if (action != null && action.equals(Intent.ACTION_VIEW)) {
      Uri data = getIntent().getData();
      if (data != null && data.getScheme().equals("xmpp")) {
        XMPPUri xmppUri;
        try {
          xmppUri = new XMPPUri(data);
        } catch (IllegalArgumentException e) {
          xmppUri = null;
        }

        List<String> accounts = new ArrayList<String>();
        for (XMPPConnection connection : service.getAllConnections()) {
          accounts.add(StringUtils.parseBareAddress(connection.getUser()));
        }

        if (xmppUri != null && !accounts.isEmpty()) {
          final String xmppJid = xmppUri.getJid();
          final String body = xmppUri.getBody();
          String queryType = xmppUri.getQueryType();

          final ArrayAdapter<String> adapter =
              new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, accounts);

          if (queryType.equals("roster")) {
            RosterDialogs.addDialog(this, xmppUri.getJid());
          } else if (queryType.equals("join")) {
            if (accounts.size() > 1) {
              AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setTitle(R.string.Accounts);
              builder.setAdapter(
                  adapter,
                  new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      String account = adapter.getItem(which);
                      MucDialogs.joinDialog(RosterActivity.this, account, xmppJid, null);
                    }
                  });
              builder.create().show();
            } else MucDialogs.joinDialog(RosterActivity.this, accounts.get(0), xmppJid, null);
          } else {
            service.setText(xmppJid, body);
            if (accounts.size() > 1) {
              service.setText(xmppJid, body);
              AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setTitle(R.string.Accounts);
              builder.setAdapter(
                  adapter,
                  new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      String account = adapter.getItem(which);
                      Intent intent = new Intent(RosterActivity.this, Chat.class);
                      intent.putExtra("account", account);
                      intent.putExtra("jid", xmppJid);
                      startActivity(intent);
                    }
                  });
              builder.create().show();
            } else {
              Intent intent = new Intent(RosterActivity.this, Chat.class);
              intent.putExtra("account", accounts.get(0));
              intent.putExtra("jid", xmppJid);
              startActivity(intent);
            }
          }
        }
      }
    }
  }
Ejemplo n.º 7
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);
  }
Ejemplo n.º 8
0
 public void onDraw(Canvas c) {
   super.onDraw(c);
   if (locMap != null) c.drawBitmap(locMap, matrix, null);
 }
Ejemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    user = (EditText) findViewById(R.id.user);
    pass = (EditText) findViewById(R.id.pass);
    imgBtn = (ImageButton) findViewById(R.id.imgBtn);
    subLayout = (LinearLayout) this.findViewById(R.id.subLayout);
    mContext = this;
    btn = (Button) findViewById(R.id.btn);
    extensionBtn = (Button) findViewById(R.id.extensionBtn);

    // Generate textview dynamically
    TextView tv = new TextView(this);
    tv.setText("这是动态添加的textView");
    subLayout.addView(tv);

    View.OnClickListener imgBtnListener =
        new View.OnClickListener() {
          public void onClick(View view) {
            if (user.getText().toString().equals("LeiBusi")
                && pass.getText().toString().equals("Halo3Q")) {
              user.setVisibility(View.GONE);
              pass.setVisibility(View.GONE);
              imgBtn.setImageResource(R.mipmap.state2);
            } else {
              user.setText("LeiBusi");
              pass.setText("");
              pass.setHint("帐号或密码错误");
              pass.requestFocus();

              Toast toast = Toast.makeText(mContext, "密码错误", Toast.LENGTH_LONG);
              toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
              toast.show();
            }
          }
        };

    View.OnLongClickListener imgBtnLongListener =
        new View.OnLongClickListener() {
          public boolean onLongClick(View view) {
            TextView tv = new TextView(mContext);
            tv.setText("这是动态添加的textView");
            subLayout.addView(tv);
            return true;
          }
        };

    View.OnClickListener btnListener =
        new View.OnClickListener() {
          public void onClick(View view) {
            user.setText("");
            pass.setText("");
            pass.setHint("请输入密码");
            user.setVisibility(View.VISIBLE);
            pass.setVisibility(View.VISIBLE);
            user.requestFocus();
            imgBtn.setImageResource(R.mipmap.state1);

            if (subLayout.getChildCount() > 0) {
              subLayout.removeAllViews();
            }

            TextView tv = new TextView(mContext);
            tv.setText("这是动态添加的textView");
            subLayout.addView(tv);
          }
        };

    View.OnClickListener extensionBtnListener =
        new View.OnClickListener() {
          public void onClick(View view) {
            Intent Extra = new Intent(MainActivity.this, Extra.class);
            startActivity(Extra);
          }
        };

    imgBtn.setOnClickListener(imgBtnListener);
    imgBtn.setOnLongClickListener(imgBtnLongListener);
    btn.setOnClickListener(btnListener);
    extensionBtn.setOnClickListener(extensionBtnListener);
  }