예제 #1
1
  void getLayoutCache() {
    final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);
    View view1 = (View) parent.findViewById(R.id.view1);
    View view2 = (View) parent.findViewById(R.id.view2);
    View view3 = (View) parent.findViewById(R.id.view3);
    View view4 = (View) parent.findViewById(R.id.view4);
    View view5 = (View) parent.findViewById(R.id.view5);
    View view12 = (View) parent.findViewById(R.id.view12);

    String firstColumn = view2.getLeft() + "," + view2.getRight();
    layoutCache.put(firstColumn, new HashMap<String, Integer>());
    String secondColumn = view1.getLeft() + "," + view1.getRight();
    layoutCache.put(secondColumn, new HashMap<String, Integer>());
    String thirdColumn = view4.getLeft() + "," + view4.getRight();
    layoutCache.put(thirdColumn, new HashMap<String, Integer>());
    String firstRow = view3.getTop() + "," + view3.getBottom();
    layoutCache.get(firstColumn).put(firstRow, 1);
    layoutCache.get(secondColumn).put(firstRow, 2);
    layoutCache.get(thirdColumn).put(firstRow, 3);
    String secondRow = view5.getTop() + "," + view5.getBottom();
    layoutCache.get(firstColumn).put(secondRow, 4);
    layoutCache.get(secondColumn).put(secondRow, 5);
    layoutCache.get(thirdColumn).put(secondRow, 6);
    String thirdRow = view12.getTop() + "," + view12.getBottom();
    layoutCache.get(firstColumn).put(thirdRow, 7);
    layoutCache.get(secondColumn).put(thirdRow, 8);
    layoutCache.get(thirdColumn).put(thirdRow, 9);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final Button runButton = new Button(this);
    runButton.setText("Run away!");

    final RelativeLayout runLayout = (RelativeLayout) findViewById(R.id.runLayout);
    runLayout.addView(runButton);

    final RelativeLayout.LayoutParams buttonParams =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    runButton.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Random rand = new Random();
            buttonParams.leftMargin = rand.nextInt(runLayout.getWidth() - 100);
            buttonParams.topMargin = rand.nextInt(runLayout.getHeight() - 100);

            runButton.setLayoutParams(buttonParams);
          }
        });
  }
  @Override
  public void onClick(View v) {
    SharedPreferences gameSettings = getSharedPreferences(GAME_SETTING_PREFS, 0);
    SharedPreferences.Editor editor = gameSettings.edit();

    if (v.getId() == R.id.playBtn) {
      Intent nextIntent;

      SharedPreferences gameState = getSharedPreferences(GameActivity.GAME_STATE_PREFS, 0);
      final int currLevel = gameState.getInt(GameActivity.STATE_LEVEL, 0);

      nextIntent = new Intent(this, GameActivity.class);
      MediaController.stopLoopingSound();

      // startNext intent
      startActivity(nextIntent);
    } else if (v.getId() == R.id.settings_btn) {
      RelativeLayout settingsWrap = (RelativeLayout) findViewById(R.id.other_settings_buttons_wrap);
      if (View.GONE == settingsWrap.getVisibility()) {
        settingsWrap.setVisibility(View.VISIBLE);
      } else {
        settingsWrap.setVisibility(View.GONE);
      }
    } else if (v.getId() == R.id.toggle_sound) {
      boolean soundEdit = gameSettings.getBoolean(SOUND_PREF, true);
      editor.putBoolean(SOUND_PREF, !soundEdit);
      editor.commit();

      if (soundEdit) {
        Toast.makeText(getApplicationContext(), "Sound is turned off", Toast.LENGTH_SHORT).show();
        MediaController.stopLoopingSound();
      } else {
        Toast.makeText(getApplicationContext(), "Sound is turned on", Toast.LENGTH_SHORT).show();
        MediaController.playSoundClip(this, R.raw.background_intro, true);
      }
    } else if (v.getId() == R.id.toggle_vibration) {
      boolean vibrateEdit = gameSettings.getBoolean(VIBRATE_PREF, true);
      editor.putBoolean(VIBRATE_PREF, !vibrateEdit);

      String vibrateState = (!vibrateEdit) ? "on" : "off";
      Toast.makeText(
              getApplicationContext(), "Vibration is turned " + vibrateState, Toast.LENGTH_SHORT)
          .show();
    } else if (v.getId() == R.id.show_credits) {
      new GameAlertDialogBuilder(this)
          .setTitle("Credits")
          .setMessage(this.getResources().getString(R.string.credits))
          .setPositiveButton(
              android.R.string.no,
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                  dialog.cancel();
                }
              })
          .show();
    }
    editor.commit();

    updateColorOfSettingsButtons();
  }
  @Override
  public void onQueryTabsComplete(List<TabsAccessor.RemoteTab> tabsList) {
    ArrayList<TabsAccessor.RemoteTab> tabs = new ArrayList<TabsAccessor.RemoteTab>(tabsList);
    if (tabs == null || tabs.size() == 0) {
      mRemoteTabs.hide();
      return;
    }

    mRemoteTabs.clear();

    String client = null;

    for (TabsAccessor.RemoteTab tab : tabs) {
      if (client == null) client = tab.name;
      else if (!TextUtils.equals(client, tab.name)) break;

      final RelativeLayout row =
          (RelativeLayout)
              mInflater.inflate(
                  R.layout.abouthome_remote_tab_row, mRemoteTabs.getItemsContainer(), false);
      ((TextView) row.findViewById(R.id.remote_tab_title))
          .setText(TextUtils.isEmpty(tab.title) ? tab.url : tab.title);
      row.setTag(tab.url);
      mRemoteTabs.addItem(row);
      row.setOnClickListener(mRemoteTabClickListener);
    }

    mRemoteTabs.setSubtitle(client);
    mRemoteTabs.show();
  }
  @Override
  public void start() {
    super.start();

    AbstractGameView gameView = GameManager.createGame(gameName, act);

    RelativeLayout mainContentHolder;
    LinearLayout dismissAlarmLayout;

    mainContentHolder = (RelativeLayout) act.findViewById(R.id.mainContentLayout);
    dismissAlarmLayout = (LinearLayout) act.findViewById(R.id.dismissAlarmLayout);

    // Make the holder for dismiss/snooze alarm buttons invisible while the game is running.
    dismissAlarmLayout.setVisibility(View.GONE);
    mainContentHolder.addView(gameView);

    // Adding all views that build the games UI after the surfaceView has been added.
    // Otherwise the UI views would all get stuck under the surface view.
    List<View> uiList = gameView.getUIComponents();
    if (uiList != null) {
      for (View v : uiList) {
        mainContentHolder.addView(v);
      }
    }
    gameView.resume();
  }
 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);
   }
 }
  /** @param constantLayoutHeight */
  private void configLoginLogout(int constantLayoutHeight) {
    /*
     * Login/Logut
     */
    RelativeLayout logOut = (RelativeLayout) rootView.findViewById(R.id.log_out_field);
    logOut.getLayoutParams().height = constantLayoutHeight;
    SCUserController userController = SCUserController.getInstance();

    if (!userController.isLogin()) {
      ((TextView) rootView.findViewById(R.id.logout_id)).setText("Log in");
    }
    logOut.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            SCUserController soundCloudUserController = SCUserController.getInstance();
            soundCloudUserController.logout();
            SCLoginDatabaseTable databaseHandler = SCLoginDatabaseTable.getInstance(getActivity());
            databaseHandler.clearTable();
            Intent loginAct = new Intent(getActivity(), UserLoginActivity.class);
            startActivity(loginAct);
          }
        });
  }
