コード例 #1
0
  @Override
  public void onClick(View view) {
    if (view == modelsTextView) {
      view.setSelected(!view.isSelected());
      if (view.isSelected() && opacityTextView.isSelected()) {
        opacityTextView.setSelected(false);
      }
      if (actionsListener != null) {
        actionsListener.onModelsClicked(view.isSelected());
      }

    } else if (view == opacityTextView) {
      view.setSelected(!view.isSelected());
      if (view.isSelected() && modelsTextView.isSelected()) {
        modelsTextView.setSelected(false);
      }
      if (actionsListener != null) {
        actionsListener.onOpacityClicked(view.isSelected());
      }

    } else if (view == moveModeView) {
      moveModeView.toNextState();
      if (actionsListener != null) {
        actionsListener.onMoveModeClicked(moveModeView.getState());
      }

    } else if (view == cancelView) {
      modelsTextView.setSelected(false);
      opacityTextView.setSelected(false);
      setVisibility(GONE);
      if (actionsListener != null) {
        actionsListener.onCancelClicked();
      }
    }
  }
コード例 #2
0
  public void setSelected(int pos, boolean isSelected) {
    if (pos >= mData.size()) {
      return;
    }

    if (isSelected) {
      if (mSelPos == pos) {
        return;
      }
      if (mSelectedItem != null) {
        mSelectedItem.setSelected(false);
      }
      mSelectedItem = getItemViewAtPos(pos);
      if (mSelectedItem != null) {
        mSelectedItem.setSelected(true);
        mSelPos = pos;
      }
    } else {
      if (mSelPos != pos) {
        return;
      }
      if (mSelectedItem != null) {
        mSelectedItem.setSelected(false);
        mSelectedItem = null;
        mSelPos = -1;
      }
    }
  }
コード例 #3
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (v == null) {
      LayoutInflater vi =
          (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = vi.inflate(mListItemLayoutId, null);
    }

    ImageView image = (ImageView) v.findViewById(R.id.icon);
    TextView text = (TextView) v.findViewById(R.id.text1);

    RWListItem q = getItem(position);
    if (q != null) {
      if (text != null) {
        text.setText(q.getText());
      }
    }

    if (q.isOn()) {
      image.setSelected(true);
      text.setSelected(true);
    } else {
      image.setSelected(false);
      text.setSelected(false);
    }

    return v;
  }
  private void initView() {
    backBtn = (Button) this.findViewById(R.id.backBtn);
    backBtn.setOnClickListener(this);

    itemDescriptionTextView = (TextView) this.findViewById(R.id.itemDescriptionTextView);
    itemDescriptionTextView.setSelected(true);
    itemDescriptionTextView.setOnClickListener(this);

    claimsTextView = (TextView) this.findViewById(R.id.claimsTextView);
    claimsTextView.setSelected(false);
    claimsTextView.setOnClickListener(this);

    contentLayout = (LinearLayout) this.findViewById(R.id.contentLayout);

    itemDescOfTransferView = new ItemDescOfTransferView(this);
    itemDescOfTransferView.setVisibility(View.VISIBLE);

    claimsview = new ClaimsView(this);
    claimsview.setVisibility(View.GONE);

    contentLayout.addView(
        itemDescOfTransferView,
        new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    contentLayout.addView(
        claimsview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  }
コード例 #5
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_onboarding_time_format, container, false);

    view.findViewById(R.id.prev).setOnClickListener(this);
    TextView next = (TextView) view.findViewById(R.id.next);
    next.setOnClickListener(this);
    next.setText(R.string.button_done);

    TextView title = (TextView) view.findViewById(R.id.card_title);
    title.setText(R.string.time_title);

    m12h = (TextView) view.findViewById(R.id.twelve);
    m24h = (TextView) view.findViewById(R.id.twenty_four);
    m12h.setOnClickListener(this);
    m24h.setOnClickListener(this);

    int method = AppSettings.getInstance(getActivity()).getTimeFormatFor(mParam1);
    if (method == PrayTime.TIME_12) {
      m12h.setSelected(true);
    } else {
      m24h.setSelected(true);
    }

    return view;
  }
