Esempio n. 1
0
  @SuppressLint("NewApi")
  private void scroll(final float height) {
    if (mType == TYPE_INDICATOR || mType == TYPE_INDICATOR_WITH_HANDLE) {
      float move = height - (mScrollIndicator.getHeight() / 2);

      if (move < 0) move = 0;
      else if (move > getHeight() - mScrollIndicator.getHeight())
        move = getHeight() - mScrollIndicator.getHeight();

      if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
        mScrollIndicator.startAnimation(moveCompat(move));
      else mScrollIndicator.setTranslationY(move);
    }

    if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE) {
      mHandlebar.setSelected(true);
      moveHandlebar(height - (mHandlebar.getHeight() / 2));
    }

    int postition = (int) ((height / getHeight()) * mItemCount);
    if (mList instanceof ExpandableListView) {
      final int grouppos =
          ExpandableListView.getPackedPositionGroup(
              ((ExpandableListView) mList).getExpandableListPosition(postition));
      if (grouppos != -1) mGroupPosition = grouppos;
    }

    if (postition < 0) postition = 0;
    else if (postition >= mItemCount) postition = mItemCount - 1;
    mScrollIndicatorText.setText(mScrollable.getIndicatorForPosition(postition, mGroupPosition));
    mList.setSelection(mScrollable.getScrollPosition(postition, mGroupPosition));
  }
Esempio n. 2
0
  private void initViews(Context context, int customLeftMenuId, int customRightMenuId) {
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.residemenu_custom, this);

    if (customLeftMenuId >= 0) {
      scrollViewLeftMenu = inflater.inflate(customLeftMenuId, this, false);
    } else {
      scrollViewLeftMenu =
          inflater.inflate(R.layout.residemenu_custom_left_scrollview, this, false);
      layoutLeftMenu = (LinearLayout) scrollViewLeftMenu.findViewById(R.id.layout_left_menu);
    }

    if (customRightMenuId >= 0) {
      scrollViewRightMenu = inflater.inflate(customRightMenuId, this, false);
    } else {
      scrollViewRightMenu =
          inflater.inflate(R.layout.residemenu_custom_right_scrollview, this, false);
      layoutRightMenu = (LinearLayout) scrollViewRightMenu.findViewById(R.id.layout_right_menu);
    }

    imageViewShadow = (ImageView) findViewById(R.id.iv_shadow);
    imageViewBackground = (ImageView) findViewById(R.id.iv_background);

    RelativeLayout menuHolder = (RelativeLayout) findViewById(R.id.sv_menu_holder);
    menuHolder.addView(scrollViewLeftMenu);
    menuHolder.addView(scrollViewRightMenu);
  }
  private void setHeaderPadding(int padding) {
    headerPadding = padding;

    MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) header.getLayoutParams();
    mlp.setMargins(0, Math.round(padding), 0, 0);
    header.setLayoutParams(mlp);
  }
Esempio n. 4
0
  protected void setRightButtonText(String text) {
    RelativeLayout rightView = (RelativeLayout) findViewById(R.id.right_view);
    rightView.removeAllViews();

    int padding = dp2px(6);
    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    lp.setMargins(0, 0, dp2px(8), 0);
    TextView tv = new TextView(this);
    tv.setText(text);
    tv.setTextColor(0xFF666666);
    tv.setTextSize(16.f);
    tv.setLayoutParams(lp);
    tv.setBackgroundResource(R.drawable.btn_gray);
    tv.setPadding(2 * padding, padding, 2 * padding, padding);
    tv.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onRightButtonClicked(v);
          }
        });

    rightView.addView(tv);
    rightView.setVisibility(View.VISIBLE);
  }
