// set wallpaper as background
 private void setBackground(Context bcontext, ViewGroup layout) {
   // Settings.System.LOCKSCREEN_BACKGROUND
   String mLockBack =
       Settings.System.getString(bcontext.getContentResolver(), "lockscreen_background");
   if (mLockBack != null) {
     if (!mLockBack.isEmpty()) {
       try {
         layout.setBackgroundColor(Integer.parseInt(mLockBack));
       } catch (NumberFormatException e) {
       }
     } else {
       String lockWallpaper = "";
       try {
         lockWallpaper =
             bcontext.createPackageContext("com.cyanogenmod.cmparts", 0).getFilesDir()
                 + "/lockwallpaper";
       } catch (NameNotFoundException e1) {
       }
       if (!lockWallpaper.isEmpty()) {
         Bitmap lockb = BitmapFactory.decodeFile(lockWallpaper);
         layout.setBackgroundDrawable(new BitmapDrawable(lockb));
       }
     }
   }
 }
 private void setUpEliteBanner(User paramUser)
 {
   ViewGroup localViewGroup = (ViewGroup)findViewById(2131494086);
   localViewGroup.setBackgroundDrawable(f);
   if (f != null) {}
   for (int k = 0;; k = 8)
   {
     localViewGroup.setVisibility(k);
     if (paramUser.isEliteUser()) {
       a(paramUser, localViewGroup);
     }
     return;
   }
 }
 public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
   paramViewGroup = paramView;
   if (paramView == null) {
     paramViewGroup = g.a(b).inflate(2130903179, null);
   }
   paramViewGroup.setBackgroundDrawable(b(paramInt));
   ((ImageView) paramViewGroup.findViewById(2131362458)).setImageDrawable(a(paramInt));
   paramView = (TextView) paramViewGroup.findViewById(2131362459);
   paramView.setTextColor(-16777216);
   paramView.setText(d[paramInt]);
   paramView = (RadioButton) paramViewGroup.findViewById(2131362460);
   if (e == paramInt) {}
   for (boolean bool = true; ; bool = false) {
     paramView.setChecked(bool);
     paramView.setClickable(false);
     paramViewGroup.setOnClickListener(new ag(this, paramInt));
     paramViewGroup.setOnTouchListener(new ah(this, paramInt));
     return paramViewGroup;
   }
 }
示例#4
0
  public void applyTheme() {
    int boxTop = R.drawable.box_top_stack;
    int boxTopR = R.drawable.box_top_r;
    int boxTopL = R.drawable.box_top_l;
    int expand = R.drawable.box_expand;
    if (view.getSettings().TRANSPARENT_MAP_THEME.get()) {
      boxTop = R.drawable.box_top_t_stack;
      boxTopR = R.drawable.box_top_rt;
      boxTopL = R.drawable.box_top_lt;
      expand = R.drawable.box_expand_t;
    }
    rightStack.setTopDrawable(view.getResources().getDrawable(boxTopR));
    rightStack.setStackDrawable(boxTop);

    leftStack.setTopDrawable(view.getResources().getDrawable(boxTopL));
    leftStack.setStackDrawable(boxTop);

    leftStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
    rightStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
    statusBar.setBackgroundDrawable(view.getResources().getDrawable(boxTop));
    showAltitude = view.getSettings().SHOW_ALTITUDE_INFO.get();
  }
示例#5
0
  public void createTopBarElements() {
    // 1. Create view groups and controls
    statusBar = createStatusBar();
    statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top));

    lanesControl = createLanesControl();
    lanesControl.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_free));

    rightStack = new MapStackControl(view.getContext());
    rightStack.addStackView(createAltitudeControl());
    rightStack.addStackView(createDistanceControl());
    rightStack.addCollapsedView(createSpeedControl());
    rightStack.addCollapsedView(createTimeControl());

    leftStack = new MapStackControl(view.getContext());
    leftStack.addStackView(createNextInfoControl());
    leftStack.addStackView(createMiniMapControl());
    leftStack.addStackView(createNextNextInfoControl());
    //		leftStack.addStackView(createAlarmInfoControl());

    // 2. Preparations
    Rect topRectPadding = new Rect();
    view.getResources().getDrawable(R.drawable.box_top).getPadding(topRectPadding);

    STATUS_BAR_MARGIN_X = (int) (STATUS_BAR_MARGIN_X * scaleCoefficient);
    statusBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    Rect statusBarPadding = new Rect();
    statusBar.getBackground().getPadding(statusBarPadding);
    // 3. put into frame parent layout controls
    FrameLayout parent = (FrameLayout) view.getParent();
    // status bar hides own top part
    int topMargin = statusBar.getMeasuredHeight() - statusBarPadding.top - statusBarPadding.bottom;
    // we want that status bar lays over map stack controls
    topMargin -= topRectPadding.top;

    FrameLayout.LayoutParams flp =
        new FrameLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            Gravity.RIGHT);
    flp.rightMargin = STATUS_BAR_MARGIN_X;
    flp.topMargin = topMargin;
    rightStack.setLayoutParams(flp);

    flp =
        new FrameLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            Gravity.CENTER_HORIZONTAL | Gravity.TOP);
    flp.topMargin = (int) (topMargin + scaleCoefficient * 8);
    lanesControl.setLayoutParams(flp);

    flp =
        new FrameLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            Gravity.LEFT);
    flp.leftMargin = STATUS_BAR_MARGIN_X;
    flp.topMargin = topMargin;
    leftStack.setLayoutParams(flp);

    flp =
        new FrameLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            Gravity.TOP);
    flp.leftMargin = STATUS_BAR_MARGIN_X;
    flp.rightMargin = STATUS_BAR_MARGIN_X;
    flp.topMargin = -topRectPadding.top;
    statusBar.setLayoutParams(flp);

    parent.addView(rightStack);
    parent.addView(leftStack);
    parent.addView(statusBar);
    parent.addView(lanesControl);
  }