コード例 #6
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater mInflater = (LayoutInflater) ((Activity) context).getLayoutInflater();
      final int index = position;
      TextView tv = null;
      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.list_videotype_item, null);
        tv = (TextView) convertView.findViewById(R.id.ItemVideo);
        // courseBeans[position].textView = tv;
        convertView.setTag(tv);
      } else {
        tv = (TextView) convertView.getTag();
      }
      tv.setText(courseString.get(position));
      // convertView.setPadding(0, 15, 0, 15);
      // Log.i("getView", "+++ postion" + selectedPosition);
      if (selectedPosition == index) {
        tv.setSelected(true);
        tv.setPressed(true);
      } else {
        tv.setSelected(false);
        tv.setPressed(false);
      }

      return convertView;
    }
コード例 #7
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View rootView = null;
    if (Util.getIsTabletFlag(getActivity())) {
      Log.e(TAG, "Device is Tablet...");
      getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
      rootView = inflater.inflate(R.layout.eventdetails_overview_tablet, container, false);
      bIsTablet = true;
    } else {
      Log.e(TAG, "Device is Phone...");
      rootView = inflater.inflate(R.layout.eventdetails_overview, container, false);
      getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      bIsTablet = false;
    }

    img_imagedetls = (ImageView) rootView.findViewById(R.id.img_imagedetls);
    txt_eventname = (TextView) rootView.findViewById(R.id.eventname);
    txt_eventvenue = (TextView) rootView.findViewById(R.id.eventvenue);
    txt_eventdate = (TextView) rootView.findViewById(R.id.eventdate);
    txt_eventdetails = (TextView) rootView.findViewById(R.id.txt_eventdetails);

    rlCalender = (RelativeLayout) rootView.findViewById(R.id.rlCalender);

    tvCalender = (TextView) rootView.findViewById(R.id.tvCalender);
    ivCalenderEvent = (ImageView) rootView.findViewById(R.id.ivCalenderEvent);

    txt_eventname.setSelected(true);
    txt_eventvenue.setSelected(true);

    rlCalender.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            if (tvCalender.getText().toString().contains("I'M GOING")) {
              // if (((Button)
              // arg0).getText().toString().contains("I'M GOING")) {
              LLDCApplication.onShowToastMesssage(getActivity(), "Event already added...");
            } else {
              long startDate =
                  Long.parseLong(LLDCApplication.selectedModel.getStartDateTime() + "000");
              long endDate = Long.parseLong(LLDCApplication.selectedModel.getEndDateTime() + "000");
              long currDate = Calendar.getInstance().getTimeInMillis();
              if (currDate < endDate) {
                // onOpenAddCalEventDialog();
                onAddCalendarIntent();
              } else {
                LLDCApplication.onShowToastMesssage(getActivity(), "Can't add past events...");
              }
            }
          }
        });
    onGetDataFromDB();

    return rootView;
  }
コード例 #8
0
 /**
  * 设置标题数据
  *
  * @param postion
  */
 private void changeTitleState(int postion) {
   // 改变标题颜色状态
   switch (postion) {
     case 0:
       tvTest.setSelected(true);
       tvGirl.setSelected(false);
       tvAnswer.setSelected(false);
       viewpaer.setCurrentItem(0);
       break;
     case 1:
       tvTest.setSelected(false);
       tvGirl.setSelected(true);
       tvAnswer.setSelected(false);
       viewpaer.setCurrentItem(1);
       break;
     case 2:
       tvTest.setSelected(false);
       tvGirl.setSelected(false);
       tvAnswer.setSelected(true);
       viewpaer.setCurrentItem(2);
       break;
     default:
       break;
   }
   // 缩放标题
 }