Esempio n. 5
0
  private RelativeLayout createPin() {
    final RelativeLayout pinLayout = new RelativeLayout(getContext());
    pinLayout.setVisibility(View.INVISIBLE);

    final Pin pin = new Pin(getContext());
    pin.setId(ID_PIN);
    final RelativeLayout.LayoutParams pinParams =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    pinParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    pinParams.addRule(RelativeLayout.ALIGN_BOTTOM, ID_PIN_TEXT);
    pinParams.addRule(RelativeLayout.ALIGN_TOP, ID_PIN_TEXT);
    pin.setLayoutParams(pinParams);
    pinLayout.addView(pin);

    final TextView indicatorTextView = new TextView(getContext());
    indicatorTextView.setId(ID_PIN_TEXT);
    final RelativeLayout.LayoutParams indicatorParams =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    indicatorParams.addRule(RelativeLayout.LEFT_OF, ID_PIN);
    indicatorTextView.setLayoutParams(indicatorParams);
    indicatorTextView.setTextColor(Color.WHITE);
    indicatorTextView.setGravity(Gravity.CENTER);
    indicatorTextView.setBackgroundColor(GREY_LIGHT);
    pinLayout.addView(indicatorTextView);

    return pinLayout;
  }
Esempio n. 6
0
  protected void applyTheme(int theme) {
    Resources res = getResources();

    mRootView.setBackgroundColor(
        res.getColor(MODE_NIGHT == theme ? R.color.background_night : R.color.background));

    if (!mHideTitle) {
      final RelativeLayout titleView = (RelativeLayout) findViewById(R.id.title_bar);
      final TextView titleText = (TextView) findViewById(R.id.title_text);
      final View divider = findViewById(R.id.split_h);
      final ImageView backBtn = (ImageView) findViewById(R.id.ic_arrow);

      final View leftView = findViewById(R.id.back_view);

      if (MODE_NIGHT == theme) {
        titleView.setBackgroundColor(0xFF1C1C1C);
        titleText.setTextColor(0xFF666666);
        divider.setBackgroundColor(0xFF303030);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back_night);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg_night);
      } else {
        titleView.setBackgroundColor(res.getColor(R.color.action_bar_color));
        titleText.setTextColor(res.getColor(R.color.white));
        divider.setBackgroundColor(0xFFCACACA);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg);
      }
    }
  }
Esempio n. 7
0
 public void onConfigurationChanged(Configuration newConfig) {
   int orientation = activity.getResources().getConfiguration().orientation;
   if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
     hideSoftInput();
     Window win = activity.getWindow();
     win.setSoftInputMode(
         WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
             | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
     rlPage.setBackgroundColor(DIM_COLOR);
     rlPage.postDelayed(
         new Runnable() {
           public void run() {
             getBackground();
             rlPage.setBackgroundDrawable(background);
           }
         },
         1000);
   } else {
     hideSoftInput();
     Window win = activity.getWindow();
     win.setSoftInputMode(
         WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
             | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
     rlPage.setBackgroundColor(DIM_COLOR);
     rlPage.postDelayed(
         new Runnable() {
           public void run() {
             getBackground();
             rlPage.setBackgroundDrawable(background);
           }
         },
         1000);
   }
 }
  @Override
  protected void createContentStructure() {
    RelativeLayout relativeLayout = new RelativeLayout();

    EmptyContent insideEmptyContent = new EmptyContent();
    insideEmptyContent.setMinHeight(DEFAULT_DIAMETER);
    insideEmptyContent.setMinWidth(DEFAULT_DIAMETER);

    ContentInsideShape contentInsideShape = new ContentInsideEllipse(insideEmptyContent, 1);
    ContentBackground contentBackground =
        new ContentBackground(
            contentInsideShape, ColorToolsBarPanel.PASTEL_GREY.getBackgroundColor());
    ContentBorder contentBorder =
        new ContentBorder(contentInsideShape, ColorToolsBarPanel.PASTEL_GREY.getBorderColor());
    relativeLayout.add(contentBackground);
    relativeLayout.add(contentBorder);

    insideEmptyContent = new EmptyContent();
    insideEmptyContent.setMinHeight(DEFAULT_DIAMETER - DEFAULT_GAP);
    insideEmptyContent.setMinWidth(DEFAULT_DIAMETER - DEFAULT_GAP);

    contentInsideShape = new ContentInsideEllipse(insideEmptyContent, 1);
    contentBackground =
        new ContentBackground(contentInsideShape, ColorToolsBarPanel.PASTEL_GREY.getBorderColor());
    relativeLayout.add(
        contentBackground,
        new Point2D.Double(DEFAULT_GAP / Math.sqrt(2), DEFAULT_GAP / Math.sqrt(2)));

    setContent(relativeLayout);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.public_video_xml);
    initView();
    // 跳转到录制页面
    Init_View();

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    surfaceView = (TextureView) findViewById(R.id.preview_video);

    RelativeLayout preview_video_parent = (RelativeLayout) findViewById(R.id.preview_video_parent);
    LinearLayout.LayoutParams layoutParams =
        (LinearLayout.LayoutParams) preview_video_parent.getLayoutParams();
    layoutParams.width = displaymetrics.widthPixels;
    layoutParams.height = displaymetrics.widthPixels;
    preview_video_parent.setLayoutParams(layoutParams);

    surfaceView.setSurfaceTextureListener(this);
    surfaceView.setOnClickListener(this);

    path = getIntent().getStringExtra("path");

    imagePlay = (ImageView) findViewById(R.id.previre_play);
    imagePlay.setOnClickListener(this);
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
  }
