コード例 #1
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != RESULT_OK) return;

    switch (requestCode) {
      case PHOTO_PICKED_WITH_DATA: // 从本地选择图片
        if (bitMap != null && !bitMap.isRecycled()) {
          bitMap.recycle();
        }
        Uri selectedImageUri = data.getData();
        if (selectedImageUri != null) {
          try {
            bitMap =
                BitmapFactory.decodeStream(getContentResolver().openInputStream(selectedImageUri));

            bitMap = ImageUtil.zoomBitmap(bitMap, 80, 80);
          } catch (FileNotFoundException e) {
            e.printStackTrace();
          }

          // 下面这两句是对图片按照一定的比例缩放,这样就可以完美地显示出来。有关图片的处理将重新写文章来介绍。
          //				int scale = ImageThumbnail.reckonThumbnail(bitMap.getWidth(),
          //						bitMap.getHeight(), 500, 600);
          //
          //				bitMap = ImageThumbnail.PicZoom(bitMap,
          //						(int) (bitMap.getWidth() / scale),
          //						(int) (bitMap.getHeight() / scale));

          //				photoView.setImageBitmap(bitMap);
          BitmapDrawable bd = new BitmapDrawable(bitMap);
          photoView.setBackgroundDrawable(bd);

          hasImage = true;
        }
        break;
      case CAMERA_WITH_DATA: // 拍照
        Bundle bundle = data.getExtras();
        bitMap = (Bitmap) bundle.get("data");
        if (bitMap != null) bitMap.recycle();

        bitMap = (Bitmap) data.getExtras().get("data");
        //			int scale = ImageThumbnail.reckonThumbnail(bitMap.getWidth(),
        //					bitMap.getHeight(), 500, 600);
        //
        //			bitMap = ImageThumbnail.PicZoom(bitMap,
        //					(int) (bitMap.getWidth() / scale),
        //					(int) (bitMap.getHeight() / scale));

        //			photoView.setImageBitmap(null);
        //			photoView.setImageBitmap(bitMap);
        BitmapDrawable bd = new BitmapDrawable(bitMap);
        photoView.setBackgroundDrawable(bd);
        hasImage = true;

        break;
    }
  }
コード例 #2
0
ファイル: EditPage.java プロジェクト: sunzhaochang/CoolMaking
  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;
  }
コード例 #3
0
ファイル: PicCom.java プロジェクト: saksaer/InstaGrand
  /** Run when the Activity begins. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    RelativeLayout rel = (RelativeLayout) findViewById(R.id.theRel);
    GradientDrawable qgd =
        new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0xFF00284D, 0xFF000000});
    rel.setBackgroundDrawable(qgd);
    Button post = (Button) findViewById(R.id.button1);
    GradientDrawable qgd2 =
        new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0xFF004684, 0xFF00284D});
    post.setBackground(qgd2);
    // The Code below is for retrieving the PictureItem to be viewed from a Parcel
    // Bundle b = this.getIntent().getExtras();
    // PictureItem p = null;
    // if (b != null){
    // p = b.getParcelable("picItem");
    // }
    // setPic(p);

    // The code below is for retrieving the PictureItem directly from a static variable
    setPic(MainActivity.currPicture);
  }
コード例 #4
0
  /** 设置转发feed的视图的可见性 */
  private void setForwardViewVisibility(FeedItem item) {
    // 显示转发视图
    mForwardLayout.setVisibility(View.VISIBLE);
    mForwardLayout.setPadding(10, 10, 10, 10);
    mForwardLayout.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            mPresenter.clickOriginFeedItem(mFeedItem);
          }
        });
    if (mImageGv != null) {
      mImageGv.setPadding(10, 2, 10, 10);
    }

    // 转发视图的背景
    mForwardLayout.setBackgroundDrawable(ResFinder.getDrawable("umeng_comm_forward_bg"));
    // 被转发的文本
    mForwardTextTv.setVisibility(View.VISIBLE);
    mForwardTextTv.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            mPresenter.clickOriginFeedItem(mFeedItem);
          }
        });

    // 隐藏位置图标
    mLocationImgView.setVisibility(View.GONE);
    mLocationTv.setVisibility(View.GONE);
  }
コード例 #5
0
 public void setBackGround(Drawable drawable) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     drawContainer.setBackground(drawable);
   } else {
     drawContainer.setBackgroundDrawable(drawable);
   }
 }
コード例 #6
0
ファイル: ViewUtils.java プロジェクト: bblue000/ExoPlayerDemo
 @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;
 }
コード例 #7
0
 @Override
 public void setBackground(Drawable background) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     mSearchTopBar.setBackground(background);
   } else {
     mSearchTopBar.setBackgroundDrawable(background);
   }
 }
コード例 #8
0
  @SuppressWarnings("deprecation")
  private void disableButtons() {
    mLoadButtonContainer.setEnabled(false);
    mLoadImageButton.setEnabled(false);

    mPurgeButtonContainer.setEnabled(false);
    mPurgeImageButton.setEnabled(false);

    mLoadButtonContainer.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.curve_border_disabled_button));
    mPurgeButtonContainer.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.curve_border_disabled_button));

    mLoadImageButton.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.left_border_disabled_part_of_button));
    mPurgeImageButton.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.left_border_disabled_part_of_button));
  }
コード例 #9
0
ファイル: Personal.java プロジェクト: aaron875499765/Master
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.personal);

    //////////////////
    Bitmap bm = BitmapFactory.decodeResource(this.getResources(), R.drawable.background_personal);
    BitmapDrawable bd = new BitmapDrawable(this.getResources(), bm);
    allLayout = (RelativeLayout) findViewById(R.id.layout_personal);
    allLayout.setBackgroundDrawable(bd);
    //////////////////

    btnPersonal = (Button) findViewById(R.id.btnPersonal);
    btnExpert = (Button) findViewById(R.id.btnExpert);
    btnMessage = (Button) findViewById(R.id.btnMessage);

    btnPersonal.setOnClickListener(new MyButtonOnClickListener());
    btnExpert.setOnClickListener(new MyButtonOnClickListener());
    btnMessage.setOnClickListener(new MyButtonOnClickListener());

    //////////////////
    final SlidingMenu menu = new SlidingMenu(this);
    btnDetails = (Button) findViewById(R.id.btnDetails);
    btnDetails.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            menu.toggle();
          }
        });
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.drawable.shadow);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setBehindWidth(500);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.sliding_detalis);
    //////////////////

    btnPersonalData = (Button) findViewById(R.id.btnPersonalData);
    btnEveryDay = (Button) findViewById(R.id.btnEveryDay);
    btnMyPlan = (Button) findViewById(R.id.btnMyPlan);
    btnMyTeacher = (Button) findViewById(R.id.btnMyTeacher);
    btnMyCollection = (Button) findViewById(R.id.btnMyCollection);
    btnMyCard = (Button) findViewById(R.id.btnMyCard);

    btnPersonalData.setOnClickListener(new MyButtonOnClickListener());
    btnEveryDay.setOnClickListener(new MyButtonOnClickListener());
    btnMyPlan.setOnClickListener(new MyButtonOnClickListener());
    btnMyTeacher.setOnClickListener(new MyButtonOnClickListener());
    btnMyCollection.setOnClickListener(new MyButtonOnClickListener());
    btnMyCard.setOnClickListener(new MyButtonOnClickListener());
  }
