コード例 #1
0
 private void initServers() {
   mainHandler = new MainHandler();
   mainHandler.addFriendsFragment((FriendsFragment) fragmentPagerAdapter.getItem(2));
   mainHandler.addHomeFragment((HomeFragment) fragmentPagerAdapter.getItem(0));
   Log.v(TAG, "BroadcastServer Start");
   new Thread(new BServer(this, mainHandler)).start();
   Log.v(TAG, "TransferServer Start");
   new Thread(new TServer(this, mainHandler)).start();
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_pull_listview);

    mListView = (PullListView) findViewById(R.id.pull_list_view);
    mListView.setLoadMode(PullListView.LoadMode.PULL_TO_LOAD);
    mListView.setHeaderLabelVisibility(View.VISIBLE);
    mListView.setLastRefreshTime(
        DateUtil.getYesterdayDate(getString(R.string.pull_view_date_format)));

    //		ImageView iv = new ImageView(this);
    //		iv.setImageResource(com.opensource.pullview.R.drawable.ic_launcher);
    //		mListView.addHeaderView(iv, null, false);
    //		ImageView iv2 = new ImageView(this);
    //		iv2.setImageResource(com.opensource.pullview.R.drawable.ic_launcher);
    //		mListView.addHeaderView(iv2);
    //		ImageView iv3 = new ImageView(this);
    //		iv3.setImageResource(com.opensource.pullview.R.drawable.ic_launcher);
    //		mListView.addHeaderView(iv3);

    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mDatas);
    List<String> datas = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
      datas.add("Datas-->" + i);
    }

    mListView.setAdapter(mAdapter);

    mListView.setEnableOverScroll(true);

    mListView.setOnRefreshListener(
        new OnRefreshListener() {

          @Override
          public void onRefresh() {
            mHandler.sendEmptyMessageDelayed(MSG_REFLESH_DONE, 5000);
            Log.e(TAG, "Start refresh+=====================^_^");
          }
        });

    mListView.setOnLoadMoreListener(
        new OnLoadMoreListener() {

          @Override
          public void onLoadMore() {
            mHandler.sendEmptyMessageDelayed(MSG_LOAD_DONE, 5000);
            Log.e(TAG, "Start load more+=====================^_^");
          }
        });

    mListView.onFootLoading("正在加载");
    mHandler.sendEmptyMessageDelayed(MSG_LOAD_DONE, 3000);
  }
コード例 #3
0
 @Override
 public boolean execute(AdditionActionType type, Object... arg) {
   Log.i(TAG, "[execute], AdditionActionType = " + type);
   switch (type) {
     case ACTION_TAKEN_PICTURE:
       if (mIsMtkCameraApServiceLaunched) {
         takePicture();
         return true;
       }
       break;
     case ACTION_ON_START_PREVIEW:
       mMainHandler.sendEmptyMessage(MSG_ON_PREVIEW_STARTED);
       break;
     default:
       break;
   }
   return false;
 }
コード例 #4
0
 public void doCallback(com.moji.mjweather.common.WeatherUpdater.Result result) {
   Message message = new Message();
   message.what = 0;
   message.obj = result;
   MainHandler.sendMessage(message);
 }