Esempio n. 1
0
  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.ib_lock:
        break;
      case R.id.ib_forward:
        mPlayerView.seek(10000);
        break;
      case R.id.ib_play:
        if (mPlayerView.isPlaying()) {
          mPlayerView.pause();
          ibPlay.setBackgroundResource(R.drawable.ic_play);
        } else {
          mPlayerView.play();
          ibPlay.setBackgroundResource(R.drawable.ic_pause);
        }
        break;

      case R.id.ib_backward:
        mPlayerView.seek(-10000);
        break;
      case R.id.ib_size:
        break;
      default:
        break;
    }
  }
Esempio n. 2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = this.mLayoutInflater.inflate(R.layout.device_listview_item_layout_other, null);
    }

    ImageView img_device = (ImageView) convertView.findViewById(R.id.img_device);
    TextView deviceItemName = (TextView) convertView.findViewById(R.id.device_item_name);
    DeviceItem item = mDeviceList.get(position);
    String deviceName = item.getDeviceName();
    deviceItemName.setText(deviceName);

    ImageButton securityProtection =
        (ImageButton) convertView.findViewById(R.id.device_listview_item_securityprotection);
    //		if (item.isSecurityProtectionOpen()) {
    //
    //	securityProtection.setBackgroundResource(R.drawable.device_listview_item_securityprotection_on);
    //		} else {
    //
    //	securityProtection.setBackgroundResource(R.drawable.device_listview_item_securityprotection_off);
    //		}

    if (!item.isUsable()) {
      //			img_device.setBackgroundColor(mContext.getResources().getColor(R.color.menu_drawer_bg));
      securityProtection.setBackgroundResource(
          R.drawable.device_listview_item_securityprotection_off);
    } else {
      //			img_device.setBackgroundColor(R.drawable.list_equipment);
      //			img_device.setBackgroundResource(R.drawable.list_equipment);
      securityProtection.setBackgroundResource(
          R.drawable.device_listview_item_securityprotection_on);
    }

    return convertView;
  }
  public void onClick(View v) {
    if (elements.containsKey(v)) {

      ElementState es = elements.get(v);
      ImageButton tab = (ImageButton) v;
      if (!es.isFocused()) {
        //				tab.setBackgroundResource(es.getFocusedIcon());
        //				es.setFocused(true);
        //				unFocusOtherTab(v);
        Log.e("tab", tab.getId() + "");
        // Right tab get user article
        if (tab.getId() == R.id.my_teams_tab1) {
          pabIndex = 1;
          if (act.getTeamList() == null | act.getTeamList().size() == 0) {
            act.displayNoGamesDialog();
          } else {
            tab.setBackgroundResource(es.getFocusedIcon());
            es.setFocused(true);
            unFocusOtherTab(v);
            act.setGameScore();
          }
        }
        // Left Tab get score
        else if (tab.getId() == R.id.my_teams_tab2) {
          pabIndex = 2;
          tab.setBackgroundResource(es.getFocusedIcon());
          es.setFocused(true);
          unFocusOtherTab(v);
          act.setArticles();
        }
      }
    }
  }
 public void setFollowupButton(boolean enabled) {
   if (followupButton == null) return;
   if (enabled) {
     followupButton.setBackgroundResource(R.drawable.rounded_imagebutton_red);
   } else {
     followupButton.setBackgroundResource(R.drawable.rounded_imagebutton_gray);
   }
 }