コード例 #9
0
  private void setTabSelectState() {
    switch (tabIndex) {
      case 0:
        title.setText("下拉刷新");
        txt1.setSelected(true);
        txt2.setSelected(false);
        txt3.setSelected(false);

        img1.setSelected(true);
        img2.setSelected(false);
        img3.setSelected(false);
        break;
      case 1:
        title.setText("双列下拉刷新");
        txt1.setSelected(false);
        txt2.setSelected(true);
        txt3.setSelected(false);

        img1.setSelected(false);
        img2.setSelected(true);
        img3.setSelected(false);
        break;
      case 2:
        title.setText("瀑布流下拉刷新");
        txt1.setSelected(false);
        txt2.setSelected(false);
        txt3.setSelected(true);

        img1.setSelected(false);
        img2.setSelected(false);
        img3.setSelected(true);
        break;
    }
  }
コード例 #10
0
 private void hideOrDisplayAudioRoutes() {
   if (routeSpeaker.getVisibility() == View.VISIBLE) {
     routeSpeaker.setVisibility(View.GONE);
     routeBluetooth.setVisibility(View.GONE);
     routeReceiver.setVisibility(View.GONE);
     audioRoute.setSelected(false);
   } else {
     routeSpeaker.setVisibility(View.VISIBLE);
     routeBluetooth.setVisibility(View.VISIBLE);
     routeReceiver.setVisibility(View.VISIBLE);
     audioRoute.setSelected(true);
   }
 }
コード例 #11
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case HANDLE_ANIM:
       TextView name = (TextView) mHeaderView.findViewById(R.id.poi_details_name);
       TextView address_line1 =
           (TextView) mHeaderView.findViewById(R.id.poi_details_address_line1);
       TextView address_line2 =
           (TextView) mHeaderView.findViewById(R.id.poi_details_address_line2);
       name.setSelected(true);
       address_line1.setSelected(true);
       address_line2.setSelected(true);
       break;
   }
 }
コード例 #12
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View return_view = null;

    return_view = _inflater.inflate(R.layout.album_view_item, null);

    ImageView cover = (ImageView) return_view.findViewById(R.id.album_view_item_cover);
    TextView name = (TextView) return_view.findViewById(R.id.album_view_name);

    try {
      if (_albums.get(position) != null) {
        if (_albums.get(position).isLocked() && !_albums.get(position).getPassword().equals("")) {
          cover.setImageResource(R.drawable.album_cover_locked);
        } else {
          cover.setImageResource(R.drawable.album_cover_default);
        }

        name.setText(_albums.get(position).getAlbumName());
        name.setEllipsize(TruncateAt.MARQUEE);
        name.setMarqueeRepeatLimit(-1);
        name.setSelected(true);
      }
    } catch (Exception e) {
    }

    return_view.startAnimation(AnimationUtils.loadAnimation(_activity, android.R.anim.fade_in));
    return return_view;
  }
コード例 #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ButterKnife.bind(this);
    mContext = this;
    mUrl = getIntent().getStringExtra(EXTRA_URL);
    mTitle = getIntent().getStringExtra(EXTRA_TITLE);

    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setLoadWithOverviewMode(true);
    settings.setAppCacheEnabled(true);
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    settings.setSupportZoom(true);
    mWebView.setWebChromeClient(new ChromeClient());
    mWebView.setWebViewClient(new LoveClient());

    mWebView.loadUrl(mUrl);

    mTextSwitcher.setFactory(
        () -> {
          TextView textView = new TextView(this);
          textView.setTextAppearance(this, R.style.WebTitle);
          textView.setSingleLine(true);
          textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
          textView.postDelayed(() -> textView.setSelected(true), 1738);
          return textView;
        });
    mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
    mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    if (mTitle != null) setTitle(mTitle);
  }
