예제 #1
0
 public void onClick(View v) {
   main_bottom_layout1.setSelected(false);
   main_bottom_layout2.setSelected(false);
   main_bottom_layout3.setSelected(true);
   main_bottom_layout4.setSelected(false);
   Intent intent = new Intent();
   intent.setClass(UserInfo.this, VisionActivity.class);
   intent.putExtra("clickble", true);
   startActivity(intent);
   main_bottom_layout3.setSelected(false);
   UserInfo.this.finish();
 }
예제 #2
0
 public void onClick(View v) {
   main_bottom_layout1.setSelected(false);
   main_bottom_layout2.setSelected(false);
   main_bottom_layout3.setSelected(false);
   main_bottom_layout4.setSelected(true);
   Intent intent = new Intent();
   intent.setClass(UserInfo.this, SinaWeiboWebView.class);
   intent.putExtra("clickble", true);
   startActivity(intent);
   overridePendingTransition(R.anim.fade, R.anim.fade);
   main_bottom_layout4.setSelected(false);
   UserInfo.this.finish();
 }
예제 #3
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.user_info);
   user_info_name = (TextView) findViewById(R.id.user_info_name);
   user_info_sex = (TextView) findViewById(R.id.user_info_sex);
   user_info_registertime = (TextView) findViewById(R.id.user_info_registertime);
   user_info_marry = (TextView) findViewById(R.id.user_info_marry);
   user_info_hobby = (TextView) findViewById(R.id.user_info_hobby);
   user_info_address = (TextView) findViewById(R.id.user_info_address);
   user_info_email = (TextView) findViewById(R.id.user_info_email);
   Logout = (Button) findViewById(R.id.Logout);
   Logout.setOnClickListener(logoutOnClickListener);
   initData();
   // 判断底部导航条是否被触按
   boolean clickble = getIntent().getBooleanExtra("clickble", true);
   // 首页底部导航条
   main_bottom_layout1 = (LinearLayout) findViewById(R.id.main_bottom_layout1_ly);
   main_bottom_layout1.setOnClickListener(clickListener_layout1);
   main_bottom_layout2 = (LinearLayout) findViewById(R.id.main_bottom_layout2_ly);
   main_bottom_layout2.setOnClickListener(clickListener_layout2);
   main_bottom_layout2.setSelected(clickble);
   main_bottom_layout3 = (LinearLayout) findViewById(R.id.main_bottom_layout3_ly);
   main_bottom_layout3.setOnClickListener(clickListener_layout3);
   main_bottom_layout4 = (LinearLayout) findViewById(R.id.main_bottom_layout4_ly);
   main_bottom_layout4.setOnClickListener(clickListener_layout4);
 }
  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;
    }
  }
  private void setCurrentView() {
    long millis = mCalendar.getTimeInMillis();

    ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mMonthAndDayView, 0.9f, 1.05f);
    if (mDelayAnimation) {
      pulseAnimator.setStartDelay(ANIMATION_DELAY);
      mDelayAnimation = false;
    }
    mDayPickerView.onDateChanged();
    mMonthAndDayView.setSelected(true);

    pulseAnimator.start();

    int flags = DateUtils.FORMAT_SHOW_DATE;
    String dayString = DateUtils.formatDateTime(getActivity(), millis, flags);
    mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString);
    Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay);
  }
예제 #6
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mAPi = new MovieApi(getActivity());

    // Get movie passed in from activity
    Intent intent = getActivity().getIntent();
    if (intent != null) {
      mMovie = intent.getParcelableExtra(ActivityDetail.TAG_MOVIE_OBJECT);
    }

    // Get trailers
    ArgsAsyncTrailers args = new ArgsAsyncTrailers();
    args.setContext(getActivity());
    args.setMovieId(mMovie.id);
    AsyncGetMovieTrailers asyncT = new AsyncGetMovieTrailers(FragmentDetail.this);
    asyncT.execute(args);

    // Get reviews
    AsyncGetMovieReviews asyncR = new AsyncGetMovieReviews(FragmentDetail.this);
    asyncR.execute(args);

    // Toggle making movie a favourite
    mFavourites.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mMovie != null) {
              if (!isFavourite()) {
                // Add new favourite
                ContentValues values = new ContentValues();
                values.put(TableHelperFavourites.COL_MOVIE_ID, mMovie.id);
                values.put(TableHelperFavourites.COL_MOVIE_TITLE, mMovie.title);
                values.put(TableHelperFavourites.COL_MOVIE_RELEASE_DATE, mMovie.releaseDate);
                values.put(TableHelperFavourites.COL_MOVIE_AVG_VOTE, mMovie.voteAverage);
                values.put(TableHelperFavourites.COL_MOVIE_OVERVIEW, mMovie.overview);
                values.put(TableHelperFavourites.COL_MOVIE_IMG_PATH, mMovie.posterPath);
                getActivity()
                    .getContentResolver()
                    .insert(MoviesContract.URI_FAVOURITES_INSERT, values);
                v.setSelected(true);
              } else {
                // Delete from favourites for this movie
                String where = TableHelperFavourites.COL_MOVIE_ID + "=?";
                String[] args = {String.valueOf(mMovie.id)};
                getActivity()
                    .getContentResolver()
                    .delete(MoviesContract.URI_FAVOURITES_INSERT, where, args);
                v.setSelected(false);
                if (mCallback != null) {
                  mCallback.onMovieUnFavoured();
                }
              }
            }
          }
        });

    mListview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position > 0) {
              // Offset item (-1) for header
              Detail detail = mAdapter.getItem(position - 1);
              String url = detail.getUrl();
              if (url != null) {
                // Luanch youtube viewer
                url = getString(R.string.youtube_link) + url;
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(intent);
              } else if (detail.getAuthor() != null) {
                // Launch review detail page
                Intent intent = new Intent(getActivity(), ActivityReview.class);
                intent.putExtra(ActivityReview.TAG_REVIEW, detail.getTitle());
                intent.putExtra(ActivityReview.TAG_AUTHOR, detail.getAuthor());
                intent.putExtra(ActivityReview.TAG_TITLE, mMovie.title);
                startActivity(intent);
              }
            }
          }
        });

    if (mMovie != null) {
      setupMovieDetails();
      // Set opening state for if movie is a favourite or not
      mFavourites.setSelected(isFavourite());
    }
  }
