public void onEvent(GetTvEvent<AppreciatetvList> event) {
    aList = event.result;

    // 处理List返回内容
    if (aList == null) return;

    // init frequency
    List<Appreciatetv> list = aList.getLists();
    List<CategoryData> datas = list.get(list.size() - 1).getData();
    mFrequencys.clear();
    for (CategoryData data : datas) {
      mFrequencys.add(data.getCategoryurl());
    }

    setViewsVisiable(View.VISIBLE);

    mProgressBar.setVisibility(View.GONE);

    mListViewAdapter.updateData(aList.getLists());
    Appreciatetv tv = (Appreciatetv) mListViewAdapter.getItem(0);
    if (tv != null) {
      mGalleryAdapter.updateData(tv.getData());
      mGallery.setSelection(Integer.MAX_VALUE / 2 - 1);
    }

    mListView.requestFocus();
  }
Exemplo n.º 2
0
  private void updateState(int state) {
    if (mState == state) {
      return;
    }

    mState = state;
    switch (state) {
      case SHOW_LIST:
        mSimList.setVisibility(View.VISIBLE);
        mMessage.setVisibility(View.GONE);
        setTitle(getString(R.string.sim_manage_messages_title));
        setProgressBarIndeterminateVisibility(false);
        mSimList.requestFocus();
        break;
      case SHOW_EMPTY:
        mSimList.setVisibility(View.GONE);
        mMessage.setVisibility(View.VISIBLE);
        setTitle(getString(R.string.sim_manage_messages_title));
        setProgressBarIndeterminateVisibility(false);
        break;
      case SHOW_BUSY:
        mSimList.setVisibility(View.GONE);
        mMessage.setVisibility(View.GONE);
        setTitle(getString(R.string.refreshing));
        setProgressBarIndeterminateVisibility(true);
        break;
      default:
        Log.e(TAG, "Invalid State");
    }
  }
Exemplo n.º 3
0
  private void addNewSlide() {
    if (mSlideshowEditor.addNewSlide()) {
      // add successfully
      mSlideListAdapter.notifyDataSetChanged();

      // Select the new slide.
      mList.requestFocus();
      mList.setSelection(mSlideshowModel.size() - 1);
    } else {
      Toast.makeText(this, R.string.cannot_add_slide_anymore, Toast.LENGTH_SHORT).show();
    }
  }
  @SuppressWarnings("unchecked")
  @Override
  public void networkCallback(Object jsonResult, int httpCode, int requestTag) {
    JsonData<ListJsonData> jResult = (JsonData<ListJsonData>) jsonResult;

    dismissWaitDialog();
    if (httpCode == HttpStatus.SC_FORBIDDEN) {
      ((AppApplication) getApplication()).userNotLogin();
      return;
    }

    if (httpCode != HttpStatus.SC_OK) {
      Log.e("Volley", "HTTP Code " + httpCode + " catched in callback!!");
      String toastString;
      if (httpCode == HttpStatus.SC_CONFLICT) {
        toastString = getString(R.string.parse_data_failed);
      } else if (httpCode == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
        toastString = getString(R.string.error_occur_retry_later);
      } else toastString = getString(R.string.connect_to_server_failed);
      ToastTools.toastWithFrequencyLimited(
          SearchOnlineMusicActivity.this, toastString, Toast.LENGTH_SHORT, true);
      return;
    }

    if (jResult.getCode() != Constants.CODE_SUCCESS) {
      Log.e("Volley", jResult.getMessage() == null ? "" : jResult.getMessage());
      ToastTools.toastWithFrequencyLimited(
          SearchOnlineMusicActivity.this, jResult.getMessage(), Toast.LENGTH_SHORT, true);
      return;
    }

    if (requestTag == REQUEST_SEARCH_MUSIC) {
      List<Music> musics = jResult.getData().getMusicList();

      mChooseMusicLocalAdapter =
          new ChooseMusicOnlineAdapter(SearchOnlineMusicActivity.this, musics);
      mChooseMusicLocalAdapter.setMusicListener(this);
      mListView.setAdapter(mChooseMusicLocalAdapter);
      if (!Utils.isListEmpty(musics)) {
        noMusicLayout.setVisibility(View.GONE);
        mListView.setVisibility(View.VISIBLE);
      } else {
        noMusicLayout.setVisibility(View.VISIBLE);
      }

      mListView.requestFocus();
    } else if (requestTag == REQUEST_GET_REMOTE_MUSIC_URL) {
      Log.d("MusicUrl", jResult.getData().getMusicList().get(0).getMusicUrl());
    }
  }
