@Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   root = (ViewSwitcher) inflater.inflate(R.layout.fragment_network, container, false);
   messages = (TextView) root.findViewById(R.id.loading_text);
   final View autoConnect = root.findViewById(R.id.auto_connect);
   // Auto connect service unavailable for manual calculations
   if (wifiNetwork.getScanResult() == null) autoConnect.setVisibility(View.GONE);
   else {
     final int level = wifiNetwork.getLevel();
     autoConnect.setOnClickListener(
         new OnClickListener() {
           public void onClick(View v) {
             if (passwordList == null) return;
             if (isAutoConnectServiceRunning()) {
               Toast.makeText(getActivity(), R.string.msg_auto_connect_running, Toast.LENGTH_SHORT)
                   .show();
               return;
             }
             if (level <= 1)
               Toast.makeText(getActivity(), R.string.msg_auto_connect_warning, Toast.LENGTH_SHORT)
                   .show();
             Intent i = new Intent(getActivity(), AutoConnectService.class);
             i.putStringArrayListExtra(
                 AutoConnectService.KEY_LIST, (ArrayList<String>) passwordList);
             i.putExtra(AutoConnectService.SCAN_RESULT, wifiNetwork.getScanResult());
             getActivity().startService(i);
           }
         });
   }
   if (passwordList != null) displayResults();
   return root;
 }
  public void onObjectUpdated() {
    Log.i(TAG, "Object " + m_id + " updated");

    View rootView = getView();
    if (rootView != null) {
      ViewSwitcher sw = (ViewSwitcher) getView().findViewById(R.id.switcher);
      if (m_child != null) {
        if (sw.getCurrentView().getId() != R.id.objectDisplayFragment) sw.showNext();

        // Notify the child
        m_child.objectUpdated(m_object);
        return;
      }

      // Construct the child fragment
      ObjectFragment frag = null;
      if (m_object == null) {
        frag = new NullObjectFragment();
      } else if ("person".equals(m_object.optString("objectType"))) {
        frag = new PersonObjectFragment();
      } else {
        frag = new StandardObjectFragment();
      }

      FragmentManager mgr = getChildFragmentManager();
      m_child = ObjectFragment.prepare(frag, m_id, m_intId);

      mgr.beginTransaction().add(R.id.objectDisplayFragment, m_child).commit();

      sw.showNext();
    } else {
      // Nothing to do - our UI hasn't yet been created
      // We will update when we have a child
    }
  }
  private void displayResults() {
    if (passwordList.isEmpty()) {
      root.findViewById(R.id.loading_spinner).setVisibility(View.GONE);
      messages.setText(R.string.msg_errnomatches);
    } else {
      final ListView list = (ListView) root.findViewById(R.id.list_keys);
      list.setOnItemClickListener(
          new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              final String key = ((TextView) view).getText().toString();
              Toast.makeText(getActivity(), getString(R.string.msg_copied, key), Toast.LENGTH_SHORT)
                  .show();
              ClipboardManager clipboard =
                  (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);

              clipboard.setText(key);
              startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
            }
          });
      list.setAdapter(
          new ArrayAdapter<String>(
              getActivity(), android.R.layout.simple_list_item_1, passwordList));
      root.showNext();
    }
  }
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;

    if (row == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      row = inflater.inflate(R.layout.list_row, null);
    } else row.setTag(""); // when reused, don't pretend to be something else

    TextView name = (TextView) row.findViewById(R.id.row_label);
    name.setText(mItems.get(position).mLabel);

    if (mLoadingBar == position
        || mItems.get(position).icon() == R.drawable.now_playing
        || mItems.get(position).icon() == R.drawable.now_paused) {
      ViewSwitcher switcher = (ViewSwitcher) row.findViewById(R.id.row_view_switcher);
      row.findViewById(R.id.row_view_switcher).setVisibility(View.VISIBLE);
      switcher.setDisplayedChild(mLoadingBar == position ? 1 : 0);
      ((ImageView) row.findViewById(R.id.row_disclosure_icon))
          .setImageResource(mItems.get(position).icon());
    } else {
      row.findViewById(R.id.row_view_switcher).setVisibility(View.GONE);
    }

    row.findViewById(R.id.row_icon).setVisibility(View.VISIBLE);
    ((ImageView) row.findViewById(R.id.row_icon)).setScaleType(ImageView.ScaleType.CENTER);
    ((ImageView) row.findViewById(R.id.row_icon)).setImageResource(R.drawable.list_icon_station);

    if (position == mItems.size() - 1) {
      row.setBackgroundResource(R.drawable.list_entry_rounded_bottom);
      row.setTag("bottom");
    } else row.setBackgroundResource(R.drawable.list_entry);

    return row;
  }
  private void updateViewVisibility() {

    mViewSwitcher.reset();

    if (mStatus == null) {
      mViewSwitcher.setDisplayedChild(0);
    } else {
      mViewSwitcher.setDisplayedChild(1);
      mTweetFeedListAdapter.notifyDataSetChanged();
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.chart_fragment, container, false);

    List<View> extras = getExtraFullViews(view);
    if (extras != null) {
      ViewSwitcher vs = (ViewSwitcher) view.findViewById(R.id.base_chart_viewswitcher_config);
      for (View v : extras) vs.addView(v);
    }

    currentTimeFrame = Preferences.getChartTimeframe(getActivity());

    listViewSwitcher =
        new ViewSwitcher3D((ViewGroup) view.findViewById(R.id.base_chart_bottom_frame));
    listViewSwitcher.setListener(this);

    chartGallery = (ChartGallery) view.findViewById(R.id.base_chart_gallery);
    chartGalleryAdapter = new ChartGalleryAdapter(new ArrayList<View>());
    chartGallery.setAdapter(chartGalleryAdapter);
    chartGallery.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

            chartGallery.setIgnoreLayoutCalls(true);

            if (view.getTag() != null) {
              // (page, column, num columns)?
              int pageColumn[] = (int[]) view.getTag();
              int page = pageColumn[0];
              int column = pageColumn[1];
              myAdapter.setCurrentChart(page, column);
              updateChartHeadline();
              myAdapter.notifyDataSetChanged();
              onChartSelected(page, column);
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });

    dataList = (ListView) view.findViewById(R.id.base_chart_list);
    timeframeText = (TextView) view.findViewById(R.id.base_chart_timeframe);
    dataframe = (ViewGroup) view.findViewById(R.id.base_chart_datacontainer);
    chartframe = (ViewGroup) view.findViewById(R.id.base_chart_chartframe);

    return view;
  }