Esempio n. 10
0
  @SuppressLint("NewApi")
  private boolean IndicatorTouchEvent(final MotionEvent event) {
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_DOWN:
        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          // mScrollIndicator.findViewById(ID_PIN).setVisibility(View.VISIBLE);
          // mScrollIndicatorText.setVisibility(View.VISIBLE);
          toggleVisibilityCompat(false);
        } else mScrollIndicator.startAnimation(mFadeIn);
        mScrollIndicator.setPadding(0, 0, getWidth(), 0);
        scroll(event.getY());
        mScrolling = true;
        return true;
      case MotionEvent.ACTION_MOVE:
        scroll(event.getY());
        return true;
      case MotionEvent.ACTION_UP:
        if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE)
          mHandlebar.setSelected(false);

        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          toggleVisibilityCompat(true);
        } else mScrollIndicator.startAnimation(mFadeOut);
        return true;
      default:
        break;
    }
    return false;
  }
Esempio n. 11
0
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   // TODO Auto-generated method stub
   if (isChecked) {
     noteLayout.setBackgroundColor(0xffcdc9c8);
   } else {
     noteLayout.setBackgroundColor(0);
   }
 }
Esempio n. 12
0
 private void hideIndicatorCompat() {
   if (mScrollIndicatorText != null) {
     mScrollIndicatorText.setVisibility(View.INVISIBLE);
     mScrollIndicatorText.startAnimation(mFadeOut);
   }
   if (mScrollIndicator != null) {
     mScrollIndicator.findViewById(ID_PIN).setVisibility(View.INVISIBLE);
     mScrollIndicator.startAnimation(mFadeOut);
   }
 }
