Example #1
0
  protected void applyTheme(int theme) {
    Resources res = getResources();

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

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

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

      if (MODE_NIGHT == theme) {
        titleView.setBackgroundColor(0xFF1C1C1C);
        titleText.setTextColor(0xFF666666);
        divider.setBackgroundColor(0xFF303030);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back_night);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg_night);
      } else {
        titleView.setBackgroundColor(res.getColor(R.color.action_bar_color));
        titleText.setTextColor(res.getColor(R.color.white));
        divider.setBackgroundColor(0xFFCACACA);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg);
      }
    }
  }
 private void changeBackgroundColor(String newColor) {
   if (newColor.equalsIgnoreCase("black")) {
     layout.setBackgroundColor(getResources().getColor(android.R.color.black));
   } else {
     layout.setBackgroundColor(getResources().getColor(android.R.color.white));
   }
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will

    RelativeLayout main_view = (RelativeLayout) findViewById(R.id.main_view);

    switch (item.getItemId()) {
      case R.id.menu_red:
        if (item.isChecked()) item.setChecked(false);
        else item.setChecked(true);
        main_view.setBackgroundColor(Color.RED);
        return true;

      case R.id.menu_green:
        if (item.isChecked()) item.setChecked(false);
        else item.setChecked(true);
        main_view.setBackgroundColor(Color.GREEN);
        return true;

      case R.id.menu_yellow:
        if (item.isChecked()) item.setChecked(false);
        else item.setChecked(true);
        main_view.setBackgroundColor(Color.YELLOW);
        return true;

      default:
        return super.onOptionsItemSelected(item);
    }
  }
Example #4
0
 @SuppressLint("NewApi")
 public void onConfigurationChanged(Configuration newConfig) {
   int orientation = activity.getResources().getConfiguration().orientation;
   if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
     hideSoftInput();
     Window win = activity.getWindow();
     win.setSoftInputMode(
         WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
             | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
     rlPage.setBackgroundColor(DIM_COLOR);
     rlPage.postDelayed(
         new Runnable() {
           public void run() {
             genBackground();
             rlPage.setBackgroundDrawable(background);
           }
         },
         1000);
   } else {
     hideSoftInput();
     Window win = activity.getWindow();
     win.setSoftInputMode(
         WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
             | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
     rlPage.setBackgroundColor(DIM_COLOR);
     rlPage.postDelayed(
         new Runnable() {
           public void run() {
             genBackground();
             rlPage.setBackgroundDrawable(background);
           }
         },
         1000);
   }
 }
Example #5
0
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   // TODO Auto-generated method stub
   if (isChecked) {
     noteLayout.setBackgroundColor(0xffcdc9c8);
   } else {
     noteLayout.setBackgroundColor(0);
   }
 }
Example #6
0
  @Override
  public void onResume() {
    photoTxt.setTextColor(Color.parseColor("#797979"));
    photo_button.setBackgroundColor(Color.parseColor("#f3f3f3"));
    photoImage.setImageResource(R.drawable.photo_black_icon);

    statusTxt.setTextColor(Color.parseColor("#797979"));
    share_button.setBackgroundColor(Color.parseColor("#f3f3f3"));
    shareImage.setImageResource(R.drawable.status_black_icon);
    super.onResume();
  }
 public void clearChioce() {
   meet_image.setImageResource(R.drawable.ic_tabbar_contacts_normal);
   meet_layout.setBackgroundColor(whirt);
   meet_text.setTextColor(gray);
   contacts_image.setImageResource(R.drawable.ic_tabbar_contacts_normal);
   contacts_layout.setBackgroundColor(whirt);
   contacts_text.setTextColor(gray);
   settings_image.setImageResource(R.drawable.ic_tabbar_settings_normal);
   settings_layout.setBackgroundColor(whirt);
   settings_text.setTextColor(gray);
 }