Beispiel #7
0
  // Handle button clicks
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.SwitchToDate:
        v.setEnabled(false);
        findViewById(R.id.SwitchToTime).setEnabled(true);
        viewSwitcher.showPrevious();
        break;

      case R.id.SwitchToTime:
        v.setEnabled(false);
        findViewById(R.id.SwitchToDate).setEnabled(true);
        viewSwitcher.showNext();
        break;
    }
  }
  public RefreshActionProvider(final Context context) {

    super(context);

    viewSwitcher =
        (ViewSwitcher) LayoutInflater.from(context).inflate(R.layout.refresh_action_item, null);

    mRefreshButton = (ImageButton) viewSwitcher.findViewById(R.id.refresh_button);
    mRefreshButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            viewSwitcher.setDisplayedChild(PROGRESS_VIEW);

            if (onRefreshClickListener != null) onRefreshClickListener.onRefreshListener();
          }
        });
    mRefreshButton.setOnLongClickListener(
        new OnLongClickListener() {

          @Override
          public boolean onLongClick(View view) {

            showCheatsheet(context, view);
            return true;
          }
        });
  }
Beispiel #9
0
 public void onClick(View arg0) {
   // wird die Raumnummer gedrückt wird der Slider geöffnet oder geschlossen
   if (arg0 == raumnummer) {
     SlidingDrawer slider = (SlidingDrawer) findViewById(R.id.slidingDrawer1);
     slider.animateOpen();
   }
   // wechselt zum
   if (arg0 == raum) {
     switcher.setDisplayedChild(0);
   }
   // wechselt zum Campus Display
   if (arg0 == flip_1_2 || arg0 == flip_3_2 || arg0 == cam_camp || arg0 == raum_camp) {
     flip.setDisplayedChild(1);
   }
   // wechselt zur Kamera Sicht
   if (arg0 == flip_2_1 || arg0 == camp_cam) {
     flip.setDisplayedChild(0);
   }
   // wechselt raumplan
   if (arg0 == flip_2_3 || arg0 == camp_raum) {
     flip.setDisplayedChild(2);
     // Beispiel raumplan
     ImageView bsp = (ImageView) findViewById(R.id.image_raumplan_scroll);
     if (nummer.equals("341")) {
       bsp.setBackgroundResource(R.drawable.ic2_stundenplan);
     }
   }
 }
  private void hideListItemsMenu(View v, boolean close) {
    boolean toBeHidden = false;
    for (int index = 0; index < list.getChildCount(); index++) {
      View view = list.getChildAt(index);
      if (view instanceof ViewSwitcher && ((ViewSwitcher) view).getDisplayedChild() == 1) {
        ((ViewSwitcher) view).showPrevious();
        toBeHidden = true;
        getPoiAdapter().setElementSelected(-1);
        postitionSelected = -1;
      }
    }
    if (!toBeHidden && v != null && v.getTag() != null && !close) {
      // no items needed to be flipped, fill and open details page
      FragmentTransaction fragmentTransaction =
          getSherlockActivity().getSupportFragmentManager().beginTransaction();
      PoiDetailsFragment fragment = new PoiDetailsFragment();

      Bundle args = new Bundle();
      args.putString(PoiDetailsFragment.ARG_POI_ID, ((PoiPlaceholder) v.getTag()).poi.getId());
      fragment.setArguments(args);

      fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
      // fragmentTransaction.detach(this);
      fragmentTransaction.replace(R.id.fragment_container, fragment, "pois");
      fragmentTransaction.addToBackStack(fragment.getTag());
      fragmentTransaction.commit();
    }
  }