Esempio n. 5
0
  private void RecordingNow(Boolean startRecording) {
    if (startRecording == true) {
      bt_audioPlayPause.setEnabled(false);

      isRecording = true;
      bt_recStartStop.setBackgroundResource(R.drawable.bt_stop_enabled);
      bt_audioPlayPause.setBackgroundResource(R.drawable.bt_play_disabled);

      mRecorder = new MediaRecorder();
      mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
      mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
      File audiofile = null;
      File sampleDir = Environment.getExternalStorageDirectory();
      try {
        audiofile = File.createTempFile("elooiaudio", ".mp4", sampleDir);
      } catch (IOException e) {
        // Log.e(TAG,"sdcard access error");
        return;
      }
      mRecorder.setOutputFile(audiofile.getAbsolutePath());
      mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
      try {
        mRecorder.prepare();
      } catch (IOException e) {
        // Log.e(LOG_TAG, "prepare() failed");
      }
      mRecorder.start();
      CountSecond(true, false);

      animateTimer = new Timer();
      animateTimer.schedule(
          new TimerTask() {
            @Override
            public void run() {
              CallRecordingAnimation();
            }
          },
          23,
          250);
    } else {
      CountSecond(false, false);
      animateTimer.cancel();
      resizebitmap = Bitmap.createScaledBitmap(mbmp, 320, 350, true);
      imgv_grayEffect.setImageBitmap(resizebitmap);
      mbmp = null;
      resizebitmap = null;

      mRecorder.stop();
      mRecorder.release();
      mRecorder = null;

      bt_audioPlayPause.setEnabled(true);
      isRecording = false;
      bt_recStartStop.setBackgroundResource(R.drawable.bt_record_enabled);
      bt_audioPlayPause.setBackgroundResource(R.drawable.bt_play_enabled);
    }
  }
 public void updateAlarm() {
   alarmBtn.setBackgroundResource(R.drawable.button_alarm);
   List<Alarm> alarms = getSiteAlarms();
   for (Alarm alarm : alarms) {
     if (alarm.getAlarmSite().equals(site.getSiteName())) {
       alarmBtn.setBackgroundResource(R.drawable.button_alarm_red);
       break;
     }
   }
 }
Esempio n. 7
0
  /** Method to reset the dice locations to nothing so a user can select dice again */
  private void resetDicePics() {
    ImageButton firstRowFirstDice = (ImageButton) findViewById(R.id.firstRowFirstDice);
    ImageButton firstRowSecondDice = (ImageButton) findViewById(R.id.firstRowSecondDice);
    ImageButton secondRowFirstDice = (ImageButton) findViewById(R.id.secondRowFirstDice);
    ImageButton secondRowSecondDice = (ImageButton) findViewById(R.id.secondRowSecondDice);

    firstRowFirstDice.setBackgroundResource(R.drawable.border);
    firstRowSecondDice.setBackgroundResource(R.drawable.border);
    secondRowFirstDice.setBackgroundResource(R.drawable.border);
    secondRowSecondDice.setBackgroundResource(R.drawable.border);
  }
  private void setCustomTitleBar() {
    titleBarTitle = (TextView) this.findViewById(R.id.titlebar_title);
    titleBarTitle.setText("添加好友");

    titleBarBack = (ImageButton) this.findViewById(R.id.titlebar_leftbtn);
    titleBarBack.setOnClickListener((this));
    titleBarBack.setBackgroundResource(R.drawable.selector_hd_ccl);

    titleBarEdit = (ImageButton) this.findViewById(R.id.titlebar_rightbtn1);
    titleBarEdit.setOnClickListener((this));
    titleBarEdit.setBackgroundResource(R.drawable.selector_hd_cmp);
  }
Esempio n. 9
0
  private void setButtonFunction() {
    if (isReward) {
      btn_reward.setEnabled(false);
      btn_reward.setBackgroundResource(R.drawable.btn_post_rewarded_selector);
    } else {
      btn_reward.setBackgroundResource(R.drawable.btn_post_reward_selector);
    }

    if (isCollect) {
      btn_collect.setBackgroundResource(R.drawable.btn_post_collected_selector);
    } else {
      btn_collect.setBackgroundResource(R.drawable.btn_post_collect_selector);
    }
  }