Exemplo n.º 5
0
  private void showList() {

    this.setContentView(R.layout.mark_list);

    this.setTitle("所有书签");

    if (marksList == null || listmodified) {
      marksList = dbHelper.getAllMarks();
      listmodified = false;
    }

    marksString = new ArrayList<CharSequence>(marksList.size());

    for (Iterator<Mark> iterator = marksList.iterator(); iterator.hasNext(); ) {
      Mark mark = iterator.next();

      marksString.add(mark.toString());
    }

    listview = (ListView) findViewById(R.id.list_marks);
    listview.setAdapter(new BaseAdapterNull(this));

    final Adapter4MarkList baseAdapterNew = new Adapter4MarkList(this);

    baseAdapterNew.setContentList(marksString);

    baseAdapterNew.setTextsize(16);

    listview.setAdapter(baseAdapterNew);
    listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listview.setSelection(0);
    listview.requestFocus();

    Button btn = (Button) this.findViewById(R.id.btnRtnFromMarks);
    btn.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            MarkActivity.this.finish();
          }
        });

    this.registerForContextMenu(listview);
  }
Exemplo n.º 6
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    busNameItemAdapter = new BusNameItemAdapter(this.getApplicationContext(), this);
    listView = (ListView) findViewById(R.id.ListView);
    listView.setAdapter(busNameItemAdapter);

    editText = (EditText) findViewById(R.id.EditText);

    listView.requestFocus();

    // Initialize the native part of the sample
    int ret = simpleOnCreate(getPackageName());
    if (0 != ret) {
      Toast.makeText(this, "simpleOnCreate failed with  " + ret, Toast.LENGTH_LONG).show();
      finish();
      return;
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    onCreateView(inflater, container);

    /// M:should create list Adapter here for child class init the right status.@{
    mAdapter = createListAdapter();
    /// @}

    boolean searchMode = isSearchMode();
    mAdapter.setSearchMode(searchMode);
    mAdapter.configureDefaultPartition(false, searchMode);
    mAdapter.setPhotoLoader(mPhotoManager);
    mListView.setAdapter(mAdapter);

    if (!isSearchMode()) {
      mListView.setFocusableInTouchMode(true);
      mListView.requestFocus();
    }

    return mView;
  }