コード例 #10
0
 /**
  * *** 判断字符串中有没有英文
  *
  * @param text
  * @return
  */
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (progress != null && !isFinishing()) {
     progress.dismiss();
   }
   progress = null;
   playerMainLayout.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
   if (bgTempbm != null && !bgTempbm.isRecycled()) bgTempbm.recycle();
   bgTempbm = null;
 }
コード例 #11
0
  public Leaderboard(Context context, String kind, String selectedContest) {
    super(context, R.style.ThemeBeintoo);
    setContentView(R.layout.leaderboardlist);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    this.current = this;
    this.currentContext = context;
    this.leader_kind = kind;
    this.codeID = selectedContest;

    // GETTING DENSITY PIXELS RATIO
    ratio = (context.getApplicationContext().getResources().getDisplayMetrics().densityDpi / 160d);
    // SET UP LAYOUTS
    double pixels = ratio * 40;
    RelativeLayout beintooBar = (RelativeLayout) findViewById(R.id.beintoobarsmall);
    beintooBar.setBackgroundDrawable(
        new BDrawableGradient(0, (int) pixels, BDrawableGradient.BAR_GRADIENT));

    listView = (ListView) findViewById(R.id.listView);
    listView.setVisibility(LinearLayout.GONE);
    listView.setCacheColorHint(0);

    LinearLayout content = (LinearLayout) findViewById(R.id.goodcontent);
    content.addView(progressLoading());

    LinearLayout tip = (LinearLayout) findViewById(R.id.tip);
    tip.setBackgroundDrawable(
        new BDrawableGradient(0, (int) (ratio * 27), BDrawableGradient.LIGHT_GRAY_GRADIENT));
    if (!Beintoo.isLogged(
        context)) { // IF THE USER IS NOT LOGGED HIDE TIPS FOR CHALLENGE AND SHOW SIGNUP BUTTON
      tip.setVisibility(LinearLayout.GONE);
      LinearLayout signup = (LinearLayout) findViewById(R.id.signupPlayer);
      signup.addView(SignupLayouts.signupRow(context, Beintoo.FEATURE_LEADERBOARD));
      signup.setVisibility(View.VISIBLE);
    }

    if (leader_kind != null && leader_kind.equals("ALLIANCES")) {
      findViewById(R.id.tip).setVisibility(View.GONE);
      findViewById(R.id.spacer).setVisibility(View.GONE);
    }

    imageManager = new ImageManager(currentContext);
    usersExts = new ArrayList<String>();
    usersNicks = new ArrayList<String>();

    listView.setOnItemClickListener(this);
    listView.setOnScrollListener(this);

    this.firstLoading();
  }
コード例 #12
0
ファイル: SlotMachineActivity.java プロジェクト: n2a5me/NS
 private void initView() {
   // TODO Auto-generated method stub
   setContentView(R.layout.slot_machine_layout);
   slotmachineLayout = (RelativeLayout) findViewById(R.id.slotmachineLayout);
   Drawable themeDrawable = Drawable.createFromPath(theme);
   ImageView logoBlink = (ImageView) findViewById(R.id.logoBlink);
   Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.tween);
   logoBlink.startAnimation(myFadeInAnimation);
   slotmachineLayout.setBackgroundDrawable(themeDrawable);
   wheel1 = initWheel(R.id.slot_1);
   wheel2 = initWheel(R.id.slot_2);
   wheel3 = initWheel(R.id.slot_3);
   onStartSpin();
 }
コード例 #13
0
 public void setImage(String bitmapLocation) {
   this.bitmapLocation = bitmapLocation;
   if (bitmapLocation == null || bitmapLocation.equals("")) return;
   Bitmap backgroundBitmap =
       ImageTools.decodeFile(
           bitmapLocation,
           DisplayUtils
               .dispayWidth); // BitmapFactory.decodeFile(bitmapLocation,
                              // ImageTools.getDefaultBitmapOptions());
   BitmapDrawable background = (BitmapDrawable) topLayout.getBackground();
   topLayout.setBackgroundDrawable(
       new BitmapDrawable(
           ImageTools.resizeBitmapToFitExactlyInBox(
               backgroundBitmap,
               DisplayUtils.getDpiSpecificValue(background.getMinimumWidth()),
               DisplayUtils.getDpiSpecificValue(background.getMinimumHeight()))));
   Utils.recycle(backgroundBitmap);
   hideWidgets();
 }
コード例 #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_action);

    // Set the action to null, this indicates that it has not been fetched
    mAction = null;

    // Fetch UI components
    RelativeLayout circleView = (RelativeLayout) findViewById(R.id.action_circle_view);
    mActionImage = (ImageView) findViewById(R.id.action_image);
    mActionTitle = (TextView) findViewById(R.id.action_title);
    mActionDescription = (TextView) findViewById(R.id.action_description);
    mExternalResourceHeader = (TextView) findViewById(R.id.action_external_resource_header);
    mExternalResource = (TextView) findViewById(R.id.action_external_resource);
    mMoreInfoHeader = (TextView) findViewById(R.id.action_more_info_header);
    mMoreInfo = (TextView) findViewById(R.id.action_more_info);
    mTickSwitcher = (ViewSwitcher) findViewById(R.id.action_tick_switcher);

    // Animate the switcher.
    mTickSwitcher.setInAnimation(this, R.anim.action_switcher_fade_in);
    mTickSwitcher.setOutAnimation(this, R.anim.action_switcher_fade_out);

    // Listeners
    findViewById(R.id.action_later).setOnClickListener(this);
    findViewById(R.id.action_did_it).setOnClickListener(this);

    // Circle view
    GradientDrawable gradientDrawable = (GradientDrawable) circleView.getBackground();
    gradientDrawable.setColor(Color.WHITE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      circleView.setBackground(gradientDrawable);
    } else {
      circleView.setBackgroundDrawable(gradientDrawable);
    }

    mActionComplete = false;

    fetchAction(getIntent().getIntExtra(ACTION_ID_KEY, -1));
  }
