private void autologin() { String active = name.getText().toString(); String password = pass.getText().toString(); if (!"".equals(active) && !"".equals(password)) { String url = "live.jsp?active=" + active + "&pass="******"&mac=" + Utils.getLocalMacAddressFromIp(LoginActivity.this); show(); loginthread = new LoginThread(this, handler, url); loginthread.start(); } }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); // Log.i("tvinfo", msg.what + "-" + msg.obj); if (msg.what == 1) { progress.setVisibility(View.VISIBLE); title.setText("开始播放 ..."); } if (msg.what == 2) { title.setText("开始加载 ..."); } if (msg.what == 3) { title.setText("开始播放 ..."); play(prg); } if (msg.what == 4) { title.setText("加载失败 ..."); } if (msg.what == 9) { show("获取", "正在获取播放列表,请稍后..."); } if (msg.what == -100) { playmenu.setVisibility(View.GONE); } if (msg.what == 66) { if (player != null && player.isPlaying() && !isseek) { currtime.setText(Utils.longToString(player.getCurrentPosition())); playSeek.setProgress(player.getCurrentPosition() / 1000); } } }
@Override public void onPrepared(MediaPlayer player) { // TODO Auto-generated method stub Log.i("tvinfo", "onPrepared"); player.start(); playSeek.setEnabled(true); playSeek.setMax(player.getDuration() / 1000); totaltime.setText(Utils.longToString(player.getDuration())); if (tupdate == null) { tupdate = new SeekBarUpdateThread(handler); tupdate.start(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sp = this.getSharedPreferences("key", Context.MODE_PRIVATE); String active = sp.getString("name", ""); String password = sp.getString("password", ""); setContentView(R.layout.activity_login); Intent service = new Intent(this, UpdateService.class); this.startService(service); hu = new HttpUtils(this); name = (EditText) super.findViewById(R.id.name); pass = (EditText) super.findViewById(R.id.pass); loginbut = (Button) super.findViewById(R.id.loginbut); test = (Button) super.findViewById(R.id.test); name.setText(active); pass.setText(password); loginbut.setOnClickListener(new OnClickListenerImpl()); test.setOnClickListener(new OnClickListenerImpl()); mac = (TextView) super.findViewById(R.id.mac); mac.setText(Utils.getLocalMacAddressFromIp(this)); autologin(); }