Exemplo n.º 1
1
  // Adds a reminder to the displayed list of reminders.
  // Returns true if successfully added reminder, false if no reminders can
  // be added.
  static boolean addReminder(
      Activity activity,
      View.OnClickListener listener,
      ArrayList<LinearLayout> items,
      ArrayList<Integer> values,
      ArrayList<String> labels,
      int minutes) {

    if (items.size() >= MAX_REMINDERS) {
      return false;
    }

    LayoutInflater inflater = activity.getLayoutInflater();
    LinearLayout parent = (LinearLayout) activity.findViewById(R.id.reminder_items_container);
    LinearLayout reminderItem = (LinearLayout) inflater.inflate(R.layout.edit_reminder_item, null);
    parent.addView(reminderItem);

    Spinner spinner = (Spinner) reminderItem.findViewById(R.id.reminder_value);
    Resources res = activity.getResources();
    spinner.setPrompt(res.getString(R.string.reminders_title));
    int resource = android.R.layout.simple_spinner_item;
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, resource, labels);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    ImageButton reminderRemoveButton;
    reminderRemoveButton = (ImageButton) reminderItem.findViewById(R.id.reminder_remove);
    reminderRemoveButton.setOnClickListener(listener);

    int index = findMinutesInReminderList(values, minutes);
    spinner.setSelection(index);
    items.add(reminderItem);

    return true;
  }
Exemplo n.º 2
1
  public void updateUI(boolean isSignedIn) {
    if (isSignedIn) {

      getActionBar().setTitle("My Profile");

      logo.setVisibility(View.GONE);
      header.setVisibility(View.GONE);
      title.setVisibility(View.GONE);
      // loginTwitter.setVisibility(View.GONE);
      btnLoginTwitter.setVisibility(View.GONE);
      btnSignIn.setVisibility(View.GONE);
      loginNormal.setVisibility(View.GONE);
      authButton.setVisibility(View.GONE);

      btnSignOut.setVisibility(View.GONE);
      btnRevokeAccess.setVisibility(View.VISIBLE);
      btnProceed.setVisibility(View.VISIBLE);
      llProfileLayout.setVisibility(View.VISIBLE);
    } else {
      logo.setVisibility(View.VISIBLE);
      header.setVisibility(View.VISIBLE);
      title.setVisibility(View.VISIBLE);
      // loginTwitter.setVisibility(View.VISIBLE);
      btnLoginTwitter.setVisibility(View.VISIBLE);
      btnSignIn.setVisibility(View.VISIBLE);
      loginNormal.setVisibility(View.VISIBLE);
      authButton.setVisibility(View.VISIBLE);

      btnSignOut.setVisibility(View.GONE);
      btnRevokeAccess.setVisibility(View.GONE);
      btnProceed.setVisibility(View.GONE);
      llProfileLayout.setVisibility(View.GONE);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_done, container, false);

    // Setup view
    btnBack = (ImageButton) view.findViewById(R.id.btnBack);
    btnFinish = (ImageButton) view.findViewById(R.id.btnFinish);

    // Setup listener
    btnFinish.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            onInputFormListener.OnFinishSelected();
          }
        });

    btnBack.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            onInputFormListener.OnBackSelected(DoneFragment.class);
          }
        });

    return view;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedinstanceState) {
   View ll = inflater.inflate(R.layout.navbar, container, false);
   mResetButton = (ImageButton) ll.findViewById(R.id.reset_button);
   mResetButton.setOnClickListener(mCommandButtons);
   mAddButton = (ImageButton) ll.findViewById(R.id.add_button);
   mAddButton.setOnClickListener(mCommandButtons);
   mSaveButton = (ImageButton) ll.findViewById(R.id.save_button);
   mSaveButton.setOnClickListener(mCommandButtons);
   mLeftMenu = (ImageView) ll.findViewById(R.id.left_menu);
   mNavBarContainer = (LinearLayout) ll.findViewById(R.id.navbar_container);
   mNavButtonsContainer = (LinearLayout) ll.findViewById(R.id.button_container);
   mButtonViews.clear();
   for (int i = 0; i < mNavButtonsContainer.getChildCount(); i++) {
     ImageButton ib = (ImageButton) mNavButtonsContainer.getChildAt(i);
     mButtonViews.add(ib);
   }
   mRightMenu = (ImageView) ll.findViewById(R.id.right_menu);
   if (mButtons.size() == 0) {
     loadButtons();
   }
   refreshButtons();
   return ll;
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_control_bar, container, false);

    ImageButton button = (ImageButton) v.findViewById(R.id.btnSettings);
    if (button != null) {
      button.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              mListener.onSettingsClick();
            }
          });
    }

    //        button = (ImageButton) v.findViewById(R.id.btnRecord);
    //        if(button != null) {
    //            button.setOnClickListener(new View.OnClickListener() {
    //                @Override
    //                public void onClick(View view) {
    //                }
    //            });
    //        }
    //
    //        button = (ImageButton) v.findViewById(R.id.btnCamera);
    //        if(button != null) {
    //            button.setOnClickListener(new View.OnClickListener() {
    //                @Override
    //                public void onClick(View view) {
    //                }
    //            });
    //        }
    return v;
  }