Esempio n. 13
0
  private RelativeLayout getPageView() {
    rlPage = new RelativeLayout(getContext());
    rlPage.setBackgroundDrawable(background);
    if (dialogMode) {
      RelativeLayout rlDialog = new RelativeLayout(getContext());
      rlDialog.setBackgroundColor(0xc0323232);
      int dp_8 = dipToPx(getContext(), 8);
      int width = getScreenWidth(getContext()) - dp_8 * 2;
      RelativeLayout.LayoutParams lpDialog =
          new RelativeLayout.LayoutParams(width, LayoutParams.WRAP_CONTENT);
      lpDialog.topMargin = dp_8;
      lpDialog.bottomMargin = dp_8;
      lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
      rlDialog.setLayoutParams(lpDialog);
      rlPage.addView(rlDialog);

      rlDialog.addView(getPageTitle());
      rlDialog.addView(getPageBody());
      rlDialog.addView(getImagePin());
    } else {
      rlPage.addView(getPageTitle());
      rlPage.addView(getPageBody());
      rlPage.addView(getImagePin());
    }
    return rlPage;
  }
  private void init() {
    setVerticalFadingEdgeEnabled(false);

    headerContainer =
        (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null);
    header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header);
    text = (TextView) header.findViewById(R.id.ptr_id_text);
    lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated);
    image = (ImageView) header.findViewById(R.id.ptr_id_image);
    spinner = (ProgressBar) header.findViewById(R.id.ptr_id_spinner);

    pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh);
    releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh);
    refreshingText = getContext().getString(R.string.ptr_refreshing);
    lastUpdatedText = getContext().getString(R.string.ptr_last_updated);

    flipAnimation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    flipAnimation.setInterpolator(new LinearInterpolator());
    flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    flipAnimation.setFillAfter(true);

    reverseFlipAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseFlipAnimation.setInterpolator(new LinearInterpolator());
    reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    reverseFlipAnimation.setFillAfter(true);

    addHeaderView(headerContainer);
    setState(State.PULL_TO_REFRESH);
    scrollbarEnabled = isVerticalScrollBarEnabled();

    ViewTreeObserver vto = header.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener());

    super.setOnItemClickListener(new PTROnItemClickListener());
    super.setOnItemLongClickListener(new PTROnItemLongClickListener());
  }
Esempio n. 15
0
 /**
  * Sets the indicator colors, when QuickScroll.TYPE_INDICATOR is selected as type.
  *
  * <p>
  *
  * @param background the background color of the square
  * @param tip the background color of the tip triangle
  * @param text the color of the text
  */
 public void setIndicatorColor(final int background, final int tip, final int text) {
   if (mType == TYPE_INDICATOR || mType == TYPE_INDICATOR_WITH_HANDLE) {
     ((Pin) mScrollIndicator.findViewById(ID_PIN)).setColor(tip);
     mScrollIndicatorText.setTextColor(text);
     mScrollIndicatorText.setBackgroundColor(background);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView =
        getActivity().getLayoutInflater().inflate(R.layout.cuc_multi_selection_layout, null);
    mDirectoriesMap = new HashMap<String, Boolean>();
    mRefreshBtn = (ImageView) rootView.findViewById(R.id.cuc_multi_selection_refresh_iv);
    mRefreshBtn.setVisibility(View.INVISIBLE);
    mListView = (ListView) rootView.findViewById(R.id.cuc_multi_selection_lv);
    mListView.setFastScrollEnabled(true);
    mUpLayout = (RelativeLayout) rootView.findViewById(R.id.cuc_multi_selection_up_layout);
    mCurrentDirText =
        (TextView) rootView.findViewById(R.id.cuc_multi_selection_current_directory_txt);
    mUpLayout.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            try {
              getDir(new File(mCurrentDir).getParentFile().getCanonicalPath());
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    mRootDir = Environment.getExternalStorageDirectory().getAbsolutePath().toString();
    mCurrentDir = mRootDir;

    // Get a list of all the selected directory paths (will be empty if this is the first run).
    mSelectedDirList = CameraUploadDBHelper.getInstance().getCustomDirList();

    // Get a list of all the directory paths that are currently stored in the DB.
    for (int i = 0; i < mSelectedDirList.size(); i++) {

      // Filter out any double slashes.
      String path = mSelectedDirList.get(i);
      if (path.contains("//")) {
        path.replace("//", "/");
      }

      mDirectoriesMap.put(path, true);
    }

    // Get the folder hierarchy of the selected directory.
    getDir(mRootDir);

    mListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
            String newPath = mDirectoryPathsList.get(index);
            getDir(newPath);
          }
        });

    return rootView;
  }
