コード例 #1
1
ファイル: WorkerService.java プロジェクト: guerwan/DataDroid
  /**
   * 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
  @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;
  }
コード例 #3
0
 public Bundle parseResponseUri(String paramString)
 {
   paramString = Uri.parse(paramString);
   Bundle localBundle = Utility.parseUrlQueryString(paramString.getQuery());
   localBundle.putAll(Utility.parseUrlQueryString(paramString.getFragment()));
   return localBundle;
 }
コード例 #4
0
 /**
  * Add a set of extended data to the extra.
  *
  * @param extras The Bundle of extras to add to this extra.
  * @see #putExtra
  * @see #removeExtra
  */
 public Request putExtras(Bundle extras) {
   if (mExtras == null) {
     mExtras = new Bundle();
   }
   mExtras.putAll(extras);
   return this;
 }
コード例 #5
0
 /**
  * Device Connectにイベントを送信する.
  *
  * @param event イベントパラメータ
  * @param bundle パラメータ
  * @return 送信成功の場合true、アクセストークンエラーの場合はfalseを返す。
  */
 public final boolean sendEvent(final Event event, final Bundle bundle) {
   Intent intent = EventManager.createEventMessage(event);
   Bundle original = intent.getExtras();
   original.putAll(bundle);
   intent.putExtras(original);
   return sendEvent(intent, event.getAccessToken());
 }
コード例 #6
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    AppState.logX(TAG, "onSaveInstanceState");

    if (getArguments() != null) outState.putAll(getArguments());
  }
コード例 #7
0
  @Override
  public void onSaveInstanceState(Bundle outState) {

    // Save values from most recent bundle (ie. most recent message)
    outState.putAll(getIntent().getExtras());

    super.onSaveInstanceState(outState);
  }
コード例 #8
0
ファイル: CommonActivity.java プロジェクト: mondonc/AnCalv2
 public void OpenActivity(int iActivityRequestCode, String sAction, long lRowId) {
   bundleDataStartup.clear();
   bundleDataStartup.putLong(CommonActivity.bundleRowId, lRowId);
   bundleDataStartup.putAll(bundleOtherDataStartup);
   Intent it = new Intent(sAction);
   it.putExtras(bundleDataStartup);
   startActivityForResult(it, iActivityRequestCode);
 }
コード例 #9
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (Log.DEBUG) Log.v("SMSPopupActivity: onSaveInstanceState()");

    // Save values from most recent bundle (ie. most recent message)
    outState.putAll(bundle);
  }
コード例 #10
0
 public void setStatus(int status, Bundle extras, long updateTime) {
   mStatus = status;
   mStatusUpdateTime = updateTime;
   mExtras.clear();
   if (extras != null) {
     mExtras.putAll(extras);
   }
   mHasStatus = true;
 }
コード例 #11
0
 public int getStatus(Bundle extras) {
   if (mHasStatus) {
     extras.clear();
     extras.putAll(mExtras);
     return mStatus;
   } else {
     return LocationProvider.AVAILABLE;
   }
 }
コード例 #12
0
 private void updateTab(String tabId, int placeholder, Fragment frag) {
   FragmentManager fm = getFragmentManager();
   Bundle args = new Bundle();
   args.putAll(getArguments());
   frag.setArguments(args);
   if (fm.findFragmentByTag(tabId) == null) {
     fm.beginTransaction().replace(placeholder, frag, tabId).commit();
   }
 }
コード例 #13
0
 protected void reloadStatuses() {
   if (getActivity() == null || isDetached()) return;
   final Bundle args = new Bundle(), fragmentArgs = getArguments();
   if (fragmentArgs != null) {
     args.putAll(fragmentArgs);
     args.putBoolean(EXTRA_FROM_USER, true);
   }
   getLoaderManager().restartLoader(0, args, this);
 }
コード例 #14
0
 /**
  * Copy all extras in 'src' in to this extra.
  *
  * @param src Contains the extras to copy.
  * @see #putExtra
  */
 public Request putExtras(Request src) {
   if (src.mExtras != null) {
     if (mExtras == null) {
       mExtras = new Bundle(src.mExtras);
     } else {
       mExtras.putAll(src.mExtras);
     }
   }
   return this;
 }
コード例 #15
0
 public static ChildrenBrowserFragment newInstance(int folderTypeId) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArgs(folderTypeId);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
コード例 #16
0
 public static Bundle parseUrl(String url) {
   try {
     URL u = new URL(url);
     Bundle b = decodeUrl(u.getQuery());
     b.putAll(decodeUrl(u.getRef()));
     return b;
   } catch (MalformedURLException e) {
     return new Bundle();
   }
 }