예제 #8
0
  private void init() {
    // 设置点击屏幕外不消失
    setCanceledOnTouchOutside(false);
    // 设置是否可通过返回键关闭
    this.setCancelable(cancelable);

    View view = LayoutInflater.from(context).inflate(R.layout.my_load_progress, null); // 加载自己定义的布局
    // 文字提示
    TextView my_progress_msg = (TextView) view.findViewById(R.id.my_progress_msg);
    img_loading = (ImageView) view.findViewById(R.id.my_progress_load_img);
    RelativeLayout img_close = (RelativeLayout) view.findViewById(R.id.my_progress_img_cancel);
    // 设置文字提示
    my_progress_msg.setText(msg);
    // 加载自定义动画
    rotateAnimation =
        (RotateAnimation) AnimationUtils.loadAnimation(context, R.anim.progress_refresh);
    // 开始动画
    img_loading.setAnimation(rotateAnimation);
    // 为Dialoge设置自己定义的布局
    setContentView(view);
    // 为close按钮添加事件
    img_close.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            dismiss();
          }
        });
  }
예제 #9
0
  private void dialog() {

    LayoutInflater inflater = LayoutInflater.from(activity);
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.exit_dialog, null);

    dialog = new AlertDialog.Builder(activity).create();
    dialog.setCancelable(false);
    dialog.show();
    dialog.getWindow().setContentView(layout);

    Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel);
    Button drop_out = (Button) layout.findViewById(R.id.drop_out);

    drop_out.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
            activity.finish();
          }
        });
    exit_cancel.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