예제 #7
0
  /** 初始化底部导航布局及设置相应的点击事件 */
  private void initView() {
    // 默认显示第一个页面
    if (mEnglishClassify == null) {
      mEnglishClassify = new EnglishClassify();
    }

    if (!mEnglishClassify.isAdded()) {
      setFragment(mEnglishClassify, false);
    }

    mLytBottom = (LinearLayout) findViewById(R.id.lyt_bottom);
    mLytBottomNav1 = (LinearLayout) findViewById(R.id.lyt_bottom_item1);
    mLytBottomNav1.setSelected(true);
    mLytBottomNav1.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mLytBottomNav1.setSelected(true);
            mLytBottomNav2.setSelected(false);
            mLytBottomNav3.setSelected(false);
            mLytBottomNav4.setSelected(false);
            // 分类英语
            EnglishClassify.flag = 1;
            if (mEnglishClassify == null) {
              mEnglishClassify = new EnglishClassify();
            }
            EnglishClassify.flag = 1;
            if (!mEnglishClassify.isAdded()) {
              setFragment(mEnglishClassify, false);
            } else {
              // 采用同一个fragment只变化数据
              mEnglishClassify.initData();
            }
          }
        });
    mLytBottomNav2 = (LinearLayout) findViewById(R.id.lyt_bottom_item2);
    mLytBottomNav2.setSelected(false);
    mLytBottomNav2.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mLytBottomNav1.setSelected(false);
            mLytBottomNav2.setSelected(true);
            mLytBottomNav3.setSelected(false);
            mLytBottomNav4.setSelected(false);

            if (mWordClassify == null) {
              mWordClassify = new WordClassifyFragment();
            }
            if (!mWordClassify.isAdded()) {
              setFragment(mWordClassify, false);
            }
          }
        });
    mLytBottomNav3 = (LinearLayout) findViewById(R.id.lyt_bottom_item3);
    mLytBottomNav3.setSelected(false);
    mLytBottomNav3.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mLytBottomNav1.setSelected(false);
            mLytBottomNav2.setSelected(false);
            mLytBottomNav3.setSelected(true);
            mLytBottomNav4.setSelected(false);
            // 已翻译列表
            ArticleListFragment articleList = new ArticleListFragment();
            Bundle bundle = new Bundle();
            bundle.putString(Util.SHIFT_FLAG, getString(R.string.already_translate_list));
            articleList.setArguments(bundle);
            setFragment(articleList, false);
          }
        });
    mLytBottomNav4 = (LinearLayout) findViewById(R.id.lyt_bottom_item4);
    mLytBottomNav4.setSelected(false);
    mLytBottomNav4.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mLytBottomNav1.setSelected(false);
            mLytBottomNav2.setSelected(false);
            mLytBottomNav3.setSelected(false);
            mLytBottomNav4.setSelected(true);
            if (mEnglishClassify == null) {
              mEnglishClassify = new EnglishClassify();
            }
            // 报错由于fragment已经激活
            //                Bundle bundle = new Bundle();
            //                bundle.putInt("flag", 1);
            //                mEnglishClassify.setArguments(bundle);
            EnglishClassify.flag = 2;
            // 里面的代码不一定会执行
            if (!mEnglishClassify.isAdded()) {
              setFragment(mEnglishClassify, false);
            } else {
              mEnglishClassify.initData();
            }
          }
        });
  }
예제 #8
0
 public void onClick(View v) {
   main_bottom_layout1.setSelected(false);
   main_bottom_layout2.setSelected(true);
   main_bottom_layout3.setSelected(false);
   main_bottom_layout4.setSelected(false);
 }