Esempio n. 17
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.bigadventure);

    bigadventure_tv = (TextView) findViewById(R.id.bigadventure_textview);
    topview = (ImageView) findViewById(R.id.bigadventure_topview);
    bottomview = (ImageView) findViewById(R.id.bigadventure_bottomview);
    relativeLayout = (RelativeLayout) findViewById(R.id.big_rl);
    shakeChange = new ShakeChange(BigAdventure.this, bigadventure_tv, 2, topview, bottomview);
    textRead = new TextRead(BigAdventure.this, 2);

    linearLayout = (LinearLayout) findViewById(R.id.linearlayout_bottom);

    // 设置触摸监听器,在触摸时调用
    relativeLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            shakeChange.StartAnimation();
            new Handler()
                .postDelayed(
                    new Runnable() {
                      @Override
                      public void run() {
                        try {
                          bigadventure_tv.setText(textRead.LineRead());
                        } catch (IOException e) {
                          e
                              .printStackTrace(); // To change body of catch statement use File |
                                                  // Settings | File Templates.
                        }
                      }
                    },
                    1000);
            return false; // To change body of implemented methods use File | Settings | File
                          // Templates.
          }
        });
    /*b_backbutton = (Button)findViewById(R.id.b_backButton);
    b_sharebutton = (Button)findViewById(R.id.b_shareButton);

    b_backbutton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            BigAdventure.this.finish();
        }
    });

    b_sharebutton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent=new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(Intent.createChooser(intent, "请选择"));
        }
    });*/

  }
Esempio n. 18
0
 @Override
 public boolean dispatchTouchEvent(MotionEvent ev) {
   super.dispatchTouchEvent(ev);
   boolean consumed = gesturedetector.onTouchEvent(ev);
   if (!consumed && ev.getAction() == MotionEvent.ACTION_DOWN) return true;
   else return consumed;
 }
  private void bounceBackHeader() {
    int yTranslate =
        state == State.REFRESHING
            ? header.getHeight() - headerContainer.getHeight()
            : -headerContainer.getHeight() - headerContainer.getTop();

    TranslateAnimation bounceAnimation =
        new TranslateAnimation(
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            yTranslate);

    bounceAnimation.setDuration(BOUNCE_ANIMATION_DURATION);
    bounceAnimation.setFillEnabled(true);
    bounceAnimation.setFillAfter(false);
    bounceAnimation.setFillBefore(true);
    bounceAnimation.setInterpolator(new OvershootInterpolator(BOUNCE_OVERSHOOT_TENSION));
    bounceAnimation.setAnimationListener(new HeaderAnimationListener(yTranslate));

    startAnimation(bounceAnimation);
  }
Esempio n. 20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // Open app in fullscreen mode
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);

    noteLayout = (RelativeLayout) findViewById(R.id.notePanel);

    canvasView = new CanvasView(this);
    switchy = new Switch(this);
    switchy = (Switch) findViewById(R.id.switch1);
    switchy.setOnCheckedChangeListener(this);

    inkRegion = new ArrayList<InkRegion>();
    inkRegion.add(new InkRegion(this, 0));
    inkRegion.add(new InkRegion(this, 1));
    inkRegion.get(0).setBackgroundColor(Color.YELLOW);
    inkRegion.get(1).setBackgroundColor(Color.CYAN);

    // noteLayout.addView(canvasView);
    noteLayout.addView(canvasView);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(200, 200);
    params.leftMargin = 300;
    params.topMargin = 200;
    inkRegion.get(0).setBackgroundColor(Color.GREEN);
    inkRegion.get(0).setPivotX(0);
    inkRegion.get(0).setPivotY(0);
    inkRegion.get(0).setRotation(45);
    inkRegion.get(0).setScaleX((float) 0.2);
    inkRegion.get(0).setScaleY((float) 0.3);
    noteLayout.addView(inkRegion.get(0), params);

    RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(200, 200);
    params1.leftMargin = 300;
    params1.topMargin = 200;
    inkRegion.get(1).setBackgroundColor(Color.BLUE);
    inkRegion.get(1).setPivotX(0);
    inkRegion.get(1).setPivotY(0);
    inkRegion.get(1).setRotation(90);
    inkRegion.get(1).setScaleX((float) 0.2);
    inkRegion.get(1).setScaleY((float) 0.2);
    noteLayout.addView(inkRegion.get(1), params1);
  }