예제 #10
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);
  }
예제 #11
0
 public void initView() {
   // 设置标题
   RelativeLayout rLayout =
       (RelativeLayout) findViewById(R.id.notice_prizes_single_specific_main_relative01);
   rLayout.setVisibility(RelativeLayout.VISIBLE);
   TextView noticePrizesTitle =
       (TextView) findViewById(R.id.notice_prizes_single_specific_title_id);
   noticePrizesTitle.setText(R.string.jingcai_kaijianggonggao);
   noticePrizesTitle.setTextSize(20);
   // 返回主列表
   reBtn = (Button) findViewById(R.id.notice_prizes_single_specific_main_returnID);
   if (dateShow.length == 0) {
     reBtn.setClickable(false);
   } else {
     reBtn.setClickable(true);
   }
   reBtn.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           // TODO Auto-generated method stub
           showBatchcodesDialog();
         }
       });
 }
예제 #12
0
 public void setBackGround(Drawable drawable) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     drawContainer.setBackground(drawable);
   } else {
     drawContainer.setBackgroundDrawable(drawable);
   }
 }
예제 #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.user_friends);
    m = new Menu(this);
    sess = new Session(FriendList.this);
    HashMap<String, String> map = sess.getUserDetails();
    idd = map.get(Session.KEY_ID);
    il = new ImageLoader(FriendList.this);
    try {
      HashMap<String, Integer> map2 = sess.getBG();
      int st = map2.get(Session.KEY_POS);
      Log.i("jkkk", "" + st);
      RelativeLayout rel = (RelativeLayout) findViewById(R.id.rel);
      rel.setBackgroundResource(icons[st]);
    } catch (Exception e) {
      e.printStackTrace();
    }
    list1 = (GridView) findViewById(R.id.gridView1);

    friend();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.package.ACTION_LOGOUT");
    registerReceiver(log, intentFilter);
  }
예제 #14
0
  void clearImageViews() {
    final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);
    try {
      for (int i = 1; i < 10; i++) {

        String action1 = zero + i;
        String action2 = X + i;
        final ImageView view1 =
            (ImageView) parent.findViewById((R.id.class.getField(action1).getInt(null)));
        view1.setVisibility(View.INVISIBLE);
        final ImageView view2 =
            (ImageView) parent.findViewById((R.id.class.getField(action2).getInt(null)));
        view2.setVisibility(View.INVISIBLE);
      }
      /*
       * final View winner = (View)
       * parent.findViewById(R.id.class.getField( "winner").getInt(null));
       * winner.setVisibility(View.INVISIBLE); final View tie = (View)
       * parent.findViewById(R.id.class.getField( "tie").getInt(null));
       * tie.setVisibility(View.INVISIBLE);
       */
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #15
0
 private void initCrossLines() {
   getImageCordinates();
   final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);
   result1 = new DrawView(this, coordinatesMap.get(1), coordinatesMap.get(3));
   result1.setVisibility(View.INVISIBLE);
   result2 = new DrawView(this, coordinatesMap.get(4), coordinatesMap.get(6));
   result2.setVisibility(View.INVISIBLE);
   result3 = new DrawView(this, coordinatesMap.get(7), coordinatesMap.get(9));
   result3.setVisibility(View.INVISIBLE);
   result4 = new DrawView(this, coordinatesMap.get(1), coordinatesMap.get(7));
   result4.setVisibility(View.INVISIBLE);
   result5 = new DrawView(this, coordinatesMap.get(2), coordinatesMap.get(8));
   result5.setVisibility(View.INVISIBLE);
   result6 = new DrawView(this, coordinatesMap.get(3), coordinatesMap.get(9));
   result6.setVisibility(View.INVISIBLE);
   result7 = new DrawView(this, coordinatesMap.get(3), coordinatesMap.get(7));
   result7.setVisibility(View.INVISIBLE);
   result8 = new DrawView(this, coordinatesMap.get(1), coordinatesMap.get(9));
   result8.setVisibility(View.INVISIBLE);
   parent.addView(result1);
   parent.addView(result2);
   parent.addView(result3);
   parent.addView(result4);
   parent.addView(result5);
   parent.addView(result6);
   parent.addView(result7);
   parent.addView(result8);
 }