コード例 #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    // ActionView_Intent.TabFlag = true;

    setContentView(R.layout.listview_5);

    lv = (ListView) findViewById(R.id.ListView02);
    tv = (TextView) findViewById(R.id.TextView05);
    tv.setSelected(true);
    Tab4Adapter sa = new Tab4Adapter(this, title, contents);

    lv.setAdapter(sa);

    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            dc = new DialogCommon(Tab5.this);
            dc.DiaMove(title[arg2], 2, arg2);
            // TODO Auto-generated method stub

            // Toast.makeText(Tab5.this, title[arg2], 0).show();
          }
        });
  }
コード例 #15
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.flash_screen);
   TextView tvwelcome = (TextView) findViewById(R.id.textView2);
   TextView tv = (TextView) findViewById(R.id.tv_header);
   tv.setSelected(true);
   Typeface tf = Typeface.createFromAsset(getAssets(), "Zawgyi One.ttf");
   tvwelcome.setTypeface(tf);
   mp = MediaPlayer.create(getApplicationContext(), R.raw.aa);
   mp.start();
   Thread td =
       new Thread(
           new Runnable() {
             @Override
             public void run() {
               try {
                 Thread.sleep(5000);
               } catch (InterruptedException e) {
                 e.printStackTrace();
               } finally {
                 mp.pause();
                 startActivity(new Intent(FlashActivity.this, Main.class));
               }
             }
           });
   td.start();
 }
コード例 #16
0
  /**
   * onCreate之后调用,可以用来初始化view
   *
   * @param savedInstanceState the saved instance state
   */
  @Override
  public final void onCreateAfter(Bundle savedInstanceState) {
    parseIntent();

    enableJavascript();
    enableCaching();
    enableClient();
    enableAdjust();
    zoomedOut();
    // 网页标题
    mTextSwitcher.setFactory(
        () -> {
          TextView textView = new TextView(this);
          textView.setTextAppearance(this, R.style.WebTitle);
          textView.setSingleLine(true);
          textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
          textView.postDelayed(() -> textView.setSelected(true), 1738);
          return textView;
        });
    mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
    mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    if (title != null) setTitle(title);

    if (mProgressBar != null)
      mProgressBar.setReachedBarColor(BaseApplication.color(R.color.colorPrimary));

    // 设置滑动监听
    mWebView.setOnScrollChangedCallback(
        (dx, dy, x, y) -> { // 滑动监听
        });

    onCreateAfterLater();
  }
コード例 #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    effect = (TextView) findViewById(R.id.effect);
    effect.setSelected(true);
    initial_temp = (Spinner) findViewById(R.id.type);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            MainActivity.this, R.array.temp, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    initial_temp.setAdapter(adapter);

    conv_to = (Spinner) findViewById(R.id.conv_to);
    conv_to.setAdapter(adapter);
    tv = (TextView) findViewById(R.id.tv);
    btn = (Button) findViewById(R.id.avanti);
    value = (EditText) findViewById(R.id.value);
    btn.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            convertTemp();
          }
        });
  }
コード例 #18
0
ファイル: PlayActivity.java プロジェクト: phongbm/Music
  private void initializeComponent() {
    imgPlay = (ImageView) findViewById(R.id.imgPlay);
    imgPlay.setOnClickListener(PlayActivity.this);
    imgSpeaker = (ImageView) findViewById(R.id.imgSpeaker);
    imgSpeaker.setOnClickListener(PlayActivity.this);
    txtCurrenDuration = (TextView) findViewById(R.id.txtCurrentDuration);
    txtTotalDuration = (TextView) findViewById(R.id.txtTotalDuration);
    txtSongTitle = (TextView) findViewById(R.id.txtSongTitle);
    txtSongTitle.setSelected(true);
    txtArtist = (TextView) findViewById(R.id.txtArtist);
    seekBar = (SeekBar) findViewById(R.id.seekBar);
    seekBar.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
              if (isPlaying) {
                mediaPlayer.seekTo(progress * 1000);
              }
            }
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });
  }