Example #8
0
  private void dispatchViews(Context context) {

    layoutCall = new RelativeLayout(context);
    layoutCall.setBackgroundColor(0xAA000000);
    //		layoutCall.setBackgroundColor(xacInteractiveCanvas.bgColorGreen);
    makeNumPad(context);

    layoutLog = new RelativeLayout(context);
    layoutLog.setBackgroundColor(0xFF00FF00);

    updateViews(idxTab);
  }
 void switchFooter(boolean isFooterOpen) {
   if (isFooterOpen) {
     bIsFooterOpen = false;
     llElementsOfFooter.setVisibility(View.GONE);
     viewFooterBlur.setVisibility(View.GONE);
     rlHeadingOfFooter.setBackgroundColor(getResources().getColor(R.color.common_footer));
   } else {
     bIsFooterOpen = true;
     llElementsOfFooter.setVisibility(View.VISIBLE);
     viewFooterBlur.setVisibility(View.VISIBLE);
     rlHeadingOfFooter.setBackgroundColor(getResources().getColor(android.R.color.white));
   }
 }
  /**
   * Called from within the base RestService after a rest call completes.
   *
   * @param result Can be any result type. This function should check the type and handle
   *     accordingly.
   */
  @Override
  public void onRestReturn(RestResult result) {
    if (result == null) {
      return;
    }

    if (result instanceof GetLoyaltyCardByIdResult) {

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

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

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

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

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

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

      StoreListAdapter storeListAdapter =
          new StoreListAdapter(this, R.layout.store_item_row, this.loyaltyCard.getStoreItems());
      list.setAdapter(storeListAdapter);
    }
  }
Example #11
0
 private void setSuitableConfiguration() {
   getControls();
   bindControls();
   videoViewBackground.setBackgroundColor(0);
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
     horizontalView.setVisibility(View.VISIBLE);
     verticalView.setVisibility(View.GONE);
     listView = (ListView) findViewById(R.id.videolist);
     fullScreenParams = new RelativeLayout.LayoutParams(horizontalView.getLayoutParams());
     videoViewBackground.setBackgroundResource(R.drawable.video_back);
   } else if (getResources().getConfiguration().orientation
       == Configuration.ORIENTATION_PORTRAIT) {
     verticalView.setVisibility(View.VISIBLE);
     horizontalView.setVisibility(View.GONE);
     fullScreenParams = new RelativeLayout.LayoutParams(verticalView.getLayoutParams());
     listView = (ListView) findViewById(R.id.videolistPort);
     videoViewBackground.setBackgroundResource(R.drawable.port_black);
   }
   if (isListVisible) {
     listVisible();
   } else {
     videoVisible();
   }
   listView.setAdapter(listAdapter);
   listView.setOnItemClickListener(this);
 }
