public void onClick(View v, int position, int countitem) {
    ImageView selectedShip = ((MapBuilder) context).getSelectedShip();
    if (selectedShip != null) {
      ShipOnMap som = new ShipOnMap();
      RelativeLayout fl = (RelativeLayout) v;
      RelativeLayout.LayoutParams params =
          new RelativeLayout.LayoutParams(selectedShip.getWidth(), selectedShip.getHeight());
      som.start.x = x;
      som.start.y = y - v.getTop();
      som.time = (countitem - 1 - position) * 3 + 1;
      String[] shipinfo = ((String) selectedShip.getTag()).split(":");
      som.type = shipinfo[0];
      som.weapon = shipinfo[1];
      params.leftMargin = x - (selectedShip.getWidth() / 2);
      params.topMargin = y - v.getTop() - (selectedShip.getHeight() / 2);
      ImageView iv = new ImageView(context);
      iv.setImageDrawable(selectedShip.getDrawable());
      int h = fl.getHeight();
      int w = fl.getWidth();
      if (!ship.containsKey(position)) {
        ship.put(position, new LinkedList<ShipOnMap>());
      }

      som.ship = iv.getDrawable();
      som.param = params;
      List<ShipOnMap> lship = ship.get(position);
      lship.add(som);
      iv.setTag(position + "/" + (lship.size() - 1));
      ((MapBuilder) context).registerForContextMenu(iv);
      fl.addView(iv, params);
      fl.getLayoutParams().height = h;
      fl.getLayoutParams().width = w;
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    RelativeLayout relativeLayout = new RelativeLayout(this);
    relativeLayout.setLayoutParams(
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    View view = LayoutInflater.from(this).inflate(_layoutResource, null);

    _busyDialog = new BusyDialog(this);
    RelativeLayout.LayoutParams layoutParams =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    relativeLayout.addView(view);

    final GestureDetector gestureDetector = new GestureDetector(new TouchDetector(this));
    _onTouchListener =
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
          }
        };

    // relativeLayout.setOnTouchListener(_onTouchListener);

    setContentView(relativeLayout);
  }
 public void drawAnnotations() {
   mAnnotationLabelOverlay.removeAllViews();
   if (mQueryResult == null) {
     return;
   }
   int[] actImageRect = getBitmapPositionInsideImageView(mImageView);
   List<Annotation> annotations = mQueryResult.annotations;
   int index = -1;
   for (Annotation anno : annotations) {
     index++;
     LabelView label = new LabelView(getActivity());
     label.mLabelText.setVisibility(View.VISIBLE);
     label.mLabelText.setText(anno.text);
     label.mPosition = index;
     float padding = 100;
     float cx = anno.getCenterX() * actImageRect[2];
     float cy = anno.getCenterY() * actImageRect[3];
     if (cx > actImageRect[2] - padding) {
       cx = actImageRect[2] - padding + randomInt(-30, 30);
     } else if (cx < padding) {
       cx = padding + randomInt(-30, 30);
     }
     if (cy > actImageRect[3] - padding) {
       cy = actImageRect[3] - padding + randomInt(-30, 30);
     } else if (cy < padding) {
       cy = padding + randomInt(-30, 30);
     }
     RelativeLayout.LayoutParams params =
         new RelativeLayout.LayoutParams(
             ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
     params.leftMargin = (int) cx + actImageRect[0];
     params.topMargin = (int) cy + actImageRect[1];
     mAnnotationLabelOverlay.addView(label, params);
     label.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             LabelView view = (LabelView) v;
             Log.d("label position: ", "" + view.mPosition);
             int position = view.mPosition;
             if (position >= 0 && position < mAnnotationList.size()) {
               mLinearLayoutManager.scrollToPosition(position);
             }
             //                    String text = view.mLabelText.getText().toString();
             //                    AnnotationDetailFragment fragment = new
             // AnnotationDetailFragment();
             //                    Bundle args = new Bundle();
             //                    args.putString("annotation_text", text);
             //                    fragment.setArguments(args);
             //
             // getFragmentManager().beginTransaction().replace(R.id.frame_container,
             // fragment).addToBackStack(null).commit();
           }
         });
     if (mLabels == null) {
       mLabels = new ArrayList<>();
     }
     mLabels.add(label);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle("WOW");

    view = new CustomView(getApplicationContext(), actionBar);
    setContentView(view);
    view.setRefreshListner(SampleForGmailLikePullToRefresh.this);
    view.setActionBar(SampleForGmailLikePullToRefresh.this);
    mListView = view.getListView();

    list = new ArrayList<Integer>();
    adapter = new DummyAdapter(SampleForGmailLikePullToRefresh.this, 0, list);

    LayoutInflater layoutInflater =
        (LayoutInflater)
            SampleForGmailLikePullToRefresh.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View loadingView = layoutInflater.inflate(R.layout.view_listview_loading, null);
    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    params.setMargins(0, 5, 0, 0);
    loadingView.setLayoutParams(params);
    mListView.setEmptyView(null);
  }