Exemplo n.º 6
0
  /**
   * fqc edit 添加一个参数 isBeiShu 来判断当前是倍数还是期数 。
   *
   * @param idFind
   * @param iV
   * @param isAdd
   * @param mSeekBar
   * @param isBeiShu
   */
  protected void setSeekWhenAddOrSub(
      int idFind, final int isAdd, final SeekBar mSeekBar, final boolean isBeiShu) {
    ImageButton subtractBeishuBtn = (ImageButton) findViewById(idFind);
    subtractBeishuBtn.setOnClickListener(
        new ImageButton.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (isBeiShu) {
              if (isAdd == 1) {
                mSeekBar.setProgress(++iProgressBeishu);
              } else {
                mSeekBar.setProgress(--iProgressBeishu);
              }
              iProgressBeishu = mSeekBar.getProgress();
            } else {
              if (isAdd == 1) {
                mSeekBar.setProgress(++iProgressQishu);
              } else {
                mSeekBar.setProgress(--iProgressQishu);
              }
              iProgressQishu = mSeekBar.getProgress();
            }
          }
        });
  }
Exemplo n.º 7
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_title_bar_back:
       finish();
       break;
     case R.id.btn_send:
       send();
       break;
     case R.id.ll_input_root:
     case R.id.et_forward_content:
       faceKeyboard.setImageResource(R.drawable.happy_face);
       faceGrid.setVisibility(View.GONE);
       inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       break;
     case R.id.btn_face_keyboard:
       if (faceGrid.getVisibility() == View.GONE) { // 先关闭输入法,再打开表情面板
         faceKeyboard.setImageResource(R.drawable.keyboard);
         inputMethodManager.hideSoftInputFromWindow(
             getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
         faceGrid.setVisibility(View.VISIBLE);
       } else { // 先关闭面板,再打开输入法
         faceKeyboard.setImageResource(R.drawable.happy_face);
         faceGrid.setVisibility(View.GONE);
         inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       }
       break;
   }
 }