コード例 #19
0
  public FolderPicker(Context context, OnClickListener listener, int themeId, boolean acceptFiles) {
    super(context, themeId);
    mListener = listener;
    mAcceptFiles = acceptFiles;
    setTitle(acceptFiles ? R.string.pick_file : R.string.pick_folder);
    setContentView(R.layout.folders);

    mRootSDCard = Environment.getExternalStorageDirectory();

    mOkButton = findViewById(R.id.ok_btn);
    mOkButton.setOnClickListener(this);
    findViewById(R.id.cancel_btn).setOnClickListener(this);
    mCurrentFolder = (TextView) findViewById(R.id.current_folder);
    mCurrentFolder.setSelected(true);
    mFolders = (ListView) findViewById(R.id.folders);
    mFolders.setOnItemClickListener(this);

    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(250);
    LayoutAnimationController controller = new LayoutAnimationController(animation);
    mFolders.setLayoutAnimation(controller);

    mAdapter = new FolderAdapter();
    mFolders.setAdapter(mAdapter);
    mPath = new Folder(mRootSDCard.getAbsolutePath());
    updateAdapter();
  }
コード例 #20
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;

    if (convertView == null) v = inflater.inflate(R.layout.sem_details_listrow, null);

    semSubName = (TextView) v.findViewById(R.id.semSubName);
    semSubName.setSelected(true);
    semCCode = (TextView) v.findViewById(R.id.semCCode);
    semSubCredits = (TextView) v.findViewById(R.id.semSubCredits);
    semSubGrade = (TextView) v.findViewById(R.id.semSubGrade);

    HashMap<String, String> row = new HashMap<String, String>();

    row = adapterkeylist.get(position);

    temp = row.get("sub");
    temp = StringEscapeUtils.unescapeHtml4(temp);

    semSubName.setText(temp);
    semCCode.setText("Subject Code: " + row.get("subcode"));
    semSubCredits.setText("Subject Credits: " + row.get("credits"));
    semSubGrade.setText("Subject Grade: " + row.get("grade"));

    return v;
  }
コード例 #21
0
  /** 初始化Column栏目项 */
  private void initTabColumn() {
    mRadioGroup_content.removeAllViews();

    if (mUserChannelList != null) {
      int count = mUserChannelList.size();
      mColumnHorizontalScrollView.setParam(
          getActivity(),
          mScreenWidth,
          mRadioGroup_content,
          mShadeleft,
          mShaderight,
          ll_more_columns,
          rl_column);
      for (int i = 0; i < count; i++) {
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.leftMargin = 5;
        params.rightMargin = 5;
        //			TextView localTextView = (TextView) mInflater.inflate(R.layout.column_radio_item,
        // null);
        TextView columnTextView = new TextView(getActivity());
        columnTextView.setTextAppearance(getActivity(), R.style.top_category_scroll_view_item_text);
        //
        //	localTextView.setBackground(getResources().getDrawable(R.drawable.top_category_scroll_text_view_bg));
        columnTextView.setBackgroundResource(R.drawable.radio_buttong_bg);
        columnTextView.setGravity(Gravity.CENTER);
        columnTextView.setPadding(5, 5, 5, 5);
        columnTextView.setId(i);
        columnTextView.setText(mUserChannelList.get(i).getName());
        columnTextView.setTextColor(
            getResources().getColorStateList(R.color.top_category_scroll_text_color_day));
        if (columnSelectIndex == i) {
          columnTextView.setSelected(true);
        }
        columnTextView.setOnClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                for (int i = 0; i < mRadioGroup_content.getChildCount(); i++) {
                  View localView = mRadioGroup_content.getChildAt(i);
                  if (localView != v) localView.setSelected(false);
                  else {
                    localView.setSelected(true);
                    mViewPager.setCurrentItem(i);
                  }
                }
                Toast.makeText(
                        getActivity().getApplicationContext(),
                        mUserChannelList.get(v.getId()).getName(),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            });
        mRadioGroup_content.addView(columnTextView, i, params);
      }
    }
  }