Esempio n. 21
0
 private void toggleVisibilityCompat(final boolean visible) {
   if (mScrollIndicatorText != null) {
     mScrollIndicatorText.startAnimation(visible ? mFadeOut : mFadeIn);
   }
   if (mScrollIndicator != null) {
     mScrollIndicator.startAnimation(visible ? mFadeOut : mFadeIn);
   }
 }
Esempio n. 22
0
 /** 绑定点击事件 */
 private void bindListeners() {
   container_menu.setOnClickListener(this);
   btn_set_mode_voice.setOnClickListener(this);
   buttonSetModeKeyboard.setOnClickListener(this);
   btnMore.setOnClickListener(this);
   mEditTextContent.setOnClickListener(this);
   mEditTextContent.addTextChangedListener(new MyTextWatcher());
 }
Esempio n. 23
0
 @Override
 protected void onWindowVisibilityChanged(int visibility) {
     super.onWindowVisibilityChanged(visibility);
     if (visibility != View.VISIBLE) {
         if (mAudioButton != null) {
             mAudioButton.stopPlaying();
         }
     }
 }
Esempio n. 24
0
    public View getView(int position, View convertView, ViewGroup parent) {
      RelativeLayout rowLayout;
      ServiceAcctInfo acct = acctList[position];
      if (convertView == null) {
        rowLayout =
            (RelativeLayout)
                LayoutInflater.from(context).inflate(R.layout.realm_login_row, parent, false);
      } else {
        rowLayout = (RelativeLayout) convertView;
      }

      String acctType = msgsetNames[acct.type.ordinal()];
      if (acct.name.acctType != null) acctType = acctType + " (" + acct.name.acctType + ')';
      if (acct.name.acctId != null) acctType = acctType + "\nAccount: " + acct.name.acctId;
      ((TextView) rowLayout.findViewById(R.id.Name)).setText(acct.desc);
      ((TextView) rowLayout.findViewById(R.id.TaskList)).setText(acctType);

      return rowLayout;
    }
  private void resetHeader() {
    if (getFirstVisiblePosition() > 0) {
      setHeaderPadding(-header.getHeight());
      setState(State.PULL_TO_REFRESH);
      return;
    }

    if (getAnimation() != null && !getAnimation().hasEnded()) {
      bounceBackHeader = true;
    } else {
      bounceBackHeader();
    }
  }
	public void setDrawerContentView(int layout_id) {
		
		LayoutInflater inflater = LayoutInflater.from(this);
		rightSideAppScreenView = inflater.inflate(layout_id, null);
		mAttachedViewID = rightSideAppScreenView.getId();
		
		mHeaderRelativeLayout = (RelativeLayout)rightSideAppScreenView.findViewById(R.id.navigation_header);
		
		mTitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_title);
		mSubtitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_subtitle);
		mHeaderImageView = (ImageView)mHeaderRelativeLayout.findViewById(R.id.iv_header_icon);
		
		mTimeTrackerTextView = (TextView) mHeaderRelativeLayout.findViewById(R.id.menu_header_time_tracker);
		mTimerLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.timer_layout);
		
		mSubtitleTextView.setOnClickListener(this);
		mTimeTrackerTextView.setOnClickListener(this);
		mTimerLayout.setOnClickListener(this);

		ViewGroup tabBar = (ViewGroup) rightSideAppScreenView.findViewById(mAttachedViewID);

		btnSlide = (ImageButton) tabBar.findViewById(R.id.bt_slider);
		btnSlide.setVisibility(View.VISIBLE);

		mSliderClickListener = new ClickListenerForScrolling(mSliderView, leftSideListView, menuOut);
		btnSlide.setOnClickListener(mSliderClickListener);
		
		mHomeBtnLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.home_layout);
		if(mHomeBtnLayout!= null)
		{
			mHomeBtnLayout.setOnClickListener(mSliderClickListener);
		}

		View[] children = new View[] { leftSideListView, rightSideAppScreenView };

		int scrollToViewIdx = 1;

		mSliderView.initViews(children, scrollToViewIdx, new SizeCallbackForMenu(btnSlide));
		
		setSubTitle(AppConfig.getAppConfigInstance(this).getUserName());
	     setTitle(getResources().getString(R.string.app_title));
		
		displayHeaderMenuBar();
		//If learn mode is active, the titlebar color must be changed.
		if (AppConfig.getAppConfigInstance(this).getDeviceSynched())
			mPresenter.checkLearnMode(this, rightSideAppScreenView,
					mSubtitleTextView);
	}
  /**
   * Called from within the base RestService after a rest call completes.
   *
   * @param result Can be any result type. This function should check the type and handle
   *     accordingly.
   */
  @Override
  public void onRestReturn(RestResult result) {
    if (result == null) {
      return;
    }

    if (result instanceof GetLoyaltyCardByIdResult) {

      this.loyaltyCard = ((GetLoyaltyCardByIdResult) result).getLoyaltyCard();

      TextView lblLoyaltyName = (TextView) findViewById(R.id.lblLoyaltyName);
      TextView lblLoyaltyDescription = (TextView) findViewById(R.id.lblLoyaltyDescription);
      TextView lblLoyaltyCount = (TextView) findViewById(R.id.lblLoyaltyCount);
      TextView lblLoyaltyPrize = (TextView) findViewById(R.id.lblLoyaltyPrize);
      ImageView viewButton = (ImageView) findViewById(R.id.viewButton);
      RelativeLayout lblLoyaltyCountHolder =
          (RelativeLayout) findViewById(R.id.lblLoyaltyCountHolder);
      RelativeLayout lblLoyaltyIsWonHolder =
          (RelativeLayout) findViewById(R.id.lblLoyaltyIsWonHolder);

      lblLoyaltyName.setText(this.loyaltyCard.getLoyalty().getName());
      lblLoyaltyDescription.setText(this.loyaltyCard.getLoyalty().getDescription());

      if (this.loyaltyCard.getIsWon()) {
        lblLoyaltyCount.setText("Go get your prize");
        lblLoyaltyCountHolder.setBackgroundColor(Color.parseColor("#27ae60"));
        lblLoyaltyIsWonHolder.setBackgroundColor(Color.parseColor("#2ecc71"));
        // viewButton.setVisibility(View.VISIBLE);
      } else {
        Integer total_left =
            Integer.parseInt(this.loyaltyCard.getLoyalty().getWinCount())
                - Integer.parseInt(this.loyaltyCard.getCount());
        lblLoyaltyCount.setText(total_left + " more");
        lblLoyaltyCountHolder.setBackgroundColor(Color.parseColor("#7f8c8d"));
        lblLoyaltyIsWonHolder.setBackgroundColor(Color.parseColor("#95a5a6"));
        // viewButton.setVisibility(View.INVISIBLE);
      }

      // holder.lblLoyaltyWinCount.setText(loyaltyCard.getLoyalty().getWinCount())
      lblLoyaltyPrize.setText(this.loyaltyCard.getLoyalty().getPrize());

      ListView list = (ListView) findViewById(R.id.lstStores);

      StoreListAdapter storeListAdapter =
          new StoreListAdapter(this, R.layout.store_item_row, this.loyaltyCard.getStoreItems());
      list.setAdapter(storeListAdapter);
    }
  }