Esempio n. 10
0
  private void imageButtonSound_Clicked() {
    mSoundEnabled = !mSoundEnabled;
    if (mSoundEnabled) {
      imageButtonSound.setBackgroundResource(R.drawable.ic_audio_vol);
    } else {
      imageButtonSound.setBackgroundResource(R.drawable.ic_audio_vol_mute);
    }

    // save to property
    m_SharedPreferences
        .edit()
        .putBoolean("checkBoxPreferencePlayGameSounds", mSoundEnabled)
        .commit();
  }
 public ChattingFooterMoreBtnBar(Context paramContext, AttributeSet paramAttributeSet) {
   super(paramContext, paramAttributeSet);
   setOrientation(0);
   setGravity(16);
   setBackgroundResource(a.h.bottombar_bg);
   int i = getResources().getDimensionPixelSize(a.g.SmallListHeight);
   paramAttributeSet = new LinearLayout.LayoutParams(0, i, 1.0F);
   topMargin = a.fromDPToPix(getContext(), 0);
   iTV = new ImageButton(getContext());
   iTV.setImageResource(a.h.chat_more_tran_btn);
   iTV.setScaleType(ImageView.ScaleType.CENTER);
   iTV.setBackgroundResource(0);
   iTV.setContentDescription(paramContext.getString(a.n.chatting_more_share));
   addView(iTV, paramAttributeSet);
   paramAttributeSet = new LinearLayout.LayoutParams(0, i, 1.0F);
   topMargin = a.fromDPToPix(getContext(), 0);
   iTY = new ImageButton(getContext());
   iTY.setImageResource(a.h.chat_more_fav_btn);
   iTY.setScaleType(ImageView.ScaleType.CENTER);
   iTY.setBackgroundResource(0);
   iTY.setContentDescription(paramContext.getString(a.n.chatting_more_favorite));
   addView(iTY, paramAttributeSet);
   paramAttributeSet = new LinearLayout.LayoutParams(0, i, 1.0F);
   topMargin = a.fromDPToPix(getContext(), 0);
   dii = new ImageButton(getContext());
   dii.setImageResource(a.h.chat_more_del_btn);
   dii.setScaleType(ImageView.ScaleType.CENTER);
   dii.setBackgroundResource(0);
   dii.setContentDescription(paramContext.getString(a.n.chatting_more_delete));
   addView(dii, paramAttributeSet);
   if (au.aOj().size() > 0) {
     paramAttributeSet = new LinearLayout.LayoutParams(0, i, 1.0F);
     topMargin = a.fromDPToPix(getContext(), 0);
     iTX = new ImageButton(getContext());
     iTX.setImageResource(a.h.chat_more_more_btn);
     iTX.setScaleType(ImageView.ScaleType.CENTER);
     iTX.setBackgroundResource(0);
     iTX.setContentDescription(paramContext.getString(a.n.chatting_more));
     addView(iTX, paramAttributeSet);
     return;
   }
   paramAttributeSet = new LinearLayout.LayoutParams(0, i, 1.0F);
   topMargin = a.fromDPToPix(getContext(), 0);
   iTW = new ImageButton(getContext());
   iTW.setImageResource(a.h.chat_more_email_btn);
   iTW.setScaleType(ImageView.ScaleType.CENTER);
   iTW.setBackgroundResource(0);
   iTW.setContentDescription(paramContext.getString(a.n.chatting_more_email));
   addView(iTW, paramAttributeSet);
 }
Esempio n. 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Bundle args = new Bundle();
    args.putParcelable("finder", mStoreFinderParcelable);

    mMap = new MapFragment();
    mMap.setArguments(args);
    mList = new ListFragment();
    mList.setArguments(args);

    mManager = getFragmentManager();
    FragmentTransaction ft = mManager.beginTransaction();
    ft.add(R.id.frame_list, mList);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.commit();
    mFragmentCase = 1;

    mKeywordHolder =
        new KeywordHodler(
            getApplicationContext(), (LinearLayout) findViewById(R.id.tag_holder), this);

    mChangeButton = (ImageButton) findViewById(R.id.change_view_button);
    mChangeButton.setBackgroundResource(R.drawable.button_tomap);
    mChangeButton.setOnClickListener(this);
  }