Exemple #5
0
  private void init() {
    setHardwareAccelerated(true);

    boolean hasShot =
        getContext()
            .getSharedPreferences(PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE)
            .getBoolean("hasShot" + getConfigOptions().showcaseId, false);
    if (hasShot && mOptions.shotType == TYPE_ONE_SHOT) {
      // The showcase has already been shot once, so we don't need to do anything
      setVisibility(View.GONE);
      mIsRedundant = true;
      return;
    }

    mShowcaseRadius = mMetricScale * INNER_CIRCLE_RADIUS;
    setOnTouchListener(this);

    if (!mOptions.noButton && mEndButton.getParent() == null) {
      RelativeLayout.LayoutParams lps = getConfigOptions().buttonLayoutParams;
      if (lps == null) {
        lps = (LayoutParams) generateDefaultLayoutParams();
        lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        int margin = ((Number) (mMetricScale * 12)).intValue();
        lps.setMargins(margin, margin, margin, margin);
      }
      mEndButton.setLayoutParams(lps);
      mEndButton.setText(mButtonText != null ? mButtonText : getResources().getString(R.string.ok));
      if (!mHasCustomClickListener) {
        mEndButton.setOnClickListener(this);
      }
      addView(mEndButton);
    }
  }
  public void displayAjustView(RecyclingBitmapDrawable value) {
    if (value != null && value.getBitmap() != null) {
      this.value = value;
      adjustView =
          new AdjustView(
              context, value.getBitmap().getWidth(), value.getBitmap().getHeight(), value);
      adjustView.setBackgroundColor(Color.TRANSPARENT);
      //			adjustView.setImageBitmap(bitmap);

      relayout.removeAllViews();
      RelativeLayout.LayoutParams params =
          new RelativeLayout.LayoutParams(
              android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT,
              android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);

      Tools.initWidth = value.getBitmap().getWidth();
      Tools.initHeight = value.getBitmap().getHeight();

      params.topMargin = (int) (screenHeight * 0.5 - value.getBitmap().getHeight() * 0.5);
      params.leftMargin = (int) (screenWidth * 0.5 - value.getBitmap().getWidth() * 0.5);
      relayout.addView(adjustView, params);

      float rate = (float) viewWidth / viewHeight;
      int mheight = (int) (value.getBitmap().getHeight() * 0.5);
      int mwidth = (int) (mheight * rate);

      adjustView.auto_setAdjustImg(0, 0, mwidth, mheight);
    } else relayout.removeAllViews();
  }
  protected void initView() {
    setContentViewSrc(R.layout.activity_web_layout);
    webView = new WebActivityFragment();
    pb_bar = (ProgressBar) findViewById(R.id.pb_bar);
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.add(R.id.fl_content, webView);
    ft.commit();

    refresh = new ImageView(this);
    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(CommonUtils.dp2px(30), CommonUtils.dp2px(30));
    params.setMargins(0, 0, CommonUtils.dp2px(10), 0);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    refresh.setLayoutParams(params);
    if (!isUseToolbar()) addOptionsMenu(refresh);
    refresh.setBackgroundResource(R.mipmap.ic_refresh);
    refresh.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (isLoading) webView.stopLoading();
            else webView.refresh();
          }
        });
  }
 private void b(Configuration paramConfiguration)
 {
   int j = 1;
   float f1 = q().getDisplayMetrics().density;
   if (f1 != 1.0D);
   View localView;
   RelativeLayout.LayoutParams localLayoutParams;
   do
   {
     return;
     localView = this.aC.findViewById(2131296921);
     localLayoutParams = (RelativeLayout.LayoutParams)localView.getLayoutParams();
   }
   while (localLayoutParams == null);
   if (paramConfiguration.orientation == j);
   while (true)
   {
     int k = 0;
     if (j != 0)
       k = (int)(0.5F + 20.0F * f1);
     localLayoutParams.bottomMargin = k;
     localView.setLayoutParams(localLayoutParams);
     break;
     j = 0;
   }
 }
  private void createView() {
    // Linear Layout
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setId(1);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setBackgroundColor(Color.BLACK);
    this.setContentView(linearLayout);

    // Relative Layout
    RelativeLayout relativeLayout = new RelativeLayout(this);
    relativeLayout.setId(2);
    relativeLayout.setGravity(Gravity.CENTER);
    relativeLayout.setBackgroundColor(Color.BLACK);
    RelativeLayout.LayoutParams relativeLayoutParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
    relativeLayout.setLayoutParams(relativeLayoutParams);
    linearLayout.addView(relativeLayout);

    // Video View
    videoView = new VideoView(this);
    videoView.setId(3);
    RelativeLayout.LayoutParams videoViewParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    videoViewParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    videoView.setLayoutParams(videoViewParams);
    relativeLayout.addView(videoView);
  }
  private ImageView initializeImageView() {
    ImageView image;
    image = new ImageView(this.activity);
    image.setId(IMAGE_ID);
    image.setAdjustViewBounds(true);
    image.setScaleType(this.style.imageScaleType);

    // set the image drawable if not null
    if (null != this.style.imageDrawable) {
      image.setImageDrawable(this.style.imageDrawable);
    }

    // set the image resource if not 0. This will overwrite the drawable
    // if both are set
    if (this.style.imageResId != 0) {
      image.setImageResource(this.style.imageResId);
    }

    RelativeLayout.LayoutParams imageParams =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    imageParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);

    image.setLayoutParams(imageParams);

    return image;
  }
  @Override
  /**
   * Ask the host application for a custom progress view to show while a <video> is loading.
   *
   * @return View The progress view.
   */
  public View getVideoLoadingProgressView() {

    if (mVideoProgressView == null) {
      // Create a new Loading view programmatically.

      // create the linear layout
      LinearLayout layout = new LinearLayout(this.appView.getContext());
      layout.setOrientation(LinearLayout.VERTICAL);
      RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.setLayoutParams(layoutParams);
      // the proress bar
      ProgressBar bar = new ProgressBar(this.appView.getContext());
      LinearLayout.LayoutParams barLayoutParams =
          new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      barLayoutParams.gravity = Gravity.CENTER;
      bar.setLayoutParams(barLayoutParams);
      layout.addView(bar);

      mVideoProgressView = layout;
    }
    return mVideoProgressView;
  }
  public RowCheckBoxOmegaFi(Context context) {
    super(context);
    setTextSizeInformation(
        context.getResources().getDimensionPixelSize(R.dimen.text_12_notification));
    checkOption = new CheckBox(context);
    checkOption.setEnabled(true);
    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.setMargins(params.leftMargin, params.topMargin, 10, params.bottomMargin);
    checkOption.setLayoutParams(params);
    checkOption.setButtonDrawable(R.drawable.radio_button);
    checkOption.setSoundEffectsEnabled(true);
    this.addViewRight(checkOption);
    setTextColor(Color.GRAY);
    setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Log.d("onclick listener row", checkOption.isChecked() + "");
            checkOption.setChecked(!checkOption.isChecked());
          }
        });
  }