Beispiel #11
0
  void showButtons() {
    if (core == null) return;
    if (!mButtonsVisible) {
      mButtonsVisible = true;
      // Update page number text and slider
      int index = mDocView.getDisplayedViewIndex();
      updatePageNumView(index);
      mPageSlider.setMax((core.countPages() - 1) * mPageSliderRes);
      mPageSlider.setProgress(index * mPageSliderRes);
      if (mTopBarIsSearch) {
        mSearchText.requestFocus();
        showKeyboard();
      }

      Animation anim = new TranslateAnimation(0, 0, -mTopBarSwitcher.getHeight(), 0);
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mTopBarSwitcher.setVisibility(View.VISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {}
          });
      mTopBarSwitcher.startAnimation(anim);

      anim = new TranslateAnimation(0, 0, mPageSlider.getHeight(), 0);
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mPageSlider.setVisibility(View.VISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mPageNumberView.setVisibility(View.VISIBLE);
            }
          });
      mPageSlider.startAnimation(anim);
    }
  }
Beispiel #12
0
 void searchModeOn() {
   if (!mTopBarIsSearch) {
     mTopBarIsSearch = true;
     // Focus on EditTextWidget
     mSearchText.requestFocus();
     showKeyboard();
     mTopBarSwitcher.showNext();
   }
 }
Beispiel #13
0
 void searchModeOff() {
   if (mTopBarIsSearch) {
     mTopBarIsSearch = false;
     hideKeyboard();
     mTopBarSwitcher.showPrevious();
     SearchTaskResult.set(null);
     // Make the ReaderView act on the change to mSearchTaskResult
     // via overridden onChildSetup method.
     mDocView.resetupChildren();
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_action);

    // Set the action to null, this indicates that it has not been fetched
    mAction = null;

    // Fetch UI components
    RelativeLayout circleView = (RelativeLayout) findViewById(R.id.action_circle_view);
    mActionImage = (ImageView) findViewById(R.id.action_image);
    mActionTitle = (TextView) findViewById(R.id.action_title);
    mActionDescription = (TextView) findViewById(R.id.action_description);
    mExternalResourceHeader = (TextView) findViewById(R.id.action_external_resource_header);
    mExternalResource = (TextView) findViewById(R.id.action_external_resource);
    mMoreInfoHeader = (TextView) findViewById(R.id.action_more_info_header);
    mMoreInfo = (TextView) findViewById(R.id.action_more_info);
    mTickSwitcher = (ViewSwitcher) findViewById(R.id.action_tick_switcher);

    // Animate the switcher.
    mTickSwitcher.setInAnimation(this, R.anim.action_switcher_fade_in);
    mTickSwitcher.setOutAnimation(this, R.anim.action_switcher_fade_out);

    // Listeners
    findViewById(R.id.action_later).setOnClickListener(this);
    findViewById(R.id.action_did_it).setOnClickListener(this);

    // Circle view
    GradientDrawable gradientDrawable = (GradientDrawable) circleView.getBackground();
    gradientDrawable.setColor(Color.WHITE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      circleView.setBackground(gradientDrawable);
    } else {
      circleView.setBackgroundDrawable(gradientDrawable);
    }

    mActionComplete = false;

    fetchAction(getIntent().getIntExtra(ACTION_ID_KEY, -1));
  }