Exemplo n.º 8
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_player_controls, container, false);

    songTitle = (TextView) view.findViewById(R.id.textSongTitle);
    songArtist = (TextView) view.findViewById(R.id.textArtistName);
    songAlbum = (TextView) view.findViewById(R.id.textAlbumTitle);

    moreInfoButton = (ImageButton) view.findViewById(R.id.songDetail);
    skipNextButton = (ImageButton) view.findViewById(R.id.nextButton);
    skipPrevButton = (ImageButton) view.findViewById(R.id.previousButton);
    playPauseButton = (ImageButton) view.findViewById(R.id.playButton);

    moreInfoButton.setOnClickListener(this);
    skipNextButton.setOnClickListener(this);
    skipPrevButton.setOnClickListener(this);
    playPauseButton.setOnClickListener(this);

    seekBar = (SeekBar) view.findViewById(R.id.songSeekBar);
    timePosition = (TimeView) view.findViewById(R.id.songTimeCurr);
    timeDuration = (TimeView) view.findViewById(R.id.songTimeMax);
    scrubberThumb = (TimeView) view.findViewById(R.id.seekThumb);

    seekBar.setOnSeekBarChangeListener(this);
    scrubberThumb.getBackground().setColorFilter(Themes.getAccent(), PorterDuff.Mode.SRC_IN);

    return view;
  }
 /*
  * Toggle switch button images
  * changing image states to on / off
  * */
 private void toggleButtonImage() {
   if (isFlashOn) {
     btnSwitch.setImageResource(R.drawable.btn_switch_on);
   } else {
     btnSwitch.setImageResource(R.drawable.btn_switch_off);
   }
 }
Exemplo n.º 10
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    lectureId = getIntent().getLongExtra(EXTRA_LECTURE_ID, -1);
    setContentView(R.layout.lecture_edit_activity);

    loadLectureData();

    Button submit = (Button) findViewById(R.id.submitLectureEdit);
    Button cancel = (Button) findViewById(R.id.cancelLectureEdit);

    submit.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            onSubmitEditLectureClicked();
          }
        });

    cancel.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            onCancelEditLectureClicked();
          }
        });

    ImageButton goHome = (ImageButton) findViewById(R.id.home);
    goHome.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            startActivity(new Intent(EditLectureActivity.this, DashboardActivity.class));
          }
        });
  }
Exemplo n.º 11
0
 @Override
 public void onGetPositioninforesult(Map obj) {
   if (obj != null) {
     int positionInt = (int) fromDateStringToInt((String) obj.get("relTime"));
     mRemotePlayPosition = positionInt;
     if (!mSeekBarTouchMode && (LocalMediaUtil.getWhichOnRemote() == LocalMediaUtil.Defs.MUSIC)) {
       mNowPosition.setText(setDurationFormat(positionInt));
       mMusicProgress.setProgress(positionInt);
       postGetPositionInfo();
     }
   } else {
     //			mIsPlayOnLocal = true;
     try {
       //				mMusicPlayService.setPlayOnPhone(true);
       mMusicPlayService.seekTo(mRemotePlayPosition);
     } catch (RemoteException e) {
       e.printStackTrace();
     }
     try {
       if (mMusicPlayService.isPlaying()) {
         mStatusButton.setImageResource(R.drawable.video_btn_pause);
       } else {
         mStatusButton.setImageResource(R.drawable.video_btn_start);
       }
     } catch (RemoteException e) {
       e.printStackTrace();
     }
   }
 }
Exemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_leaderboard);

    context = getApplicationContext();
    userID = getIntent().getStringExtra("userID");

    getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    getActionBar().setCustomView(R.layout.mainmenu1);
    getActionBar().setDisplayShowHomeEnabled(true);
    getActionBar().setDisplayShowTitleEnabled(true);

    ImageButton btNewTheme = (ImageButton) findViewById(R.id.bt_create_new_theme);
    btNewTheme.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intentCreateNewTheme = new Intent(context, CreateThemeActivity.class);
            intentCreateNewTheme.putExtra("userID", userID);
            startActivity(intentCreateNewTheme);
          }
        });

    listLeaderboard = (ListView) findViewById(R.id.listLeaderboard);

    new LongRunningGetIO().execute();
  }
