예제 #1
0
  @Override
  public boolean onJsConfirm(
      final WebView view, final String url, final String message, final JsResult result) {
    final BWebHost webHost = webView.getWebHost();
    final FragmentActivity activity = webHost.getHost();
    if (webHost == null || activity == null) {
      return false;
    }
    AlertDialogFragment fragment =
        AlertDialogFragment.getInstance(
            null, message, android.R.string.ok, android.R.string.cancel);
    fragment.setCallback(
        new SimpleFragmentDialogCallback() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
              result.confirm();
            } else {
              result.cancel();
            }
          }

          @Override
          public void cancel() {
            result.cancel();
          }
        });
    fragment.show(activity.getSupportFragmentManager());
    return true;
  }
 private void resolveTheme() {
   // Look up the guidedStepTheme in the currently specified theme.  If it exists,
   // replace the theme with its value.
   FragmentActivity activity = getActivity();
   if (mTheme == -1 && !isGuidedStepTheme(activity)) {
     // Look up the guidedStepTheme in the activity's currently specified theme.  If it
     // exists, replace the theme with its value.
     int resId = R.attr.guidedStepTheme;
     TypedValue typedValue = new TypedValue();
     boolean found = activity.getTheme().resolveAttribute(resId, typedValue, true);
     if (DEBUG) Log.v(TAG, "Found guided step theme reference? " + found);
     if (found) {
       ContextThemeWrapper themeWrapper = new ContextThemeWrapper(activity, typedValue.resourceId);
       if (isGuidedStepTheme(themeWrapper)) {
         mTheme = typedValue.resourceId;
         mThemeWrapper = themeWrapper;
       } else {
         found = false;
         mThemeWrapper = null;
       }
     }
     if (!found) {
       Log.e(TAG, "GuidedStepSupportFragment does not have an appropriate theme set.");
     }
   } else if (mTheme != -1) {
     mThemeWrapper = new ContextThemeWrapper(activity, mTheme);
   }
 }
예제 #3
0
  private void exitFullscreenAnimated(boolean animated) {
    if (!isVideoFullScreen()) return;

    swipeRefreshLayout.setVisibility(View.VISIBLE);

    // reset the values correctly
    viewer.setRotation(0.f);
    viewer.setScaleX(1.f);
    viewer.setScaleY(1.f);
    viewer.setTranslationX(0.f);

    // simulate scrolling to fix the clipping and translationY
    simulateScroll();

    // go back to normal!
    FragmentActivity activity = getActivity();
    activity.supportInvalidateOptionsMenu();

    if (activity instanceof ToolbarActivity) {
      // show the toolbar again
      ((ToolbarActivity) activity).getScrollHideToolbarListener().reset();
    }

    Screen.unlockOrientation(activity);
  }
예제 #4
0
    public void run() {
      final FragmentActivity context = getActivity();
      if (context == null) {
        return;
      }

      if (mSeasonId != null) {
        // update one season
        DBUtils.updateUnwatchedCount(context, mSeasonId);
      } else {
        // update all seasons of this show, start with the most recent
        // one
        final Cursor seasons =
            context
                .getContentResolver()
                .query(
                    Seasons.buildSeasonsOfShowUri(mShowId),
                    new String[] {Seasons._ID},
                    null,
                    null,
                    Seasons.COMBINED + " DESC");
        if (seasons == null) {
          return;
        }
        while (seasons.moveToNext()) {
          String seasonId = seasons.getString(0);
          DBUtils.updateUnwatchedCount(context, seasonId);

          notifyContentProvider(context);
        }
        seasons.close();
      }

      notifyContentProvider(context);
    }
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      FragmentActivity activity = getActivity();
      Context themedContext = null;
      if (!isGuidedStepTheme(activity)) {
        // Look up the guidedStepTheme in the activity's currently specified theme.  If it
        // exists, replace the theme with its value.
        int resId = R.attr.guidedStepTheme;
        TypedValue typedValue = new TypedValue();
        boolean found = activity.getTheme().resolveAttribute(resId, typedValue, true);
        if (DEBUG) Log.v(TAG, "Found guided step theme reference? " + found);
        if (found) {
          ContextThemeWrapper themeWrapper =
              new ContextThemeWrapper(activity, typedValue.resourceId);
          if (isGuidedStepTheme(themeWrapper)) {
            themedContext = themeWrapper;
          }
        }
        if (!found) {
          Log.e(TAG, "GuidedStepSupportFragment does not have an appropriate theme set.");
        }
      }

      if (themedContext != null) {
        inflater = inflater.cloneInContext(themedContext);
      }

      return inflater.inflate(R.layout.lb_guidedstep_background, container, false);
    }
  private void parseJson(String json) {
    mThread.interrupt();
    Looper.prepare();
    try {

      JSONObject obj = new JSONObject(json);
      String updateMessage = obj.getString(Constants.APK_UPDATE_CONTENT);
      String apkUrl = obj.getString(Constants.APK_DOWNLOAD_URL);
      int apkCode = obj.getInt(Constants.APK_VERSION_CODE);

      int versionCode =
          mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode;

      if (apkCode > versionCode) {
        if (mTypeOfNotice == NOTICE_NOTIFICATION) {
          showNotification(updateMessage, apkUrl);
        } else if (mTypeOfNotice == NOTICE_DIALOG) {
          showDialog(updateMessage, apkUrl);
        }
      } else {
        // Toast.makeText(mContext, mContext.getString(R.string.app_no_new_update),
        // Toast.LENGTH_SHORT).show();
      }

    } catch (PackageManager.NameNotFoundException ignored) {
    } catch (JSONException e) {
      Log.e(TAG, "parse json error", e);
    }
  }