Beispiel #15
0
  private void updateMainList(List<AppInfo> apps) {

    if (apps != null) {

      if (apps.size() > 0) {
        footer.setVisibility(View.VISIBLE);

        String autosyncSet = Preferences.getAutosyncSet(Main.this, accountname);
        if (autosyncSet == null) {

          // set autosync default value
          AutosyncHandlerFactory.getInstance(Main.this)
              .setAutosyncPeriod(accountname, AutosyncHandler.DEFAULT_PERIOD);

          Preferences.saveAutosyncSet(Main.this, accountname);
        }
      }

      adapter.setAppInfos(apps);
      adapter.notifyDataSetChanged();

      Date lastUpdateDate = null;

      for (int i = 0; i < apps.size(); i++) {
        Date dateObject = apps.get(i).getLastUpdate();
        if (lastUpdateDate == null || lastUpdateDate.before(dateObject)) {
          lastUpdateDate = dateObject;
        }
      }

      if (lastUpdateDate != null) {
        statusText.setText("last update: " + ContentAdapter.formatDate(lastUpdateDate));
      }
    }

    if (!(R.id.main_app_list == mainViewSwitcher.getCurrentView().getId())) {
      mainViewSwitcher.showNext();
    }
  }
Beispiel #16
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    ViewPager viewPager = (ViewPager) container;

    final ViewSwitcher viewSwitcher = new ViewSwitcher(container.getContext());

    questionView =
        new QuestionView(container.getContext(), stepInfo, viewPager) {

          @Override
          protected void onCorrectAnswer() {
            stepInfo.setRevealed(true);
            viewSwitcher.showNext();
          }

          protected void onIncorrectAnswer() {
            stepInfo.setRevealed(true);
            stepInfo.setMistake(true);
            knotStepView.hideAnswer();
            viewSwitcher.showNext();
          }
        };

    knotStepView = new KnotStepView(container.getContext(), stepInfo, viewPager);

    viewSwitcher.addView(questionView);
    viewSwitcher.addView(knotStepView);

    viewSwitcher.setInAnimation(container.getContext(), android.R.anim.fade_in);
    viewSwitcher.setOutAnimation(container.getContext(), android.R.anim.fade_out);

    if (stepInfo.isRevealed()) {
      viewSwitcher.showNext();
    }

    return viewSwitcher;
  }