Esempio n. 28
0
  protected void FillViewGroup(
      LinearLayout layout, String title, String center, String content, String result) {
    exchange_icon_item =
        (RelativeLayout) LayoutInflater.from(getApplicationContext()).inflate(R.layout.item, null);
    item_img_icon = (ImageView) exchange_icon_item.findViewById(R.id.img_icon);
    tv_item_title = (TextView) exchange_icon_item.findViewById(R.id.tv_item_title);
    tv_item_center = (TextView) exchange_icon_item.findViewById(R.id.tv_item_center);
    tv_item_content = (TextView) exchange_icon_item.findViewById(R.id.tv_item_content);
    tv_result = (TextView) exchange_icon_item.findViewById(R.id.tv_result);
    ibtn_arrow = (ImageButton) exchange_icon_item.findViewById(R.id.btn_arrow);

    tv_item_title.setText(title);
    tv_item_content.setText(content);
    tv_item_center.setText(center);
    tv_result.setText(result);

    layout.addView(exchange_icon_item);
  }
Esempio n. 29
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    if (mList.getAdapter() == null) return false;
    mItemCount = mList.getAdapter().getCount();
    if (mItemCount == 0) return false;

    if (event.getActionMasked() == MotionEvent.ACTION_CANCEL) {
      if (mType == TYPE_POPUP || mType == TYPE_POPUP_WITH_HANDLE) {
        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          mScrollIndicatorText.setVisibility(View.GONE);
        } else mScrollIndicatorText.startAnimation(mFadeOut);
      } else {
        if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE)
          mHandlebar.setSelected(false);

        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          toggleVisibilityCompat(true);
        } else mScrollIndicator.startAnimation(mFadeOut);
      }
    }

    switch (mType) {
      case TYPE_POPUP:
        return PopupTouchEvent(event);
      case TYPE_POPUP_WITH_HANDLE:
        return PopupTouchEvent(event);
      case TYPE_INDICATOR:
        return IndicatorTouchEvent(event);
      case TYPE_INDICATOR_WITH_HANDLE:
        return IndicatorTouchEvent(event);
      default:
        break;
    }
    return false;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gallery_list);
    getSupportActionBar().hide();
    RelativeLayout galleryListRelativeLayout =
        (RelativeLayout) findViewById(R.id.galleryListRelativeLayout);
    galleryListRelativeLayout.setBackgroundResource(R.drawable.rsz_androids);
    galleryListRelativeLayout.getBackground().setAlpha(40);
    ArrayList galleryListArrayList = new ArrayList();
    galleryListArrayList.add("HK Photos");
    galleryListArrayList.add("Gaoming Photos");
    galleryListArrayList.add("Hour of Code Photos");
    ListView galleryListListView = (ListView) findViewById(R.id.galleryListListView);
    CustomList customAdapter = new CustomList(this, galleryListArrayList, imageId);
    galleryListListView.setAdapter(customAdapter);
    galleryListListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (i == 0) {
              Intent intent = new Intent(GalleryList.this, HKPhotos.class);
              startActivity(intent);
            }
            if (i == 1) {
              Intent intent = new Intent(GalleryList.this, GaomingPhotos.class);
              startActivity(intent);
            }
            if (i == 2) {
              Intent intent = new Intent(GalleryList.this, Gallery.class);
              startActivity(intent);
            }
          }
        });

    ListView drawerListView = (ListView) findViewById(R.id.drawer_list);
    ArrayList drawerArrayList = new ArrayList();
    drawerArrayList.add("Objectives");
    drawerArrayList.add("Results");
    drawerArrayList.add("Workshop");
    drawerArrayList.add("Gallery");
    drawerListView.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, drawerArrayList));
    drawerListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (i == 0) {
              Intent intent = new Intent(GalleryList.this, Objectives.class);
              startActivity(intent);
            }
            if (i == 1) {
              Intent intent = new Intent(GalleryList.this, Results.class);
              startActivity(intent);
            }
            if (i == 2) {
              Intent intent = new Intent(GalleryList.this, Workshop.class);
              startActivity(intent);
            }
            if (i == 3) {
              Toast.makeText(
                      GalleryList.this.getApplicationContext(),
                      "You are already in the gallery page",
                      Toast.LENGTH_SHORT)
                  .show();
              return;
            }
          }
        });
  }