Пример #1
0
  @Override
  public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
    Log.i(TAG, "Java: onCreate()");

    /*ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
          .threadPriority(Thread.NORM_PRIORITY - 1).threadPoolSize(16)
             .denyCacheImageMultipleSizesInMemory().tasksProcessingOrder(QueueProcessingType.LIFO)
             .diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100)
             .build();

    ImageLoader.getInstance().init(config);*/

    // ExceptionHandler.register(this, "http://iloveyaya.zz.vc/crash/crash.php");

    Util.initLog(this);

    CrashHandler.getInstance().init(this, UPLOAD_URL);

    IntentFilter filter = new IntentFilter(Intent.ACTION_TIME_TICK);
    MyBroadcastReceiver receiver = new MyBroadcastReceiver();
    registerReceiver(receiver, filter);

    Intent intent = new Intent(getApplicationContext(), MyHttpService.class);
    startService(intent);
  }
Пример #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    Log.i(TAG, "Java: onCreate()");

    setContentView(R.layout.activity_pptv_livecenter);

    this.tvDay = (TextView) this.findViewById(R.id.tv_day);
    this.btnLive = (Button) this.findViewById(R.id.btn_live);
    this.btnPlayback = (Button) this.findViewById(R.id.btn_playback);
    this.btnNextDay = (Button) this.findViewById(R.id.btn_nextday);
    this.btnBwType = (Button) this.findViewById(R.id.btn_bw_type);
    this.lv_tvlist = (ListView) this.findViewById(R.id.lv_tvlist);

    this.btnLive.setOnClickListener(mOnClickListener);
    this.btnPlayback.setOnClickListener(mOnClickListener);
    this.btnNextDay.setOnClickListener(mOnClickListener);
    this.btnBwType.setOnClickListener(mOnClickListener);

    this.lv_tvlist.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View view, int position, long id) {
            // TODO Auto-generated method stub
            LiveStream liveStrm = mAdapter.getItem(position);
            new EPGTask().execute(ACTION_LIVE_FT, liveStrm.title, liveStrm.channelID);
          }
        });

    this.lv_tvlist.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {

          @Override
          public boolean onItemLongClick(AdapterView<?> arg0, View view, int position, long id) {
            // TODO Auto-generated method stub
            LiveStream strm = mAdapter.getItem(position);
            if (strm != null)
              Toast.makeText(
                      PPTVLiveCenterActivity.this,
                      "channel_id: " + strm.channelID,
                      Toast.LENGTH_SHORT)
                  .show();
            return true;
          }
        });

    mBwType = Util.readSettingsInt(this, "live_bwtype");
    mPlaybackTime = new PlayBackTime(this);

    Intent intent = getIntent();
    mLiveId = intent.getStringExtra("livecenter_id");

    mEPG = new EPGUtil();
    if (mLiveId == null) Toast.makeText(this, "live_type 未获取", Toast.LENGTH_SHORT).show();
    else new EPGTask().execute(ACTION_LIVE_CENTER, mLiveId, updateTime());
  }
Пример #3
0
        @Override
        public void onClick(View v) {
          // TODO Auto-generated method stub
          int id = v.getId();
          switch (id) {
            case R.id.btn_live:
              mPlaybackTime.setLive();
              Toast.makeText(PPTVLiveCenterActivity.this, "切换为 直播 模式", Toast.LENGTH_SHORT).show();
              break;
            case R.id.btn_playback:
              mPlaybackTime.setPlaybackTime();
              break;
            case R.id.btn_nextday:
              dayOffset++;
              if (dayOffset > MAX_DAY) dayOffset = -1;

              new EPGTask().execute(ACTION_LIVE_CENTER, mLiveId, updateTime());
              break;
            case R.id.btn_bw_type:
              final String[] bw_type = {"P2P", "MYHTTP", "M3U8"};
              int sel = Util.readSettingsInt(PPTVLiveCenterActivity.this, "live_bwtype");

              Dialog choose_bw_type_dlg =
                  new AlertDialog.Builder(PPTVLiveCenterActivity.this)
                      .setTitle("select bw_type")
                      .setSingleChoiceItems(
                          bw_type,
                          sel, /*default selection item number*/
                          new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                              mBwType = whichButton;
                              btnBwType.setText(bw_type[mBwType]);
                              Util.writeSettingsInt(
                                  PPTVLiveCenterActivity.this, "live_bwtype", mBwType);
                              Toast.makeText(
                                      PPTVLiveCenterActivity.this,
                                      "switch bw_type to " + bw_type[mBwType],
                                      Toast.LENGTH_SHORT)
                                  .show();
                              dialog.dismiss();
                            }
                          })
                      .create();
              choose_bw_type_dlg.show();
              break;
            default:
              break;
          }
        }