예제 #7
0
 public Fragment instantiate(FragmentActivity paramFragmentActivity, Fragment paramFragment)
 {
   if (this.mInstance != null);
   for (Fragment localFragment = this.mInstance; ; localFragment = this.mInstance)
   {
     return localFragment;
     if (this.mArguments != null)
       this.mArguments.setClassLoader(paramFragmentActivity.getClassLoader());
     this.mInstance = Fragment.instantiate(paramFragmentActivity, this.mClassName, this.mArguments);
     if (this.mSavedFragmentState != null)
     {
       this.mSavedFragmentState.setClassLoader(paramFragmentActivity.getClassLoader());
       this.mInstance.mSavedFragmentState = this.mSavedFragmentState;
     }
     this.mInstance.setIndex(this.mIndex, paramFragment);
     this.mInstance.mFromLayout = this.mFromLayout;
     this.mInstance.mRestored = true;
     this.mInstance.mFragmentId = this.mFragmentId;
     this.mInstance.mContainerId = this.mContainerId;
     this.mInstance.mTag = this.mTag;
     this.mInstance.mRetainInstance = this.mRetainInstance;
     this.mInstance.mDetached = this.mDetached;
     this.mInstance.mFragmentManager = paramFragmentActivity.mFragments;
     if (!FragmentManagerImpl.DEBUG)
       continue;
     Log.v("FragmentManager", "Instantiated fragment " + this.mInstance);
   }
 }
    @Override
    protected Void doInBackground(Void... params) {

      // Simulates a background task
      try {
        Thread.sleep(500);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      // load more data
      try {
        getDataForContacts(mCurNumItems, mCurNumItems + NUMBER_DATA_GET_MORE);
      } catch (IndexOutOfBoundsException ex) {
        mIsOverData = true;
        final FragmentActivity activity = getActivity();
        activity.runOnUiThread(
            new Runnable() {
              public void run() {
                Toast.makeText(activity, "No more data to load", Toast.LENGTH_SHORT).show();
              }
            });
      }

      return null;
    }
  @Override
  public void onBackPressed() {
    if (createFragment().getClass() == ArenaFragment.class) {
      // when user press back suddenly
      ArenaFragment.timer.cancel();
      super.onBackPressed();
    } else if (createFragment().getClass() == HomeFragment.class) {
      FragmentManager fm = getSupportFragmentManager();
      DialogExitFragment dialog = new DialogExitFragment();
      dialog.show(fm, null);
    } else { // Back From GameSettings
      if (GameSettingsFragment.firstTimerRadioBtn.isChecked()) {
        ArenaSettingsLab.get(SingleFragmentActivity.this).setTimerSelected(20000);
        ArenaSettingsLab.get(SingleFragmentActivity.this).setCurrentTimerPos(0);

      } else if (GameSettingsFragment.secondTimerRadioBtn.isChecked()) {
        ArenaSettingsLab.get(SingleFragmentActivity.this).setTimerSelected(40000);
        ArenaSettingsLab.get(SingleFragmentActivity.this).setCurrentTimerPos(1);
      } else if (GameSettingsFragment.thirdTimerRadioBtn.isChecked()) {
        ArenaSettingsLab.get(SingleFragmentActivity.this).setTimerSelected(80000);
        ArenaSettingsLab.get(SingleFragmentActivity.this).setCurrentTimerPos(2);
      } else {
        ArenaSettingsLab.get(SingleFragmentActivity.this).setTimerSelected(0);
        ArenaSettingsLab.get(SingleFragmentActivity.this).setCurrentTimerPos(3);
      }
      super.onBackPressed();
    }
  }
  @Override
  protected void onPostExecute(ArrayList<RouteChangesEntity> routeChangesList) {
    super.onPostExecute(routeChangesList);

    if (routeChangesList == null) {
      ActivityUtils.showNoInternetToast(context);
    } else if (routeChangesList.size() == 0) {
      Toast.makeText(
              context, context.getString(R.string.route_changes_list_empty_text), Toast.LENGTH_LONG)
          .show();
    } else {
      switch (loadType) {
        case INIT:
          Bundle bundle = new Bundle();
          bundle.putSerializable(RouteChanges.BUNDLE_ROUTE_CHANGES_NEWS_LIST, routeChangesList);

          Intent routeChangesIntent;
          if (globalContext.isPhoneDevice()) {
            routeChangesIntent = new Intent(context, RouteChanges.class);
          } else {
            routeChangesIntent = new Intent(context, RouteChangesDialog.class);
          }

          routeChangesIntent.putExtras(bundle);
          context.startActivity(routeChangesIntent);
          break;
        default:
          ((RouteChanges) context).refreshRouteChangesList(routeChangesList);
          break;
      }
    }

    dismissLoadingView();
  }
예제 #11
0
파일: UITools.java 프로젝트: ChansEbm/Frame
 public static void removeAllActivities() {
   for (FragmentActivity activity : activities) {
     if (!activity.isFinishing()) activity.finish();
     activities.remove(activity);
   }
   activities.clear();
 }
예제 #12
0
    public BackUpTask(FragmentActivity activity) {
      super(activity);
      String s = activity.getApplicationInfo().dataDir;
      app_internal = new File(s).listFiles(new FilesDirFilter());

      appFiles = new ArrayList<>(3);

      // Get the path of all the app files in both the sd card, the emulated memory, and the
      // internal memory
      appFiles.add(activity.getFilesDir());

      if (FileHandler.isExternalStorageWritable(activity)) {
        appFiles.add(FileHandler.getExternalFilesDir(activity));
      }

      if (FileHandler.isEmulatedFilesDirWritable()) {
        final File emulatedDir = FileHandler.getEmulatedFilesDir(activity);
        if (emulatedDir != null) appFiles.add(emulatedDir);
      }

      // Get the destination path
      if (isSdCardWritable(activity)) {
        // Only true if there is an sd card and android version is less than 5.0
        output = new File(FileHandler.getExternalStorageDirectory(activity), FILENAME);
      } else if (FileHandler.isEmulatedFilesDirWritable()) {
        output = new File(Environment.getExternalStorageDirectory(), FILENAME);
      } else {
        output = null;
        cancel(true);
      }
    }
  @NonNull
  @SuppressLint("InflateParams")
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    FragmentActivity activity = getActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = activity.getLayoutInflater();
    View view = inflater.inflate(R.layout.solarsystem, null);
    builder.setView(view);
    builder.setPositiveButton("Set", new MarketFetchClickListener());
    builder.setNegativeButton("Cancel", null);

    Spinner sp_region = (Spinner) view.findViewById(R.id.sp_solarsystem_region);
    sp_system = (Spinner) view.findViewById(R.id.sp_solarsystem_system);

    system = 30000142;

    regions = Starmap.getRegions();
    ArrayList<CharSequence> region_list = new ArrayList<>();
    for (SolarSystemRegion r : regions) {
      region_list.add(r.Name);
    }
    ArrayAdapter<CharSequence> region_adapter =
        new ArrayAdapter<>(activity, android.R.layout.simple_spinner_item, region_list);
    region_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    SolarSystemRegion reg = Starmap.getRegion(Starmap.getSolarSystem(system).Region);
    sp_region.setAdapter(region_adapter);
    sp_region.setSelection(regions.indexOf(reg), true);
    setRegionSystems(reg);
    sp_region.setOnItemSelectedListener(new RegionSelectedListener());
    sp_system.setOnItemSelectedListener(new SystemSelectedListener());
    return builder.create();
  }
    @Override
    protected void onPostExecute(Boolean result) {
      super.onPostExecute(result);
      if (result) {
        Toast.makeText(
                getActivity().getApplicationContext(),
                getString(R.string.adjustments_successful),
                Toast.LENGTH_LONG)
            .show();
        dismiss();
        FragmentActivity activity = getActivity();
        if (activity != null) {
          activity.finish();

          startActivity(
              adjustmentReasonIsPhysicalCount()
                  ? new Intent(context, HomeActivity.class)
                  : activity.getIntent());
        }
      } else {
        Toast.makeText(
                getActivity().getApplicationContext(),
                "Failed to save Adjustments",
                Toast.LENGTH_LONG)
            .show();
      }
      dialog.dismiss();
    }