Example #12
0
 /**
  * Gets the next opponent after the current opponent is defeated. Updates Leaderboard and calls
  * RewardScreen if victorious.
  */
 public void generateNextOpponent() {
   RelativeLayout rl = (RelativeLayout) findViewById(R.id.fightLayout);
   ImageButton frfd = (ImageButton) findViewById(R.id.firstRowFirstDice);
   frfd.setTag(null);
   ImageButton frsd = (ImageButton) findViewById(R.id.firstRowSecondDice);
   frsd.setTag(null);
   ImageButton srfd = (ImageButton) findViewById(R.id.secondRowFirstDice);
   srfd.setTag(null);
   ImageButton srsd = (ImageButton) findViewById(R.id.secondRowSecondDice);
   srsd.setTag(null);
   if (opponents.size() == 0) {
     if (this.player.getUserId() != 0) {
       updateLeaderboard();
     }
     rewardsScreen();
   } else {
     if (this.player.getUserId() != 0) {
       updateLeaderboard();
     }
     Opponent next = opponents.get(0);
     currOpponet = next;
     int resId = getResources().getIdentifier(next.getLayout(), "drawable", getPackageName());
     rl.setBackgroundColor(Color.WHITE);
     rl.setBackground(ContextCompat.getDrawable(this, resId));
     resetDicePics();
     generateOperations(currOpponet.getOp());
     generateAns(level);
     opProgressBar.setProgress(currOpponet.getPercentHealthLeft());
     opHealth.setText(currOpponet.getName() + " HP: " + currOpponet.getCurrentHealth());
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    View view = inflater.inflate(R.layout.fragment_purchase_quotation_list, container, false);
    ivBack = (ImageView) view.findViewById(R.id.common_title_back);
    llBack = (LinearLayout) view.findViewById(R.id.common_ll_title_back);
    ivBack.setImageResource(R.drawable.ic_title_back_blue);
    llBack.setOnClickListener(clickListener);
    llBack.setBackgroundResource(R.drawable.bg_common_white_btn);

    rlTitle = (RelativeLayout) view.findViewById(R.id.rl_common_title);

    rlTitle.setBackgroundColor(getResources().getColor(R.color.color_ffffff));

    tvTitle = (TextView) view.findViewById(R.id.common_title_name);

    mListView = (ListView) view.findViewById(R.id.purchase_quotationlist_listListView);
    // mTotalTextView = (TextView) view.findViewById(R.id.purchase_quotationlist__totalTextView);

    pageStateView = (PageStatusView) view.findViewById(R.id.broadcast_page_status);
    progressBar = (SearchListProgressBar) view.findViewById(R.id.progress_bar);
    pageStateView.setLinkOrRefreshOnClickListener(reloadListener);

    showwait();
    initData();
    return view;
  }
  private void createView() {
    // Linear Layout
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setId(1);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setBackgroundColor(Color.BLACK);
    this.setContentView(linearLayout);

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

    // Video View
    videoView = new VideoView(this);
    videoView.setId(3);
    RelativeLayout.LayoutParams videoViewParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    videoViewParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    videoView.setLayoutParams(videoViewParams);
    relativeLayout.addView(videoView);
  }
Example #15
0
  private RelativeLayout getPageView() {
    rlPage = new RelativeLayout(getContext());
    rlPage.setBackgroundDrawable(background);
    if (dialogMode) {
      RelativeLayout rlDialog = new RelativeLayout(getContext());
      rlDialog.setBackgroundColor(0xc0323232);
      int dp_8 = dipToPx(getContext(), 8);
      int width = getScreenWidth(getContext()) - dp_8 * 2;
      RelativeLayout.LayoutParams lpDialog =
          new RelativeLayout.LayoutParams(width, LayoutParams.WRAP_CONTENT);
      lpDialog.topMargin = dp_8;
      lpDialog.bottomMargin = dp_8;
      lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
      rlDialog.setLayoutParams(lpDialog);
      rlPage.addView(rlDialog);

      rlDialog.addView(getPageTitle());
      rlDialog.addView(getPageBody());
      rlDialog.addView(getImagePin());
    } else {
      rlPage.addView(getPageTitle());
      rlPage.addView(getPageBody());
      rlPage.addView(getImagePin());
    }
    return rlPage;
  }
Example #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fun_facts);

    final TextView factLabel = (TextView) findViewById(R.id.factTextView);
    final Button showFactButton = (Button) findViewById(R.id.showFactButton);
    final RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);

    // Set random initial fact and color
    int firstColor = getColor();
    factLabel.setText(getFact());
    relativeLayout.setBackgroundColor(firstColor);
    showFactButton.setTextColor(firstColor);

    // Add onClick listener to button
    View.OnClickListener listener =
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            String fact = getFact();
            factLabel.setText(fact);

            int color = getColor();
            // Toast.makeText(FunFactsActivity.this, "#" + Integer.toString(color).substring(1),
            // Toast.LENGTH_SHORT).show();
            relativeLayout.setBackgroundColor(color);
            showFactButton.setTextColor(color);
          }
        };
    showFactButton.setOnClickListener(listener);

    // Toast.makeText(this, "Yay! Our Activity was created!", Toast.LENGTH_SHORT).show();
    // Log.d(TAG, "We're logging from the onCreate() method!");
  }
 void hideFooterData() {
   viewUnderline.setVisibility(View.GONE);
   llElementsOfFooter.setVisibility(View.GONE);
   tvFooterTitle.setText("WHAT ARE YOU HERE TO DO?");
   tvFooterTitle.setTypeface(null, Typeface.BOLD);
   tvFooterTitle.setTextColor(getResources().getColor(R.color.black_heading));
   rlHeadingOfFooter.setBackgroundColor(getResources().getColor(R.color.common_footer));
 }