예제 #16
0
 @SuppressWarnings("deprecation")
 public static RelativeLayout newTransparentRelativeLayout(Context context) {
   RelativeLayout layout = new RelativeLayout(context);
   layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
   layout.setBackgroundDrawable(null);
   return layout;
 }
예제 #17
0
 /** 是否隐藏期号 */
 public void isIssue(boolean isVisble) {
   if (isVisble) {
     relativeLayout.setVisibility(RelativeLayout.INVISIBLE);
   } else {
     relativeLayout.setVisibility(RelativeLayout.GONE);
   }
 }
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    final int y = (int) event.getY();
    mBounceHack = false;

    switch (event.getAction()) {
      case MotionEvent.ACTION_UP:
        if (!isVerticalScrollBarEnabled()) {
          setVerticalScrollBarEnabled(true);
        }
        if (getFirstVisiblePosition() == 0 && mRefreshState != REFRESHING) {
          if ((mRefreshView.getBottom() >= mRefreshViewHeight || mRefreshView.getTop() >= 0)
              && mRefreshState == RELEASE_TO_REFRESH) {
            // Initiate the refresh
            mRefreshState = REFRESHING;
            prepareForRefresh();
            onRefresh();
          } else if (mRefreshView.getBottom() < mRefreshViewHeight || mRefreshView.getTop() <= 0) {
            // Abort refresh and scroll down below the refresh view
            resetHeader();
            setSelection(1);
          }
        }
        break;
      case MotionEvent.ACTION_DOWN:
        mLastMotionY = y;
        break;
      case MotionEvent.ACTION_MOVE:
        applyHeaderPadding(event);
        break;
    }
    return super.onTouchEvent(event);
  }
예제 #19
0
  @Override
  protected void dispatchDraw(Canvas canvas) {
    if (mShowcaseX < 0 || mShowcaseY < 0 || mIsRedundant) {
      super.dispatchDraw(canvas);
      return;
    }

    boolean recalculatedCling = mShowcaseDrawer.calculateShowcaseRect(mShowcaseX, mShowcaseY);
    boolean recalculateText = recalculatedCling || mAlteredText;
    mAlteredText = false;

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && !mHasNoTarget) {
      Path path = new Path();
      path.addCircle(mShowcaseX, mShowcaseY, mShowcaseRadius, Path.Direction.CW);
      canvas.clipPath(path, Op.DIFFERENCE);
    }

    // Draw background color
    canvas.drawColor(mBackgroundColor);

    // Draw the showcase drawable
    if (!mHasNoTarget) {
      mShowcaseDrawer.drawShowcase(
          canvas, mShowcaseX, mShowcaseY, mScaleMultiplier, mShowcaseRadius);
    }

    // Draw the text on the screen, recalculating its position if necessary
    if (recalculateText) {
      mTextDrawer.calculateTextPosition(canvas.getWidth(), canvas.getHeight(), this);
    }
    mTextDrawer.draw(canvas, recalculateText);

    super.dispatchDraw(canvas);
  }
 /** Sets the header padding back to original size. */
 private void resetHeaderPadding() {
   mRefreshView.setPadding(
       mRefreshView.getPaddingLeft(),
       mRefreshOriginalTopPadding,
       mRefreshView.getPaddingRight(),
       mRefreshView.getPaddingBottom());
 }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreateView(inflater, container, savedInstanceState);
   RelativeLayout root =
       (RelativeLayout) inflater.inflate(R.layout.fragment_networks_list, container, false);
   listview = (ListView) root.findViewById(R.id.networks_list);
   wifiListAdapter = new WifiListAdapter(getActivity());
   listview.setAdapter(wifiListAdapter);
   noNetworksMessage = root.findViewById(R.id.message_group);
   if (savedInstanceState != null) {
     if (savedInstanceState.containsKey(NETWORKS_FOUND)) {
       Parcelable[] storedNetworksFound = savedInstanceState.getParcelableArray(NETWORKS_FOUND);
       networksFound = new WiFiNetwork[storedNetworksFound.length];
       for (int i = 0; i < storedNetworksFound.length; ++i)
         networksFound[i] = (WiFiNetwork) storedNetworksFound[i];
       onScanFinished(networksFound);
     }
     if (savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
       setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
     }
   }
   registerForContextMenu(listview);
   listview.setOnItemClickListener(this);
   return root;
 }