예제 #15
0
    private FrameLayout constructFragment(Context context)
        throws InstantiationException, IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
      TestAttributeSet attributeSet =
          new TestAttributeSet(
              attributes, resourceExtractor, attrResourceLoader, View.class, isSystem);
      if (strictI18n) {
        attributeSet.validateStrictI18n();
      }

      Class<? extends Fragment> clazz = loadFragmentClass(attributes.get("android:name"));
      Fragment fragment = ((Constructor<? extends Fragment>) clazz.getConstructor()).newInstance();
      if (!(context instanceof FragmentActivity)) {
        throw new RuntimeException(
            "Cannot inflate a fragment unless the activity is a FragmentActivity");
      }

      FragmentActivity activity = (FragmentActivity) context;

      String tag = attributeSet.getAttributeValue("android", "tag");
      int id = attributeSet.getAttributeResourceValue("android", "id", 0);
      // TODO: this should probably be changed to call TestFragmentManager.addFragment so that the
      // inflated fragments don't get started twice (once in the commit, and once in
      // ShadowFragmentActivity's
      // onStart()
      activity.getSupportFragmentManager().beginTransaction().add(id, fragment, tag).commit();

      View view = fragment.getView();

      FrameLayout container = new FrameLayout(context);
      container.setId(id);
      container.addView(view);
      return container;
    }
 public FileSDCardPageAdapter(FragmentActivity activity, ViewPager viewPager) {
   super(activity.getSupportFragmentManager());
   mActivity = activity;
   mActionBar = activity.getActionBar();
   mViewPager = viewPager;
   mViewPager.setAdapter(this);
   mViewPager.setOnPageChangeListener(this);
 }
