Esempio n. 1
0
  @Override
  public void putProtocol(JSONObject jsonProtocol) {
    super.putProtocol(jsonProtocol);
    Logger.d(TAG, "!--->MusicResultShowSession-putProtocol--mDataObject " + mDataObject);

    if (mDataObject != null) {
      mType = JsonTool.getJsonValue(mDataObject, SessionPreference.KEY_TYPE);
      musicName = JsonTool.getJsonValue(mDataObject, SessionPreference.KEY_MUSIC_RESULT_SONG);
      artist = JsonTool.getJsonValue(mDataObject, SessionPreference.KEY_MUSIC_RESULT_ARTIST);
    }

    Logger.d(
        TAG,
        "!--->MusicResultShowSession-putProtocol--mType "
            + mType
            + "; musicName = "
            + musicName
            + "; artist = "
            + artist);
    if (SessionPreference.VALUE_MUSIC_RESULT_TYPE_DORESO.equals(mType)) {
      if (mMusicResultView == null) {
        mMusicResultView = new MusicResultView(mContext);
        mMusicResultView.initView(musicName, artist);
      }
      addSessionView(mMusicResultView);
    }
  }
Esempio n. 2
0
 @Override
 public void destroyItem(View container, int position, Object object) {
   Logger.d(TAG, "destroyItem-----position = " + position);
   if (mViewList != null && mViewList.size() > 0 && mViewList.size() >= position) {
     Logger.d(TAG, "!--->destroyItem---mViewList size" + mViewList.size());
     ((ViewPager) container).removeView(mViewList.get(position));
   }
 }
Esempio n. 3
0
 /** 取消广播 */
 private void unregistReceiver() {
   try {
     mContext.unregisterReceiver(mReceiver);
   } catch (Exception e) {
     Logger.printStackTrace(e);
   }
 }
Esempio n. 4
0
 @Override
 public void release() {
   super.release();
   Logger.d(TAG, "!--->release-----");
   if (null != mLocalView) {
     mLocalView.release();
   }
 }
Esempio n. 5
0
  @Override
  public void onTTSEnd() {
    Logger.d(TAG, "onTTSEnd");
    super.onTTSEnd();
    mSessionManagerHandler.sendEmptyMessage(SessionPreference.MESSAGE_SESSION_DONE);

    startMusic();

    mDataObject = null;
  }
Esempio n. 6
0
 @Override
 public void onPlayerStatus(PlayerStatus status) {
   switch (status) {
     case INIT:
       Logger.d("PlayerStatus", "初始化");
       break;
     case PLAYING:
       Logger.d("PlayerStatus", "播放");
       break;
     case BUFFERING:
       Logger.d("PlayerStatus", "缓冲");
       break;
     case PAUSE:
       Logger.d("PlayerStatus", "暂停");
       break;
     case STOP:
       Logger.d("PlayerStatus", "停止");
       break;
     default:
       Logger.d("PlayerStatus", "未知");
       break;
   }
 }
