예제 #1
1
  /**
   * Method used to send back the result to the {@link RequestManager}
   *
   * @param intent The value passed to {@link onHandleIntent(Intent)}. It must contain the {@link
   *     ResultReceiver} and the requestId
   * @param data A {@link Bundle} the data to send back
   * @param code The success/error code to send back
   */
  protected void sendResult(final Intent intent, Bundle data, final int code) {

    if (LogConfig.DP_DEBUG_LOGS_ENABLED) {
      Log.d(LOG_TAG, "sendResult : " + ((code == SUCCESS_CODE) ? "Success" : "Failure"));
    }

    ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra(INTENT_EXTRA_RECEIVER);

    if (receiver != null) {
      Bundle result = null;
      // Also adding the request parameters (can be useful when receiving the result)
      if (intent != null && intent.getExtras() != null) {
        result = intent.getExtras();
        result.putAll(data);
      }

      if (result == null) {
        result = new Bundle();
      }

      result.putInt(
          RequestManager.RECEIVER_EXTRA_REQUEST_ID,
          intent.getIntExtra(INTENT_EXTRA_REQUEST_ID, -1));

      result.putBoolean(
          RequestManager.RECEIVER_EXTRA_REQUEST_SAVE_IN_MEMORY,
          intent.getBooleanExtra(INTENT_EXTRA_IS_POST_REQUEST, false)
              || intent.getBooleanExtra(INTENT_EXTRA_SAVE_IN_MEMORY, false));

      result.putInt(RequestManager.RECEIVER_EXTRA_RESULT_CODE, code);

      receiver.send(code, result);
    }
  }
예제 #2
0
  private Bundle parserRecProgram() {
    ServiceInfoDao serInfoDao = new ServiceInfoDaoImpl(this);
    SharedPreferences spRec =
        getSharedPreferences("dvb_rec", MODE_WORLD_READABLE | MODE_WORLD_WRITEABLE);

    // parser rec programme.
    int recServiceId = spRec.getInt("rec_serviceId", 0);
    int recNumber = spRec.getInt("rec_logicalNumber", 0);
    int recServicePos = spRec.getInt("rec_servicePosition", 0);
    String recServiceName = spRec.getString("rec_serviceName", null);

    ServiceInfoBean rBean = serInfoDao.getChannelInfoByServiceId(recServiceId, recNumber);
    Bundle bundle = new Bundle();
    if (null != rBean) {
      bundle.putInt("ServicePos", recServicePos);
      bundle.putInt("LogicalNumber", recNumber);
      bundle.putInt("ServiceId", recServiceId);
      bundle.putString("ServiceName", recServiceName);
      bundle.putChar("ServiceType", serviceType);
      bundle.putString("superPwd", superPwd);
      bundle.putInt("Grade", grade);
      bundle.putBoolean("RecStatus", recStatus);
    }
    return bundle;
  }
  @Override
  public void onSaveInstanceState(Bundle savedInstanceState) {

    // Saving title field
    if (titleEditText != null) {
      savedInstanceState.putString(STATE_TITLE, titleEditText.getText().toString());
    }

    // Saving description field
    if (descriptionEditText != null) {
      savedInstanceState.putString(STATE_DESCRIPTION, descriptionEditText.getText().toString());
    }

    // Saving time field
    if (time != null) {
      savedInstanceState.putInt(STATE_TIME_HOUR, time.first);
      savedInstanceState.putInt(STATE_TIME_MINUTES, time.second);
    }

    // Saving week days field
    if (weekDays != null) {
      savedInstanceState.putBooleanArray(STATE_WEEK_DAYS, weekDays);
    }

    // The call to super method must be at the end here
    super.onSaveInstanceState(savedInstanceState);
  }