Beispiel #17
0
  void hideButtons() {
    if (mButtonsVisible) {
      mButtonsVisible = false;
      hideKeyboard();

      Animation anim = new TranslateAnimation(0, 0, 0, -mTopBarSwitcher.getHeight());
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {}

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mTopBarSwitcher.setVisibility(View.INVISIBLE);
            }
          });
      mTopBarSwitcher.startAnimation(anim);

      anim = new TranslateAnimation(0, 0, 0, mPageSlider.getHeight());
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mPageNumberView.setVisibility(View.INVISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mPageSlider.setVisibility(View.INVISIBLE);
            }
          });
      mPageSlider.startAnimation(anim);
    }
  }
  public void markAsDone(InstallResult result) {
    mSwitcher.setDisplayedChild(1);
    mFairyAnimation.stop();
    switch (result.getResult()) {
      case OK:
        final View.OnClickListener onClickListener =
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {

                setResult(RESULT_OK);
                finish();
              }
            };
        mButtonStartApp.setOnClickListener(onClickListener);
        mFairyContainer.setOnClickListener(onClickListener);
        mTextViewSpeechBubble.setText(R.string.start_app);
        break;
      case NOT_ENOUGH_DISK_SPACE:
        String errorMsg = getString(R.string.install_error_disk_space);
        final long diff = result.getNeededSpace() - result.getFreeSpace();
        errorMsg = String.format(errorMsg, (diff / (1024 * 1024)));
        mTextViewSpeechBubble.setText(errorMsg);
        mButtonStartApp.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                setResult(RESULT_CANCELED);
                finish();
              }
            });
        break;
      case UNSPEZIFIED_ERROR:
        errorMsg = getString(R.string.install_error);
        mTextViewSpeechBubble.setText(errorMsg);
        mButtonStartApp.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                setResult(RESULT_CANCELED);
                finish();
              }
            });
        break;
    }
  }
Beispiel #19
0
 void makeButtonsView() {
   mButtonsView = getLayoutInflater().inflate(R.layout.buttons, null);
   mFilenameView = (TextView) mButtonsView.findViewById(R.id.docNameText);
   mPageSlider = (SeekBar) mButtonsView.findViewById(R.id.pageSlider);
   mPageNumberView = (TextView) mButtonsView.findViewById(R.id.pageNumber);
   mSearchButton = (ImageButton) mButtonsView.findViewById(R.id.searchButton);
   mCancelButton = (ImageButton) mButtonsView.findViewById(R.id.cancel);
   mOutlineButton = (ImageButton) mButtonsView.findViewById(R.id.outlineButton);
   mTopBarSwitcher = (ViewSwitcher) mButtonsView.findViewById(R.id.switcher);
   mSearchBack = (ImageButton) mButtonsView.findViewById(R.id.searchBack);
   mSearchFwd = (ImageButton) mButtonsView.findViewById(R.id.searchForward);
   mSearchText = (EditText) mButtonsView.findViewById(R.id.searchText);
   // XXX		mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
   mTopBarSwitcher.setVisibility(View.INVISIBLE);
   mPageNumberView.setVisibility(View.INVISIBLE);
   mPageSlider.setVisibility(View.INVISIBLE);
 }
Beispiel #20
0
  // once TTS engine is loaded
  @Override
  public void onLoaded(boolean loaded) {
    if (loaded) {
      runOnUiThread(
          new Runnable() {
            @Override
            public void run() {
              // hide the loading screen when loaded
              switcher.showNext();
            }
          });

    } else {
      // reset the loading screen
      switcher.setDisplayedChild(1);
    }
  }
  /** I did it clicked. */
  private void didIt() {
    if (!mActionComplete) {
      mActionComplete = true;
      mTickSwitcher.showNext();
      Intent completeAction = new Intent(this, CompleteActionService.class);
      completeAction.putExtra(CompleteActionService.ACTION_KEY, mAction.getMappingId());
      startService(completeAction);

      // Finish the activity after one second
      new Handler()
          .postDelayed(
              new Runnable() {
                @Override
                public void run() {
                  finish();
                }
              },
              1000);
    }
  }
Beispiel #22
0
  public DateTimePicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Get LayoutInflater instance
    final LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // Inflate myself
    inflater.inflate(R.layout.datetimepicker, this, true);

    // Inflate the date and time picker views
    final LinearLayout datePickerView = (LinearLayout) inflater.inflate(R.layout.datepicker, null);
    final LinearLayout timePickerView = (LinearLayout) inflater.inflate(R.layout.timepicker, null);

    // Grab a Calendar instance
    mCalendar = Calendar.getInstance();
    // Grab the ViewSwitcher so we can attach our picker views to it
    viewSwitcher = (ViewSwitcher) this.findViewById(R.id.DateTimePickerVS);

    // Init date picker
    datePicker = (DatePicker) datePickerView.findViewById(R.id.DatePicker);
    datePicker.init(
        mCalendar.get(Calendar.YEAR),
        mCalendar.get(Calendar.MONTH),
        mCalendar.get(Calendar.DAY_OF_MONTH),
        this);

    // Init time picker
    timePicker = (TimePicker) timePickerView.findViewById(R.id.TimePicker);
    timePicker.setOnTimeChangedListener(this);

    // Handle button clicks
    ((Button) findViewById(R.id.SwitchToTime)).setOnClickListener(this); // shows the time picker
    ((Button) findViewById(R.id.SwitchToDate)).setOnClickListener(this); // shows the date picker

    // Populate ViewSwitcher
    viewSwitcher.addView(datePickerView, 0);
    viewSwitcher.addView(timePickerView, 1);
  }
 @Override
 public void closeSearchUI() {
   if (mSearchView.getVisibility() != View.VISIBLE) return;
   mViewSwitcher.showPrevious();
 }