예제 #17
0
 public void dismissMenu() {
   FragmentActivity activity = getActivity();
   if (activity != null) {
     activity
         .getSupportFragmentManager()
         .popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
   }
 }
예제 #18
0
 public TabsAdapter(FragmentActivity activity, ScrollableViewPager pager) {
   super(activity.getSupportFragmentManager());
   this.context = activity;
   this.actionBar = activity.getActionBar();
   this.viewPager = pager;
   this.viewPager.setAdapter(this);
   this.viewPager.setOnPageChangeListener(this);
 }
 private void updateIndicators(int selected) {
   for (int i = 0; i < mIndicators.size(); i++) {
     if ((mIndicators.get(selected).id & mIndicators.get(i).id) != 0) {
       if (selected == i) mActivity.findViewById(mIndicators.get(selected).id).setSelected(true);
       else mActivity.findViewById(mIndicators.get(i).id).setSelected(false);
     }
   }
 }
예제 #20
0
 public TabsAdapter(FragmentActivity activity, ViewPager pager) {
   super(activity.getSupportFragmentManager());
   mContext = activity;
   mActionBar = activity.getActionBar();
   mViewPager = pager;
   mViewPager.setAdapter(this);
   mViewPager.setOnPageChangeListener(this);
 }
 public void show(FragmentActivity context) {
   final String tag = getBuilder().mTag;
   Fragment frag = context.getSupportFragmentManager().findFragmentByTag(tag);
   if (frag != null) {
     ((DialogFragment) frag).dismiss();
     context.getSupportFragmentManager().beginTransaction().remove(frag).commit();
   }
   show(context.getSupportFragmentManager(), tag);
 }
예제 #22
0
  /** 点击了“与我相关”按钮 */
  public static void clickMyfeedBtn() {

    // Intent intentr = new Intent(getActivity(), PayData.class);
    Intent intentr = new Intent(act, PayChart.class);
    intentr.putExtra("cwp.id", userid);
    intentr.putExtra("type", 0);
    act.startActivity(intentr);
    act.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
  }
  @Override
  boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
      String scope = TextUtils.join(",", request.getPermissions());
      parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
      addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
        ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null && (previousTokenString.equals(loadCookieToken()))) {
      parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousTokenString);
      // Don't log the actual access token, just its presence or absence.
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
      // The call to clear cookies will create the first instance of CookieSyncManager if
      // necessary
      Utility.clearFacebookCookies(loginClient.getActivity());
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener =
        new WebDialog.OnCompleteListener() {
          @Override
          public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
          }
        };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder =
        new AuthDialogBuilder(fragmentActivity, request.getApplicationId(), parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setReauthenticate(request.isReauthenticate())
            .setOnCompleteListener(listener)
            .setTheme(FacebookSdk.getWebDialogTheme());
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(), FacebookDialogFragment.TAG);

    return true;
  }