예제 #4
0
 void saveInstanceState(Bundle bundle) {
   bundle.putBoolean("hasSelectedSmallBox", hasSelectedSmallBox);
   bundle.putInt("selectingState", selectingState);
   //			bundle.putInt("selectedSmallBox_row", selectedSmallBox.cell1.row);
   //			bundle.putInt("selectedSmallBox_col", selectedSmallBox.cell1.col);
   if (hasSelectedSmallBox) bundle.putInt("selectedSmallBox_ID", selectedSmallBox.getId());
 }
 public void click(int index) {
   switch (index) {
     case 0: // 回复评论
       if (!ReplayPermit.isMayClick) {
         return;
       }
       ReplayPermit.isMayClick = false;
       Message message1 = new Message();
       message1.what = MessageID.MESSAGE_MENUCLICK_COMMENTC_MSG_REPLY;
       Bundle data = new Bundle();
       data.putInt("is_subject", isSubject);
       data.putInt("subjectid", Integer.parseInt(subjectId));
       data.putInt("commentid", commentid);
       data.putInt("touserid", touserid);
       data.putString("tousername", tousername);
       data.putString("cid", cid);
       message1.setData(data);
       //			message1.obj = subjectId;
       //			message1.arg1 = isSubject;
       //			message1.arg2 = commentid;
       handler.sendMessage(message1);
       break;
     case 1: // 查看商品
       Message message2 = new Message();
       message2.what = MessageID.MESSAGE_MENUCLICK_COMMENTC_MSG_COMMODITY;
       Bundle data2 = new Bundle();
       data2.putInt("position", position);
       message2.setData(data2);
       handler.sendMessage(message2);
       break;
   }
 }
예제 #6
0
파일: w.java 프로젝트: 007slm/WeChatRE
 public final void run() {
   new x(this).start();
   QQSyncUI.a(this.aGm, new SyncModel(this.aGm.getApplicationContext(), null));
   QQSyncUI.g(this.aGm).addContactAdapter(this.aGm.getApplicationContext());
   ISyncModel.SyncResult localSyncResult;
   Message localMessage;
   Bundle localBundle;
   if (QQSyncUI.r(this.aGm)) {
     localSyncResult = QQSyncUI.g(this.aGm).safeBackupAll();
     this.aGw = true;
     localMessage = QQSyncUI.v(this.aGm).obtainMessage();
     localBundle = new Bundle();
     localBundle.putString("progress", QQSyncUI.g(this.aGm).getProgressPrecent());
     if (localSyncResult != ISyncModel.SyncResult.SUCCEED) break label183;
     localBundle.putInt("status", 0);
   }
   while (true) {
     localMessage.setData(localBundle);
     QQSyncUI.v(this.aGm).sendMessage(localMessage);
     return;
     localSyncResult = QQSyncUI.g(this.aGm).safeRestoreAll();
     break;
     label183:
     if (localSyncResult == ISyncModel.SyncResult.FAIL) localBundle.putInt("status", 1);
     else localBundle.putInt("status", 2);
   }
 }
  /**
   * Displays the frame reader dialog
   *
   * @param p
   */
  protected void showFrameReaderDialog(Project p, FramesListAdapter.DisplayOption option) {
    if (p != null && p.getSelectedChapter() != null) {
      // move other dialogs to backstack
      FragmentTransaction ft = getFragmentManager().beginTransaction();
      Fragment prev = getFragmentManager().findFragmentByTag("dialog");
      if (prev != null) {
        ft.remove(prev);
      }
      ft.addToBackStack(null);

      // Create the dialog
      FramesReaderDialog newFragment = new FramesReaderDialog();
      Bundle args = new Bundle();
      args.putString(FramesReaderDialog.ARG_PROJECT_ID, p.getId());
      args.putString(FramesReaderDialog.ARG_CHAPTER_ID, p.getSelectedChapter().getId());
      args.putInt(
          FramesReaderDialog.ARG_SELECTED_FRAME_INDEX,
          p.getSelectedChapter().getFrameIndex(p.getSelectedChapter().getSelectedFrame()));

      // configure display option
      args.putInt(FramesReaderDialog.ARG_DISPLAY_OPTION_ORDINAL, option.ordinal());

      // display dialog
      newFragment.setArguments(args);
      newFragment.show(ft, "dialog");
    }
  }