예제 #22
0
  private void InitControl() {
    find_user_panel = (RelativeLayout) findViewById(R.id.find_user_panel);
    tab_interested_friend = (RadioGroup) findViewById(R.id.tab_interested_friend);
    search_layout = (RelativeLayout) findViewById(R.id.search_layout);
    btn_Addfriend = (Button) findViewById(R.id.btn_Addfriend);
    btn_Back = (Button) findViewById(R.id.btn_Back);
    list_user = (ListView) findViewById(R.id.lst_friend);
    txt_find_user = (EditText) findViewById(R.id.txt_find_user);
    btn_FindUser = (Button) findViewById(R.id.btn_find_user);
    title_view = (TextView) findViewById(R.id.feature_title_txt);
    loading_panel = (RelativeLayout) findViewById(R.id.loading_panel);
    btn_Clear = (Button) findViewById(R.id.btn_Clear_find_user);
    empty_layout = (RelativeLayout) findViewById(R.id.empty_layout);
    empty_icon = (ImageView) findViewById(R.id.empty_icon);
    empty_label = (TextView) findViewById(R.id.empty_label);

    title_view.setText(R.string.find_friend);
    find_user_panel.setVisibility(View.VISIBLE);
    tab_interested_friend.setVisibility(View.GONE);
    search_layout.setVisibility(View.GONE);
    btn_Addfriend.setVisibility(View.GONE);
    list_user.setVisibility(View.GONE);
    btn_Back.setOnClickListener(onbackListener);
    btn_FindUser.setOnClickListener(onFindListener);
    btn_Clear.setOnClickListener(onClearListener);
    txt_find_user.setOnKeyListener(ontxtFindListener);
  }
  /** @param constantLayoutHeight */
  private void configMySC(int constantLayoutHeight) {
    /*
     * My SoundCloud
     */
    RelativeLayout mySoundCloudLayout =
        (RelativeLayout) rootView.findViewById(R.id.acc_soundcloud_field);
    mySoundCloudLayout.getLayoutParams().height = constantLayoutHeight;

    mySoundCloudLayout.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            MusicPlayerMainActivity.type = MusicPlayerMainActivity.MY_SOUNDCLOUD;
            Intent i = new Intent(getActivity(), MusicPlayerMainActivity.class);
            SCUserController soundCloudUserController = SCUserController.getInstance();

            Bundle bundle;
            try {
              bundle =
                  soundCloudUserController.getBundle(soundCloudUserController.getCurrentUser());
              i.putExtra(USER, bundle);
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }

            // i.putExtra(ME_FAVORITES,stringResponse);
            MusicPlayerMainActivity.getActivity().finish();
            startActivity(i);
          }
        });
  }
  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();
  }
 public void setScreenOrientation(boolean isFullScreen, int screenOritation) {
   DisplayMetrics metrics = getResources().getDisplayMetrics();
   if (isFullScreen) {
     Log.i("jiangtao4", "activity onToggleFullScreen");
     video_down_layout.setVisibility(View.GONE);
     FrameLayout.LayoutParams layoutParams =
         new FrameLayout.LayoutParams(
             FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
     mVideoView.setLayoutParams(layoutParams);
     width = metrics.widthPixels;
     height = metrics.heightPixels;
     mVideoView.setDimensions(height, width);
   } else {
     video_down_layout.setVisibility(View.VISIBLE);
     FrameLayout.LayoutParams layoutParams =
         new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, 200);
     mVideoView.setLayoutParams(layoutParams);
     // 屏幕旋转后,宽高相反
     height = (int) (metrics.widthPixels * (3 / (8 * 1.0f)));
     width = metrics.heightPixels;
     mVideoView.setDimensions(width, height);
   }
   mVideoView.setIsFullScreen(isFullScreen);
   setRequestedOrientation(screenOritation);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    // Turn off the window's title bar
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Super
    super.onCreate(savedInstanceState);

    // Fullscreen mode
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // We create our Surfaceview for our OpenGL here.
    glSurfaceView = new GLSurf(this);

    // Set our view.
    setContentView(R.layout.activity_main);

    // Retrieve our Relative layout from our main layout we just set to our view.
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.gamelayout);

    // Attach our surfaceview to our relative layout from our main layout.
    RelativeLayout.LayoutParams glParams =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    layout.addView(glSurfaceView, glParams);
  }