Exemplo n.º 13
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
    if (requestCode == REQUEST_CODE_PHOTO) {
      if (resultCode == RESULT_OK) {
        if (imageReturnedIntent == null) {
        } else {

          Bundle bndl = imageReturnedIntent.getExtras();
          if (bndl != null) {
            Object obj = imageReturnedIntent.getExtras().get("data");
            if (obj instanceof Bitmap) {
              Bitmap bitmap = (Bitmap) obj;
              imbutton.setImageBitmap(bitmap);
            }
          }
        }
      } else if (resultCode == RESULT_CANCELED) {

      }
    }
    Bitmap bitmap = null;
    switch (requestCode) {
      case GALLERY_REQUEST:
        if (resultCode == RESULT_OK) {
          Uri selectedImage = imageReturnedIntent.getData();
          imbutton.setImageURI(selectedImage);
          imbutton.setImageBitmap(bitmap);
        }
    }
  }
  private void cancelGameMode(String message) {
    gameMode = false;
    Snackbar.make(rootView, message, Snackbar.LENGTH_LONG).setAction("Action", null).show();
    gameModeStatusTextView.setText(getActivity().getResources().getString(R.string.game_mode_null));
    gameModeButton.setText(getActivity().getResources().getString(R.string.game_mode));
    plusButton.setEnabled(true);
    minusButton.setEnabled(true);
    count = 0;
    gameModeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            // notify the user
            Snackbar.make(
                    rootView,
                    "Your Game Begins now. Enter the Binary equivalent of "
                        + gameModeText
                        + "Time is 2 min.",
                    Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
            showGameModeDialog();
          }
        });
  }
  public void setGameMode(String text) {
    gameModeText = text;
    gameModeStatusTextView.setText(
        String.format(getActivity().getResources().getString(R.string.game_mode_format), text));
    // Toast.makeText(getActivity(), "text", Toast.LENGTH_LONG).show();
    gameMode = true;

    // once the game mode is set disable plus and minus buttons
    // chang ethe string written in the game mod button to Reset
    // remove the onclick listener and add a new on
    plusButton.setEnabled(false);
    minusButton.setEnabled(false);
    gameModeButton.setText(getActivity().getResources().getString(R.string.string_reset));
    gameModeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            cancelGameMode("Game Mode Cancelled");
            allOff();
          }
        });

    // start the game
    // turn all off
    allOff();
    // how do i code the game now
    gameStart();
  }
Exemplo n.º 16
0
  private void setTabAction() {

    final LinearLayout tab1 = (LinearLayout) findViewById(R.id.tab1);
    final LinearLayout tab2 = (LinearLayout) findViewById(R.id.tab2);

    ImageButton btn1 = (ImageButton) findViewById(R.id.btn1);
    btn1.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            tab1.setVisibility(LinearLayout.VISIBLE);

            tab2.setVisibility(LinearLayout.GONE);
          }
        });

    ImageButton btn2 = (ImageButton) findViewById(R.id.btn2);

    btn2.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            tab1.setVisibility(LinearLayout.GONE);

            tab2.setVisibility(LinearLayout.VISIBLE);
          }
        });
  }
Exemplo n.º 17
0
  @Override
  public void onUpdate() {
    Song nowPlaying = PlayerController.getNowPlaying();
    if (nowPlaying != null) {
      songTitle.setText(nowPlaying.getSongName());
      songArtist.setText(nowPlaying.getArtistName());
      songAlbum.setText(nowPlaying.getAlbumName());

      int duration = PlayerController.getDuration();
      timeDuration.setTime(duration);
      seekBar.setMax(duration);

      if (!observer.isRunning()) {
        observerThread = new Thread(observer);
        observerThread.start();
      }
    } else {
      songTitle.setText(R.string.nothing_playing);
      songArtist.setText(R.string.unknown_artist);
      songAlbum.setText(R.string.unknown_album);
    }

    seekBar.setEnabled(nowPlaying != null);

    if (PlayerController.isPlaying()) {
      playPauseButton.setImageResource(R.drawable.ic_pause_36dp);
    } else {
      playPauseButton.setImageResource(R.drawable.ic_play_arrow_36dp);
    }
  }