Exemple #13
0
  @Override
  protected void onAttachedToWindow() {
    super.onAttachedToWindow();

    // Create a text view supposed to display tuto messages
    if (mTutoTextView == null) {
      mTutoTextView = new TextView(getContext());
      mTutoTextView.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
      mTutoTextView.setTextColor(getResources().getColor(R.color.white));
      mTutoTextView.setTypeface(null, Typeface.BOLD);
      mTutoTextView.setBackgroundResource(R.color.alpha_shadow);
      mTutoTextView.setGravity(Gravity.CENTER);
      final int padding = getResources().getDimensionPixelSize(R.dimen.default_padding);
      mTutoTextView.setPadding(padding, 2 * padding, padding, padding);

      final RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
      layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
      mTutoTextView.setLayoutParams(layoutParams);
    }

    mAnimationLayer.addView(mTutoTextView);
    displayCurrentStepMessage(false);
  }
 @SuppressLint("ResourceAsColor")
 @Override
 public View getView(int arg0, View arg1, ViewGroup arg2) {
   HolerView holerView = null;
   if (arg1 == null) {
     holerView = new HolerView();
     arg1 =
         LayoutInflater.from(ChoiceCollActivity.this)
             .inflate(R.layout.commodity_item, arg2, false);
     holerView.table = (TextView) arg1.findViewById(R.id.table);
     arg1.setTag(holerView);
   } else {
     holerView = (HolerView) arg1.getTag();
   }
   RelativeLayout.LayoutParams param =
       (RelativeLayout.LayoutParams) holerView.table.getLayoutParams();
   param.height = mCommodityListView.getHeight() / 10;
   holerView.table.setLayoutParams(param);
   holerView.table.setText(mCommodityListData.get(arg0));
   if (mCommodityListFlg.get(arg0)) {
     holerView.table.setBackgroundResource(R.color.white);
   } else {
     holerView.table.setBackgroundResource(R.color.item_of);
   }
   return arg1;
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    list = new ListView(getActivity());
    list.setBackgroundColor(Color.WHITE);
    borrowedBooks = new ArrayList<>();

    // Initiate progressbar
    pb = new ProgressBar(getActivity()); // Init the progressbar
    pb.setId(1); // Give pb an id
    pb.setVisibility(View.INVISIBLE); // Set progressbar visibility

    // Progressbar details
    RelativeLayout.LayoutParams progressBarDetails =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    progressBarDetails.addRule(RelativeLayout.CENTER_HORIZONTAL);
    progressBarDetails.addRule(RelativeLayout.CENTER_VERTICAL);

    if (borrowedBooks.isEmpty()) {
      try {
        requestRequests(BookshelfConstants.CONNECTION_URI);
      } catch (JSONException e) {
        e.printStackTrace();
      }
    } else {
      updateDisplay();
    }
    return list;
  }
  @Override
  public void onGUICreate() {
    ApplicationScreen.getGUIManager().removeViews(modeSwitcher, R.id.specialPluginsLayout3);

    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

    if (!CameraController.isRemoteCamera()) {
      ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout3))
          .addView(this.modeSwitcher, params);
    }

    this.modeSwitcher.setLayoutParams(params);

    if (ModePreference.compareTo("0") == 0)
      ApplicationScreen.getGUIManager()
          .showHelp(
              "Dro help",
              ApplicationScreen.getAppResources().getString(R.string.Dro_Help),
              R.drawable.plugin_help_dro,
              "droShowHelp");
  }
  public void setSelected(int newState) {
    RelativeLayout.LayoutParams lp =
        (RelativeLayout.LayoutParams) mToggleSelector.getLayoutParams();
    lp.topMargin = (mTableLayout.getMeasuredHeight() - heightItem) / 2;
    lp.leftMargin = newState * widthItem + mTableLayout.getPaddingLeft();
    mToggleSelector.setLayoutParams(lp);

    if (Build.VERSION.SDK_INT < 11) {
      AlphaAnimation animation = new AlphaAnimation((float) 0.2, (float) 0.2);
      animation.setDuration(0);
      animation.setFillAfter(true);
      for (ImageView view : buttonList) {
        view.startAnimation(animation);
      }
      currentState = newState;
      animation = new AlphaAnimation(1, 1);
      animation.setDuration(0);
      animation.setFillAfter(true);
      buttonList.get(currentState).startAnimation(animation);
    } else {
      for (ImageView view : buttonList) {
        view.setAlpha((float) 0.2);
      }
      currentState = newState;
      buttonList.get(currentState).setAlpha((float) 1);
    }
  }
  public static void tryFlowText(
      SpannableStringBuilder ss, View thumbnailView, TextView messageView, Display display) {
    // There is nothing I can do for older versions, so just return
    if (!mNewClassAvailable) return;

    // Get height and width of the image and height of the text line
    thumbnailView.measure(display.getWidth(), display.getHeight());
    int height = thumbnailView.getMeasuredHeight();
    int width = thumbnailView.getMeasuredWidth();
    float textLineHeight = messageView.getPaint().getTextSize();

    // Set the span according to the number of lines and width of the image
    int lines = (int) Math.round(height / textLineHeight);
    // For an html text you can use this line: SpannableStringBuilder ss =
    // (SpannableStringBuilder)Html.fromHtml(text);
    ss.setSpan(new MyLeadingMarginSpan2(lines, width), 0, ss.length(), 0);
    messageView.setText(ss);

    // Align the text with the image by removing the rule that the text is
    // to the right of the image
    RelativeLayout.LayoutParams params =
        (RelativeLayout.LayoutParams) messageView.getLayoutParams();
    int[] rules = params.getRules();
    rules[RelativeLayout.RIGHT_OF] = 0;
  }