Esempio n. 13
0
  // 初始化各个组件
  void initView() {
    Video_data = Videos_Input.GetVideoData1(2);
    firstGame_textview = (TextView) findViewById(R.id.firstGame);
    weibokong_textview = (TextView) findViewById(R.id.weibokong);
    gamevideo_textview = (TextView) findViewById(R.id.gamevideo);
    if (Video_data != null) {
      for (int i = 0; i < Video_data.size(); i++) {
        if (Video_data.get(i).getCatid() == 209) {
          firstGame_textview.setText(Video_data.get(i).getCatname());
        } else if (Video_data.get(i).getCatid() == 210) {
          weibokong_textview.setText(Video_data.get(i).getCatname());
        } else if (Video_data.get(i).getCatid() == 211) {
          gamevideo_textview.setText(Video_data.get(i).getCatname());
        }
      }
    }

    bodyView = (LinearLayout) findViewById(R.id.bodyView);
    bodyView.addView(
        (getLocalActivityManager())
            .startActivity("1111", new Intent(Videos_Main.this, Videos_Expanda_FristGame.class))
            .getDecorView());

    news_imageview = (ImageButton) findViewById(R.id.pictures_bib1);
    videos_imageview = (ImageButton) findViewById(R.id.pictures_bib2);
    videos_imageview.setBackgroundResource(R.drawable.news_videos2);
    collects_imageview = (ImageButton) findViewById(R.id.pictures_bib3);
    pictures_imageview = (ImageButton) findViewById(R.id.pictures_bib4);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings_special_list);
    Bundle b = getArguments();
    if (b != null) {
      Log.d(TAG, "id= " + getArguments().getInt("id"));
      final SpecialList specialList = SpecialList.getSpecialList(getArguments().getInt("id") * -1);
      ((SpecialListsSettingsActivity) getActivity()).setSpecialList(specialList);

      ActionBar actionbar = getActivity().getActionBar();
      if (specialList == null) actionbar.setTitle("No list");
      else actionbar.setTitle(specialList.getName());
      if (!MirakelCommonPreferences.isTablet()) {
        ImageButton delList = new ImageButton(getActivity());
        delList.setBackgroundResource(android.R.drawable.ic_menu_delete);
        actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
        actionbar.setCustomView(
            delList,
            new ActionBar.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT,
                Gravity.CENTER_VERTICAL | DefinitionsHelper.GRAVITY_RIGHT));
        delList.setOnClickListener(((ListSettings) getActivity()).getDelOnClickListener());
      }
      try {
        new SpecialListSettings(this, specialList).setup();
      } catch (NoSuchListException e) {
        getActivity().finish();
      }
    } else {
      Log.d(TAG, "bundle null");
    }
  }
Esempio n. 15
0
 /** 暂停/播放 */
 public void showOrHindImage() {
   if (mPlayer.isPlaying()) {
     mPlayer.pause();
     isPause = true;
     controlAnimationShow();
     mPauseCenter.setVisibility(View.VISIBLE);
     mPauseCenter.requestLayout(); // 刷新view
     mPause.setBackgroundResource(R.drawable.mp_ctrl_play_sl);
   } else {
     mPlayer.start();
     isPause = false;
     controlAnimationHide();
     mPauseCenter.setVisibility(View.INVISIBLE);
     mPause.setBackgroundResource(R.drawable.mp_ctrl_pause_sl);
   }
 }