Example #18
0
 @Override
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   if (key == Constracts.KEY_THEME) {
     int anInt = sharedPreferences.getInt(key, 0);
     titleContainer.setBackgroundColor(
         changeBackgroundColor(mSharedPreferences.getInt(Constracts.KEY_THEME, 0)));
   }
 }
Example #19
0
 /**
  * 蓝牙连接断开
  *
  * @param v
  */
 public void btConnect(View v) {
   Log.d("goc", "btConnect");
   btPair.setEnabled(false);
   btPair.setBackgroundColor(Color.GRAY);
   sendBroadcast(
       new Intent(isBTConnected() ? GocMessage.DISCONNECT_PHONE : GocMessage.CONNECT_PHONE));
   handler.postDelayed(r, 60000);
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == 2) {
     final SharedPreferences pref =
         getActivity().getSharedPreferences("color1", getActivity().MODE_PRIVATE);
     int a = pref.getInt("background", 0);
     layout.setBackgroundColor(a);
   }
 }
  /** Create the view in which the video will be rendered. */
  private void setupView() {
    LinearLayout lLinLayout = new LinearLayout(this);
    lLinLayout.setId(1);
    lLinLayout.setOrientation(LinearLayout.VERTICAL);
    lLinLayout.setGravity(Gravity.CENTER);
    lLinLayout.setBackgroundColor(Color.BLACK);

    LayoutParams lLinLayoutParms =
        new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
    lLinLayout.setLayoutParams(lLinLayoutParms);

    this.setContentView(lLinLayout);

    RelativeLayout lRelLayout = new RelativeLayout(this);
    lRelLayout.setId(2);
    lRelLayout.setGravity(Gravity.CENTER);
    lRelLayout.setBackgroundColor(Color.BLACK);
    android.widget.RelativeLayout.LayoutParams lRelLayoutParms =
        new android.widget.RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
    lRelLayout.setLayoutParams(lRelLayoutParms);
    lLinLayout.addView(lRelLayout);

    mVideoView = new VideoView(this);
    mVideoView.setId(3);
    android.widget.RelativeLayout.LayoutParams lVidViewLayoutParams =
        new android.widget.RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lVidViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    mVideoView.setLayoutParams(lVidViewLayoutParams);
    lRelLayout.addView(mVideoView);

    mProgressBar = new ProgressBar(this);
    mProgressBar.setIndeterminate(true);
    mProgressBar.setVisibility(View.VISIBLE);
    mProgressBar.setEnabled(true);
    mProgressBar.setId(4);
    android.widget.RelativeLayout.LayoutParams lProgressBarLayoutParms =
        new android.widget.RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lProgressBarLayoutParms.addRule(RelativeLayout.CENTER_IN_PARENT);
    mProgressBar.setLayoutParams(lProgressBarLayoutParms);
    lRelLayout.addView(mProgressBar);

    mProgressMessage = new TextView(this);
    mProgressMessage.setId(5);
    android.widget.RelativeLayout.LayoutParams lProgressMsgLayoutParms =
        new android.widget.RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lProgressMsgLayoutParms.addRule(RelativeLayout.CENTER_HORIZONTAL);
    lProgressMsgLayoutParms.addRule(RelativeLayout.BELOW, 4);
    mProgressMessage.setLayoutParams(lProgressMsgLayoutParms);
    mProgressMessage.setTextColor(Color.LTGRAY);
    mProgressMessage.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
    mProgressMessage.setText("...");
    lRelLayout.addView(mProgressMessage);
  }
  private void setBackgroundImage() {
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.clubResult_background);

    if (globals.getBackgroundSetting()) {
      layout.setBackgroundResource(R.drawable.fallbrook_cropped_opaque);
    } else {
      layout.setBackgroundColor(Color.WHITE);
    }
  }
 @SuppressLint("ResourceAsColor")
 void showFooterData() {
   viewUnderline.setVisibility(View.VISIBLE);
   llElementsOfFooter.setVisibility(View.VISIBLE);
   tvFooterTitle.setTypeface(null, Typeface.NORMAL);
   tvFooterTitle.setText("WHAT ARE YOU LOOKING TO DO?");
   tvFooterTitle.setTextColor(R.color.textcolor_grey);
   rlHeadingOfFooter.setBackgroundColor(getResources().getColor(android.R.color.white));
 }
  public final void setupLayout() {
    RelativeLayout relativeLayout = new RelativeLayout(context);

    removeAllViews();
    relativeLayout.removeAllViews();

    relativeLayout.setBackgroundColor(Color.BLACK);
    relativeLayout.addView(preview);
    addView(relativeLayout);
  }