예제 #8
0
파일: Game.java 프로젝트: rabaut/project1
  /**
   * Save the puzzle to a bundle
   *
   * @param bundle The bundle we save to
   */
  public void saveInstanceState(Bundle bundle) {
    float[] locationX = new float[blocks.size() + 1];
    float[] locationY = new float[blocks.size() + 1];
    int[] weights = new int[blocks.size() + 1];

    // store place blocks
    for (int i = 0; i < blocks.size(); i++) {
      Block piece = blocks.get(i);
      locationX[i] = piece.xPosition;
      locationY[i] = piece.yPosition;
      weights[i] = piece.weight;
    }
    // store temp block
    locationX[blocks.size()] = .5f;
    locationY[blocks.size()] = yPositionTracker;
    weights[blocks.size()] = tempBlock.weight;

    bundle.putFloatArray(LOCATIONX, locationX);
    bundle.putFloatArray(LOCATIONY, locationY);
    bundle.putIntArray(WEIGHT, weights);
    bundle.putInt(Turn, PlayerTurn);
    bundle.putInt(Score1, player1Score);
    bundle.putInt(Score2, player2Score);
    // remember who goes first
    if (blocks.size() % 2 == 0) bundle.putInt(First, PlayerTurn);
    else if (PlayerTurn == 1) bundle.putInt(First, 2);
    else bundle.putInt(First, 1);
  }
예제 #9
0
  public void onAddHostZeroconfFoundHost(HostInfo hostInfo) {
    HostFragmentManualConfiguration fragment = new HostFragmentManualConfiguration();

    Bundle args = new Bundle();
    if (hostInfo != null) {
      args.putString(HostFragmentManualConfiguration.HOST_NAME, hostInfo.getName());
      args.putString(HostFragmentManualConfiguration.HOST_ADDRESS, hostInfo.getAddress());
      args.putInt(HostFragmentManualConfiguration.HOST_HTTP_PORT, hostInfo.getHttpPort());
      args.putInt(HostFragmentManualConfiguration.HOST_TCP_PORT, hostInfo.getTcpPort());
      args.putString(HostFragmentManualConfiguration.HOST_USERNAME, hostInfo.getUsername());
      args.putString(HostFragmentManualConfiguration.HOST_PASSWORD, hostInfo.getPassword());
      args.putInt(HostFragmentManualConfiguration.HOST_PROTOCOL, hostInfo.getProtocol());
      // Ignore Mac Address and Wol Port
      args.putBoolean(
          HostFragmentManualConfiguration.HOST_USE_EVENT_SERVER, hostInfo.getUseEventServer());
      args.putInt(
          HostFragmentManualConfiguration.HOST_EVENT_SERVER_PORT, hostInfo.getEventServerPort());

      // Send this fragment straight to test
      args.putBoolean(HostFragmentManualConfiguration.GO_STRAIGHT_TO_TEST, true);
      fragment.setArguments(args);
    }
    args.putString(
        HostFragmentManualConfiguration.CANCEL_BUTTON_LABEL_ARG, getString(R.string.previous));
    fragment.setArguments(args);
    switchToFragment(fragment);
  }
예제 #10
0
파일: Compressor.java 프로젝트: Czard/aaaa
 public void saveState(Bundle map, int id) {
   map.putDouble(String.format("%d-compressor-moveDown", id), moveDown);
   map.putInt(String.format("%d-compressor-scroll", id), scroll);
   map.putInt(String.format("%d-compressor-scrollMax", id), scrollMax);
   map.putInt(String.format("%d-compressor-steps", id), steps);
   map.putInt(String.format("%d-compressor-steps", id), steps);
 }
