コード例 #1
0
ファイル: RouteFragment.java プロジェクト: haovn577/open
  private void resetPagerItemStyling(int page) {
    if (page > 0) {
      page--;
      adapter.setTurnIcon(
          pager.findViewWithTag("Instruction_" + page),
          DisplayHelper.getRouteDrawable(
              pager.getContext(),
              instructions.get(page).getTurnInstruction(),
              DisplayHelper.IconStyle.GRAY));

      adapter.setBackgroundColorInactive(pager.findViewWithTag("Instruction_" + page));
    }
  }
コード例 #2
0
ファイル: RouteFragment.java プロジェクト: haovn577/open
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.route_widget, container, false);
    ButterKnife.inject(this, rootView);
    fragment = this;
    adapter = new RouteAdapter(act, instructions, fragment);
    adapter.setDestinationName(simpleFeature.getProperty(TEXT));
    TextView destinationName = (TextView) rootView.findViewById(R.id.destination_name);
    destinationName.setText(getString(R.string.routing_to_text) + simpleFeature.getProperty(TEXT));
    if (route != null) {
      distanceToDestination.setDistance(route.getTotalDistance());
    }
    pager.setAdapter(adapter);
    pager.setOnPageChangeListener(this);
    adapter.notifyDataSetChanged();
    currentXCor = mapFragment.getMap().getMapPosition().getX();
    initSpeakerbox();
    initNotificationCreator();
    pager.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            turnAutoPageOff();
            return false;
          }
        });
    initDebugView(rootView);
    initSlideLayout(rootView);
    setMapOnTouchListener();

    res = act.getResources();
    prefs = getDefaultSharedPreferences(act);

    if (LocationServices.FusedLocationApi != null) {
      if (prefs.getBoolean(getString(R.string.settings_mock_gpx_key), false)) {
        final String key = getString(R.string.settings_mock_gpx_filename_key);
        final String defaultFile = getString(R.string.settings_mock_gpx_filename_default_value);
        final String filename = prefs.getString(key, defaultFile);
        final File file = new File(Environment.getExternalStorageDirectory(), filename);
        LocationServices.FusedLocationApi.setMockMode(true);
        LocationServices.FusedLocationApi.setMockTrace(file);
      } else {
        LocationServices.FusedLocationApi.setMockMode(false);
      }
    }

    hideLocateButtonAndAttribution();
    return rootView;
  }
コード例 #3
0
ファイル: RouteFragment.java プロジェクト: haovn577/open
  private void setCurrentPagerItemStyling(int page) {
    if (page == instructions.size() - 1) {
      adapter.setBackgroundColorComplete(pager.findViewWithTag("Instruction_" + page));
    } else {
      adapter.setBackgroundColorActive(pager.findViewWithTag("Instruction_" + page));
    }

    adapter.setTurnIcon(
        pager.findViewWithTag("Instruction_" + page),
        DisplayHelper.getRouteDrawable(
            pager.getContext(),
            instructions.get(page).getTurnInstruction(),
            DisplayHelper.IconStyle.STANDARD));
    resetPagerItemStyling(page);
  }