Example #25
0
  public Call(Context context) {
    super(context);
    color = xacInteractiveCanvas.fgColorGreen;

    CallManager.setPhone(this);

    appLayout = new RelativeLayout(context);
    appLayout.setBackgroundColor(xacInteractiveCanvas.bgColorGreen);

    //		dispatchButtons(context);
    layoutViews = new RelativeLayout(context);
    appLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent event) {
            posture = xacPostureSenseFeatureMaker.calculatePosture();
            if (posture != xacPostureSenseFeatureMaker.NOWATCH) {
              return false;
            }

            return true;
          }
        });
    layoutViews.setId(42);
    appLayout.addView(layoutViews);

    dispatchViews(context);

    layoutCallScreen = new RelativeLayout(context);
    layoutCallScreen.setBackgroundColor(0xDD000000);
    layoutCallScreen.setBackgroundResource(R.drawable.call_out);
    layoutCallScreen.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {

            posture = xacPostureSenseFeatureMaker.calculatePosture();
            if (posture == xacPostureSenseFeatureMaker.NONE) {
              if (event.getAction() == MotionEvent.ACTION_UP) {
                layoutCallScreen.setBackgroundColor(0xDD000000);
                appLayout.removeView(layoutCallScreen);
                isCalling = false;
                isInApp = false;
              }
            } else if (posture == xacPostureSenseFeatureMaker.NOWATCH) {
              doTouch(event);
            }

            return true;
          }
        });

    sup = "5 missed calls from Tiffany";
  }