Exemplo n.º 18
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.menu, container, false);

    mImageView = (ImageView) view.findViewById(R.id.imageView1);

    ImageButton picSBtn = (ImageButton) view.findViewById(R.id.btnIntendS);
    picSBtn.setImageResource(R.drawable.ic_action_camera);
    setBtnListenerOrDisable(picSBtn, mTakePicSOnClickListener, MediaStore.ACTION_IMAGE_CAPTURE);

    BookActivity.stopButton = (ImageButton) view.findViewById(R.id.stopSound);
    BookActivity.stopButton.setImageResource(R.drawable.ic_action_volume_on);
    BookActivity.stopButton.setOnClickListener(
        new View.OnClickListener() {
          boolean isPlaying = true;

          @Override
          public void onClick(View v) {

            BookActivity.setMuted();
            BookActivity.stopButton.setImageResource(BookActivity.playIcon);
          }
        });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
      mAlbumStorageDirFactory = new FroyoAlbumDirFactory();
    } else {
      mAlbumStorageDirFactory = new BaseAlbumDirFactory();
    }

    // Set image profile for user, this way we can continue playing having the picture profile of
    // the user
    // mImageView.setImageURI(Uri.parse("file:///storage/sdcard/Pictures/CameraSample/IMG_20140206_082344_-733536260.jpg"));
    return view;
  }
Exemplo n.º 19
0
  private void init(AttributeSet attrs, int defStyle) {
    LayoutInflater inflater =
        (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    inflater.inflate(R.layout.timeline_item, this, true);

    mVideoView = (VideoView) findViewById(R.id.thumbinail);

    mSegmentSelector = (RangeSelector) findViewById(R.id.segment);
    mSegmentSelector.setEventsListener(this);

    mOpenButton = ((ImageButton) findViewById(R.id.open));
    mOpenButton.setOnClickListener(this);

    mDeleteButton = ((ImageButton) findViewById(R.id.delete));
    mDeleteButton.setOnClickListener(this);

    mTitleText = (TextView) findViewById(R.id.title);
    mDurationText = (TextView) findViewById(R.id.length);

    mMediaInfo = new MediaFileInfo(new AndroidMediaObjectFactory(mContext));

    mEnableSegmentPicker = true;

    setMediaUri(null);
  }
Exemplo n.º 20
0
  private void goToMyLocation() {

    LogManager.d("mapView height" + mapView.getMeasuredHeight());
    View parent = (View) mapView.getParent();
    LogManager.d("mapView height" + parent.getMeasuredHeight());

    if (mCurrentLocation == null) {

      LogManager.d("找不到当前位置");

      map_view_enable.setVisibility(View.VISIBLE);
      mapView.setVisibility(View.GONE);
      searchButton.setEnabled(false);
      // setMapCenter(mDefaultCurrentLocation);
    } else {
      searchButton.setEnabled(true);
      map_view_enable.setVisibility(View.GONE);
      mapView.setVisibility(View.VISIBLE);
      int getLatitude = (int) (mCurrentLocation.getLatitude() * 1e6);
      int getLongitude = (int) (mCurrentLocation.getLongitude() * 1e6);

      GeoPoint geoPoint = null;
      if (debugChinaDevice) {
        int latitude = (int) (44.648837 * 1e6);
        int longitude = (int) (10.920087000000001 * 1e6);
        geoPoint = new GeoPoint(latitude, longitude);
      } else {
        geoPoint = new GeoPoint(getLatitude, getLongitude);
      }
      setMapCenter(geoPoint);
    }
  }
Exemplo n.º 21
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_control, container, false);
    mListener = (ControlFragmentListener) getActivity();
    mHelper.setListeners(getActivity());

    mControlButton = (ImageButton) view.findViewById(R.id.button_control_service);
    mControlButton.setOnClickListener(mButtonListener);

    mCurrentPathButton = (ImageButton) view.findViewById(R.id.button_show_current);
    mCurrentPathButton.setOnClickListener(mCurrentButtonListener);

    mClearButton = (ImageButton) view.findViewById(R.id.button_clear);
    mClearButton.setOnClickListener(mClearButtonListener);

    mSaveButton = (ImageButton) view.findViewById(R.id.button_save);
    mSaveButton.setOnClickListener(mSaveButtonListener);

    mInfoButton = (ImageButton) view.findViewById(R.id.button_info);
    mInfoButton.setOnClickListener(mInfoButtonListener);

    changeButtonIcon(mHelper.isServiceStarted());
    mHelper.getList();
    return view;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.home_page, container, false);

    mPitchDetector = (ImageButton) v.findViewById(R.id.pitch_detector);
    mPitchDetector.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(getActivity(), PitchDetectorActivity.class);
            startActivity(i);
          }
        });

    mNotePlayer = (ImageButton) v.findViewById(R.id.note_player);
    mNotePlayer.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(getActivity(), NotePagerActivity.class);
            HomePageFragment.this.startActivity(i);
          }
        });

    mPitchQuiz = (ImageButton) v.findViewById(R.id.pitch_quiz);
    mPitchQuiz.setEnabled(false);

    mVoicePartTest = (ImageButton) v.findViewById(R.id.voice_part_test);
    mVoicePartTest.setEnabled(false);

    return v;
  }