コード例 #17
0
 public final void a(Bundle paramBundle) {
   if (!b(3)) {}
   do {
     return;
     if (paramBundle != null) {
       p.putAll(paramBundle);
     }
   } while (!e());
   k();
 }
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    this.setContentView(R.layout.topiclist_activity);
    PullToRefreshAttacher.Options options = new PullToRefreshAttacher.Options();
    options.refreshScrollDistance = 0.3f;
    options.refreshOnUp = true;
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this, options);

    if (ActivityUtil.isNotLessThan_4_0()) setNfcCallBack();

    if (null == findViewById(R.id.item_detail_container)) {
      dualScreen = false;
    }
    FragmentManager fm = getSupportFragmentManager();
    Fragment f1 = fm.findFragmentById(R.id.item_list);
    if (f1 == null) {
      f1 = new TopiclistContainer();
      Bundle args = new Bundle(); // (getIntent().getExtras());
      if (null != getIntent().getExtras()) {
        args.putAll(getIntent().getExtras());
      }
      args.putString("url", getIntent().getDataString());
      f1.setArguments(args);
      FragmentTransaction ft = fm.beginTransaction().add(R.id.item_list, f1);
      // .add(R.id.item_detail_container, f);
      ft.commit();
    }
    Fragment f2 = fm.findFragmentById(R.id.item_detail_container);
    if (null == f2) {
      f1.setHasOptionsMenu(true);
    } else if (!dualScreen) {
      this.setTitle(R.string.app_name);
      fm.beginTransaction().remove(f2).commit();
      f1.setHasOptionsMenu(true);
    } else {
      f1.setHasOptionsMenu(false);
      f2.setHasOptionsMenu(true);
    }

    int fid = getIntent().getIntExtra("fid", 0);
    if (fid != 0) {
      String boardName = BoardHolder.boardNameMap.get(fid);
      if (null != boardName) {
        strs[0] = boardName;
      }
    }
    int favor = getIntent().getIntExtra("favor", 0);
    int authorid = getIntent().getIntExtra("authorid", 0);
    if (favor == 0 && authorid == 0) {
      setNavigation();
    } else {
      flags = ThemeManager.ACTION_BAR_FLAG;
    }
  }
コード例 #19
0
 private void reloadData(int position, int verse) {
   ReadingFragment fragment = (ReadingFragment) mAdapter.instantiateItem(mPager, position);
   if (verse > 0) {
     fragment.setForceVerse(verse);
   }
   Bundle bundle = fragment.getArguments();
   if (bundle != null) {
     bundle.putAll(mAdapter.getData(position));
     fragment.reloadData();
   }
 }
コード例 #20
0
 public static ChildrenBrowserFragment newInstanceById(String folderIdentifier) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArg(folderIdentifier);
   b.putBoolean(PARAM_IS_SHORTCUT, true);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
コード例 #21
0
 @SuppressWarnings("Recycle")
 protected void readSyncState() throws ContactsStorageException {
   @Cleanup("recycle")
   Parcel parcel = Parcel.obtain();
   byte[] raw = getSyncState();
   syncState.clear();
   if (raw != null) {
     parcel.unmarshall(raw, 0, raw.length);
     parcel.setDataPosition(0);
     syncState.putAll(parcel.readBundle());
   }
 }
コード例 #22
0
 private static ChildrenBrowserFragment newInstance(
     Folder parentFolder, String pathFolder, Site site, boolean isShortcut) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArgs(parentFolder, pathFolder, site);
   b.putBoolean(PARAM_IS_SHORTCUT, isShortcut);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
コード例 #23
0
ファイル: Util.java プロジェクト: pournima/spike
 /**
  * Parse a URL query and fragment parameters into a key-value bundle.
  *
  * @param url the URL to parse
  * @return a dictionary bundle of keys and values
  */
 public static Bundle parseUrl(String url) {
   // hack to prevent MalformedURLException
   url = url.replace("fbconnect", "http");
   try {
     URL u = new URL(url);
     Bundle b = decodeUrl(u.getQuery());
     b.putAll(decodeUrl(u.getRef()));
     return b;
   } catch (MalformedURLException e) {
     return new Bundle();
   }
 }
コード例 #24
0
        public void onReceive(Context context, Intent intent) {

          /*
           * Dispatch intent commands to handler
           */
          Message message = drawhandler.obtainMessage(STATUS_MESSAGE);
          Bundle data = new Bundle();
          if (intent.getExtras() != null) {
            data.putAll(intent.getExtras());
          }
          message.setData(data);
          drawhandler.sendMessage(message);
        }
コード例 #25
0
    public mActions addExtras(Bundle bundle)
    {
label0:
        {
            if (bundle != null)
            {
                if (mExtras != null)
                {
                    break label0;
                }
                mExtras = new Bundle(bundle);
            }
            return this;
        }
        mExtras.putAll(bundle);
        return this;
    }