Esempio n. 16
0
  // method: onSigninWithTwitterButtonClicked
  // purpose: on button click signs user in and starts the discover Activity screen
  private void onSigninWithTwitterButtonClicked() {

    twitter.setBackgroundResource(R.drawable.twitterfull);

    /*
            Map<String, String> twitterFieldsMappings = new HashMap<String, String>();
            twitterFieldsMappings.put("name", "twitter_name");


            Backendless.UserService.loginWithTwitter(SignInActivity.this, twitterFieldsMappings, new AsyncCallback<BackendlessUser>() {
                @Override
                public void handleResponse(BackendlessUser backendlessUser) {

                    Log.d("MyApp", "twitter Registered success " + backendlessUser);
                 //   showDiscoverActivity(name);
                }

                @Override
                public void handleFault(BackendlessFault backendlessFault) {

                    Log.d("MyApp", "twitter Registered failed " + backendlessFault);
                    twitter.setBackgroundResource(R.drawable.twitter);
                }
            });

    */

    Context context = getApplicationContext();
    CharSequence text = "Twitter Sign in coming with the next update!";
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
  }
  @OnClick(R.id.imb_content_item_detail_download)
  public void download(View view) {
    if (!isFinishDownload) {
      imb_content_item_detail_download.setBackgroundResource(
          R.drawable.album_detail_download_finish);
      ll_phone_and_download_manager.setVisibility(View.VISIBLE);
    } else {
      imb_content_item_detail_download.setBackgroundResource(R.drawable.album_detail_download);
      ll_phone_and_download_manager.setVisibility(View.GONE);
    }

    isFinishDownload = !isFinishDownload;
    if (onChangeDownloadState != null) {

      onChangeDownloadState.onChange(isFinishDownload);
    }
  }
  private void updateColorOfSettingsButtons() {
    SharedPreferences gameState = getSharedPreferences(GAME_SETTING_PREFS, 0);
    boolean vibrateState = gameState.getBoolean(VIBRATE_PREF, true);
    boolean soundState = gameState.getBoolean(SOUND_PREF, true);

    if (vibrateState) {
      vibrate.setBackgroundResource(R.drawable.btn_green);
    } else {
      vibrate.setBackgroundResource(R.drawable.btn_red);
    }

    if (soundState) {
      sound.setBackgroundResource(R.drawable.btn_green);
    } else {
      sound.setBackgroundResource(R.drawable.btn_red);
    }
  }
Esempio n. 19
0
  @Override
  protected void onResume() {
    super.onResume();

    switch (Video_Tools.Num) {
      case 0:
        firstGame_textview.setBackgroundResource(R.drawable.videos_toppicked);
        firstGame_textview.setTextColor(Color.WHITE);
        weibokong_textview.setBackgroundResource(R.drawable.videos_topunpicked);
        weibokong_textview.setTextColor(Color.BLACK);
        gamevideo_textview.setBackgroundResource(R.drawable.videos_topunpicked1);
        gamevideo_textview.setTextColor(Color.BLACK);
        break;
      case 1:
        /*weibokong_textview.setBackgroundResource(R.drawable.videos_toppicked);
        weibokong_textview.setTextColor(Color.WHITE);
        firstGame_textview.setBackgroundResource(R.drawable.videos_topunpicked);
        firstGame_textview.setTextColor(Color.BLACK);
        gamevideo_textview.setBackgroundResource(R.drawable.videos_topunpicked1);
        gamevideo_textview.setTextColor(Color.BLACK);*/
        break;
      case 2:
        gamevideo_textview.setBackgroundResource(R.drawable.videos_toppicked1);
        gamevideo_textview.setTextColor(Color.WHITE);
        weibokong_textview.setBackgroundResource(R.drawable.videos_topunpicked);
        weibokong_textview.setTextColor(Color.BLACK);
        firstGame_textview.setBackgroundResource(R.drawable.videos_topunpicked);
        firstGame_textview.setTextColor(Color.BLACK);
        break;
    }
    news_imageview.setBackgroundResource(R.drawable.news_news1);
    videos_imageview.setBackgroundResource(R.drawable.news_videos2);
    collects_imageview.setBackgroundResource(R.drawable.news_collects1);
    pictures_imageview.setBackgroundResource(R.drawable.news_pictures1);

    bodyView.removeAllViews();
    bodyView.addView(
        (getLocalActivityManager())
            .startActivity("1111", new Intent(Videos_Main.this, Video.class))
            .getDecorView());
    bodyView.removeAllViews();
    bodyView.addView(
        (getLocalActivityManager())
            .startActivity("1111", new Intent(Videos_Main.this, Videos_Expanda_FristGame.class))
            .getDecorView());
  }
 private void refreshButtonBackground(ImageButton ib, File associatedFile) {
   if (associatedFile.exists()) {
     if (associatedFile.getName().endsWith(".png")) {
       Drawable d = Drawable.createFromPath(associatedFile.getAbsolutePath());
       ib.setBackgroundDrawable(d);
     } else if (associatedFile.getName().endsWith(".3gpp"))
       ib.setBackgroundResource(R.drawable.microphone_blue);
   }
 }
  private void addUniversalButtonLayoutToDialogView(String name, String signal) {
    TextWatcher tw =
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {
            sendChannelDetailsChangedBroadcast(
                getActivity(), null, 0, null, -1, getCurrentUniversalButtons());
          }
        };
    LinearLayout newUniversalButtonLayout = new LinearLayout(getActivity());
    newUniversalButtonLayout.setOrientation(LinearLayout.VERTICAL);

    LinearLayout nameLayout = new LinearLayout(getActivity());
    nameLayout.setOrientation(LinearLayout.HORIZONTAL);

    AppCompatEditText universalButtonNameEditText = new AppCompatEditText(getActivity());
    universalButtonNameEditText.setHint(R.string.name);
    universalButtonNameEditText.setText(name);
    universalButtonNameEditText.addTextChangedListener(tw);

    ImageButton deleteUniversalButton = new ImageButton(getActivity());
    deleteUniversalButton.setBackgroundResource(android.R.color.transparent);
    deleteUniversalButton.setImageResource(android.R.drawable.ic_menu_delete);
    deleteUniversalButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonsList.removeView((View) v.getParent().getParent());
            sendChannelDetailsChangedBroadcast(
                getActivity(), null, 0, null, -1, getCurrentUniversalButtons());
          }
        });

    nameLayout.addView(
        universalButtonNameEditText,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
    nameLayout.addView(deleteUniversalButton);

    AppCompatEditText universalButtonSignalEditText = new AppCompatEditText(getActivity());
    universalButtonSignalEditText.setHint(R.string.enter_network_signal);
    universalButtonSignalEditText.setText(signal);
    universalButtonSignalEditText.addTextChangedListener(tw);

    newUniversalButtonLayout.addView(nameLayout);
    newUniversalButtonLayout.addView(universalButtonSignalEditText);

    buttonsList.addView(newUniversalButtonLayout);
  }