예제 #27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_info);

    mainLayout = (RelativeLayout) findViewById(R.id.infoRelativeLayout);

    nameView = (EditText) findViewById(R.id.infoItemName);
    dayView = (EditText) findViewById(R.id.infoDay);
    monthView = (EditText) findViewById(R.id.infoMonth);
    yearView = (EditText) findViewById(R.id.infoYear);
    quantityView = (EditText) findViewById(R.id.infoQuantityEdit);
    commentsView = (EditText) findViewById(R.id.infoComment);

    completionBar = (SeekBar) findViewById(R.id.infoCompletionEdit);

    completionUpdate = (TextView) findViewById(R.id.infoCompletionDisplay);

    if (quantity == 1) {
      mainLayout.removeView(completionBar);
      mainLayout.removeView(completionUpdate);
    } else {
      completionBar.setMax(quantity);
      completionBar.setProgress(completion);
      completionUpdate.setText("" + completion + "/" + quantity);
    }
  }
예제 #28
0
  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];
  }
예제 #29
0
 @Override
 public void getViews() {
   RelativeLayout titlebar = (RelativeLayout) findViewById(R.id.detail_titlebar);
   titleBack = (Button) titlebar.findViewById(R.id.titlebar_back);
   titleName = (TextView) titlebar.findViewById(R.id.titlebar_name);
   titleHome = (Button) titlebar.findViewById(R.id.titlebar_home);
   userinfo = (LinearLayout) findViewById(R.id.detail_userinfo);
   icon = (ImageView) findViewById(R.id.detail_icon);
   v = (ImageView) findViewById(R.id.detail_v);
   name = (TextView) findViewById(R.id.detail_name);
   content = (TextView) findViewById(R.id.detail_content);
   pic = (ImageView) findViewById(R.id.detail_pic);
   sub = (LinearLayout) findViewById(R.id.detail_sub);
   subContent = (TextView) findViewById(R.id.detail_subContent);
   subPic = (ImageView) findViewById(R.id.detail_subPic);
   subRedirect = (LinearLayout) findViewById(R.id.detail_subRedirect);
   subRedirectNum = (TextView) findViewById(R.id.detail_sub_redirectNum);
   subComment = (LinearLayout) findViewById(R.id.detail_subComent);
   subCommentNum = (TextView) findViewById(R.id.detail_sub_commentNum);
   redirect_bt = (Button) findViewById(R.id.detail_redirect_bt);
   comment_bt = (Button) findViewById(R.id.detail_comment_bt);
   time = (TextView) findViewById(R.id.detail_time);
   source = (TextView) findViewById(R.id.detail_from);
   refresh = (Button) findViewById(R.id.detail_refresh);
   comment = (Button) findViewById(R.id.detail_comment);
   redirect = (Button) findViewById(R.id.detail_redirect);
   favorite = (Button) findViewById(R.id.detail_favorite);
   weibodel = (Button) findViewById(R.id.detail_del);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_message);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    Intent intent = getIntent();
    String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE);
    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText(message);

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.content);
    layout.addView(textView);
  }