Esempio n. 7
0
  @Override
  public void putProtocol(JSONObject jsonProtocol) {
    super.putProtocol(jsonProtocol);
    Logger.d(TAG, "tyz--putProtocol");

    try {
      JSONObject objectData = jsonProtocol.getJSONObject("data");
      Logger.d(TAG, "tyz--putProtocol ; data == " + objectData.toString());

      JSONArray datas = objectData.getJSONArray("locationSearch");
      // category = objectData.getString("category");//Error

      Logger.d(TAG, "tyz--putProtocol----category = " + category + ";--datas == " + datas);
      CallbakeLocalSearch listCallback =
          new CallbakeLocalSearch() {
            @Override
            public void dissMissLocalSessionView(int type, String protocal) {
              //          Message localSearchMsg = new Message();
              if (CALL_BACK_NAVI == type) {
                // localSearchMsg.what = SessionPreference.MESSAGE_START_LOCALSEARCH_NAVI;
                Logger.d(TAG, "!--->onClick()----protocal = " + protocal);
                onUiProtocal(SessionPreference.EVENT_NAME_SELECT_ITEM, protocal);
              } else {
                // localSearchMsg.what = SessionPreference.MESSAGE_START_LOCALSEARCH_CALL;
                // mSessionManagerHandler.sendMessage(localSearchMsg);//消失sessionView的界面,导航页面在主界面
                Logger.d(TAG, "!--->onClick()----protocal = " + protocal);
                onUiProtocal(SessionPreference.EVENT_NAME_SELECT_ITEM, protocal);
              }
            }
          };
      mPickListener =
          new IPickListener() {

            @Override
            public void onPre() {
              // TODO Auto-generated method stub

            }

            @Override
            public void onPickCancel() {
              // TODO Auto-generated method stub

            }

            @Override
            public void onNext() {
              // TODO Auto-generated method stub

            }

            @Override
            public void onItemPicked(int position) {
              if (canBeClick) {
                if (mDataItemProtocalList != null && mDataItemProtocalList.size() > 0) {
                  /* < BUG-2792 XD 20150722 modify Begin */
                  Logger.d(
                      TAG,
                      "!--->onItemPicked()----position = "
                          + position
                          + "; mDataItemProtocalList"
                          + mDataItemProtocalList.size());
                  if (mDataItemProtocalList.size() > position) {
                    String selectedItem = mDataItemProtocalList.get(position);

                    Logger.d(TAG, "!--->onItemPicked()----selectedItem = " + selectedItem);
                    onUiProtocal(
                        SessionPreference.EVENT_NAME_SELECT_LOCALSEARCH_ITEM, selectedItem);
                  } else {
                    Logger.e(TAG, "!--->Error: position >= mDataItemProtocalList size");
                  }
                  /* BUG-2792 XD 20150722 modify End > */
                }
                canBeClick = false;
              }
            }
          };

      mLocalView = new LocalSearchView(mContext);
      mLocalView.setPickListener(mPickListener);
      mLocalView.setListener(listCallback);
      mLocalView.initView(getDatas(datas), category);
      addAnswerView(mLocalView);
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
Esempio n. 8
0
 @Override
 public void onClick(View v) {
   Logger.d(TAG, "!--->mOnClickListener--v.getId:" + v.getId());
   Intent intent = new Intent(AllFunctionsActivity.this, FunctionHelpActivity.class);
   intent.setAction(GUIConfig.ACTION_FUNCTION_HELP);
   int helpType = 0;
   CharSequence helpTitle = "";
   switch (v.getId()) {
       // page1 line1
     case R.id.btn_function_bluetooth:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_BLUETOOTH;
       helpTitle = btnBluetooth.getShowText();
       break;
     case R.id.btn_function_navigation:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_NAVIGATION;
       helpTitle = btnNavigation.getShowText();
       break;
     case R.id.btn_function_music:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_MUSIC;
       helpTitle = btnMusic.getShowText();
       break;
     case R.id.btn_function_quick_setting:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_SETTING;
       helpTitle = btnQuickSetting.getShowText();
       break;
       // page1 line2
     case R.id.btn_function_radio:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_RADIO;
       helpTitle = btnRadio.getShowText();
       break;
     case R.id.btn_function_weather:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_WEATHER;
       helpTitle = btnWeather.getShowText();
       break;
     case R.id.btn_function_stock:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_STOCK;
       helpTitle = btnStock.getShowText();
       break;
     case R.id.btn_function_local_search:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_LOCAL_SEARCH;
       helpTitle = btnLocalSearch.getShowText();
       break;
       // Page2 line1
     case R.id.btn_function_traffic:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_TRAFFIC;
       helpTitle = btnTraffic.getShowText();
       break;
     case R.id.btn_function_limit:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_LIMIT;
       helpTitle = btnLimit.getShowText();
       break;
     case R.id.btn_function_wakeup:
       helpType = GUIConfig.VALUE_FUNCTION_HELP_TYPE_WAKEUP;
       helpTitle = btnWakeup.getShowText();
       break;
     default:
       break;
   }
   intent.putExtra(GUIConfig.KEY_FUNCTION_HELP_TYPE, helpType);
   intent.putExtra(GUIConfig.KEY_FUNCTION_HELP_TITLE, helpTitle);
   Logger.d(TAG, "!--->helpType = " + helpType + "; helpTitle = " + helpTitle);
   startActivity(intent);
 }
Esempio n. 9
0
        @Override
        public Object instantiateItem(View container, int position) {
          /*< XiaoDong 20150721 added begin*/
          int childCount = ((ViewPager) container).getChildCount();
          if (mViewList == null) {
            Logger.e(TAG, "!--->PagerAdapter instantiateItem error, mViewList is null.");
            return null;
          }
          if (null != mViewList && mViewList.size() < position) {
            Logger.e(
                TAG,
                "!--->PagerAdapter instantiateItem error, return null. ViewList size = "
                    + mViewList.size()
                    + "; position = "
                    + position);
            return null;
          }
          Logger.d(
              TAG,
              "!--->PagerAdapter--position:"
                  + position
                  + "; childCount:"
                  + childCount
                  + "; mViewList.size:"
                  + mViewList.size());
          /* XiaoDong 20150721 added End >*/
          switch (position) {
            case 0:
              ((ViewPager) container).addView(mViewList.get(position), 0);
              btnBluetooth = (ImageViewWithText) findViewById(R.id.btn_function_bluetooth);
              btnNavigation = (ImageViewWithText) findViewById(R.id.btn_function_navigation);
              btnMusic = (ImageViewWithText) findViewById(R.id.btn_function_music);
              btnQuickSetting = (ImageViewWithText) findViewById(R.id.btn_function_quick_setting);
              btnRadio = (ImageViewWithText) findViewById(R.id.btn_function_radio);
              btnWeather = (ImageViewWithText) findViewById(R.id.btn_function_weather);
              btnStock = (ImageViewWithText) findViewById(R.id.btn_function_stock);
              btnLocalSearch = (ImageViewWithText) findViewById(R.id.btn_function_local_search);

              btnBluetooth.setOnClickListener(mOnClickListener);
              btnNavigation.setOnClickListener(mOnClickListener);
              btnMusic.setOnClickListener(mOnClickListener);
              btnQuickSetting.setOnClickListener(mOnClickListener);
              btnRadio.setOnClickListener(mOnClickListener);
              btnWeather.setOnClickListener(mOnClickListener);
              btnStock.setOnClickListener(mOnClickListener);
              btnLocalSearch.setOnClickListener(mOnClickListener);
              break;

            case 1:
              /*< XiaoDong 20150721 added Begin */
              if (childCount == 0) {
                Logger.w(TAG, "!--->position is 1 but childCount is 0");
                ((ViewPager) container).addView(mViewList.get(position), 0);
              }
              /* XiaoDong 20150721 added End >*/

              ((ViewPager) container).addView(mViewList.get(position), 1);
              btnTraffic = (ImageViewWithText) findViewById(R.id.btn_function_traffic);
              btnLimit = (ImageViewWithText) findViewById(R.id.btn_function_limit);
              btnWakeup = (ImageViewWithText) findViewById(R.id.btn_function_wakeup);

              btnTraffic.setOnClickListener(mOnClickListener);
              btnLimit.setOnClickListener(mOnClickListener);
              btnWakeup.setOnClickListener(mOnClickListener);
              break;
          }
          return mViewList.get(position);
        }