예제 #11
0
    @Override
    public Fragment getItem(int position) {
      // getItem is called to instantiate the fragment for the given page.
      // Return a DummySectionFragment (defined as a static inner class
      // below) with the page number as its lone argument.
      Fragment fragment = null;
      Bundle args = new Bundle();

      switch (position) {
        case 0:
          fragment = new CategoriesFragment();
          args.putInt(CategoriesFragment.ARG_SECTION_NUMBER, position + 1);
          fragment.setArguments(args);
          break;
        case 1:
          fragment = new DiscoverFragment();
          args.putInt(DiscoverFragment.ARG_SECTION_NUMBER, position + 1);
          fragment.setArguments(args);
          break;
        case 2:
          fragment = new ExploreFragment();
          args.putInt(ExploreFragment.ARG_SECTION_NUMBER, position + 1);
          fragment.setArguments(args);
          break;
        case 3:
          fragment = new My_ShowsFragment();
          args.putInt(My_ShowsFragment.ARG_SECTION_NUMBER, position + 1);
          fragment.setArguments(args);
          break;
      }

      return fragment;
    }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putString(EXTRA_ACCOUNT, mAccount.getUuid());
   outState.putInt(STATE_SECURITY_TYPE_POSITION, mCurrentSecurityTypeViewPosition);
   outState.putInt(STATE_AUTH_TYPE_POSITION, mCurrentAuthTypeViewPosition);
 }
  /**
   * Builds a new {@link CheckInDialogFragment} setting all values based on the given episode TVDb
   * id. Might return null.
   */
  public static CheckInDialogFragment newInstance(Context context, int episodeTvdbId) {
    CheckInDialogFragment f = null;

    final Cursor episode =
        context
            .getContentResolver()
            .query(
                Episodes.buildEpisodeWithShowUri(episodeTvdbId),
                CheckInQuery.PROJECTION,
                null,
                null,
                null);
    if (episode != null) {
      if (episode.moveToFirst()) {
        f = new CheckInDialogFragment();
        Bundle args = new Bundle();
        args.putString(InitBundle.TITLE, episode.getString(CheckInQuery.SHOW_TITLE));
        args.putInt(InitBundle.SHOW_TVDB_ID, episode.getInt(CheckInQuery.SHOW_TVDB_ID));
        args.putInt(InitBundle.SEASON, episode.getInt(CheckInQuery.SEASON));
        args.putInt(InitBundle.EPISODE, episode.getInt(CheckInQuery.NUMBER));
        args.putString(InitBundle.SHOW_GETGLUE_ID, episode.getString(CheckInQuery.SHOW_GETGLUE_ID));

        String episodeTitleWithNumbers = ShareUtils.onCreateShareString(context, episode);
        args.putString(InitBundle.ITEM_TITLE, episodeTitleWithNumbers);
        args.putString(InitBundle.DEFAULT_MESSAGE, episodeTitleWithNumbers);
        f.setArguments(args);
      }
      episode.close();
    }

    return f;
  }
예제 #14
0
    @Override
    public void onClick(View v) {
      if (v.getId() == DYNAMIC_IMAGE_ID) {
        Intent intent = new Intent(getActivity().getApplicationContext(), PrototypeActivity.class);

        intent.putExtra(PrototypeActivity.ACTION, "compose");
        intent.putExtra(PrototypeActivity.ORDER, 8);
        startActivity(intent);
      }

      int topic_id = v.getId() - DYNAMIC_TOPIC_ID;

      if (topic_id >= 0) {
        Fragment fragment = new DummySectionFragment();
        Bundle args = new Bundle();
        args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, DummySectionFragment.HOME);

        args.putInt(DummySectionFragment.ARG_MAIN_TAB_NUMBER, topic_id);

        fragment.setArguments(args);
        getActivity()
            .getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.container, fragment)
            .commit();
      }
    }
예제 #15
0
  @Override
  public void onNavigationDrawerItemSelected(final int position) {
    mSelectPos = position;

    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    switch (position) {
      case 0:
        if (mNewestTopicsFragment == null) {
          mNewestTopicsFragment = new TopicsFragment();
          Bundle bundle = new Bundle();
          bundle.putInt("node_id", TopicsFragment.LatestTopics);
          bundle.putBoolean("attach_main", true);
          bundle.putBoolean("show_menu", false);
          mNewestTopicsFragment.setArguments(bundle);
        }
        fragmentTransaction.replace(R.id.container, mNewestTopicsFragment).commit();
        break;
      case 1:
        if (mHotTopicsFragment == null) {
          mHotTopicsFragment = new TopicsFragment();
          Bundle bundle = new Bundle();
          bundle.putInt("node_id", TopicsFragment.HotTopics);
          bundle.putBoolean("attach_main", true);
          bundle.putBoolean("show_menu", false);
          mHotTopicsFragment.setArguments(bundle);
        }
        fragmentTransaction.replace(R.id.container, mHotTopicsFragment).commit();
        break;
      case 2:
        // 特别处理
        break;
      case 3:
        if (mAllNodesFragment == null) {
          mAllNodesFragment = new AllNodesFragment();
        }
        fragmentTransaction.replace(R.id.container, mAllNodesFragment).commit();
        break;
      case 4:
        if (mFavNodesFragment == null) {
          mFavNodesFragment = new FavNodesFragment();
        }
        fragmentTransaction.replace(R.id.container, mFavNodesFragment).commit();
        break;
      case 5:
        if (mNotificationFragment == null) {
          mNotificationFragment = new NotificationFragment();
        }
        fragmentTransaction.replace(R.id.container, mNotificationFragment).commit();
        break;
      case 6:
        fragmentTransaction.replace(R.id.container, new SettingsFragment()).commit();
        break;
    }

    if (position == 2) {
      onSpinnerSelected();
      return;
    }
  }
 public static Bundle createWallpaperOffsetBundle(int count, int scrollX, int range) {
   Bundle dataBundle = new Bundle();
   dataBundle.putInt(WallpaperControler.FIELD_SCREEN_NUMS, count);
   dataBundle.putInt(WallpaperControler.FIELD_SCROLL_X, scrollX);
   dataBundle.putInt(WallpaperControler.FIELD_SCROLL_RANGE, range);
   return dataBundle;
 }