コード例 #15
0
  public UserBalance(Context context) {
    super(context, R.style.ThemeBeintoo);
    current = this;

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.userbalance);

    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // GETTING DENSITY PIXELS RATIO
    ratio = (context.getApplicationContext().getResources().getDisplayMetrics().densityDpi / 160d);
    // SET UP LAYOUTS
    double pixels = ratio * 40;
    RelativeLayout beintooBar = (RelativeLayout) findViewById(R.id.beintoobarsmall);
    beintooBar.setBackgroundDrawable(
        new BDrawableGradient(0, (int) pixels, BDrawableGradient.BAR_GRADIENT));
    TextView titleBar = (TextView) findViewById(R.id.dialogTitle);
    titleBar.setText(current.getContext().getString(R.string.balance));

    startLoading();
  }
コード例 #16
0
ファイル: Cameras.java プロジェクト: van-lima/Ascent
  @Override
  public void executeUI() {
    setTitle("Cameras");

    LinearLayout linearLayoutRoot = new LinearLayout(getApplicationContext());
    linearLayoutRoot.setLayoutParams(
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
    linearLayoutRoot.setOrientation(LinearLayout.HORIZONTAL);

    linearLayoutRoot.addView(getView("Camera One"));

    linearLayoutRoot.addView(getView("Door Intercom"));

    RelativeLayout relativeLayout = new RelativeLayout(getApplicationContext());
    relativeLayout.setLayoutParams(
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT));
    relativeLayout.setBackgroundDrawable(new ColorDrawable(Color.GREEN));
    relativeLayout.addView(linearLayoutRoot);
    ScrollView scrollView = new ScrollView(getApplicationContext());
    scrollView.addView(relativeLayout);
    getContentPane().addView(scrollView);
  }
コード例 #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_single);
    // 获得波的数据和R点下标
    Bundle bundle = this.getIntent().getExtras();
    String dataFilteredjson = bundle.getString("dataFilteredjson");

    // 对波形进行json解析
    try {
      dataFiltered = getJsonToFloatArray(dataFilteredjson);
    } catch (JSONException e) {
      e.printStackTrace();
    }
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    scrWidth = dm.widthPixels;
    scrHeight = dm.heightPixels;
    Log.v(ECGApplication.getTAG(), "屏幕高度:" + scrHeight);
    gobackBtn = (RelativeLayout) findViewById(R.id.addtoyangben_rl);
    zoomInBtn = (RelativeLayout) findViewById(R.id.zoom_in_wave);
    zoomOutBtn = (RelativeLayout) findViewById(R.id.zoom_out_wave);

    mScrollView = (ObservableScrollView) findViewById(R.id.wave_scrollView);
    mScrollView.setHorizontalScrollBarEnabled(true);
    mScrollView.setScrollViewListener(this);
    // 绘制心电图格子
    mECGStaticPage = new ECGStaticPage();
    Bitmap bgBitmap = mECGStaticPage.createStaicECGPage(scrWidth, scrHeight);
    Drawable bgDrawable = new BitmapDrawable(this.getResources(), bgBitmap);
    ECGStaticPage = (RelativeLayout) findViewById(R.id.ecg_static_page);
    ECGStaticPage.setBackgroundDrawable(bgDrawable);

    // 绘制心电图数据
    mECGWaveIamgeView = (ECGWaveImageView) findViewById(R.id.wave_view);
    mECGWaveIamgeView.recycleBitmap(); // 回收Bitmap,避免内存溢出;(可以尝试多线程去处理)
    mECGWaveIamgeView.setBitmapHeightWidth(dataFiltered.length, scrHeight); // 加了/2
    mECGWaveIamgeView.drawWave(dataFiltered, rPeak);
    /** 心电图放大操作按钮--监听 */
    zoomInBtn.setOnClickListener(
        new View.OnClickListener() {
          float maxheight = 0;

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            // mECGWaveIamgeView.setScaleX(zoomScaleX*=1.5f);
            for (int i = 0; i < dataFiltered.length; i++) {
              dataFiltered[i] *= zoomScale;
              if (dataFiltered[i] > maxheight) maxheight = dataFiltered[i];
            }
            mECGWaveIamgeView.recycleBitmap();
            mECGWaveIamgeView.setBitmapHeightWidth(dataFiltered.length, (int) maxheight);
            mECGWaveIamgeView.drawWave(dataFiltered, rPeak);
          }
        });

    /** 心电图缩小操作按钮--监听 */
    zoomOutBtn.setOnClickListener(
        new View.OnClickListener() {
          float maxheight = 0;

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            // mECGWaveIamgeView.setScaleX(zoomScaleX/=1.5f);
            for (int i = 0; i < dataFiltered.length; i++) {
              dataFiltered[i] /= zoomScale;
              if (dataFiltered[i] > maxheight) maxheight = dataFiltered[i];
            }
            mECGWaveIamgeView.recycleBitmap();
            mECGWaveIamgeView.setBitmapHeightWidth(dataFiltered.length, (int) maxheight);
            mECGWaveIamgeView.drawWave(dataFiltered, rPeak);
          }
        });

    gobackBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mECGWaveIamgeView.recycleBitmap();
            finish();
          }
        });

    //		waveMianLayout=new LinearLayout(this);
    //		waveMianLayout.setLayoutParams(new LinearLayout.LayoutParams(-1,-1));
    //		mECGWaveIamgeView = new ECGWaveIamgeView(ViewWaveActivity.this,dataFiltered);
    //		mECGWaveIamgeView.setLayoutParams(new LinearLayout.LayoutParams(-1,-2));
    //
    //		waveMianLayout.addView(mECGWaveIamgeView);//添加iv
    //		setContentView(waveMianLayout);//显示manLayout
    // dataFiltered =null;
  }