コード例 #22
0
  private void setCurrentView(final int viewIndex) {
    long millis = mCalendar.getTimeInMillis();

    switch (viewIndex) {
      case MONTH_AND_DAY_VIEW:
        ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mMonthAndDayView, 0.9f, 1.05f);
        if (mDelayAnimation) {
          pulseAnimator.setStartDelay(ANIMATION_DELAY);
          mDelayAnimation = false;
        }
        mDayPickerView.onDateChanged();
        if (mCurrentView != viewIndex) {
          mMonthAndDayView.setSelected(true);
          mYearView.setSelected(false);
          mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
          mCurrentView = viewIndex;
        }
        pulseAnimator.start();

        int flags = DateUtils.FORMAT_SHOW_DATE;
        String dayString = DateUtils.formatDateTime(getActivity(), millis, flags);
        mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString);
        Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay);
        break;
      case YEAR_VIEW:
        pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f);
        if (mDelayAnimation) {
          pulseAnimator.setStartDelay(ANIMATION_DELAY);
          mDelayAnimation = false;
        }
        mYearPickerView.onDateChanged();
        if (mCurrentView != viewIndex) {
          mMonthAndDayView.setSelected(false);
          mYearView.setSelected(true);
          mAnimator.setDisplayedChild(YEAR_VIEW);
          mCurrentView = viewIndex;
        }
        pulseAnimator.start();

        CharSequence yearString = YEAR_FORMAT.format(millis);
        mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString);
        Utils.tryAccessibilityAnnounce(mAnimator, mSelectYear);
        break;
    }
  }
コード例 #23
0
ファイル: Util.java プロジェクト: jeanbo-1990/xmkp
 /**
  * Set the alignment mode of the specified TextView with the desired align mode from preferences.
  *
  * <p>See @array/audio_title_alignment_values
  *
  * @param alignMode Align mode as read from preferences
  * @param t Reference to the textview
  */
 public static void setAlignModeByPref(int alignMode, TextView t) {
   if (alignMode == 1) t.setEllipsize(TruncateAt.END);
   else if (alignMode == 2) t.setEllipsize(TruncateAt.START);
   else if (alignMode == 3) {
     t.setEllipsize(TruncateAt.MARQUEE);
     t.setMarqueeRepeatLimit(-1);
     t.setSelected(true);
   }
 }
コード例 #24
0
 @Override
 public void setChecked(boolean checked) {
   if (checked) {
     mSelectImageIconView.setVisibility(View.VISIBLE);
   } else {
     mSelectImageIconView.setVisibility(View.INVISIBLE);
   }
   mTextView.setSelected(checked);
 }
コード例 #25
0
 protected Void doInBackground() {
   player = MediaPlayer.create(this, R.raw.banjo_hb);
   player.setLooping(true);
   player.setVolume(100, 100);
   player.start();
   tv.setSelected(true);
   isPLaying = true;
   return null;
 }
コード例 #26
0
 @Override
 public void onClick(View v) {
   AppSettings settings = AppSettings.getInstance(getActivity());
   if (v.getId() == R.id.next) {
     mListener.onOptionSelected();
   } else if (v.getId() == R.id.prev) {
     getActivity().onBackPressed();
   } else if (v.getId() == m12h.getId()) {
     m12h.setSelected(true);
     m24h.setSelected(false);
     settings.setTimeFormatFor(mParam1, PrayTime.TIME_12);
     mListener.onOptionSelected();
   } else if (v.getId() == m24h.getId()) {
     m12h.setSelected(false);
     m24h.setSelected(true);
     settings.setTimeFormatFor(mParam1, PrayTime.TIME_24);
     mListener.onOptionSelected();
   }
 }
