Beispiel #1
0
 @SuppressWarnings("deprecation")
 private void inui() throws AppException {
   // TODO Auto-generated method stub
   String loadTime = user.getString("url", "");
   if (loadTime.equals("")) {
     mainLayout.setBackgroundResource(R.drawable.ic_mainbg2);
   } else {
     if (loadTime.startsWith("sd:")) {
       loadTime = loadTime.substring(3);
       mainLayout.setBackground(new BitmapDrawable(BitmapFactory.decodeFile(loadTime)));
     } else {
       try {
         mainLayout.setBackground(
             new BitmapDrawable(BitmapFactory.decodeStream(getAssets().open(loadTime))));
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
   Reminds reminds = null;
   if (!remindfzDB.select().equals("")) {
     reminds = Reminds.parse(remindfzDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindfs.add(reminds.getFileList().get(i));
     }
   }
   if (remindfs.size() == 0) {
     rels.setVisibility(View.INVISIBLE);
   } else {
     fsize.setText(String.valueOf(remindfs.size()));
   }
   if (!remindzjDB.select().equals("")) {
     reminds = Reminds.parse(remindzjDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindzj.add(reminds.getFileList().get(i));
     }
   }
   if (remindzj.size() == 0) {
     rels1.setVisibility(View.INVISIBLE);
   } else {
     hsize.setText(String.valueOf(remindzj.size()));
   }
   if (!remindnewsDB.select().equals("")) {
     reminds = Reminds.parse(remindnewsDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindnews.add(reminds.getFileList().get(i));
     }
   }
   if (remindnews.size() == 0) {
     rels2.setVisibility(View.INVISIBLE);
   } else {
     nsize.setText(String.valueOf(remindnews.size()));
   }
 }
 /**
  * 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());
   }
 }
  public void setBackground() {
    // avoid outOfMemory problem
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;

    BitmapFactory.decodeResource(this.getResources(), R.drawable.background, options);

    int width = options.outWidth;
    int height = options.outHeight;

    Display display = getWindowManager().getDefaultDisplay();

    int screenWidth = display.getWidth();
    int screenHeight = display.getHeight();

    int scale = 1;
    int scaleWeight = width / screenWidth;
    int scaleHeight = height / screenHeight;

    if (scaleWeight >= scaleHeight && scaleWeight > 1) {
      scale = scaleWeight;
    } else if (scaleHeight > scaleWeight && scaleHeight >= 1) {
      scale = scaleHeight;
    }

    options.inSampleSize = 4;
    options.inJustDecodeBounds = false;
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.background, options);

    rl.setBackground(new BitmapDrawable(getResources(), bitmap));
  }
 public void setBackGround(Drawable drawable) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     drawContainer.setBackground(drawable);
   } else {
     drawContainer.setBackgroundDrawable(drawable);
   }
 }
 @Override
 public void setBackground(Drawable background) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     mSearchTopBar.setBackground(background);
   } else {
     mSearchTopBar.setBackgroundDrawable(background);
   }
 }
 @SuppressLint("NewApi")
 /**
  * @param drawable
  *     <p>Sets the background color of the month bar. Requires at least API level 16
  */
 public void setMonthTextBackgroundDrawable(Drawable drawable) {
   if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
     base.setBackground(drawable);
   }
 }
Beispiel #7
0
 @Override
 public boolean onTouch(View v, MotionEvent event) {
   // TODO Auto-generated method stub
   if (event.getAction() == MotionEvent.ACTION_DOWN) {
     rl_back.setBackgroundResource(R.drawable.abs__list_focused_holo);
   } else {
     rl_back.setBackground(null);
     finish();
   }
   return true;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_net);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // Объявление компонентов и установка настроек
    editText = (EditText) findViewById(R.id.editText);
    netMain = (RelativeLayout) findViewById(R.id.netMain);
    Resources res = getResources();
    netMain.setBackground(res.getDrawable(R.drawable.theme));
    button = (Button) findViewById(R.id.button);
    button.setOnClickListener(this);
  }
  /** create feedback screen UI as per model and set data */
  private void componentInitialization() {
    // Set Parent Layout Image background
    String parentLayoutImageBackgroundPath = BASE_URL + "/screen2_background_and.png";
    RelativeLayout parentRL = (RelativeLayout) this.findViewById(R.id.thankuScreenParentRL);
    parentRL.setBackground(new BitmapDrawable(null, getBitmap(parentLayoutImageBackgroundPath)));

    // Set screen2_header_and
    String headerBackgroundPath = BASE_URL + "/screen2_header_and.png";
    RelativeLayout greetingScreenHeaderRL =
        (RelativeLayout) findViewById(R.id.thankuScreenHeaderRL);
    greetingScreenHeaderRL.setBackground(new BitmapDrawable(null, getBitmap(headerBackgroundPath)));

    // center parent
    String centerParentBackgroundPath = BASE_URL + "/screen3_background_and.png";
    RelativeLayout centerParentLL = (RelativeLayout) findViewById(R.id.thankuScreenCenterParentLL);
    centerParentLL.setBackground(new BitmapDrawable(null, getBitmap(centerParentBackgroundPath)));

    // parent of final rating rl
    String ratingDialogBG = BASE_URL + "/screen4_ratings_layout_bg_and.png";
    RelativeLayout finalRatingRL = (RelativeLayout) findViewById(R.id.thankuScreenFinalRatingRL);
    finalRatingRL.setBackground(new BitmapDrawable(null, getBitmap(ratingDialogBG)));
    // inner RL
    String rating_bg_and = BASE_URL + "/screen4_ratings_bg_and.png";
    RelativeLayout ratingInnerBGRL =
        (RelativeLayout) findViewById(R.id.thankuScreenRatingInnerBGRL);
    ratingInnerBGRL.setBackground(new BitmapDrawable(null, getBitmap(rating_bg_and)));

    String ratingTitleBG = BASE_URL + "/screen4_rating_header_and.png";
    RelativeLayout ratingHeaderRL = (RelativeLayout) findViewById(R.id.thankuScreenRatingHeaderRL);
    ratingHeaderRL.setBackground(new BitmapDrawable(null, getBitmap(ratingTitleBG)));

    TextView thankuScreenRatingHeadingTV =
        (TextView) this.findViewById(R.id.thankuScreenRatingHeadingTV);
    thankuScreenRatingHeadingTV.setText(Title_Msg);

    ((TextView) this.findViewById(R.id.thankuScreenFinalRatingText))
        .setText("" + HosiacSharedPreference.getFinalRating());

    // star rating
    selectedStarBG = BASE_URL + "/star_on_and.png";
    non_selectedStarBG = BASE_URL + "/star_off_and.png";
    half_selectedStarBG = BASE_URL + "/star_half_and.png";

    finalRatingStar1IV = (ImageView) this.findViewById(R.id.thankuScreenFinalRatingStar1IV);
    finalRatingStar2IV = (ImageView) this.findViewById(R.id.thankuScreenFinalRatingStar2IV);
    finalRatingStar3IV = (ImageView) this.findViewById(R.id.thankuScreenFinalRatingStar3IV);
    finalRatingStar4IV = (ImageView) this.findViewById(R.id.thankuScreenFinalRatingStar4IV);
    finalRatingStar5IV = (ImageView) this.findViewById(R.id.thankuScreenFinalRatingStar5IV);

    initializeStarsImages();
  }
  @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));
  }
  // View inflater
  @SuppressWarnings("deprecation")
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    // Inflate custom note view if null
    if (convertView == null)
      convertView = this.inflater.inflate(R.layout.list_view_note, parent, false);

    // Initialize layout items
    RelativeLayout relativeLayout = (RelativeLayout) convertView.findViewById(R.id.relativeLayout);
    LayerDrawable roundedCard =
        (LayerDrawable) context.getResources().getDrawable(R.drawable.rounded_card);
    TextView titleView = (TextView) convertView.findViewById(R.id.titleView);
    TextView bodyView = (TextView) convertView.findViewById(R.id.bodyView);
    ImageButton favourite = (ImageButton) convertView.findViewById(R.id.favourite);

    // Get Note object at position
    JSONObject noteObject = getItem(position);

    if (noteObject != null) {
      // If noteObject not empty -> initialize variables
      String title = context.getString(R.string.note_title);
      String body = context.getString(R.string.note_body);
      String colour = String.valueOf(context.getResources().getColor(R.color.white));
      int fontSize = 18;
      Boolean hideBody = false;
      Boolean favoured = false;

      try {
        // Get noteObject data and store in variables
        title = noteObject.getString(NOTE_TITLE);
        body = noteObject.getString(NOTE_BODY);
        colour = noteObject.getString(NOTE_COLOR);

        if (noteObject.has(NOTE_FONT_SIZE)) fontSize = noteObject.getInt(NOTE_FONT_SIZE);

        if (noteObject.has(NOTE_HIDE_BODY)) hideBody = noteObject.getBoolean(NOTE_HIDE_BODY);

        favoured = noteObject.getBoolean(NOTE_FAVOURED);

      } catch (JSONException e) {
        e.printStackTrace();
      }

      // Set favourite image resource
      if (favoured) favourite.setImageResource(R.drawable.ic_fav);
      else favourite.setImageResource(R.drawable.ic_unfav);

      // If search or delete modes are active -> hide favourite button; Show otherwise
      if (searchActive || deleteActive) favourite.setVisibility(View.INVISIBLE);
      else favourite.setVisibility(View.VISIBLE);

      titleView.setText(title);

      // If hidBody is true -> hide body of note
      if (hideBody) bodyView.setVisibility(View.GONE);

      // Else -> set visible note body, text to normal and set text size to 'fontSize' as sp
      else {
        bodyView.setVisibility(View.VISIBLE);
        bodyView.setText(body);
        bodyView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
      }

      // If current note is selected for deletion -> highlight
      if (checkedArray.contains(position)) {
        ((GradientDrawable) roundedCard.findDrawableByLayerId(R.id.card))
            .setColor(context.getResources().getColor(R.color.theme_primary));
      }

      // If current note is not selected -> set background colour to normal
      else {
        ((GradientDrawable) roundedCard.findDrawableByLayerId(R.id.card))
            .setColor(Color.parseColor(colour));
      }

      // Set note background style to rounded card
      relativeLayout.setBackground(roundedCard);

      final Boolean finalFavoured = favoured;
      favourite.setOnClickListener(
          new View.OnClickListener() {
            // If favourite button was clicked -> change that note to favourite or un-favourite
            @Override
            public void onClick(View v) {
              setFavourite(context, !finalFavoured, position);
            }
          });
    }

    return convertView;
  }
 /**
  * Sets the content for the fight based on the level chosen. For each level, adds opponents
  * equation operators and answers, plus sets the first background.
  */
 public void setContent() {
   String lastMap = player.getLastMap();
   RelativeLayout rl = (RelativeLayout) findViewById(R.id.fightLayout);
   switch (level) {
     case "1_1":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone1gobloidspearman));
       Opponent spearman = new Opponent(Opponent.Stats.GB_SPEARMAN, "zone1gobloidspearman");
       currOpponet = spearman;
       setProgressBars(currOpponet);
       spearman.setOp(opList);
       opponents.add(spearman);
       opList.clear();
       opList.add("+");
       generateOperations(opList);
       generateAns(level);
       break;
     case "1_2":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone1gobloidslasher));
       Opponent slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone1gobloidslasher");
       currOpponet = slasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       slasher.setOp(opList);
       opponents.add(slasher);
       generateOperations(opList);
       generateAns(level);
       break;
     case "1_3":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone1gobloidslasher));
       slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone1gobloidslasher");
       spearman = new Opponent(Opponent.Stats.GB_SPEARMAN, "zone1gobloidspearman");
       currOpponet = slasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       spearman.setOp(opList);
       slasher.setOp(opList);
       opponents.add(slasher);
       opponents.add(spearman);
       generateOperations(opList);
       generateAns(level);
       break;
     case "1_4":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone1gobloidslasher));
       slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone1gobloidslasher");
       Opponent slasherTwo = new Opponent(Opponent.Stats.GB_SLASHER, "zone1gobloidslasher");
       Opponent shaman = new Opponent(Opponent.Stats.GB_SHAMAN, "zone1gobloidshaman");
       currOpponet = slasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       shaman.setOp(opList);
       slasher.setOp(opList);
       slasherTwo.setOp(opList);
       opponents.add(slasher);
       opponents.add(shaman);
       opponents.add(slasherTwo);
       generateOperations(opList);
       generateAns(level);
       break;
     case "1_5":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone1gobloidspearman));
       spearman = new Opponent(Opponent.Stats.GB_SPEARMAN, "zone1gobloidspearman");
       shaman = new Opponent(Opponent.Stats.GB_SHAMAN, "zone1gobloidshaman");
       Opponent grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone1skeletoniangrabber");
       currOpponet = spearman;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       spearman.setOp(opList);
       shaman.setOp(opList);
       grabber.setOp(opList);
       opponents.add(spearman);
       opponents.add(shaman);
       opponents.add(grabber);
       generateOperations(opList);
       generateAns(level);
       break;
     case "2_1":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone2gobloidslasher));
       slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone2gobloidslasher");
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone2skeletoniangrabber");
       currOpponet = slasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       slasher.setOp(opList);
       grabber.setOp(opList);
       opponents.add(slasher);
       opponents.add(grabber);
       generateOperations(opList);
       generateAns(level);
       break;
     case "2_2":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone2skeletoniangrabber));
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone2skeletoniangrabber");
       Opponent smasher = new Opponent(Opponent.Stats.SK_SMASHER, "zone2skeletoniansmasher");
       Opponent grabberTwo = new Opponent(Opponent.Stats.SK_GRABBER, "zone2skeletoniangrabber");
       currOpponet = grabber;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       grabber.setOp(opList);
       smasher.setOp(opList);
       grabberTwo.setOp(opList);
       opponents.add(grabber);
       opponents.add(smasher);
       opponents.add(grabberTwo);
       generateOperations(opList);
       generateAns(level);
       break;
     case "2_3":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone2skeletoniansmasher));
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone2skeletoniangrabber");
       smasher = new Opponent(Opponent.Stats.SK_SMASHER, "zone2skeletoniansmasher");
       Opponent smasherTwo = new Opponent(Opponent.Stats.SK_SMASHER, "zone2skeletoniansmasher");
       currOpponet = smasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       grabber.setOp(opList);
       smasher.setOp(opList);
       smasherTwo.setOp(opList);
       opponents.add(smasher);
       opponents.add(grabber);
       opponents.add(smasherTwo);
       generateOperations(opList);
       generateAns(level);
       break;
     case "2_4":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone2skeletonianwizard));
       Opponent wizard = new Opponent(Opponent.Stats.SK_WIZARD, "zone2skeletonianwizard");
       currOpponet = wizard;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       wizard.setOp(opList);
       opponents.add(wizard);
       generateOperations(opList);
       generateAns(level);
       break;
     case "2_5":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone2skeletoniangrabber));
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone2skeletoniangrabber");
       wizard = new Opponent(Opponent.Stats.SK_WIZARD, "zone2skeletonianwizard");
       currOpponet = grabber;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       wizard.setOp(opList);
       grabber.setOp(opList);
       opponents.add(grabber);
       opponents.add(wizard);
       generateOperations(opList);
       generateAns(level);
       break;
     case "3_1":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone3skeletoniangrabber));
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone3skeletoniangrabber");
       spearman = new Opponent(Opponent.Stats.GB_SPEARMAN, "zone3gobloidspearman");
       shaman = new Opponent(Opponent.Stats.GB_SHAMAN, "zone3gobloidshaman");
       currOpponet = grabber;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       spearman.setOp(opList);
       shaman.setOp(opList);
       grabber.setOp(opList);
       opponents.add(grabber);
       opponents.add(spearman);
       opponents.add(shaman);
       generateOperations(opList);
       generateAns(level);
       break;
     case "3_2":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone3skeletoniangrabber));
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone3skeletoniangrabber");
       smasher = new Opponent(Opponent.Stats.SK_SMASHER, "zone3skeletoniansmasher");
       slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone3gobloidslasher");
       currOpponet = grabber;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       opList.add("/");
       smasher.setOp(opList);
       slasher.setOp(opList);
       grabber.setOp(opList);
       opponents.add(grabber);
       opponents.add(smasher);
       opponents.add(slasher);
       generateOperations(opList);
       generateAns(level);
       break;
     case "3_3":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone3gobloidslasher));
       smasher = new Opponent(Opponent.Stats.SK_SMASHER, "zone3skeletoniansmasher");
       slasher = new Opponent(Opponent.Stats.GB_SLASHER, "zone3gobloidslasher");
       slasherTwo = new Opponent(Opponent.Stats.GB_SLASHER, "zone3gobloidslasher");
       currOpponet = slasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       opList.add("/");
       smasher.setOp(opList);
       slasher.setOp(opList);
       slasherTwo.setOp(opList);
       opponents.add(slasher);
       opponents.add(smasher);
       opponents.add(slasherTwo);
       generateOperations(opList);
       generateAns(level);
       break;
     case "3_4":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone3skeletoniansmasher));
       smasher = new Opponent(Opponent.Stats.SK_SMASHER, "zone3skeletoniansmasher");
       shaman = new Opponent(Opponent.Stats.GB_SLASHER, "zone3gobloidslasher");
       smasherTwo = new Opponent(Opponent.Stats.GB_SLASHER, "zone3skeletoniansmasher");
       currOpponet = smasher;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       opList.add("/");
       smasher.setOp(opList);
       shaman.setOp(opList);
       smasherTwo.setOp(opList);
       opponents.add(smasher);
       opponents.add(shaman);
       opponents.add(smasherTwo);
       generateOperations(opList);
       generateAns(level);
       break;
     case "3_5":
       rl.setBackground(ContextCompat.getDrawable(this, R.drawable.zone3gobloidspearman));
       spearman = new Opponent(Opponent.Stats.GB_SPEARMAN, "zone3gobloidspearman");
       shaman = new Opponent(Opponent.Stats.GB_SHAMAN, "zone3gobloidshaman");
       grabber = new Opponent(Opponent.Stats.SK_GRABBER, "zone3skeletoniangrabber");
       wizard = new Opponent(Opponent.Stats.SK_WIZARD, "zone3skeletonianwizard");
       currOpponet = spearman;
       setProgressBars(currOpponet);
       opList.clear();
       opList.add("+");
       opList.add("-");
       opList.add("*");
       opList.add("/");
       spearman.setOp(opList);
       shaman.setOp(opList);
       grabber.setOp(opList);
       wizard.setOp(opList);
       opponents.add(spearman);
       opponents.add(grabber);
       opponents.add(shaman);
       opponents.add(wizard);
       generateOperations(opList);
       generateAns(level);
       break;
   }
 }