Exemple #19
0
 /** 距离屏幕左右的边距 */
 public EasyDialog setMarginLeftAndRight(int left, int right) {
   RelativeLayout.LayoutParams layoutParams =
       (RelativeLayout.LayoutParams) llContent.getLayoutParams();
   layoutParams.setMargins(left, 0, right, 0);
   llContent.setLayoutParams(layoutParams);
   return this;
 }
 protected void changePlayerScale(int displayMode) {
   setPlayerScale(displayMode);
   RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(playerWidth, playerHeight);
   params.addRule(RelativeLayout.CENTER_IN_PARENT);
   Log.e("MoboVideoView", playerWidth + "X" + playerHeight);
   mMoboVideoView.setLayoutParams(params);
 }
Exemple #21
0
  public UserDetail(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.linearlayout_userdetail, this);
    imageviewbili = (ImageView) findViewById(R.id.littletv);
    imageviewbili.setOnTouchListener(this);
    imageviewbili.setBackgroundResource(R.drawable.bili_up);
    ImageView usericon = (ImageView) findViewById(R.id.usericon);
    TextView textview = (TextView) findViewById(R.id.username);

    RelativeLayout.LayoutParams layoutParamsb =
        (RelativeLayout.LayoutParams) imageviewbili.getLayoutParams();
    layoutParamsb.height = (int) (MainActivity.window_height * 3 / 11 / 1.5);
    layoutParamsb.width = 270 * layoutParamsb.height / 208;
    imageviewbili.setLayoutParams(layoutParamsb);

    StyleController.contextinStyleController = context;
    setusernametextTheme(textview);
    data = getData();
    UserDetailAdapter adapter = new UserDetailAdapter(context);
    lv = (ListView) findViewById(R.id.userlv);
    lv.setAdapter(adapter);
    lv.setDividerHeight(1);
  }
  public void resetTouchFocus() {
    if (!mInitialized) return;

    splitMode = false;
    mMeteringIndicatorRotateLayout.setVisibility(View.GONE);

    // Put focus indicator to the center.
    RelativeLayout.LayoutParams p =
        (RelativeLayout.LayoutParams) mFocusIndicatorRotateLayout.getLayoutParams();
    int[] rules = p.getRules();
    rules[RelativeLayout.CENTER_IN_PARENT] = RelativeLayout.TRUE;
    p.setMargins(0, 0, 0, 0);

    mFocusArea = null;
    mMeteringArea = null;

    // allow driver to choose whatever it wants for focusing / metering
    // without these two lines Continuous focus is not re-enabled on HTC One
    int focusMode = getFocusMode();
    if ((focusMode == CameraParameters.AF_MODE_CONTINUOUS_PICTURE
            || focusMode == CameraParameters.AF_MODE_CONTINUOUS_VIDEO
            || focusMode == CameraParameters.AF_MODE_AUTO
            || focusMode == CameraParameters.AF_MODE_MACRO)
        && mFocusAreaSupported) {
      String modeName =
          PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext())
              .getString("defaultModeName", null);
      boolean isVideoRecording =
          PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext())
              .getBoolean("videorecording", false);
    }
  }
  private MonthView addMonth(int index, CalendarDays days, int height, boolean first) {
    layout = new RelativeLayout(getContext());
    layout.setLayoutParams(
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
    layout.setClickable(true);
    layout.setOnClickListener(clickListener);
    mv[index] = new MonthView(getContext());

    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    mv[index].setMonthIndex(index);
    mv[index].setLayoutParams(lp);
    mv[index].setDays(days, height);
    mv[index].setFocusable(false);
    mv[index].setOnDayClickListener(this);
    layout.addView(mv[index]);
    if (first) {
      addView(layout, 0);
    } else {
      addView(layout);
    }
    return mv[index];
  }
Exemple #24
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    View vi = convertView;
    if (vi == null) {
      vi = inflater.inflate(R.layout.row_chat_box, null);
    }
    try {
      JSONObject json_data = new JSONObject(data.get(position));
      LinearLayout right_delete_box = (LinearLayout) vi.findViewById(R.id.right_delete_box);
      LinearLayout left_delete_box = (LinearLayout) vi.findViewById(R.id.left_delete_box);
      LinearLayout row_box = (LinearLayout) vi.findViewById(R.id.row_box);
      LinearLayout chat_box = (LinearLayout) vi.findViewById(R.id.chat_box);
      RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) chat_box.getLayoutParams();
      int left = Math.round(100 * this.context.getResources().getDisplayMetrics().density);
      int top = Math.round(5 * this.context.getResources().getDisplayMetrics().density);
      int right = Math.round(10 * this.context.getResources().getDisplayMetrics().density);
      if (json_data.getString("sender_id").equals(jsonuser.getString(TblUsers.USER_ID))) {
        params.setMargins(left, top, right, top);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        row_box.setBackgroundResource(R.drawable.bg_chat_box);
        chat_box.findViewById(R.id.img_mark).setVisibility(View.VISIBLE);
        right_delete_box.setVisibility(View.GONE);
        left_delete_box.setVisibility(View.VISIBLE);

        if (json_data.getString("read").equals("0")) {
          chat_box.findViewById(R.id.img_mark).setVisibility(View.GONE);
        }
      } else {
        params.setMargins(right, top, left, top);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
        row_box.setBackgroundResource(R.drawable.bg_button_deactive);
        chat_box.findViewById(R.id.img_mark).setVisibility(View.GONE);
        right_delete_box.setVisibility(View.VISIBLE);
        left_delete_box.setVisibility(View.GONE);
      }

      if (ChatBoxActivity.allow_edit == 0) {
        right_delete_box.setVisibility(View.GONE);
        left_delete_box.setVisibility(View.GONE);
      }
      chat_box.setLayoutParams(params);

      right_delete_box.setClickable(true);
      right_delete_box.setOnClickListener(deleteMessage(position, data.get(position)));

      left_delete_box.setClickable(true);
      left_delete_box.setOnClickListener(deleteMessage(position, data.get(position)));

      ((TextView) vi.findViewById(R.id.chat_text)).setText(json_data.getString("conversation"));
      ((TextView) vi.findViewById(R.id.chat_text)).setAutoLinkMask(1);

      String timing_send =
          FormatDateTime.formatAutoGetDateTimeForMessage(json_data.getString("timing_send"));
      ((TextView) vi.findViewById(R.id.message_time)).setText(timing_send);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return vi;
  }
  public void add_car(int x, int y, int rotation, int state) {

    ImageView car = new ImageView(getActivity());

    carList.add(car);
    switch (state) {
      case 0:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher0));
        break;
      case 1:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher1));
        break;
      case 2:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher2));
        break;
      default:
        break;
    }

    RelativeLayout.LayoutParams layoutParams =
        new LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(x, y, 10, 10); // 150-1650/50-950
    car.setRotation(rotation);
    layout.addView(car, layoutParams);
  }
  private void setLinePositions(GridLayoutView glv) {

    // extend imgageView to bounds
    Bitmap bitmapy = BitmapFactory.decodeResource(getResources(), R.drawable.line_y);
    bitmapy = Bitmap.createScaledBitmap(bitmapy, glWidth, bitmapy.getHeight(), true);
    lineY.setImageBitmap(bitmapy);

    Bitmap bitmapx = BitmapFactory.decodeResource(getResources(), R.drawable.line_x);
    bitmapx = Bitmap.createScaledBitmap(bitmapx, bitmapx.getWidth(), glHeight, true);
    lineX.setImageBitmap(bitmapx);

    xParams = (RelativeLayout.LayoutParams) lineX.getLayoutParams();
    yParams = (RelativeLayout.LayoutParams) lineY.getLayoutParams();

    int positionLineXCentre = glv.getAxisXlines().get(glv.getGridSize() / 2).x;
    xParams.leftMargin =
        shapeStartPointX(glv.getZeroPosX(), glv.getLineSpacingX(), lineStartCoordX)
            - bitmapx.getWidth() / 2;
    lineX.setLayoutParams(xParams);

    int positionLineYCentre = glv.getAxisYlines().get(glv.getGridSize() / 2).y;
    yParams.topMargin =
        shapeStartPointY(glv.getZeroPosY(), glv.getLineSpacingY(), lineStartCoordY)
            - bitmapy.getHeight() / 2;
    lineY.setLayoutParams(yParams);
  }
  @Override
  public void onResume() {
    super.onResume();
    if (super.getUser().isQuickInsertActivity()) {
      RelativeLayout activityList = (RelativeLayout) findViewById(R.id.activitylist);

      RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      layoutParams.setMargins(0, 0, 0, 50);

      activityList.setLayoutParams(layoutParams);

      RelativeLayout quickActivityInsert = (RelativeLayout) findViewById(R.id.quickinsertactivity);
      quickActivityInsert.setVisibility(View.VISIBLE);

    } else {
      RelativeLayout activityList = (RelativeLayout) findViewById(R.id.activitylist);

      RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      layoutParams.setMargins(0, 0, 0, 0);

      activityList.setLayoutParams(layoutParams);

      RelativeLayout quickActivityInsert = (RelativeLayout) findViewById(R.id.quickinsertactivity);
      quickActivityInsert.setVisibility(View.GONE);
    }
  }
  private void addNewItems() {

    currentChildCount = getChildCount();
    parentLayout = false;
    int start = itemIds.size();
    int end = Math.min(start + screenMaxColumns * rows * 2, adapter.getCount());

    for (int i = start; i < end; i++) {
      int left = (i / rows) * (itemWidth + spaceHori);
      int top = (i % rows) * (spaceVert + itemHeight);
      RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(itemWidth, itemHeight);
      rlp.setMargins(left, top, 0, 0);
      View child = adapter.getView(i, null, this);
      this.addView(child, rlp);
      int viewId = child.getId();
      if (viewId == -1) {
        viewId = TvUtil.buildId();
        // 此处硬设置id同时建议开发者不用此范围id
      }
      child.setId(viewId);
      itemIds.put(viewId, i);
      bindEventOnChild(child, i);
      layoutFlag = true;
    }

    colCount = itemIds.size() % rows == 0 ? itemIds.size() / rows : itemIds.size() / rows + 1;
  }
  private void initView(View layout) {
    lamp = layout.findViewById(R.id.v_lamp);
    menuLv = (ListView) layout.findViewById(R.id.lv_menu);
    subjectLv = (ListView) layout.findViewById(R.id.lv_subject);
    foldBtn = layout.findViewById(R.id.ll_title_sp);
    foldContent = layout.findViewById(R.id.ll_lv_sp);
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) foldBtn.getLayoutParams();
    lp.leftMargin = location[0];
    lp.topMargin = location[1];
    foldBtn.setLayoutParams(lp);
    foldBtn.setOnClickListener(this);
    lamp.setOnClickListener(this);
    menuAdapter = new DataAdapter(getActivity().getBaseContext());

    menuAdapter.setData(allocateData());
    menuLv.setAdapter(menuAdapter);
    menuLv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            menuAdapter.checked(i);
            subjectAdapter.setData(allocateSubject());
            subjectAdapter.notifyDataSetChanged();
          }
        });
    subjectAdapter = new DataAdapter(getActivity().getBaseContext());
    subjectAdapter.checked(-1);
    subjectAdapter.setData(allocateSubject());
    subjectLv.setAdapter(subjectAdapter);
  }
Exemple #30
0
  /** Adds a hint button to the keyboard */
  private void addHintButton() {
    // now adds button to show hint
    RelativeLayout rl = (RelativeLayout) findViewById(R.id.gra_layout);
    RelativeLayout.LayoutParams lp = createButtonLayoutParams();

    Button btn = createButton("hint", 35, null);
    final Button btnfinal = btn;
    btn.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            TextView textView1 = (TextView) findViewById(R.id.text_message);
            if (!hintOn) {
              showHint();
              changeButtonBackground(btnfinal, R.drawable.small_button_clicked, 100);
              hintOn = true;
            } else {
              textView1.setText("");
              changeButtonBackground(btnfinal, R.drawable.small_button, 100);
              hintOn = false;
            }
          }
        });
    lp.addRule(RelativeLayout.RIGHT_OF, 34);
    lp.addRule(RelativeLayout.BELOW, 30);
    rl.addView(btn, lp);
  }