コード例 #18
0
ファイル: Main.java プロジェクト: LovlyN1/crocodilenote
  @SuppressWarnings("deprecation")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (isP(_P.secrecy) && !ENC) {
      setTitle("Initializing " + Main.name + "...");
      return;
    }

    Intent caller = getIntent();
    if (caller != null) {
      try {
        String tmp = caller.getStringExtra(_I.Main_setAbsoluteFolder.name());
        if (tmp == null) {
          finish();
          return;
        }
        setAbsoluteFolder(tmp);

        tmp = caller.getStringExtra(_I.Main_setFolderShowname.name());
        if (tmp == null) {
          finish();
          return;
        }
        setFolderShowname(tmp);
      } catch (Exception e) {
        e.printStackTrace();
        return;
      }
    }

    WatchImpl.enable = false;

    l1 = new RelativeLayout(this);

    int xi = 0;
    while (true) {
      if (!checkFiles(xi)) break;
      xi++;
    }
    if (xi > max) max = xi;

    thetexts = new Vector<InnerEdit>(max + 5);

    ScrollView sv = new ScrollView(this);
    l1.addView(sv);

    RelativeLayout.LayoutParams sv_lp = (RelativeLayout.LayoutParams) sv.getLayoutParams();
    sv_lp.width = RelativeLayout.LayoutParams.MATCH_PARENT;
    sv_lp.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
    sv_lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    sv.setLayoutParams(sv_lp);

    l2 = new LinearLayout(this);
    l2.setOrientation(LinearLayout.VERTICAL);
    l2.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    sv.addView(l2);

    ArrayList<String> vals = null;
    ArrayList<Integer> ids = null;
    int newone = -1;
    int focusone = -1;

    if (caller != null) {
      if (caller.getBooleanExtra("OKAY", false)) {
        vals = caller.getStringArrayListExtra("vals");
        ids = caller.getIntegerArrayListExtra("ids");
        newone = caller.getIntExtra("newone", -1);
        focusone = caller.getIntExtra("curfocus", -1);
      }
    }

    if (newone > 0) max = newone + 1;

    setTitle(title(max));

    for (int i = 0; i < max; i++) {
      EditText t2 = new EditText(this);
      t2.setId(i);
      t2.setOnFocusChangeListener(
          new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View v, boolean hasFocus) {
              if (hasFocus) curfocus = (EditText) v;
            }
          });
      t2.setImeOptions(EditorInfo.IME_ACTION_DONE);
      t2.setOnEditorActionListener(one);
      InnerEdit in = new InnerEdit(t2);
      thetexts.add(in);
      t2.addTextChangedListener(new WatchImpl(in));
      l2.addView(t2, 0);
      if (ids != null && ids.contains(i)) {
        String tmp = vals.get(ids.indexOf(i));
        if (tmp != null) t2.setText(tmp);
        else t2.setText("err");
        in.changed = true;
      } else {
        if (checkFiles(i)) {
          String x = loadFiles(i);
          t2.setText(x);
        } else {
          t2.setText("");
        }
      }

      if (focusone >= 0) {
        if (i == focusone) t2.requestFocus();
      } else {
        if (i == max - 1) t2.requestFocus();
      }
    }

    WatchImpl.enable = true;

    Button b1 = new Button(this);
    b1.setText("  Save  ");

    b1.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            int ctr = 0;
            for (int i = 0; i < max; i++) {
              if (thetexts.get(i).changed || !checkFiles(i)) {
                storeFiles(i, thetexts.get(i).edit.getText().toString());
                ctr++;
                thetexts.get(i).changed = false;
              }
            }
            Toast.makeText(me, "Saved (" + ctr + ")", Toast.LENGTH_SHORT).show();
          }
        });

    Button b2 = new Button(this);
    b2.setText("  Add  ");

    b2.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            EditText t2 = new EditText(me);
            t2.setOnFocusChangeListener(
                new OnFocusChangeListener() {

                  @Override
                  public void onFocusChange(View v, boolean hasFocus) {
                    if (hasFocus) curfocus = (EditText) v;
                  }
                });
            t2.setImeOptions(EditorInfo.IME_ACTION_DONE);
            t2.setOnEditorActionListener(one);

            l2.addView(t2, 0);
            t2.setId(max);
            max++;
            InnerEdit in = new InnerEdit(t2, true);
            thetexts.add(in);
            t2.addTextChangedListener(new WatchImpl(in));
            setTitle(title(max));
            t2.requestFocus();
          }
        });

    Button b3 = new Button(this);
    b3.setText("Save & Exit");
    b3.setOnClickListener(
        new OnClickListener() {
          // TODO: reduce redundancy

          @Override
          public void onClick(View v) {
            int ctr = 0;
            for (int i = 0; i < max; i++) {
              if (thetexts.get(i).changed || !checkFiles(i)) {
                storeFiles(i, thetexts.get(i).edit.getText().toString());
                ctr++;
                thetexts.get(i).changed = false;
              }
            }
            if (ctr > 0) Toast.makeText(me, "Saved (" + ctr + ")", Toast.LENGTH_SHORT).show();
            else Toast.makeText(me, "Quick Exit", Toast.LENGTH_SHORT).show();

            finish();
          }
        });

    Button b4 = new Button(this);
    b4.setText("Return");

    b4.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            for (int i = 0; i < max; i++) {
              if (thetexts.get(i).changed || !checkFiles(i)) {
                Toast.makeText(me, "unsaved data", Toast.LENGTH_SHORT).show();
                return;
              }
            }

            startActivity(new Intent(me, Startup.class));
            finish();
          }
        });

    HorizontalScrollView hori = new HorizontalScrollView(this);
    LinearLayout ll_hori = new LinearLayout(this);
    ll_hori.setOrientation(LinearLayout.HORIZONTAL);

    ll_hori.addView(b1);
    ll_hori.addView(b3);
    ll_hori.addView(b2);
    ll_hori.addView(b4);

    hori.addView(ll_hori);
    l1.addView(hori);
    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    hori.setLayoutParams(lp);
    hori.setId(121232);

    sv_lp = (RelativeLayout.LayoutParams) sv.getLayoutParams();
    sv_lp.addRule(RelativeLayout.ABOVE, hori.getId());
    sv.setLayoutParams(sv_lp);

    BitmapDrawable bd =
        new BitmapDrawable(
            getResources(), BitmapFactory.decodeResource(getResources(), R.drawable.back_base));
    bd.setTileModeXY(TileMode.MIRROR, TileMode.REPEAT);
    l1.setBackgroundDrawable(bd);

    setContentView(l1);
  }
コード例 #19
0
 @SuppressWarnings("deprecation")
 @Override
 @Deprecated
 public void setBackgroundDrawable(Drawable background) {
   super.setBackgroundDrawable(null);
 }