Exemplo n.º 8
0
  @Override
  public View onCreateSubView(LayoutInflater inflater) {
    // TODO Auto-generated method stub
    View contentView = inflater.inflate(R.layout.video, null, false);

    sourceLv = (ListView) contentView.findViewById(R.id.source_lv);
    sourceLv.setAdapter(listAdapter);
    sourceLv.setOnItemClickListener(onItemClickListener);
    sourceLv.setOnItemSelectedListener(onItemSelectedListener);
    sourceLv.requestFocus();

    surfaceContainer = contentView.findViewById(R.id.surface_container);

    surfaceView = (SurfaceView) contentView.findViewById(R.id.video_surface);
    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(
        new SurfaceHolder.Callback() {

          @Override
          public void surfaceDestroyed(SurfaceHolder arg0) {
            // TODO Auto-generated method stub
            //				videoInspect.setFullscale();
            LogUtil.d(TAG, "surfaceDestroyed");
          }

          @Override
          public void surfaceCreated(SurfaceHolder arg0) {
            // TODO Auto-generated method stub
            LogUtil.d(TAG, "surfaceCreated");
          }

          @Override
          public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
            // TODO Auto-generated method stub
            LogUtil.d(TAG, "surfaceChanged");
            try {
              PanelProperty pp = PictureManager.getInstance().getPanelWidthHeight();
              LogUtil.d(TAG, "pp width:" + pp.width + " height:" + pp.height);
              DisplayMetrics dm = new DisplayMetrics();
              getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
              LogUtil.d(TAG, "dm width:" + dm.widthPixels + " height:" + dm.heightPixels);

              if (pp.width != 0 && dm.widthPixels != 0) {
                xScale = (float) pp.width / (float) (dm.widthPixels);
              }

              if (pp.height != 0 && dm.heightPixels != 0) {
                yScale = (float) (pp.height) / (float) (dm.heightPixels);
              }
              LogUtil.d(TAG, "xScale" + xScale + " yScale:" + yScale);
            } catch (TvCommonException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }

            int[] location = new int[2];
            surfaceContainer.getLocationOnScreen(location);
            surfaceContainerX = location[0];
            surfaceContainerY = location[1];

            surfaceContainerW = surfaceContainer.getWidth();
            surfaceContainerH = surfaceContainer.getHeight();

            if (videoInspect != null) {
              LogUtil.d(
                  TAG,
                  "surfaceContainer width:" + surfaceContainerW + " height:" + surfaceContainerH);
              videoInspect.setPipDimens(
                  (int) (surfaceContainerX * xScale),
                  (int) (surfaceContainerY * yScale),
                  (int) (surfaceContainerW * xScale),
                  (int) (surfaceContainerH * yScale));
              videoInspect.setPipscale();
            }
          }
        });

    return contentView;
  }
Exemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.dialog);

    mLinkedList = VideoPlayerActivity.playList;

    mInflater = getLayoutInflater();
    ImageButton iButton = (ImageButton) findViewById(R.id.cancel);
    iButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            VideoChooseActivity.this.finish();
          }
        });

    ListView myListView = (ListView) findViewById(R.id.list);
    myListView.setAdapter(
        new BaseAdapter() {

          @Override
          public int getCount() {
            // TODO Auto-generated method stub
            return mLinkedList.size();
          }

          @Override
          public Object getItem(int arg0) {
            // TODO Auto-generated method stub
            return arg0;
          }

          @Override
          public long getItemId(int arg0) {
            // TODO Auto-generated method stub
            return arg0;
          }

          @Override
          public View getView(int arg0, View convertView, ViewGroup arg2) {
            // TODO Auto-generated method stub
            if (convertView == null) {
              convertView = mInflater.inflate(R.layout.list, null);
            }
            TextView text = (TextView) convertView.findViewById(R.id.text);
            text.setText(mLinkedList.get(arg0).displayName);

            return convertView;
          }
        });

    myListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            Intent intent = new Intent();
            intent.putExtra("CHOOSE", arg2);
            VideoChooseActivity.this.setResult(Activity.RESULT_OK, intent);
            VideoChooseActivity.this.finish();
          }
        });

    urlInput = (EditText) findViewById(R.id.url_input);
    urlInput.setText("http://");
    urlInput.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // TODO Auto-generated method stub

            Log.d("actionId", "" + actionId);
            Editable url = ((EditText) v).getEditableText();
            Intent intent = new Intent();
            intent.putExtra("CHOOSE_URL", url.toString());
            VideoChooseActivity.this.setResult(Activity.RESULT_OK, intent);
            VideoChooseActivity.this.finish();

            return false;
          }
        });

    myListView.requestFocus();
  }
Exemplo n.º 10
0
 @Override
 public boolean onKeyDown() {
   mListView.requestFocus();
   return false;
 }