예제 #17
0
 private Bundle PutBundledMessage(int iMsgId) {
   Bundle extras = new Bundle();
   extras.putInt("msgResStrId", iMsgId);
   extras.putInt("msgType", Utils.MSGTYPE_ERROR);
   extras.putString("action", Action.ShowMsg.toString());
   return extras;
 }
 @Override
 public void onNoteSelected(int pagePosition, int verseNumber) {
   Bundle bundle = new Bundle();
   bundle.putInt(ReaderFragment.KEY_PAGE_POSITION, pagePosition);
   bundle.putInt(ReaderFragment.KEY_VERSE_NUMBER, verseNumber);
   EpubReader.getFlowInstanse().replace(new ReaderFragment(), bundle, false);
 }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testMultipleCaches() {
    Bundle bundle1 = new Bundle(), bundle2 = new Bundle();

    bundle1.putInt(INT_KEY, 10);
    bundle1.putString(STRING_KEY, "ABC");
    bundle2.putInt(INT_KEY, 100);
    bundle2.putString(STRING_KEY, "xyz");

    ensureApplicationContext();

    SharedPreferencesTokenCachingStrategy cache1 =
        new SharedPreferencesTokenCachingStrategy(getContext());
    SharedPreferencesTokenCachingStrategy cache2 =
        new SharedPreferencesTokenCachingStrategy(getContext(), "CustomCache");

    cache1.save(bundle1);
    cache2.save(bundle2);

    // Get new references to make sure we are getting persisted data.
    // Reverse the cache references for fun.
    cache1 = new SharedPreferencesTokenCachingStrategy(getContext(), "CustomCache");
    cache2 = new SharedPreferencesTokenCachingStrategy(getContext());

    Bundle newBundle1 = cache1.load(), newBundle2 = cache2.load();

    Assert.assertEquals(bundle2.getInt(INT_KEY), newBundle1.getInt(INT_KEY));
    Assert.assertEquals(bundle2.getString(STRING_KEY), newBundle1.getString(STRING_KEY));
    Assert.assertEquals(bundle1.getInt(INT_KEY), newBundle2.getInt(INT_KEY));
    Assert.assertEquals(bundle1.getString(STRING_KEY), newBundle2.getString(STRING_KEY));
  }
  public void initTab(String result) {
    tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    try {
      JSONObject jsonObj = new JSONObject(result);
      JSONArray jsonArraySuccess = jsonObj.getJSONArray("Success");
      JSONArray jsonArrayFail = jsonObj.getJSONArray("Fail");
      int totalBooksBorrow = jsonArraySuccess.length() + jsonArrayFail.length();

      Bundle success = new Bundle();
      success.putString("Json", jsonArraySuccess.toString());
      success.putInt("totalBooksBorrow", totalBooksBorrow);

      Bundle fail = new Bundle();
      fail.putString("Json", jsonArrayFail.toString());
      fail.putInt("totalBooksBorrow", totalBooksBorrow);

      tabHost.addTab(
          tabHost.newTabSpec("Success").setIndicator("Success"),
          SuccessBorrowBookFragment.class,
          success);
      tabHost.addTab(
          tabHost.newTabSpec("Fail").setIndicator("Fail"), FailBorrowBookFragment.class, fail);

      tabHost.setOnTabChangedListener(
          new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
              /*Toast.makeText(ShowBorrowBooksResultActivity.this, "Tab Changed", Toast.LENGTH_SHORT).show();*/
            }
          });
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
예제 #21
0
	// 长按菜单响应函数
	@Override
	public boolean onContextItemSelected(MenuItem item) {
		int itemIndex = item.getItemId();
		AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
		View v = menuInfo.targetView;
		switch (itemIndex) {
			case R.id.menu_unrss://取消订阅
				default:
				//显示ProgressDialog  
	            progressDialog = ProgressDialog.show(MyFavActivity.this, "删除收藏", "正在删除收藏中,请稍候", true, false);
				TextView tvId=(TextView)v.findViewById(R.id.recommend_text_id);
				int contentId=Integer.valueOf(tvId.getText().toString());
				FavList.EnumContentType contentType=FavList.EnumContentType.Blog;
				
				try{
					FavListHelper.RemoveFav(contentId,contentType,getApplicationContext());
					Toast.makeText(getApplicationContext(), R.string.unfav_succ, Toast.LENGTH_SHORT).show();
				}catch(Exception ex){
					Toast.makeText(getApplicationContext(), R.string.unfav_fail, Toast.LENGTH_SHORT).show();
				}
				progressDialog.dismiss();
				// 广播
				Intent intent = new Intent();
				Bundle bundle = new Bundle();
				bundle.putInt("contentId",contentId);
				bundle.putInt("contentType", contentType.ordinal());
				bundle.putBoolean("isfav", false);
				intent.putExtras(bundle);
				intent.setAction("android.cnblogs.com.update_favlist");
				sendBroadcast(intent);
		}
		return super.onContextItemSelected(item);
	}
  @Override
  public void onResume() {
    Log.d(SampleExtensionService.LOG_TAG, "Starting animation");

    Bundle b1 = new Bundle();
    b1.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.sample_control_text_1);
    b1.putString(Control.Intents.EXTRA_TEXT, "1");

    Bundle b2 = new Bundle();
    b2.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.sample_control_text_2);
    b2.putString(Control.Intents.EXTRA_TEXT, "2");

    Bundle b3 = new Bundle();
    b3.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.sample_control_text_3);
    b3.putString(Control.Intents.EXTRA_TEXT, "3");

    Bundle b4 = new Bundle();
    b4.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.sample_control_text_4);
    b4.putString(Control.Intents.EXTRA_TEXT, "4");

    Bundle[] data = new Bundle[4];

    data[0] = b1;
    data[1] = b2;
    data[2] = b3;
    data[3] = b4;

    showLayout(R.layout.sample_control_2, data);

    startAnimation();
  }