コード例 #20
0
  private void init() {
    place = getPlaceById();
    if (place != null) {
      currentCityId = place.getCityId();
      nearbyPlaceList = new ArrayList<Place>();
      List<String> imagePath = place.getImagesList();
      LayoutInflater inflater = getLayoutInflater();
      ArrayList<View> imageViewlist = new ArrayList<View>();
      imageLoader = ImageLoader.getInstance();
      int size = imagePath.size();
      String url = "";
      View view = null;
      ImageView imageView = null;
      for (int i = 0; i < size; i++) {
        view = inflater.inflate(R.layout.place_detail_image, null);
        imageView = (ImageView) view.findViewById(R.id.place_image_item);
        url = imagePath.get(i);
        url = TravelUtil.getImageUrl(currentCityId, url);
        imageLoader.displayImage(url, imageView);
        imageViewlist.add(view);
      }
      imageViews = new ImageView[size];
      main = (ViewGroup) inflater.inflate(R.layout.common_place_detail, null);
      ViewGroup group = (ViewGroup) main.findViewById(R.id.place_images_group);
      ViewPager placeImage = (ViewPager) main.findViewById(R.id.place_images);
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(10, 10);
      params.setMargins(
          (int) getResources().getDimension(R.dimen.image_margin),
          0,
          (int) getResources().getDimension(R.dimen.image_margin),
          0);
      for (int i = 0; i < size; i++) {
        imageView = new ImageView(CommonPlaceDetailActivity.this);
        imageView.setLayoutParams(params);
        imageViews[i] = imageView;
        if (i == 0) {
          imageViews[i].setBackgroundResource(R.drawable.guide_dot_white);
        } else {
          imageViews[i].setBackgroundResource(R.drawable.guide_dot_black);
        }
        group.addView(imageView);
      }
      PlaceImageAdapter sceneryAdapter = new PlaceImageAdapter(imageViewlist);
      if (isSupportService()) {
        ViewGroup serviceGroup = (ViewGroup) main.findViewById(R.id.proServiceGroup);
        serviceGroup.setVisibility(View.VISIBLE);
        ImageView serviceImageView = null;
        LayoutParams layoutParams =
            new LayoutParams(
                (int) this.getResources().getDimension(R.dimen.service_icon2),
                LayoutParams.WRAP_CONTENT);
        for (int id : place.getProvidedServiceIdList()) {

          serviceImageView = new ImageView(CommonPlaceDetailActivity.this);
          serviceImageView.setLayoutParams(layoutParams);
          serviceImageView.setScaleType(ScaleType.FIT_CENTER);
          serviceImageView.setImageResource(TravelUtil.getServiceImage(id));
          serviceGroup.addView(serviceImageView);
        }
      }

      placeImage.setAdapter(sceneryAdapter);
      placeImage.setOnPageChangeListener(placeImageOnPageChangeListener);
      setContentView(main);

      if (isSupportSpecialTrafficStyle()) {
        main.findViewById(R.id.special_trans_group).setVisibility(View.VISIBLE);
        String trafficInfos = place.getTransportation();
        trafficInfos = trafficInfos.replaceAll(":;", "").trim();
        String[] traffic = trafficInfos.split(";");
        specialTrans = (ViewGroup) main.findViewById(R.id.special_trans);
        if (traffic.length > 0) {
          int i = 1;
          String[] trafficDetail = null;
          RelativeLayout.LayoutParams params1 =
              new RelativeLayout.LayoutParams(
                  (int) getResources().getDimension(R.dimen.special_traffic_loaction),
                  LayoutParams.WRAP_CONTENT);
          RelativeLayout.LayoutParams params2 =
              new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
          LayoutParams params3 =
              new LayoutParams(
                  (int) getResources().getDimension(R.dimen.transport_width),
                  (int) getResources().getDimension(R.dimen.transport_height));
          for (String trafficInfo : traffic) {
            row = new RelativeLayout(CommonPlaceDetailActivity.this);
            row.setLayoutParams(params3);
            if (i == traffic.length) {
              row.setBackgroundDrawable(getResources().getDrawable(R.drawable.table5_down));
            } else {
              row.setBackgroundDrawable(getResources().getDrawable(R.drawable.table5_center));
            }

            trafficDetail = trafficInfo.split(":");
            if (trafficDetail.length == 2) {
              locationTextView = new TextView(CommonPlaceDetailActivity.this);
              distanceTextView = new TextView(CommonPlaceDetailActivity.this);
              params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
              params1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
              params1.setMargins(
                  (int) getResources().getDimension(R.dimen.transport_margin_left), 0, 0, 0);
              params2.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
              params2.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
              params2.setMargins(
                  (int) getResources().getDimension(R.dimen.transport_margin_right), 0, 0, 0);
              locationTextView.setLayoutParams(params1);
              distanceTextView.setLayoutParams(params2);
              locationTextView.setTextColor(getResources().getColor(R.color.place_price_color));
              locationTextView.setTextSize(
                  getResources().getDimension(R.dimen.transport_text_size));
              locationTextView.setSingleLine(true);
              locationTextView.setMarqueeRepeatLimit(-1);
              locationTextView.setEllipsize(TruncateAt.MARQUEE);
              locationTextView.setHorizontallyScrolling(true);
              locationTextView.setSelected(true);
              distanceTextView.setTextColor(getResources().getColor(R.color.place_price_color));
              distanceTextView.setTextSize(
                  getResources().getDimension(R.dimen.transport_location_text_size));
              locationTextView.setText(trafficDetail[0]);
              distanceTextView.setText(trafficDetail[1]);
              row.addView(locationTextView);
              row.addView(distanceTextView);
              specialTrans.addView(row, i);
            }
            i++;
          }
        }

      } else {
        main.findViewById(R.id.transport_group).setVisibility(View.VISIBLE);
        TextView transport = (TextView) main.findViewById(R.id.transport);
        transport.setSelected(true);
        transport.setText(place.getTransportation());
      }

      // ticket
      if (isSupportTicket()) {
        String priceDescription = place.getPriceDescription();
        if (priceDescription != null && !priceDescription.equals("")) {
          findViewById(R.id.ticket_group).setVisibility(View.VISIBLE);
          TextView ticket = (TextView) findViewById(R.id.ticket);
          ticket.setText(priceDescription);
        }
      }

      // food
      if (isSupportFood()) {
        String footCate = AppManager.getInstance().getAllSubCatMap().get(place.getSubCategoryId());
        if (footCate != null && !footCate.equals("")) {
          findViewById(R.id.food_group).setVisibility(View.VISIBLE);
          TextView food = (TextView) findViewById(R.id.food);
          food.setText(footCate);
        }
      }

      // openTime
      if (isSupportOpenTime()) {
        String openTimeString = place.getOpenTime();
        if (openTimeString != null && !openTimeString.equals("")) {
          findViewById(R.id.open_time_group).setVisibility(View.VISIBLE);
          if (place.getCategoryId() != PlaceCategoryType.PLACE_SPOT_VALUE) {
            TextView openTimeTitle = (TextView) findViewById(R.id.open_time_title);
            openTimeTitle.setText(getString(R.string.open_time1));
          }

          TextView openTime = (TextView) findViewById(R.id.open_time);
          openTime.setText(openTimeString);
        }
      }

      // avgPrice
      if (isSupportAvgPrice()) {
        String avePriceString = place.getAvgPrice();
        if (avePriceString != null && !avePriceString.equals("")) {
          findViewById(R.id.avg_price_group).setVisibility(View.VISIBLE);
          TextView avgPrice = (TextView) findViewById(R.id.avg_price);
          HashMap<Integer, String> symbolHashMap = AppManager.getInstance().getSymbolMap();
          StringBuffer symbol = new StringBuffer();
          if (symbolHashMap.containsKey(currentCityId)) {
            String symbolStr = symbolHashMap.get(currentCityId);
            symbol.append(symbolStr);
          }
          avgPrice.setText(symbol + avePriceString);
        }
      }

      // specialFood
      if (isSupportSpecialFood()) {
        List<String> typcialDisList = place.getTypicalDishesList();
        if (typcialDisList != null && typcialDisList.size() > 0) {
          findViewById(R.id.special_food_group).setVisibility(View.VISIBLE);
          TextView specialFood = (TextView) findViewById(R.id.special_food);
          StringBuffer typicalDishes = new StringBuffer();
          for (String typcial : typcialDisList) {
            typicalDishes.append(typcial);
            typicalDishes.append("  ");
          }
          specialFood.setText(typicalDishes);
        }
      }

      // tips
      if (isSupportTips()) {
        String tipsString = place.getTips();
        if (tipsString != null && !tipsString.equals("")) {
          findViewById(R.id.tips_group).setVisibility(View.VISIBLE);
          TextView tipsTitles = (TextView) findViewById(R.id.tips_title);
          TextView tips = (TextView) findViewById(R.id.tips);
          tipsTitles.setText(tipsTitle);
          tips.setText(tipsString);
        }
      }

      // park
      if (isSupportPark()) {
        String parkGuideString = place.getParkingGuide();
        if (parkGuideString != null && !parkGuideString.equals("")) {
          findViewById(R.id.park_group).setVisibility(View.VISIBLE);
          TextView park = (TextView) findViewById(R.id.park);
          park.setText(place.getParkingGuide());
        }
      }

      // hotelStart
      if (isSupportHotelStart()) {
        int hotelStartLevel = place.getHotelStar();
        if (hotelStartLevel > 0) {
          findViewById(R.id.hotel_start_group).setVisibility(View.VISIBLE);
          TextView hotelStart = (TextView) findViewById(R.id.hotel_start);
          hotelStart.setText(TravelUtil.getHotelStar(this, hotelStartLevel));
          ViewGroup hotelStartImageGroup = (ViewGroup) findViewById(R.id.hotel_start_image);
          ImageView hotelStartImage;
          LayoutParams layoutParams =
              new LayoutParams(
                  (int) this.getResources().getDimension(R.dimen.hotel_start_icon),
                  LayoutParams.WRAP_CONTENT);
          for (int i = 0; i < place.getHotelStar(); i++) {

            hotelStartImage = new ImageView(CommonPlaceDetailActivity.this);
            hotelStartImage.setLayoutParams(layoutParams);
            hotelStartImage.setPadding(0, 0, 5, 0);
            hotelStartImage.setScaleType(ScaleType.FIT_CENTER);
            hotelStartImage.setImageResource(R.drawable.star_ico);
            hotelStartImageGroup.addView(hotelStartImage);
          }
        }
      }

      // keyword
      if (isSupportKeyWords()) {
        List<String> keyList = place.getKeywordsList();
        if (keyList != null && keyList.size() > 0) {
          findViewById(R.id.keyword_group).setVisibility(View.VISIBLE);
          TextView keyword = (TextView) findViewById(R.id.place_keyword);
          StringBuffer keywordStr = new StringBuffer();
          for (String key : keyList) {
            keywordStr.append(key);
            keywordStr.append("、");
          }
          if (keywordStr.length() > 1) {
            keyword.setText(keywordStr.substring(0, keywordStr.length() - 1));
          }
        }
      }

      // roomprice
      if (isSupportRoomPrice()) {
        String priceString = place.getPrice();
        if (priceString != null && !priceString.equals("")) {
          findViewById(R.id.room_price_group).setVisibility(View.VISIBLE);
          TextView roomPrice = (TextView) findViewById(R.id.room_price);
          HashMap<Integer, String> symbolHashMap = AppManager.getInstance().getSymbolMap();
          StringBuffer symbol = new StringBuffer();
          if (symbolHashMap.containsKey(currentCityId)) {
            String symbolStr = symbolHashMap.get(currentCityId);
            symbol.append(symbolStr);
          }
          symbol.append(priceString);
          symbol.append("起");
          roomPrice.setText(symbol);
        }
      }

      ImageView recommendImage1 = (ImageView) findViewById(R.id.place_detail_recommend_image1);
      ImageView recommendImage2 = (ImageView) findViewById(R.id.place_detail_recommend_image2);
      ImageView recommendImage3 = (ImageView) findViewById(R.id.place_detail_recommend_image3);

      TextView placeDetailTitle = (TextView) findViewById(R.id.place_detail_title);
      TextView placeIntroTitle = (TextView) findViewById(R.id.place_intro_title);
      TextView placeIntro = (TextView) findViewById(R.id.place_intro);
      placeDetailTitle.setText(place.getName());
      placeIntroTitle.setText(getPlaceIntroTitle());
      String introduction = place.getIntroduction();
      introduction = TravelUtil.handlerString(introduction);
      placeIntro.setText("		" + introduction);

      int rank = place.getRank();
      switch (rank) {
        case 1:
          {
            recommendImage1.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
            recommendImage2.setImageDrawable(this.getResources().getDrawable(R.drawable.good2));
            recommendImage3.setImageDrawable(this.getResources().getDrawable(R.drawable.good2));
          }
          break;
        case 2:
          {
            recommendImage1.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
            recommendImage2.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
            recommendImage3.setImageDrawable(this.getResources().getDrawable(R.drawable.good2));
          }
          break;
        case 3:
          {
            recommendImage1.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
            recommendImage2.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
            recommendImage3.setImageDrawable(this.getResources().getDrawable(R.drawable.good));
          }
          break;
        default:
          break;
      }

      if (place.getTelephoneList().size() > 0) {
        ViewGroup phoneGroup = (ViewGroup) findViewById(R.id.phone_group);
        phoneNum = (TextView) findViewById(R.id.phone_num);
        phoneNum.setSelected(true);
        ImageView phoneCall = (ImageView) findViewById(R.id.phone_call);
        phoneGroup.setVisibility(View.VISIBLE);
        StringBuffer phoneNumber = new StringBuffer();
        for (String telephone : place.getTelephoneList()) {
          phoneNumber.append(telephone);
          phoneNumber.append(" ");
        }
        phoneNum.setText(getString(R.string.phone_number) + " " + phoneNumber);
        phoneCall.setOnClickListener(phoneCallOnClickListener);
        phoneGroup.setOnClickListener(phoneCallOnClickListener);
      }

      if (place.getAddressList().size() > 0) {
        ViewGroup addressGroup = (ViewGroup) findViewById(R.id.address_group);
        TextView address = (TextView) findViewById(R.id.address);
        address.setSelected(true);
        ImageView addressMapView = (ImageView) findViewById(R.id.address_map_view);
        addressGroup.setVisibility(View.VISIBLE);
        StringBuffer addressStr = new StringBuffer();
        for (String addres : place.getAddressList()) {
          addressStr.append(addres);
          addressStr.append(" ");
        }
        address.setText(getString(R.string.address) + " " + addressStr);
        addressMapView.setOnClickListener(addressLocateOnClickListener);
        addressGroup.setOnClickListener(addressLocateOnClickListener);
      }

      if (place.getWebsite() != null && !place.getWebsite().equals("")) {
        ViewGroup websiteGroup = (ViewGroup) findViewById(R.id.website_group);
        websiteGroup.setVisibility(View.VISIBLE);
        TextView website = (TextView) findViewById(R.id.website);
        website.setText(place.getWebsite());
      }
      nearbyListGroup = (ViewGroup) findViewById(R.id.nearby_list_group);
      favoriteCount = (TextView) findViewById(R.id.favorite_count);
      collect = (TextView) findViewById(R.id.collect);
      collectBtn = (ImageView) findViewById(R.id.collect_btn);
      collectBtn.setOnClickListener(addFavoriteOnClickListener);
      ImageButton locationButton = (ImageButton) findViewById(R.id.location_button);
      Button indexButton = (Button) findViewById(R.id.index_button);
      indexButton.setOnClickListener(indexOnClickListener);
      ImageView help2Button = (ImageView) findViewById(R.id.help2);
      locationButton.setOnClickListener(locationOnClickListener);
      help2Button.setOnClickListener(helpOnClickListener);
    }
  }