Exemplo n.º 23
0
 @Override
 protected void reset() {
   setProgressBarIndeterminateVisibility(true);
   mPayPalButton.setVisibility(GONE);
   mAndroidPayButton.setVisibility(GONE);
   mPurchaseButton.setEnabled(false);
 }
Exemplo n.º 24
0
  private void createSaveButton() {
    mToolbar = ((MainActivity) getActivity()).getToolbar();
    mToolbar.inflateMenu(R.menu.menu_save);

    ImageButton saveButton =
        (ImageButton) mToolbar.getMenu().findItem(R.id.save_view).getActionView();
    saveButton.setImageDrawable(
        ContextCompat.getDrawable(getActivity(), R.drawable.ic_action_save));
    saveButton.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.ColorPrimaryDark));
    saveButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (isReadyToSave()) {
              saveUpdatedProfile();
              Toast.makeText(getActivity(), "Successfully saved", Toast.LENGTH_SHORT).show();
              InputMethodManager imm =
                  (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
              imm.hideSoftInputFromWindow(
                  view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
              ((MainActivity) getActivity()).setupProfileOnDrawer();
              ((MainActivity) getActivity()).openDrawer();
            }
          }
        });
  }
  private void addIconTab(final int position, int resId) {

    ImageButton tab = new ImageButton(getContext());
    tab.setImageResource(resId);

    addTab(position, tab);
  }
Exemplo n.º 26
0
  // check which button is pushed and do the turn
  public void clickTicTac(View view) {

    System.out.println("Button Pushed");
    ImageButton pushedButton = (ImageButton) findViewById(view.getId());

    int horizontal = Integer.parseInt(map.get(view.getId()).substring(0, 1));
    int vertical = Integer.parseInt(map.get(view.getId()).substring(1, 2));

    System.out.println(horizontal);
    System.out.println(vertical);

    if (board[horizontal][vertical] == 0) {

      System.out.println("box was empty, now filling..");
      // Do the human turn and check for a winner
      board[horizontal][vertical] = 1;
      pushedButton.setImageResource(R.mipmap.circle);
      checkWinner(1);

      System.out.println("image resource changed");

      // do the computer move and check for a winner
      computerTurn();
      System.out.println("Done computer turn");
      checkWinner(2);
    }
  }
  @Test
  public void testAddItem() {

    ArrayList<GroceryItem> items = _activity.getItemsDisplayed();
    int count = items.size();

    _btnAdd.performClick();

    try {

      _btnAdd.performClick();
      Intent data =
          super.targetActivityIsStarted(
              shadowOf(this._activity), EditMasterItemActivity.class.getName());
      assert (data != null);

      GroceryItem item = saveGroceryItemValues(data);
      _activity.processActivityResult(BaseListActivity.ACTIVITY_ADD, Activity.RESULT_OK, data);
      ArrayList<GroceryItem> itemsDisplayed = _activity.getItemsDisplayed();

      assertTrue(itemsDisplayed.contains(item));
      _activity.saveList();
      items = _activity.loadGroceryItems(FileNameConstants.MasterFileName);
      assertEquals(count + 1, items.size());

    } catch (Exception e) {
      fail("Exception testing adding of an empty category");
      // TODO Auto-generated catch block
      // e.printStackTrace();
    }
  }