Exemplo n.º 11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_note_list);

    Bundle extras = getIntent().getExtras();
    m_strUserId = extras.getString("USER_ID");
    m_strUserName = extras.getString("USER_NAME");
    m_strLoginToken = extras.getString("LOGIN_TOKEN");

    m_connectionDetector = new ConnectionDetector(this);

    m_listViewNote = (ListView) findViewById(R.id.list_view_notes);
    m_itemAdapter =
        new DataAdapter(
            this,
            R.layout.list_item_entry,
            R.layout.list_item_loading,
            m_strUserId,
            m_strUserName,
            m_strLoginToken);
    m_listViewNote.setAdapter((ListAdapter) m_itemAdapter);

    // list view click
    m_listViewNote.setOnItemClickListener(
        new ListView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
            if (!m_connectionDetector.isConnectingToInternet()) {
              Toast.makeText(
                      NoteListActivity.this,
                      getString(R.string.str_error_no_network),
                      Toast.LENGTH_LONG)
                  .show();
              return;
            }

            m_listViewNote.requestFocus();
            NoteItem currentItem = (NoteItem) m_itemAdapter.getItem(position);
            if (currentItem != null) {
              Intent intent = new Intent(NoteListActivity.this, NoteEditActivity.class);
              intent.putExtra("USER_ID", m_strUserId);
              intent.putExtra("USER_NAME", m_strUserName);
              intent.putExtra("LOGIN_TOKEN", m_strLoginToken);
              intent.putExtra("NOTE_ID", currentItem.m_nId);
              intent.putExtra("NOTE_LOCAL_ID", currentItem.m_nLocalId);
              startActivityForResult(intent, ACTIVITY_EDIT);
            }
          }
        });

    registerForContextMenu(m_listViewNote);

    // refresh
    m_btnRefresh = (Button) findViewById(R.id.btn_refresh);
    m_btnRefresh.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            if (!m_connectionDetector.isConnectingToInternet()) {
              Toast.makeText(
                      NoteListActivity.this,
                      getString(R.string.str_error_no_network),
                      Toast.LENGTH_LONG)
                  .show();
              return;
            }

            m_itemAdapter.refreshData();
            m_listViewNote.invalidate();
            m_listViewNote.requestFocus();
          }
        });

    // new
    m_btnNew = (Button) findViewById(R.id.btn_new);
    m_btnNew.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            if (!m_connectionDetector.isConnectingToInternet()) {
              Toast.makeText(
                      NoteListActivity.this,
                      getString(R.string.str_error_no_network),
                      Toast.LENGTH_LONG)
                  .show();
              return;
            }

            Intent intent = new Intent(NoteListActivity.this, NoteEditActivity.class);
            intent.putExtra("USER_ID", m_strUserId);
            intent.putExtra("USER_NAME", m_strUserName);
            intent.putExtra("LOGIN_TOKEN", m_strLoginToken);
            intent.putExtra("NOTE_ID", -1);
            startActivityForResult(intent, ACTIVITY_EDIT);
          }
        });

    // search
    m_editSearchText = (EditText) findViewById(R.id.edit_search_text);
    /*
         m_editSearchText.setOnFocusChangeListener(new EditText.OnFocusChangeListener() {

    @Override
    public void onFocusChange(View v, boolean hasFocus) {
    	if(hasFocus)
    	{
    		m_btnRefresh.setVisibility(Button.INVISIBLE);
    		m_btnNew.setVisibility(Button.INVISIBLE);
    	} else {
    		m_btnRefresh.setVisibility(Button.VISIBLE);
    		m_btnNew.setVisibility(Button.VISIBLE);
    	}
    }
         });
         */

    m_btnSearch = (Button) findViewById(R.id.btn_search);
    m_btnSearch.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            if (!m_connectionDetector.isConnectingToInternet()) {
              Toast.makeText(
                      NoteListActivity.this,
                      getString(R.string.str_error_no_network),
                      Toast.LENGTH_LONG)
                  .show();
              return;
            }

            String strSearch = m_editSearchText.getText().toString().trim();
            m_itemAdapter.searchText(strSearch);
            m_listViewNote.requestFocus();
          }
        });

    m_listViewNote.requestFocus();
  }