예제 #23
0
 /** Post a shout for a show. */
 public TraktTask shout(int showTvdbid, String shout, boolean isSpoiler) {
   mArgs.putInt(InitBundle.TRAKTACTION, TraktAction.SHOUT.index);
   mArgs.putInt(InitBundle.SHOW_TVDBID, showTvdbid);
   mArgs.putString(InitBundle.MESSAGE, shout);
   mArgs.putBoolean(InitBundle.ISSPOILER, isSpoiler);
   return this;
 }
예제 #24
0
        public void run() {

          User user = new User();
          user.setUsername(nameText.getText().toString());
          user.setPasswd(pwdText.getText().toString());
          Message msg = new Message();
          Bundle b = new Bundle();

          ILoginService ls = ClientServiceHelper.getLoginService();
          Map<String, Object> result = ls.login(user.getUsername(), user.getPasswd());
          if (result == null) {
            b.putInt("result", 1);
            b.putString("msg", "连不上服务器");
          } else {
            int status = (Integer) result.get("status");
            if (status == 0) {
              b.putInt("result", 0);
              user = (User) result.get("User");
              ((MyApplication) getApplication()).setUser(user);
            } else {
              b.putInt("result", 1);
              String backMsg = (String) result.get("msg");
              b.putString("msg", backMsg);
            }
          }

          // user.setContactId(1);
          // user.setId(1);
          // user.setKey("abc");
          // user.setType(1);
          // ((MyApplication) getApplication()).setUser(user);
          // b.putInt("result", 0);
          msg.setData(b);
          LoginActivity.this.myHandler.sendMessage(msg);
        }