Exemplo n.º 28
0
    public void initView() {

      mPrepareView = findViewById(R.id.prepare_panel);
      mTVPrepareSpeed = (TextView) findViewById(R.id.tv_prepare_speed);

      mLoadView = findViewById(R.id.loading_panel);
      mTVLoadSpeed = (TextView) findViewById(R.id.tv_speed);

      mControlView = findViewById(R.id.control_panel);
      mTVSongName = (TextView) findViewById(R.id.tv_title);
      mTVArtist = (TextView) findViewById(R.id.tv_artist);
      mTVAlbum = (TextView) findViewById(R.id.tv_album);

      mBtnPlay = (ImageButton) findViewById(R.id.btn_play);
      mBtnPause = (ImageButton) findViewById(R.id.btn_pause);
      mBtnPlay.setOnClickListener(this);
      mBtnPause.setOnClickListener(this);
      mSeekBar = (SeekBar) findViewById(R.id.playback_seeker);
      mTVCurTime = (TextView) findViewById(R.id.tv_curTime);
      mTVTotalTime = (TextView) findViewById(R.id.tv_totalTime);
      mVisualizerView = (VisualizerView) findViewById(R.id.mp_freq_view);
      mIVAlbum = (ImageView) findViewById(R.id.iv_album);
      setSeekbarListener(this);

      mHideDownTransformation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 200.0f);
      mHideDownTransformation.setDuration(1000);

      mAlphaHideTransformation = new AlphaAnimation(1, 0);
      mAlphaHideTransformation.setDuration(1000);

      updateAlbumPIC(getResources().getDrawable(R.drawable.mp_music_default));
    }
Exemplo n.º 29
0
 public void addTrailerView() {
   LayoutInflater vi =
       (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   Log.d("vi", "Null " + Boolean.toString(vi == null));
   for (int i = 0; i < trailerVideo.size(); i++) {
     View trailerView = vi.inflate(R.layout.trailer_view, null);
     final TextView trailerTitleView = (TextView) trailerView.findViewById(R.id.trailer_title);
     trailerTitleView.setText(trailerVideo.get(i).getName());
     ImageButton imageButton = (ImageButton) trailerView.findViewById(R.id.trailer_play_button);
     final String source = trailerVideo.get(i).getSource();
     imageButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + source));
             startActivity(intent);
           }
         });
     insertTrailerPoint.addView(
         trailerView,
         0,
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
   }
 }
Exemplo n.º 30
0
  private void setListener() {
    uploadphotoBtn.setOnClickListener(this);
    cancle.setOnClickListener(this);
    photoBtn.setOnClickListener(this);
    delPhotoBtn.setOnClickListener(this);
    previewImage.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            AlertDialog.Builder buide =
                new AlertDialog.Builder(GpsCameraActivity.this)
                    .setPositiveButton(R.string.close, null);
            try {

              Bitmap bitmap = getLastPhoto(photoName);
              LayoutInflater layout = LayoutInflater.from(GpsCameraActivity.this);
              View diaLoagView = layout.inflate(R.layout.loadphoto_image, null);
              ImageView image1 = (ImageView) diaLoagView.findViewById(R.id.Load_bigimage);
              image1.setImageBitmap(bitmap);
              LayoutParams layoutParams = image1.getLayoutParams();
              WindowManager manager = getWindowManager();
              layoutParams.height = (int) (manager.getDefaultDisplay().getHeight() * 0.5);
              layoutParams.width = (int) (manager.getDefaultDisplay().getWidth() * 0.7);
              image1.setLayoutParams(layoutParams);
              buide.setView(diaLoagView);
              buide.show();
            } catch (Exception e) {
              Logger.debug("出现异常:" + e.getMessage());
            }
          }
        });
  }