Beispiel #24
0
 @Override
 protected void onResume() {
   switcher.setDisplayedChild(0);
   loadTTS();
   super.onResume();
 }
 @OnClick(R.id.login_change_to_login)
 void showLogin() {
   viewSwitcher.showPrevious();
 }
 @OnClick(R.id.login_change_to_register)
 void showRegister() {
   viewSwitcher.showNext();
 }
Beispiel #27
0
  public static void startLocalActivity(
      final ActivityGroup activityGroup,
      final Intent intent,
      final String identifier,
      final int regionId,
      final int anim) {
    final LocalActivityManager activityManager = activityGroup.getLocalActivityManager();
    final View paneView = activityManager.startActivity(identifier, intent).getDecorView();

    final ViewParent parent = paneView.getParent();
    if ((parent != null) && (parent instanceof ViewGroup)) {
      throw new IllegalStateException("should not happen - currently we don't recycle activities");
    }

    final ViewGroup region = (ViewGroup) activityGroup.findViewById(regionId);
    if ((anim != ANIM_NONE) && (region instanceof ViewSwitcher)) {
      final ViewSwitcher animator = (ViewSwitcher) region;

      if (anim == ANIM_NEXT) {
        animator.setInAnimation(activityGroup, R.anim.sl_next_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_next_out);
      } else {
        animator.setInAnimation(activityGroup, R.anim.sl_previous_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_previous_out);
      }

      final int numChilds = animator.getChildCount();
      if (numChilds == 0) {
        animator.addView(
            paneView,
            0,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
      } else if (numChilds == 1) {
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      } else {
        animator.removeViewAt(0);
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      }
    } else {
      region.removeAllViews();
      region.addView(
          paneView,
          new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    }
  }
Beispiel #28
0
 public void stopHymne(View view) {
   mViewSwitcher.showPrevious();
   if (mMediaPlayer != null) mMediaPlayer.release();
 }
Beispiel #29
0
  public void playHymne(View view) {
    long absTime = 0, duration = 0, msec = 0;
    if (myCountry > 0) {
      mViewSwitcher.showNext();

      if (mSharedPreferences.getBoolean(AUTO_PLAY, false)) {
        mMediaPlayer = MediaPlayer.create(mContext, sounds.getResourceId(myCountry, 0));
        if (mMediaPlayer != null) {
          mMediaPlayer.setLooping(true);
          duration = mMediaPlayer.getDuration();
          if (mSharedPreferences.getBoolean(SYNCHRO, false)) {
            sysTime = System.currentTimeMillis();
            if (ntpDelta != 0) absTime = sysTime + ntpDelta;
            else if (gpsDelta != 0) absTime = sysTime + gpsDelta;
            else absTime = sysTime;
            msec = absTime % duration;
            mMediaPlayer.seekTo((int) msec);
          }
          mMediaPlayer.start();
        }
        Toast.makeText(mContext, R.string.message_flag, Toast.LENGTH_SHORT).show();
      }

      StringBuilder stat = new StringBuilder();
      stat.append(sysTime)
          .append("|")
          .append(gpsTime)
          .append("|")
          .append(gpsDelta)
          .append("|")
          .append(ntpTime)
          .append("|")
          .append(ntpDelta)
          .append("|")
          .append(absTime);
      stat.append("|").append(myCountry).append("|").append(duration).append("|").append(msec);
      stat.append("|")
          .append(System.getProperty("os.name"))
          .append("|")
          .append(System.getProperty("os.version"))
          .append("|")
          .append(System.getProperty("os.arch"))
          .append("|")
          .append(System.getProperty("user.region"))
          .append("|")
          .append(System.getProperty("http.agent"));
      stat.append("|")
          .append(Build.BOARD)
          .append("|")
          .append(Build.BOOTLOADER)
          .append("|")
          .append(Build.BRAND)
          .append("|")
          .append(Build.CPU_ABI)
          .append("|")
          .append(Build.CPU_ABI2)
          .append("|")
          .append(Build.DEVICE)
          .append("|")
          .append(Build.DISPLAY)
          .append("|")
          .append(Build.FINGERPRINT)
          .append("|")
          .append(Build.HARDWARE)
          .append("|")
          .append(Build.HOST)
          .append("|")
          .append(Build.ID)
          .append("|")
          .append(Build.MANUFACTURER)
          .append("|")
          .append(Build.MODEL)
          .append("|")
          .append(Build.PRODUCT)
          .append("|")
          .append(Build.RADIO)
          .append("|")
          .append(Build.SERIAL)
          .append("|")
          .append(Build.TAGS)
          .append("|")
          .append(Build.TIME)
          .append("|")
          .append(Build.TYPE)
          .append("|")
          .append(Build.UNKNOWN)
          .append("|")
          .append(Build.USER);
      try {
        stat.append("|")
            .append(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
      } catch (NameNotFoundException e) {
        e.printStackTrace();
        stat.append("|NA");
      }

      Log.d(TAG, "stat : " + stat);
      postStat("http://kiof.free.fr/stats.php?", stat.toString());
    }
  }
  protected void setupOptionsListeners(final ViewSwitcher vs, final int position) {
    final POIObject poi = ((PoiPlaceholder) vs.getTag()).poi;

    ImageButton b = (ImageButton) vs.findViewById(R.id.poi_delete_btn);
    // CAN DELETE ONLY OWN OBJECTS
    if (DTHelper.isOwnedObject(poi)) {
      b.setVisibility(View.VISIBLE);
      b.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              {
                new SCAsyncTask<POIObject, Void, Boolean>(
                        getActivity(), new POIDeleteProcessor(getActivity()))
                    .execute(poi);
              }
            }
          });
    } else {
      b.setVisibility(View.GONE);
    }

    b = (ImageButton) vs.findViewById(R.id.poi_edit_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            {
              FragmentTransaction fragmentTransaction =
                  getSherlockActivity().getSupportFragmentManager().beginTransaction();
              Fragment fragment = new CreatePoiFragment();
              setStorePoiId((View) vs, position);
              Bundle args = new Bundle();
              args.putSerializable(CreatePoiFragment.ARG_POI, poi);
              fragment.setArguments(args);
              fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
              // fragmentTransaction.detach(this);
              fragmentTransaction.replace(R.id.fragment_container, fragment, "pois");
              fragmentTransaction.addToBackStack(fragment.getTag());
              fragmentTransaction.commit();
            }
          }
        });
    b = (ImageButton) vs.findViewById(R.id.poi_tag_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            {
              TaggingDialog taggingDialog =
                  new TaggingDialog(
                      getActivity(),
                      new TaggingDialog.OnTagsSelectedListener() {

                        @SuppressWarnings("unchecked")
                        @Override
                        public void onTagsSelected(Collection<SemanticSuggestion> suggestions) {
                          new TaggingAsyncTask(poi).execute(Utils.conceptConvertSS(suggestions));
                        }
                      },
                      PoisListingFragment.this,
                      Utils.conceptConvertToSS(poi.getCommunityData().getTags()));
              taggingDialog.show();
            }
          }
        });
    b = (ImageButton) vs.findViewById(R.id.poi_follow_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            SCAsyncTask<Object, Void, BaseDTObject> followTask =
                new SCAsyncTask<Object, Void, BaseDTObject>(
                    getSherlockActivity(),
                    new FollowAsyncTaskProcessor(getSherlockActivity(), null));
            followTask.execute(
                getSherlockActivity().getApplicationContext(),
                DTParamsHelper.getAppToken(),
                DTHelper.getAuthToken(),
                poi);
          }
        });
  }