コード例 #26
0
  /** Converts an intent into a {@link Bundle} suitable for use as fragment arguments. */
  public static Bundle intentToFragmentArguments(Intent intent) {
    Bundle arguments = new Bundle();
    if (intent == null) {
      return arguments;
    }

    final Uri data = intent.getData();
    if (data != null) {
      arguments.putParcelable("_uri", data);
    }

    final Bundle extras = intent.getExtras();
    if (extras != null) {
      arguments.putAll(intent.getExtras());
    }

    return arguments;
  }
コード例 #27
0
 private void a(Bundle paramBundle, fxw paramfxw) {
   if (a != null) {
     paramfxw.b();
     return;
   }
   if (c == null) {
     c = new LinkedList();
   }
   c.add(paramfxw);
   if (paramBundle != null) {
     if (b != null) {
       break label72;
     }
     b = ((Bundle) paramBundle.clone());
   }
   for (; ; ) {
     a(i);
     return;
     label72:
     b.putAll(paramBundle);
   }
 }
コード例 #28
0
    protected void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        setContentView(k.bc_activity_me);
        Intent intent = getIntent();
        int i;
        if (intent != null)
        {
            bundle = intent.getStringExtra("Title");
        } else
        {
            bundle = null;
        }
        b(bundle);
        b().a();
        if (intent != null)
        {
            i = intent.getIntExtra("ListMode", 1);
        } else
        {
            i = 1;
        }
        i;
        JVM INSTR tableswitch 1 1: default 72
    //                   1 130;
           goto _L1 _L2
_L1:
        if (e != null)
        {
            bundle = new Bundle();
            bundle.putAll(intent.getExtras());
            e.setArguments(bundle);
            getSupportFragmentManager().beginTransaction().add(j.fragment_main_panel, e).commit();
        }
        return;
_L2:
        e = new n();
        if (true) goto _L1; else goto _L3
コード例 #29
0
  protected Bundle makeExtrasBundle(String email, String password) {
    final Bundle bundle = new Bundle();

    // Pass through any extras that we were started with.
    if (getIntent() != null && getIntent().getExtras() != null) {
      bundle.putAll(getIntent().getExtras());
    }

    // Overwrite with current settings.
    if (email == null) {
      email = emailEdit.getText().toString();
    }
    if (password == null) {
      password = passwordEdit.getText().toString();
    }
    bundle.putString(EXTRA_EMAIL, email);
    bundle.putString(EXTRA_PASSWORD, password);

    boolean isPasswordShown =
        passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
    bundle.putBoolean(EXTRA_PASSWORD_SHOWN, isPasswordShown);

    return bundle;
  }
  @Override
  public void getServerDiffs(
      SyncContext context,
      SyncData baseSyncData,
      SyncableContentProvider tempProvider,
      Bundle extras,
      Object baseSyncInfo,
      SyncResult syncResult) {
    final ContentResolver cr = getContext().getContentResolver();
    mServerDiffs++;
    final boolean syncingSingleFeed = (extras != null) && extras.containsKey("feed");
    if (syncingSingleFeed) {
      String feedUrl = extras.getString("feed");
      getServerDiffsForFeed(context, baseSyncData, tempProvider, feedUrl, baseSyncInfo, syncResult);
      return;
    }

    // select the set of calendars for this account.
    Cursor cursor =
        cr.query(
            Calendar.Calendars.CONTENT_URI,
            CALENDARS_PROJECTION,
            SELECT_BY_ACCOUNT,
            new String[] {getAccount()},
            null /* sort order */);

    Bundle syncExtras = new Bundle();

    boolean refreshCalendars = true;

    try {
      while (cursor.moveToNext()) {
        boolean syncEvents = (cursor.getInt(6) == 1);
        String feedUrl = cursor.getString(3);

        if (!syncEvents) {
          continue;
        }

        // since this is a poll (no specific feed selected), refresh the list of calendars.
        // we can move away from this when we move to the new allcalendars feed, which is
        // syncable.  until then, we'll rely on the daily poll to keep the list of calendars
        // up to date.
        if (refreshCalendars) {
          mRefresh++;
          context.setStatusText("Fetching list of calendars");
          // get rid of the current cursor and fetch from the server.
          cursor.close();
          final String[] accountSelectionArgs = new String[] {getAccount()};
          cursor =
              cr.query(
                  Calendar.Calendars.LIVE_CONTENT_URI,
                  CALENDARS_PROJECTION,
                  SELECT_BY_ACCOUNT,
                  accountSelectionArgs,
                  null /* sort order */);
          // start over with the loop
          refreshCalendars = false;
          continue;
        }

        // schedule syncs for each of these feeds.
        syncExtras.clear();
        syncExtras.putAll(extras);
        syncExtras.putString("feed", feedUrl);
        cr.startSync(Calendar.CONTENT_URI, syncExtras);
      }
    } finally {
      cursor.close();
    }
  }