Beispiel #13
0
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.set_rl_back:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_back.setBackgroundResource(R.drawable.abs__list_focused_holo);
        } else {
          rl_back.setBackground(null);
          finish();
        }
        break;
      case R.id.set_rl_refresh:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_refresh.setBackgroundResource(R.color.light_gray);
        } else {
          rl_refresh.setBackground(null);
        }
        break;
      case R.id.set_rl_font:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_font.setBackgroundResource(R.color.light_gray);
        } else {
          rl_font.setBackground(null);
          String[] items = {"较大", "普通", "较小"}; // 列表中显示的内容组成的数组
          Builder dialog = new AlertDialog.Builder(SetActivity.this);
          dialog.setTitle("字体大小设置"); // 对话框标题
          dialog.setSingleChoiceItems(
              items,
              1,
              new DialogInterface.OnClickListener() { // 每一条的名称
                public void onClick(DialogInterface dialog, int which) { // 响应点击事件
                  switch (which) {
                    case 0:
                      dialog.dismiss();
                      break;

                    case 1:
                      dialog.dismiss();
                      break;

                    case 2:
                      dialog.dismiss();
                      break;

                    default:
                      break;
                  }
                }
              });
          dialog.show();
        }
        break;
      case R.id.set_rl_cache:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_cache.setBackgroundResource(R.color.light_gray);
        } else {
          rl_cache.setBackground(null);
          Builder dialog = new AlertDialog.Builder(SetActivity.this);
          dialog.setTitle("清空缓存"); // 对话框标题
          dialog.setMessage("是否清空缓存?");
          dialog
              .setPositiveButton(
                  "是",
                  new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      // TODO Auto-generated method stub

                    }
                  })
              .setNegativeButton(
                  "否",
                  new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      // TODO Auto-generated method stub

                    }
                  });
          dialog.show();
        }
        break;
      case R.id.set_rl_image:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_image.setBackgroundResource(R.color.light_gray);
        } else {
          rl_image.setBackground(null);
          String[] items = {"中图", "小图", "无图"}; // 列表中显示的内容组成的数组
          Builder dialog = new AlertDialog.Builder(SetActivity.this);
          dialog.setTitle("微博图片显示模式"); // 对话框标题
          dialog.setSingleChoiceItems(
              items,
              1,
              new DialogInterface.OnClickListener() { // 每一条的名称
                public void onClick(DialogInterface dialog, int which) { // 响应点击事件
                  switch (which) {
                    case 0:
                      dialog.dismiss();
                      break;

                    case 1:
                      dialog.dismiss();
                      break;

                    case 2:
                      dialog.dismiss();
                      break;

                    default:
                      break;
                  }
                }
              });
          dialog.show();
        }
        break;
      case R.id.set_rl_down:
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
          rl_down.setBackgroundResource(R.color.light_gray);
        } else {
          rl_down.setBackground(null);
          String[] items = {"中图", "小图", "无图"}; // 列表中显示的内容组成的数组
          Builder dialog = new AlertDialog.Builder(SetActivity.this);
          dialog.setTitle("下载图片质量"); // 对话框标题
          dialog.setSingleChoiceItems(
              items,
              1,
              new DialogInterface.OnClickListener() { // 每一条的名称
                public void onClick(DialogInterface dialog, int which) { // 响应点击事件
                  switch (which) {
                    case 0:
                      dialog.dismiss();
                      break;

                    case 1:
                      dialog.dismiss();
                      break;

                    case 2:
                      dialog.dismiss();
                      break;

                    default:
                      break;
                  }
                }
              });
          dialog.show();
        }
        break;

      default:
        break;
    }

    return true;
  }
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 @Override
 public void setBackground(Drawable background) {
   super.setBackground(null);
 }
 private void resetLayout() {
   _updateListItems();
   btnTeamAdd.setBackground(getDrawable(R.drawable.buttonshape));
 }
 private void displayStepImage() {
   int imageResource =
       getResources().getIdentifier(foodItem.getCurrentStepImage(), "drawable", getPackageName());
   Drawable stepImage = getResources().getDrawable(imageResource);
   trainingLayout.setBackground(stepImage);
 }
Beispiel #17
0
 public void setbackgroundColorRelay(Drawable drawable) {
   layout.setBackground(drawable);
 }