예제 #24
0
  @Override
  protected void onStart() {
    super.onStart();

    super.onStart();
    mInternetAvailable = NetworkChecker.isConnected(MainActivity.this);
    MyTextView errorMsg = (MyTextView) findViewById(R.id.noInternetMessage);
    if (mInternetAvailable) errorMsg.setVisibility(View.INVISIBLE);
    else errorMsg.setVisibility(View.VISIBLE);
  }
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   int type = getItemViewType(position);
   if (type == CONTACT) {
     context.startActivity(new Intent(context, ContactActivity.class));
   } else if (type == FORUM) {
     context.startActivity(new Intent(context, ForumActivity.class));
   } else if (type == TOPIC || type == ARTICLE) {
     Utils.showModel(context, (BaseModel) getItem(position));
   }
 }
예제 #26
0
파일: UITools.java 프로젝트: ChansEbm/Frame
 public static void removeSingleActivity(FragmentActivity fragmentActivity) {
   fragmentActivity.finish();
   for (FragmentActivity activity : activities) {
     if (activities.contains(fragmentActivity)) {
       LogTools.w("finishedActivity:" + activity.getClass().getSimpleName());
       activities.remove(activity);
       break;
     }
   }
 }
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    parentActivity = this.getActivity();
    layoutInflater =
        ((LayoutInflater) parentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE));
    font = Typeface.createFromAsset(parentActivity.getAssets(), "Roboto-Light.ttf");
    myExperimentLoginText.setTypeface(font);
    myExperimentLoginText.setTextSize(20);
    myExperimentLoginText.setOnClickListener(
        new android.view.View.OnClickListener() {
          @Override
          public void onClick(View v) {
            User user = TavernaAndroid.getMyEUserLoggedin();
            if (user != null) {
              MessageHelper.showOptionsDialog(
                  parentActivity,
                  "Do you wish to log out ?",
                  "Attention",
                  new CallbackTask() {
                    @Override
                    public Object onTaskInProgress(Object... param) {
                      // Clear user logged-in and cookie
                      TavernaAndroid.setMyEUserLoggedin(null);
                      TavernaAndroid.setMyExperimentSessionCookies(null);
                      TavernaAndroid.setMyWorkflows(null);
                      TavernaAndroid.setFavouriteWorkflows(null);
                      clearLoginPreference();
                      parentActivity.recreate();
                      // refreshLoginState();
                      return null;
                    }

                    @Override
                    public Object onTaskComplete(Object... result) {
                      return null;
                    }
                  },
                  null);
            } else {
              ((MainPanelActivity) parentActivity).getMenu().toggle();
              Intent gotoMyexperimentLogin = new Intent(parentActivity, MyExperimentLogin.class);
              parentActivity.startActivity(gotoMyexperimentLogin);
            }
          }
        });

    // create a new AuthSession so that we can use the Dropbox API.
    AndroidAuthSession session = buildSession();
    mApi = new DropboxAPI<AndroidAuthSession>(session);
    TavernaAndroid.setmApi(mApi);
    if (dropboxLoggedIn()) {
      getDropboxAccountInfo();
    }
    authenticating = false;
  }
예제 #28
0
 /**
  * Updates the status on the action bar.
  *
  * @param resId a string resource ID
  */
 private void setStatus(int resId) {
   FragmentActivity activity = getActivity();
   if (null == activity) {
     return;
   }
   final ActionBar actionBar = activity.getActionBar();
   if (null == actionBar) {
     return;
   }
   actionBar.setSubtitle(resId);
 }
예제 #29
0
 /**
  * Updates the status on the action bar.
  *
  * @param subTitle status
  */
 private void setStatus(CharSequence subTitle) {
   FragmentActivity activity = getActivity();
   if (null == activity) {
     return;
   }
   final ActionBar actionBar = activity.getActionBar();
   if (null == actionBar) {
     return;
   }
   actionBar.setSubtitle(subTitle);
 }
 private void registerService() {
   activity.registerReceiver(
       recordingBroadcastReceiver,
       new IntentFilter(RecordingService.SERVICE_BROADCAST_ACTION_START));
   activity.registerReceiver(
       recordingBroadcastReceiver,
       new IntentFilter(RecordingService.SERVICE_BROADCAST_ACTION_PAUSE));
   activity.registerReceiver(
       locationBroadcastReceiver,
       new IntentFilter(RecordingService.BROADCAST_ACTION_LOCATION_CHANGED));
 }