예제 #25
0
 private void loadSelection(int i) {
   switch (i) {
     case 0:
       CostOverviewFragment overviewFragment = new CostOverviewFragment();
       toolbar.setTitle("Cost Overview");
       FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
       Bundle bundle = new Bundle();
       bundle.putParcelable("house", house);
       bundle.putParcelable("account", current);
       bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost"));
       getIntent().putExtra("extra", bundle);
       fragmentTransaction.replace(R.id.detailsFragmentHolder, overviewFragment);
       fragmentTransaction.addToBackStack(overviewFragment.getTag());
       fragmentTransaction.commit();
       break;
     case 1:
       PersonalCostOverview personalCostOverview = new PersonalCostOverview();
       toolbar.setTitle(cost.getSplit().get(selectedUser).getName() + "'s payments");
       fragmentTransaction = fragmentManager.beginTransaction();
       bundle = new Bundle();
       bundle.putParcelable("house", house);
       bundle.putParcelable("account", current);
       bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost"));
       bundle.putInt("selected", selectedUser);
       getIntent().putExtra("extra", bundle);
       fragmentTransaction.replace(R.id.detailsFragmentHolder, personalCostOverview);
       fragmentTransaction.addToBackStack(personalCostOverview.getTag());
       fragmentTransaction.commit();
       break;
   }
 }
예제 #26
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root =
        (ViewGroup) inflater.inflate(R.layout.fragment_default_view_pager, container, false);
    ButterKnife.inject(this, root);

    Bundle tvArgs = new Bundle(), radioArgs = new Bundle();
    if (getArguments() != null) {
      tvArgs.putAll(getArguments());
      radioArgs.putAll(getArguments());
    }
    tvArgs.putInt(PVR_LIST_TYPE_KEY, LIST_TV_CHANNELS);
    radioArgs.putInt(PVR_LIST_TYPE_KEY, LIST_RADIO_CHANNELS);

    tabsAdapter =
        new TabsAdapter(getActivity(), getChildFragmentManager())
            .addTab(PVRChannelsListFragment.class, tvArgs, R.string.tv_channels, 1)
            .addTab(PVRChannelsListFragment.class, radioArgs, R.string.radio_channels, 2)
            .addTab(PVRRecordingsListFragment.class, getArguments(), R.string.recordings, 3);

    viewPager.setAdapter(tabsAdapter);
    pagerTabStrip.setViewPager(viewPager);

    return root;
  }
예제 #27
0
  private void go2BootDefaultChannel(int serviceId) {
    ServiceInfoDao serInfoDao = new ServiceInfoDaoImpl(this);
    List<ServiceInfoBean> nBeans = serInfoDao.getChannelIdByLogicalNumber(serviceId);
    ServiceInfoBean nBean = null;
    if (nBeans.size() != 0) {
      nBean = nBeans.get(0);
    }
    if (null == nBean) {
      LogUtils.printLog(1, 5, TAG, "--->>> get boot default channel is null !");
      finish();
      return;
    }

    Bundle bundle = new Bundle();
    bundle.putInt("ServicePos", nBean.getChannelPosition());
    bundle.putInt("LogicalNumber", serviceId);
    bundle.putInt("ServiceId", serviceId);
    bundle.putString("ServiceName", nBean.getChannelName());
    bundle.putChar("ServiceType", nBean.getServiceType());
    bundle.putString("superPwd", superPwd);
    bundle.putInt("Grade", grade);
    bundle.putBoolean("RecStatus", recStatus);
    CommonUtils.skipActivity(
        SplashActivity.this, TVChannelPlay.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP);
  }
예제 #28
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(C.CATEGORY, mOldCategoryId);
   outState.putInt(C.ACCOUNT, mAccountId);
   outState.putInt("Category_Position", mPosition);
 }
 @Override
 public void onSaveInstanceState(Bundle savedInstanceState) {
   savedInstanceState.putInt(KEY_TRIM_START, mTrimStartTime);
   savedInstanceState.putInt(KEY_TRIM_END, mTrimEndTime);
   savedInstanceState.putInt(KEY_VIDEO_POSITION, mVideoPosition);
   super.onSaveInstanceState(savedInstanceState);
 }
예제 #30
0
 public void toBundle(Bundle paramBundle) {
   paramBundle.putInt("_wxapi_command_type", getType());
   paramBundle.putInt("_wxapi_baseresp_errcode", this.errCode);
   paramBundle.putString("_wxapi_baseresp_errstr", this.errStr);
   paramBundle.putString("_wxapi_baseresp_transaction", this.transaction);
   paramBundle.putString("_wxapi_baseresp_openId", this.openId);
 }