Esempio n. 22
0
  /** 创建直选机选 */
  public void createTable(LinearLayout layout) {
    for (int i = 0; i < balls.size(); i++) {
      final int index = i;
      int iScreenWidth = PublicMethod.getDisplayWidth(this);
      LinearLayout lines = new LinearLayout(layout.getContext());
      for (int j = 0; j < balls.get(i).getVZhuma().size(); j++) {
        String color = (String) balls.get(i).getVColor().get(j);
        TableLayout table;
        if (color.equals("red")) {
          table =
              PublicMethod.makeBallTableJiXuan(
                  null, iScreenWidth, redBallResId, balls.get(i).getBalls(j), this);
        } else {
          table =
              PublicMethod.makeBallTableJiXuan(
                  null, iScreenWidth, blueBallResId, balls.get(i).getBalls(j), this);
        }

        lines.addView(table);
      }
      ImageButton delet = new ImageButton(lines.getContext());
      delet.setBackgroundResource(R.drawable.shanchu);
      delet.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              if (balls.size() > 1) {
                zhumaView.removeAllViews();
                balls.remove(index);
                isOnclik = false;
                jixuanZhu.setSelection(balls.size() - 1);
                createTable(zhumaView);
              } else {
                Toast.makeText(
                        DanshiJiXuan.this,
                        getResources().getText(R.string.zhixuan_jixuan_toast),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            }
          });
      LinearLayout.LayoutParams param =
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
      param.setMargins(10, 5, 0, 0);
      lines.addView(delet, param);
      lines.setGravity(Gravity.CENTER_HORIZONTAL);
      if (i % 2 == 0) {
        lines.setBackgroundResource(R.drawable.jixuan_list_bg);
      }
      lines.setPadding(0, 3, 0, 0);
      layout.addView(lines);
    }
  }
Esempio n. 23
0
  // method: onGooglePlusButtonClicked
  // purpose: on button click signs user in and starts the discover Activity screen
  private void onGooglePlusButtonClicked() {

    google.setBackgroundResource(R.drawable.googleplusfull);

    Context context = getApplicationContext();
    CharSequence text = "Google+ Sign in coming with the next update!";
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
  }
 public void unFocusOtherTab(View stillFocus) {
   Set<Entry<View, ElementState>> s = elements.entrySet();
   for (Entry<View, ElementState> entry : s) {
     View tab = entry.getKey();
     ElementState tabProp = entry.getValue();
     if (tab != stillFocus) {
       ImageButton tabImg = (ImageButton) tab;
       tabImg.setBackgroundResource(tabProp.getNormalIcon());
       tabProp.setFocused(false);
     }
   }
 }