コード例 #27
0
  // Set place data on views and set place location on the map
  public void setData(final Place place) {
    txtPlaceName.setText(place.getName());
    txtPlaceName.setSelected(true);
    txtPlaceAddress.setText(place.getAddress());
    if (place.getPhone() == null) {
      txtPlacePhone.setText("Phone not available");
    } else {
      txtPlacePhone.setText(place.getPhone());

      // On txtPlacePhone clicked, call the place
      txtPlacePhone.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent dialIntent = new Intent();
              String phone = txtPlacePhone.getText().toString();
              phone = phone.replace("-", "");
              dialIntent.setAction(Intent.ACTION_CALL);
              dialIntent.setData(Uri.parse("tel:" + phone));
              startActivity(dialIntent);
            }
          });

      HelpMethods.makeTextViewHyperlink(txtPlacePhone);
    }

    if (place.getWeb() == null) txtPlaceWeb.setText("Website not available");
    else {
      txtPlaceWeb.setText(place.getWeb());
    }

    // On btnWaze clicked, set address on waze
    btnWaze.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            try {
              String url = "waze://?q=" + place.getAddress();
              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
              startActivity(intent);
            } catch (ActivityNotFoundException ex) {
              Intent intent =
                  new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.waze"));
              startActivity(intent);
            }
          }
        });

    // Set place location on map
    mMap.animateCamera(
        CameraUpdateFactory.newLatLngZoom(new LatLng(place.getLat(), place.getLon()), 17));
    mMap.addMarker(
        new MarkerOptions().position(new LatLng(place.getLat(), place.getLon())).title("Target"));
  }
コード例 #28
0
  private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    if (position == 0) tab.setSelected(true);

    addTab(position, tab);
  }
コード例 #29
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    RelativeLayout layoutItem;

    if (convertView == null) {
      layoutItem = (RelativeLayout) inflater.inflate(R.layout.view_book, parent, false);
    } else {
      layoutItem = (RelativeLayout) convertView;
    }

    // Get the fields
    ImageView bookImage = (ImageView) layoutItem.findViewById(R.id.book_image);
    TextView bookName = (TextView) layoutItem.findViewById(R.id.book_name);
    TextView bookGenre = (TextView) layoutItem.findViewById(R.id.book_genre);
    TextView bookPages = (TextView) layoutItem.findViewById(R.id.book_pages);
    RatingBar bookRatings = (RatingBar) layoutItem.findViewById(R.id.book_ratings);

    // Fills it
    IApiBook book = listBook.get(position);

    // Load image with Picasso : http://square.github.io/picasso/
    Picasso.with(context).load(book.getImagePath()).into(bookImage);

    bookName.setText(book.getName());
    bookName.setSelected(true); // For the auto scroll
    bookGenre.setText(book.getGenre());
    bookGenre.setSelected(true); // For the auto scroll

    int pages = book.getPages();
    if (pages > 0) {
      bookPages.setText(String.format(context.getString(R.string.book_pages), pages));
    }

    double rating = book.getRatings();
    if (rating > 0) {
      bookRatings.setRating((float) rating);
    }

    return layoutItem;
  }
コード例 #30
0
    @Override
    public void onPageSelected(int position) {
      if (delegatePageListener != null) {
        delegatePageListener.onPageSelected(position);
      }

      if (position < tabCount) {
        for (int i = 0; i < tabCount; i++) {
          View v = tabsContainer.getChildAt(i);
          if (v instanceof TextView) {
            TextView tab = (TextView) v;
            if (i == position) tab.setSelected(true);
            else tab.setSelected(false);
          } else if (v instanceof CustomTabView) {
            CustomTabView tab = (CustomTabView) v;
            if (i == position) tab.getTabItemTxt().setSelected(true);
            else tab.getTabItemTxt().setSelected(false);
          }
        }
      }
    }