Example #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // remove title bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    // remove notification bar
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    layout = new RelativeLayout(this);
    layout.setBackgroundColor(0xFFFFFF00);
    layout.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View view, MotionEvent event) {
            // TODO Auto-generated method stub
            int action = event.getAction();
            PointerCoords curCoord = new PointerCoords();
            event.getPointerCoords(0, curCoord);
            Calendar calendar = Calendar.getInstance();
            long curTime = calendar.getTimeInMillis();
            switch (action) {
              case MotionEvent.ACTION_DOWN:
                xTouchDown = event.getAxisValue(MotionEvent.AXIS_X); // curCoord.x;
                yTouchDown = curCoord.y;
                timeTouchDown = curTime;
                cntDataPoint = 0;
                break;
                //				case MotionEvent.ACTION_MOVE:
              default:
                int dt = (int) (curTime - timeTouchDown);
                if (dt < HANDEDNESSTIMEOUT) {
                  Log.d(
                      LOGTAG,
                      "["
                          + cntDataPoint++
                          + "] "
                          + dt
                          + ": "
                          + event.getOrientation(0)
                          + ", "
                          + (event.getAxisValue(MotionEvent.AXIS_X) - xTouchDown));
                }
                break;
                //				case MotionEvent.ACTION_UP:
                //					break;
            }
            return true;
          }
        });

    setContentView(layout);
  }
  public ArticleThumbnailFrame(Context context) {
    super(context);

    this.context = context;

    DisplayMetrics metrics = getResources().getDisplayMetrics();

    ImageView cornerImg = new ImageView(context);

    cornerImg.setImageResource(R.drawable.corner);

    int imgWidth = (int) (metrics.widthPixels / 32);
    int imgMargin = (int) (metrics.widthPixels / 32 / 2);
    RelativeLayout rel = new RelativeLayout(context);
    RelativeLayout rel2 = new RelativeLayout(context);
    LinearLayout lin = new LinearLayout(context);

    float w = metrics.widthPixels / 14 * 13 / 5 / 3;
    float h = w / 130 * 36;
    LinearLayout.LayoutParams linPar = new LinearLayout.LayoutParams((int) w, (int) h);
    lin.setLayoutParams(linPar);
    RelativeLayout.LayoutParams params1 =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    RelativeLayout.LayoutParams params3 =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

    //	RelativeLayout.LayoutParams params4 = new RelativeLayout.LayoutParams(w, 50);
    rel.setPadding(
        metrics.widthPixels / 14 * 13 / 5 / 8,
        0,
        metrics.widthPixels / 14 * 13 / 5 / 20,
        metrics.widthPixels / 14 * 13 / 5 / 20);

    params3.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    rel.addView(lin, params1);
    rel2.setBackgroundColor(Color.WHITE);

    controlsLayer = new ArticleControlsLayer(context);
    controlsLayer.setVisibility(View.INVISIBLE);

    LayoutParams cornerParams = new LayoutParams(imgWidth, imgWidth);
    cornerParams.setMargins(imgMargin, imgMargin, 0, 0);
    cornerImg.setLayoutParams(cornerParams);
    MyPaint viewPaint = new MyPaint(context, controlsLayer, cornerImg, imgMargin, imgWidth);

    this.addView(rel, params1);
    this.addView(viewPaint);
    this.addView(
        controlsLayer, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    this.addView(cornerImg);
  }
Example #28
0
  private void openNotificationPage(String url) {

    actionBarHobtime.setBackgroundColor(getResources().getColor(R.color.hobtimeGreen));
    WebViewFragment webViewFragment = WebViewFragment.newInstance(url);
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.setCustomAnimations(
        R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right);
    fragmentTransaction.replace(R.id.afterLoginFragmentContainer, webViewFragment);
    fragmentTransaction.addToBackStack("");
    fragmentTransaction.commit();
  }
 // 3. Manejar los eventos de click sobre los context Menu
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.amarillo:
       ventana.setBackgroundColor(Color.YELLOW);
       break;
     case R.id.azul:
       ventana.setBackgroundColor(Color.BLUE);
       break;
     case R.id.rojo:
       ventana.setBackgroundColor(Color.RED);
       break;
     case R.id.verde:
       ventana.setBackgroundColor(Color.GREEN);
       break;
     default:
       ventana.setBackgroundColor(Color.MAGENTA);
       break;
   }
   return super.onContextItemSelected(item);
 }
Example #30
0
 @Override
 public View initView() {
   View inflate = mLayoutInflater.inflate(R.layout.news_detail_content, null);
   ScrollView scrollView = (ScrollView) inflate.findViewById(R.id.scrollView);
   scrollView.smoothScrollTo(0, 0);
   scrollView.setVerticalScrollBarEnabled(false);
   scrollView.setOverScrollMode(View.OVER_SCROLL_NEVER);
   titleContainer = (RelativeLayout) inflate.findViewById(R.id.title_container);
   titleContainer.setBackgroundColor(
       changeBackgroundColor(mSharedPreferences.getInt(Constracts.KEY_THEME, 0)));
   return inflate;
 }