Esempio n. 25
0
  public void onClick(View v) {
    // Fragment入れ替え
    FragmentTransaction ft = mManager.beginTransaction();
    Fragment nowFragment = mManager.findFragmentById(R.id.frame_list);
    if (nowFragment.equals(mMap)) {
      ft.replace(R.id.frame_list, mList);
    } else if (nowFragment.equals(mList)) {
      ft.replace(R.id.frame_list, mMap);
    }
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.addToBackStack(null);
    ft.commit();

    // 画面切替ボタンの画像入れ替え
    if (nowFragment.equals(mMap)) {
      mChangeButton.setBackgroundResource(R.drawable.button_tomap);
      mFragmentCase = 1;
    } else if (nowFragment.equals(mList)) {
      mChangeButton.setBackgroundResource(R.drawable.button_tolist);
      mFragmentCase = 0;
    }
  }
Esempio n. 26
0
 /**
  * Fonction qui affiche au fur et a mesure les clees trouvee
  *
  * @param nb nombre de cle trouvee
  */
 public void keyFoundNumber(int nb) {
   if (nb == 1) {
     keyFound1.setBackgroundResource(R.drawable.keyv);
     // keyFound1.setBackground(this.getResources().getDrawable(R.drawable.keyv));
     keyFound1.setEnabled(false);
   } else if (nb == 2) {
     keyFound2.setBackgroundResource(R.drawable.keyv);
     // keyFound2.setBackground(this.getResources().getDrawable(R.drawable.keyv));
     keyFound2.setEnabled(false);
   } else if (nb == 3) {
     keyFound3.setBackgroundResource(R.drawable.keyv);
     // keyFound3.setBackground(this.getResources().getDrawable(R.drawable.keyv));
     keyFound3.setEnabled(false);
   } else if (nb == 4) {
     keyFound4.setBackgroundResource(R.drawable.keyv);
     // keyFound4.setBackground(this.getResources().getDrawable(R.drawable.keyv));
     keyFound4.setEnabled(false);
   } else if (nb == 5) {
     keyFound5.setBackgroundResource(R.drawable.keyv);
     // keyFound5.setBackground(this.getResources().getDrawable(R.drawable.keyv));
     keyFound5.setEnabled(false);
   }
 }
Esempio n. 27
0
  /////////////////  Transparency bar /////////////////////////
  private void initTransparencyBar(final OsmandMapTileView view, FrameLayout parent) {
    int minimumHeight = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumHeight();
    android.widget.FrameLayout.LayoutParams params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER);
    params.setMargins(0, 0, 0, minimumHeight + 3);
    transparencyBarLayout = new LinearLayout(view.getContext());
    transparencyBarLayout.setVisibility(settingsToTransparency != null ? View.VISIBLE : View.GONE);
    parent.addView(transparencyBarLayout, params);

    transparencyBar = new SeekBar(view.getContext());
    transparencyBar.setMax(255);
    if (settingsToTransparency != null) {
      transparencyBar.setProgress(settingsToTransparency.get());
    }
    transparencyBar.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (settingsToTransparency != null) {
              settingsToTransparency.set(progress);
              mapActivity.getMapView().refreshMap();
            }
          }
        });
    android.widget.LinearLayout.LayoutParams prms =
        new LinearLayout.LayoutParams((int) (scaleCoefficient * 100), LayoutParams.WRAP_CONTENT);
    transparencyBarLayout.addView(transparencyBar, prms);
    ImageButton imageButton = new ImageButton(view.getContext());
    prms = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    prms.setMargins((int) (2 * scaleCoefficient), (int) (2 * scaleCoefficient), 0, 0);
    imageButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            transparencyBarLayout.setVisibility(View.GONE);
            hideTransparencyBar(settingsToTransparency);
          }
        });
    imageButton.setContentDescription(view.getContext().getString(R.string.close));
    imageButton.setBackgroundResource(R.drawable.headliner_close);
    transparencyBarLayout.addView(imageButton, prms);
  }