コード例 #21
0
  @Override
  public void initViews() {
    music_player_dlan = (LinearLayout) findViewById(R.id.music_player_dlan);
    badMusicBtn = (ImageView) findViewById(R.id.player_bad_music_btn);
    goodMusicBtn = (ImageView) findViewById(R.id.player_good_music_btn);
    sharedBtn = (ImageView) findViewById(R.id.player_shared_music_btn);
    playerMainLayout = (RelativeLayout) findViewById(R.id.player_main_relativelayout);
    playerMainLayout.setBackgroundDrawable(getBgRandom(playerMainLayout));
    sharedBtn.setVisibility(View.GONE);
    // music_player_normal.setOnClickListener(new MyOnClickListener());
    if (AdaptUtil.isNewProtocol252()) {
      goodMusicBtn.setVisibility(View.VISIBLE);
      badMusicBtn.setVisibility(View.VISIBLE);
    } else {
      goodMusicBtn.setVisibility(View.GONE);
      badMusicBtn.setVisibility(View.GONE);
    }
    playOrPause = (Button) findViewById(R.id.music_player_play_or_pause);
    playNext = (ImageButton) findViewById(R.id.music_player_next);
    playPre = (ImageButton) findViewById(R.id.music_player_last);
    playing_music_flipper = (ViewPager) findViewById(R.id.playing_music_flipper);
    playOrPause.setOnClickListener(this);
    playNext.setOnClickListener(this);
    playPre.setOnClickListener(this);
    goodMusicBtn.setOnClickListener(this);
    badMusicBtn.setOnClickListener(this);
    sharedBtn.setOnClickListener(this);
    seekBar = (SeekBar) findViewById(R.id.music_player_seekBar);
    NewViewHead.showAll(
            context, getString(R.string.ba_main_music), R.drawable.player_to_list_btn_selector)
        .setOnClickListener(this);
    mWifiCRUDForVolume = new WifiCRUDForVolume(getBoxIp(), getBoxTcpPort());
    LinearLayout guideViewPointLinearlayout =
        (LinearLayout) findViewById(R.id.guide_view_point_linearlayout);
    // TODO 去掉歌词
    guideViewPointLinearlayout.setVisibility(View.GONE);
    guideViewPoints = new ImageView[2];
    for (int i = 0; i < guideViewPoints.length; i++) {
      guideViewPoints[i] = (ImageView) guideViewPointLinearlayout.getChildAt(i);
      guideViewPoints[i].setEnabled(false);
    }
    LayoutInflater inflater = LayoutInflater.from(this);
    ArrayList<View> list = new ArrayList<View>();
    View view = inflater.inflate(R.layout.playing_music_name, null);
    music_player_normal = (RelativeLayout) view.findViewById(R.id.music_player_normal);
    songTv = (TextView) view.findViewById(R.id.player_music_name);
    songTv.setSelected(true);
    singerTv = (TextView) view.findViewById(R.id.player_music_singer);
    toXmlyBtn = view.findViewById(R.id.player_to_xmly_btn);
    toXmlyBtn.setOnClickListener(this);
    // 点击显示或隐藏seekbar
    view.findViewById(R.id.music_player_normal).setOnClickListener(new MyOnClickListener());
    view.findViewById(R.id.music_player_normal)
        .setOnLongClickListener(
            new OnLongClickListener() {
              public boolean onLongClick(View v) {
                // setParam();
                // iatDialog.setListener(recognizerDialogListener);
                // iatDialog.show();
                startVoiceActivity();
                return false;
              }
            });
    playerRoundIv = (RotateImageView) view.findViewById(R.id.player_round_iv);
    setRotateImageView();
    playerOperate = (RotateReleaseImageView) view.findViewById(R.id.player_operate_iv);
    setRotateImageView_operate();
    list.add(view);
    view = inflater.inflate(R.layout.playing_music_lrc, null);
    // TODO 去掉歌词
    // list.add(view);
    playing_music_flipper.setAdapter(new MusicPagerAdapter(list));
    guideViewPoints[0].setEnabled(true);
    playing_music_flipper.setOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageSelected(int arg0) {
            setCurDot(arg0);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
  }
コード例 #22
0
 protected void updateView(WifiMusicInfo info) {
   currMusicInfo = info;
   if (System.currentTimeMillis() - collectTime > changeButtonStateDelayed) {
     if (currMusicInfo.is_isCollected()) {
       goodMusicBtn.setImageResource(R.drawable.player_good_music_pressed);
     } else {
       goodMusicBtn.setImageResource(R.drawable.player_good_music_selector);
     }
   }
   String currState = info.getPlayStatus();
   if (MUSIC_STATE_DLAN.equals(currState)) {
     isDlanPlay = true;
     music_player_dlan.setVisibility(View.VISIBLE);
     music_player_normal.setVisibility(View.GONE);
   } else {
     isDlanPlay = false;
     music_player_dlan.setVisibility(View.GONE);
     music_player_normal.setVisibility(View.VISIBLE);
     String currMusicName = info.getName() != null ? info.getName() : "";
     String currSinger = info.getAuthor() != null ? info.getAuthor() : "";
     int currVolume = info.getMusicCurrVolume() - 1;
     int maxVolume = info.getMusicMaxVolume() - 1;
     LogManager.e("volume :" + currVolume + "," + maxVolume);
     if (maxVolume != seekBar.getMax()) {
       seekBar.setMax(maxVolume);
     }
     if (System.currentTimeMillis() - volumeChangeTime > changeButtonStateDelayed) {
       if (currVolume != seekBar.getProgress()) {
         seekBar.setTag("unchange");
         seekBar.setProgress(currVolume);
       }
     }
     if (!isOperateButton) {
       if (MUSIC_STATE_STOP.equals(currState) || MUSIC_STATE_PAUSE.equals(currState)) {
         if (!"".equals(getPrefString(KeyList.PKEY_SELECT_MUSIC_ID))) {
           setPrefString(KeyList.PKEY_SELECT_MUSIC_ID, "");
         }
         playerRoundIv.pauseRound();
         playerOperate.release();
         playOrPause.setBackgroundResource(R.drawable.player_play_btn_selector);
       } else if (MUSIC_STATE_PLAYING.equals(currState)) {
         if (info.getMusicId() != null
             && !info.getMusicId().equals(getPrefString(KeyList.PKEY_SELECT_MUSIC_ID))) {
           setPrefString(KeyList.PKEY_SELECT_MUSIC_ID, info.getMusicId());
         }
         playerOperate.startRound();
         playerRoundIv.startRound();
         playOrPause.setBackgroundResource(R.drawable.player_pause_btn_selector);
       }
     }
     // }
     if (!currMusicName.equals(musicName)) {
       playerMainLayout.setBackgroundDrawable(getBgRandom(playerMainLayout));
       songTv.setText(currMusicName);
     }
     if (!currSinger.equals(singer)) {
       singerTv.setText(currSinger);
     }
     musicName = currMusicName;
     singer = currSinger;
   }
 }
コード例 #23
0
  @Override
  protected void onResume() {
    super.onResume();

    switch (mState) {
      case STATE_EDIT:
        title.setText("修改联系人");
        //			id = ContentUris.parseId(uri);
        id = bundle.get("id").toString();
        mCursor =
            managedQuery(
                ContactEntity.CONTENT_URI,
                null,
                ContactEntity.KEY_PARTYID + " = '" + id + "'",
                null,
                null);
        mCursor.moveToFirst();
        entity = new ContactEntity(mCursor);
        nameEditText.setText(entity.getName());
        titleEditText.setText(entity.getTitle());
        companyEditText.setText(entity.getCompanyname());

        // 电话
        String phoneJSON = entity.getPhone();
        mobile_row_layout.removeAllViews();
        try {
          JSONArray phoneAry = new JSONArray(phoneJSON);
          for (int i = 0; i < phoneAry.length(); i++) {
            JSONObject json = (JSONObject) phoneAry.get(i);
            genMobileLayout(true, json.getString("phoneType"), json.getString("phoneText"));
          }
        } catch (JSONException e) {
          e.printStackTrace();
        }
        // Email
        String emailJSON = entity.getEmail();
        email_row_layout.removeAllViews();
        try {
          JSONArray emailAry = new JSONArray(emailJSON);
          for (int i = 0; i < emailAry.length(); i++) {
            JSONObject json = (JSONObject) emailAry.get(i);
            genEmailLayout(true, json.getString("emailType"), json.getString("emailText"));
          }
        } catch (JSONException e) {
          e.printStackTrace();
        }
        // 地址
        String addressJSON = entity.getAddress();
        address_row_layout.removeAllViews();
        try {
          JSONArray addressAry = new JSONArray(addressJSON);
          for (int i = 0; i < addressAry.length(); i++) {
            JSONObject json = (JSONObject) addressAry.get(i);
            genAddressLayout(true, json.getString("addressType"), json.getString("addressText"));
          }
        } catch (JSONException e) {
          e.printStackTrace();
        }
        // IM
        String imJSON = entity.getIm();
        im_row_layout.removeAllViews();
        try {
          JSONArray imAry = new JSONArray(imJSON);
          for (int i = 0; i < imAry.length(); i++) {
            JSONObject json = (JSONObject) imAry.get(i);
            genImLayout(true, json.getString("imType"), json.getString("imText"));
          }
        } catch (JSONException e) {
          e.printStackTrace();
        }

        // 网址
        String website = entity.getWebsites();
        website_row_layout.removeAllViews();
        try {
          JSONArray webAry = new JSONArray(website);
          for (int i = 0; i < webAry.length(); i++) {
            JSONObject json = (JSONObject) webAry.get(i);
            genWebsiteLayout(true, json.getString("websitesType"), json.getString("websitesText"));
          }
        } catch (JSONException e) {
          e.printStackTrace();
        }

        // 头像
        if (hasImage) { // 选择过上传头像

        } else {
          String partyFace = entity.getPartyface();
          if (!StringUtil.isEmpty(partyFace)) {
            Cursor photoCursor =
                managedQuery(
                    PhotoEntity.CONTENT_URI,
                    null,
                    PhotoEntity.KEY_NAME + " = '" + partyFace + "'",
                    null,
                    null);
            if (photoCursor.moveToFirst()) {
              String content = photoCursor.getString(4);
              byte[] data = Base64.decode(content, Base64.DEFAULT);
              Bitmap icon = BitmapFactory.decodeByteArray(data, 0, data.length);
              //						photoView.setImageBitmap(icon);
              icon = ImageUtil.zoomBitmap(icon, 80, 80);
              BitmapDrawable bd = new BitmapDrawable(icon);
              photoView.setBackgroundDrawable(bd);
            }
            photoCursor.close();
          }
        }

        break;
      case STATE_INSERT:
        title.setText("新增联系人");
        entity = new ContactEntity();

        // 生成默认
        mobile_row_layout.removeAllViews();
        genMobileLayout(false, null, null);

        email_row_layout.removeAllViews();
        genEmailLayout(false, null, null);

        address_row_layout.removeAllViews();
        genAddressLayout(false, null, null);

        im_row_layout.removeAllViews();
        genImLayout(false, null, null);

        website_row_layout.removeAllViews();
        genWebsiteLayout(false, null, null);

        break;
      default:
        break;
    }
  }
コード例 #24
0
 public void setSelectedImage(Bitmap bitmap) {
   topLayout.setBackgroundDrawable(new BitmapDrawable(bitmap));
 }