Esempio n. 28
0
  // method: onSigninWithFacebookButtonClicked
  // purpose: on button click signs user in and starts the discover Activity screen
  private void onSigninWithFacebookButtonClicked() {

    // purpose:If clicked change icon
    facebook.setBackgroundResource(R.drawable.facebookfull);

    // purpose: provide mapping between facebook and backendless fields
    Map<String, String> facebookFieldMappings = new HashMap<String, String>();
    facebookFieldMappings.put("email", "fb_email");

    List<String> permissions = new ArrayList<String>();
    permissions.add("public_profile");
    permissions.add("email");

    Backendless.UserService.loginWithFacebookSdk(
        SignInActivity.this,
        facebookFieldMappings,
        permissions,
        callbackManager,
        new AsyncCallback<BackendlessUser>() {

          @Override
          public void handleResponse(BackendlessUser loggedInUser) {

            Log.d("MyApp", "Registered on fb " + loggedInUser);

            Profile profile = Profile.getCurrentProfile();
            String name = profile.getName();
            showDiscoverActivity(name);
          }

          @Override
          public void handleFault(BackendlessFault fault) {

            Log.d("MyApp", "fb Registered failed " + fault);

            if (fault.toString().contains("3033")) {

              Log.d("MyApp", "Already registered: Proceed");
              Profile profile = Profile.getCurrentProfile();
              String name = profile.getName();
              showDiscoverActivity(name);
            } else {
              facebook.setBackgroundResource(R.drawable.facebook);
            }
          }
        });
  }
Esempio n. 29
0
  private void setupHeader(View view) {
    View addAccountFrame = ((ViewStub) view.findViewById(R.id.addAccountStub)).inflate();
    ((ImageView) addAccountFrame.findViewById(R.id.icon))
        .getDrawable()
        .mutate()
        .setColorFilter(mRegularColor, PorterDuff.Mode.SRC_ATOP);

    mAccountsFrame = (LinearLayout) view.findViewById(R.id.accountsFrame);
    mAccountsFrame
        .findViewById(R.id.addAccountFrame)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                showAccountAddDialog();
              }
            });
    ImageButton dropdown = (ImageButton) view.findViewById(R.id.dropdown);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
      dropdown.setBackgroundResource(Utils.resolveDrawable(getActivity(), R.attr.menu_selector));
    dropdown.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (v.getTag() == null) {
              ((ImageButton) v).setImageResource(R.drawable.ic_uparrow);
              v.setTag("GOUP");
              View root = getView();
              if (root != null) {
                ((TextView) root.findViewById(R.id.accountHeader)).setText(R.string.accounts);
                root.findViewById(R.id.accountsFrame).setVisibility(View.VISIBLE);
                root.findViewById(R.id.list).setVisibility(View.GONE);
              }
            } else {
              ((ImageButton) v).setImageResource(R.drawable.ic_downarrow);
              v.setTag(null);
              View root = getView();
              if (root != null) {
                ((TextView) root.findViewById(R.id.accountHeader)).setText(R.string.local);
                root.findViewById(R.id.accountsFrame).setVisibility(View.GONE);
                root.findViewById(R.id.list).setVisibility(View.VISIBLE);
              }
            }
          }
        });
  }
 private void addBackButton() {
   mBackButton = new ImageButton(mContext);
   mBackButton.setImageResource(R.drawable.ic_back_hierarchy_holo_dark);
   TypedValue outValue = new TypedValue();
   getContext()
       .getTheme()
       .resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
   int resid = outValue.resourceId;
   mBackButton.setBackgroundResource(resid);
   mBackButton.setLayoutParams(
       new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
   mBackButton.setOnClickListener(this);
   mBackButton.setVisibility(View.GONE);
   mBackButton.setContentDescription(
       mContext.getText(R.string.accessibility_button_bookmarks_folder_up));
   addView(mBackButton, 0);
 }