public void RefreshTotalChecked(
      TextView totalCheckedTextView, TextView tvName, LinearLayout layout, int position) {
    ShoppingList shoppingList = shoppingLists.get(position);
    String text =
        DataManager.shoppingListGetChecked(shoppingList) + "/" + shoppingList.getItems().size();
    totalCheckedTextView.setText(text);

    boolean shoppingListIsChecked = DataManager.shoppingListIsChecked(shoppingList);
    if (shoppingListIsChecked) {
      DataManager.setShoppingListIsChecked(shoppingList, true);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackgroundChecked),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      DataManager.setShoppingListIsChecked(shoppingList, false);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackground),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View rootView = inflateAndBind(inflater, container, R.layout.fragment_contact);
   sendFeedback.setOnClickListener(this);
   contact1.setPaintFlags(contact1.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
   contact2.setPaintFlags(contact2.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
   contact1.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           String s = contact1.getText().toString();
           startActivity(
               new Intent(Intent.ACTION_DIAL)
                   .setData(Uri.parse("tel:" + s.substring(s.indexOf(":")).trim())));
         }
       });
   contact2.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           String s = contact2.getText().toString();
           startActivity(
               new Intent(Intent.ACTION_DIAL)
                   .setData(Uri.parse("tel:" + s.substring(s.indexOf(":")).trim())));
         }
       });
   return rootView;
 }
Exemple #3
0
 public static void strike(TextView tv, boolean enable) {
   if (enable) {
     tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
   } else {
     tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
   }
 }
 private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean predictive) {
   double estimate = 0;
   if ((new Date().getTime()) - (60000 * 11) - lastBgReading.timestamp > 0) {
     notificationText.setText("Signal Missed");
     if (!predictive) {
       estimate = lastBgReading.calculated_value;
     } else {
       estimate = BgReading.estimated_bg(lastBgReading.timestamp + (6000 * 7));
     }
     currentBgValueText.setText(bgGraphBuilder.unitized_string(estimate));
     currentBgValueText.setPaintFlags(
         currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
     dexbridgeBattery.setPaintFlags(
         dexbridgeBattery.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
   } else {
     if (notificationText.getText().length() == 0) {
       notificationText.setTextColor(Color.WHITE);
     }
     if (!predictive) {
       estimate = lastBgReading.calculated_value;
       String stringEstimate = bgGraphBuilder.unitized_string(estimate);
       String slope_arrow = lastBgReading.slopeArrow();
       if (lastBgReading.hide_slope) {
         slope_arrow = "";
       }
       currentBgValueText.setText(stringEstimate + " " + slope_arrow);
     } else {
       estimate = BgReading.activePrediction();
       String stringEstimate = bgGraphBuilder.unitized_string(estimate);
       currentBgValueText.setText(stringEstimate + " " + BgReading.activeSlopeArrow());
     }
   }
   int minutes = (int) (System.currentTimeMillis() - lastBgReading.timestamp) / (60 * 1000);
   notificationText.append("\n" + minutes + ((minutes == 1) ? " Minute ago" : " Minutes ago"));
   List<BgReading> bgReadingList = BgReading.latest(2);
   if (bgReadingList != null && bgReadingList.size() == 2) {
     // same logic as in xDripWidget (refactor that to BGReadings to avoid redundancy / later
     // inconsistencies)?
     if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
       notificationText.append("  ");
     } else {
       notificationText.append("\n");
     }
     notificationText.append(bgGraphBuilder.unitizedDeltaString(true, true));
   }
   if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) {
     currentBgValueText.setTextColor(Color.parseColor("#C30909"));
   } else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) {
     currentBgValueText.setTextColor(Color.parseColor("#FFBB33"));
   } else {
     currentBgValueText.setTextColor(Color.WHITE);
   }
 }
  public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) {
    if (data != null) {
      data.moveToFirst();
      final Double exchangeRate =
          data.getDouble(data.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_EXCHANGE_RATE));

      viewBalanceLocal.setVisibility(View.GONE);
      if (application.getWallet().getBalance(BalanceType.ESTIMATED).signum() > 0
          && exchangeRate != null) {
        final String exchangeCurrency =
            prefs.getString(
                Constants.PREFS_KEY_EXCHANGE_CURRENCY, Constants.DEFAULT_EXCHANGE_CURRENCY);
        final BigInteger balance = application.getWallet().getBalance(BalanceType.ESTIMATED);
        final BigInteger valueLocal =
            new BigDecimal(balance).multiply(new BigDecimal(exchangeRate)).toBigInteger();
        viewBalanceLocal.setVisibility(View.VISIBLE);
        viewBalanceLocal.setText(
            getString(
                R.string.wallet_balance_fragment_local_value,
                exchangeCurrency,
                WalletUtils.formatValue(valueLocal)));
        if (Constants.TEST)
          viewBalanceLocal.setPaintFlags(
              viewBalanceLocal.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      }
    }
  }
  /**
   * Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple times,
   * as this adds a TextWatcher.
   *
   * <p>Deferring should really only be used on tricky views which get Typeface set by the system at
   * weird times.
   *
   * @param textView Not null, TextView or child of.
   * @param typeface Not null, Typeface to apply to the TextView.
   * @param deferred If true we use Typefaces and TextChange listener to make sure font is always
   *     applied, but this sometimes conflicts with other {@link android.text.Spannable}'s.
   * @return true if applied otherwise false.
   * @see #applyFontToTextView(android.widget.TextView, android.graphics.Typeface)
   */
  public static boolean applyFontToTextView(
      final TextView textView, final Typeface typeface, boolean deferred) {
    if (textView == null || typeface == null) return false;
    textView.setPaintFlags(
        textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    textView.setTypeface(typeface);
    if (deferred) {
      textView.setText(
          applyTypefaceSpan(textView.getText(), typeface), TextView.BufferType.SPANNABLE);
      textView.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {}

            @Override
            public void afterTextChanged(Editable s) {
              applyTypefaceSpan(s, typeface);
            }
          });
    }
    return true;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    emailTextView = (AutoCompleteTextView) findViewById(R.id.email);
    loadAutoComplete();

    passwordTextView = (EditText) findViewById(R.id.password);
    passwordTextView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == EditorInfo.IME_NULL) {
              initLogin();
              return true;
            }
            return false;
          }
        });

    loginFormView = findViewById(R.id.login_form);
    progressView = findViewById(R.id.login_progress);
    tv = (TextView) findViewById(R.id.tv);

    // Adiciona botom para el loguin
    Button loginButton = (Button) findViewById(R.id.email_sign_in_button);
    loginButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            dialog = ProgressDialog.show(LoginActivity.this, "", "Validacion de Usuario...", true);

            new Thread(
                    new Runnable() {
                      @Override
                      public void run() {
                        initLogin();
                      }
                    })
                .start();
          }
        });
    // adding underline and link to signup textview
    signUpTextView = (TextView) findViewById(R.id.signUpTextView);
    signUpTextView.setPaintFlags(signUpTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    Linkify.addLinks(signUpTextView, Linkify.ALL);

    signUpTextView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.i("LoginActivity", "Sign Up Activity activated.");
            // this is where you should start the signup Activity
            // LoginActivity.this.startActivity(new Intent(LoginActivity.this,
            // SignupActivity.class));
          }
        });
  }
  private void initViews() {

    txtv_viewAllEvents = (TextView) findViewById(R.id.txtv_viewAllEvents);
    if (txtv_viewAllEvents != null) {
      txtv_viewAllEvents.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
      txtv_viewAllEvents.setOnClickListener(this);
    }
  }
 /** Apply the typeface to all the given viewIds, and enable subpixel rendering. */
 public BaseRcvAdapterHelper setTypeface(Typeface typeface, int... viewIds) {
   for (int viewId : viewIds) {
     TextView view = retrieveView(viewId);
     view.setTypeface(typeface);
     view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
   }
   return this;
 }
Exemple #10
0
 public ViewHolder setTypeface(Typeface typeface, int... viewIds) {
   for (int viewId : viewIds) {
     TextView view = getView(viewId);
     view.setTypeface(typeface);
     view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
   }
   return this;
 }
Exemple #11
0
    public View getView(int position, View convertView, ViewGroup parent) {
      View view;
      int type = getItemViewType(position);
      if (convertView == null) {
        // view = new TextView(getContext());
        int res = R.layout.bookmark_position_item;
        switch (type) {
          case ITEM_COMMENT:
            res = R.layout.bookmark_comment_item;
            break;
          case ITEM_CORRECTION:
            res = R.layout.bookmark_correction_item;
            break;
          case ITEM_SHORTCUT:
            res = R.layout.bookmark_shortcut_item;
            break;
        }
        view = mInflater.inflate(res, null);
      } else {
        view = (View) convertView;
      }
      TextView labelView = (TextView) view.findViewById(R.id.bookmark_item_shortcut);
      TextView posTextView = (TextView) view.findViewById(R.id.bookmark_item_pos_text);
      TextView titleTextView = (TextView) view.findViewById(R.id.bookmark_item_title);
      TextView commentTextView = (TextView) view.findViewById(R.id.bookmark_item_comment_text);
      if (type == ITEM_CORRECTION && posTextView != null)
        posTextView.setPaintFlags(posTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

      Bookmark b = (Bookmark) getItem(position);
      if (labelView != null) {
        if (b != null && b.getShortcut() > 0) labelView.setText(String.valueOf(b.getShortcut()));
        else labelView.setText(String.valueOf(position + 1));
      }
      if (b != null) {
        String percentString = Utils.formatPercent(b.getPercent());
        String s1 = b.getTitleText();
        String s2 = b.getPosText();
        String s3 = b.getCommentText();
        if (s1 != null && s2 != null) {
          s1 = percentString + "   " + s1;
        } else if (s1 != null) {
          s2 = s1;
          s1 = percentString;
        } else if (s2 != null) {
          s1 = percentString;
        } else {
          s1 = s2 = "";
        }
        if (titleTextView != null) titleTextView.setText(s1);
        if (posTextView != null) posTextView.setText(s2);
        if (commentTextView != null) commentTextView.setText(s3);
      } else {
        if (commentTextView != null) commentTextView.setText("");
        if (titleTextView != null) titleTextView.setText("");
        if (posTextView != null) posTextView.setText("");
      }
      return view;
    }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   // Inflate the layout for this fragment
   View rootView = inflater.inflate(R.layout.fragment_bt_unavailable, container, false);
   ButterKnife.bind(this, rootView);
   githubLink.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
   return rootView;
 }
  public void setAppearance(String appearance) {
    if (view != null) {
      if (Tools.contains(appearance, "bold")) {
        view.setTypeface(null, Typeface.BOLD);
      }

      if (Tools.contains(appearance, "italic")) {
        view.setTypeface(null, Typeface.ITALIC);
      }

      if (Tools.contains(appearance, "underline")) {
        view.setPaintFlags(view.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
      }

      if (Tools.contains(appearance, "strikethru")) {
        view.setPaintFlags(view.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      }
    }
  }
  private void intViews(View view) {

    TextView shippingInIndia = (TextView) view.findViewById(R.id.shippingInIndia);
    shippingInIndia.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
    TextView shippingInt = (TextView) view.findViewById(R.id.shippingInternational);
    shippingInt.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);

    mLocationsIndia = (TextView) view.findViewById(R.id.txtLocationsIndia);
    mTimeIndia = (TextView) view.findViewById(R.id.txtTimeIndia);
    mChargesIndia = (TextView) view.findViewById(R.id.txtChargesIndia);
    mNoteInt = (TextView) view.findViewById(R.id.txtNoteInt);
    mTimeInt = (TextView) view.findViewById(R.id.txtTimeInt);
    mChargesInt = (TextView) view.findViewById(R.id.txtChargesInt);
    Bundle bundle = getArguments();
    if (bundle != null) {
      Gson gson = new Gson();
      mTabDetails = gson.fromJson(bundle.getString("tabDetails"), TabDetails.class);
      updateViews();
    }
  }
  @Override
  protected void onTimeChanged(WatchFaceTime oldTime, WatchFaceTime newTime) {
    if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
      wakeLock.acquire(50);
      final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
      mTime.setText(timeFormat.format(System.currentTimeMillis()));
      mTimestamp.setText(readingAge());

      if (ageLevel() <= 0) {
        mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      } else {
        mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
      }

      missedReadingAlert();
      mRelativeLayout.measure(specW, specH);
      mRelativeLayout.layout(
          0, 0, mRelativeLayout.getMeasuredWidth(), mRelativeLayout.getMeasuredHeight());
    }
  }
Exemple #16
0
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      LayoutInflater mLayoutInflater = LayoutInflater.from(mContext);
      convertView = mLayoutInflater.inflate(R.layout.job_row_item, null);
    }

    Job job = mJobs.get(position);

    TextView descriptionView = (TextView) convertView.findViewById(R.id.job_description);

    descriptionView.setText(job.getDescription());

    if (job.isCompleted()) {
      descriptionView.setPaintFlags(descriptionView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      descriptionView.setPaintFlags(
          descriptionView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }

    return convertView;
  }
Exemple #17
0
  private void updateTextAttributes() {
    float baseSize = Float.parseFloat(Preferences.getString(Preferences.Key.BASE_TEXT_SIZE));
    content.setTextSize(baseSize);
    title.setTextSize(baseSize * 1.3f);

    title.setTextColor(Color.BLUE);
    title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    title.setBackgroundColor(0xffffffff);

    content.setBackgroundColor(0xffffffff);
    content.setTextColor(Color.DKGRAY);
  }
  public void displayCurrentInfo() {
    DecimalFormat df = new DecimalFormat("#");
    df.setMaximumFractionDigits(0);

    boolean isDexbridge = CollectionServiceStarter.isDexbridgeWixel(getApplicationContext());
    int bridgeBattery = prefs.getInt("bridge_battery", 0);

    if (isDexbridge) {
      if (bridgeBattery == 0) {
        dexbridgeBattery.setText("Waiting for packet");
      } else {
        dexbridgeBattery.setText("Bridge Battery: " + bridgeBattery + "%");
      }
      if (bridgeBattery < 50) dexbridgeBattery.setTextColor(Color.YELLOW);
      if (bridgeBattery < 25) dexbridgeBattery.setTextColor(Color.RED);
      else dexbridgeBattery.setTextColor(Color.GREEN);
      dexbridgeBattery.setVisibility(View.VISIBLE);
    } else {
      dexbridgeBattery.setVisibility(View.INVISIBLE);
    }

    if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) {
      currentBgValueText.setPaintFlags(
          currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
      dexbridgeBattery.setPaintFlags(
          dexbridgeBattery.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
    BgReading lastBgReading = BgReading.lastNoSenssor();
    boolean predictive =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
            .getBoolean("predictive_bg", false);
    if (isBTShare) {
      predictive = false;
    }
    if (lastBgReading != null) {
      displayCurrentInfoFromReading(lastBgReading, predictive);
    }
    setupCharts();
  }
  // method: initUI
  // purpose: initializes the social media icons
  private void initUI() {

    learnMore = (TextView) findViewById(R.id.learnmoreBtn);
    facebook = (ImageButton) findViewById(R.id.facebookBtn);
    twitter = (ImageButton) findViewById(R.id.twitterBtn);
    google = (ImageButton) findViewById(R.id.googlePlusBtn);

    // purpose: If clicked directs user to the learn more activity
    learnMore.setPaintFlags(learnMore.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    learnMore.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            onLearnMoreButtonClicked();
          }
        });

    // purpose: Provide user with option to sign in with default account.
    // Implementation: LOW PRIORITY
    google.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            onGooglePlusButtonClicked();
          }
        });

    // purpose: Provide user with option to sign in with facebook
    // Implementation: Main Priority - 2/1/16 - connected to Facebook.
    facebook.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            onSigninWithFacebookButtonClicked();
          }
        });

    // purpose: Provide user with option to sign in with twitter
    // Implementation: LOW Priority
    twitter.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            onSigninWithTwitterButtonClicked();
          }
        });
  }
  private void populateRateList() {
    final Hotel hotel = SampleApp.selectedHotel;
    final TextView loadingView = (TextView) this.findViewById(R.id.loadingRoomsView);
    loadingView.setVisibility(TextView.GONE);
    if (!SampleApp.HOTEL_ROOMS.containsKey(hotel.hotelId)) {
      final TextView noAvail = (TextView) this.findViewById(R.id.noRoomsAvailableView);
      noAvail.setVisibility(TextView.VISIBLE);
      return;
    }
    final TableLayout rateList = (TableLayout) findViewById(R.id.roomRateList);
    View view;
    final LayoutInflater inflater = getLayoutInflater();
    for (HotelRoom room : SampleApp.HOTEL_ROOMS.get(hotel.hotelId)) {
      view = inflater.inflate(R.layout.roomtypelistlayout, null);

      final TextView roomDesc = (TextView) view.findViewById(R.id.roomRateDescritpiton);
      roomDesc.setText(room.description);

      final TextView drrPromoText = (TextView) view.findViewById(R.id.drrPromoText);
      drrPromoText.setText(room.promoDescription);

      final TextView highPrice = (TextView) view.findViewById(R.id.highPrice);
      final TextView lowPrice = (TextView) view.findViewById(R.id.lowPrice);
      final ImageView drrIcon = (ImageView) view.findViewById(R.id.drrPromoImg);
      final NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();
      currencyFormat.setCurrency(Currency.getInstance(room.rate.chargeable.currencyCode));
      lowPrice.setText(currencyFormat.format(room.rate.chargeable.getAverageRate()));
      if (room.rate.chargeable.areAverageRatesEqual()) {
        highPrice.setVisibility(TextView.GONE);
        drrIcon.setVisibility(ImageView.GONE);
        drrPromoText.setVisibility(ImageView.GONE);
      } else {
        highPrice.setVisibility(TextView.VISIBLE);
        drrIcon.setVisibility(ImageView.VISIBLE);
        drrPromoText.setVisibility(ImageView.VISIBLE);
        highPrice.setText(currencyFormat.format(room.rate.chargeable.getAverageBaseRate()));
        highPrice.setPaintFlags(highPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      }
      view.setTag(room);
      view.setClickable(true);
      view.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(final View view) {
              SampleApp.selectedRoom = (HotelRoom) view.getTag();
              startActivity(new Intent(HotelInformation.this, BookingSummary.class));
            }
          });
      rateList.addView(view);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = getActivity().getApplicationContext();
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_artists_music_library_editor, null);

    cursor = mApp.getDBAccessHelper().getAllUniqueArtists("");
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorArtistsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new PlaylistEditorArtistsMultiselectAdapter(getActivity(), cursor));

    listView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.artistCheckboxMusicLibraryEditor);
            checkbox.performClick();

            /* Since we've performed a software-click (checkbox.performClick()), all we have
             * to do now is determine the *new* state of the checkbox. If the checkbox is checked,
             * that means that the user tapped on it when it was unchecked, and we should add
             * the artist's songs to the HashSet. If the checkbox is unchecked, that means the user
             * tapped on it when it was checked, so we should remove the artist's songs from the
             * HashSet.
             */
            if (checkbox.isChecked()) {
              view.setBackgroundColor(0xCC0099CC);
              AsyncGetArtistSongIds task =
                  new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
              task.execute(new String[] {"ADD"});
            } else {
              view.setBackgroundColor(0x00000000);
              AsyncGetArtistSongIds task =
                  new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
              task.execute(new String[] {"REMOVE"});
            }
          }
        });

    instructions = (TextView) rootView.findViewById(R.id.artists_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(
        instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    return rootView;
  }
Exemple #22
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    requestURL =
        getActivity().getResources().getString(R.string.serverURL) + "api/user/registerByFacebook";

    ((Authentication) getActivity()).SetToolBarTitle("YOUR ACCOUNT");

    txtBlurb = (TextView) getActivity().findViewById(R.id.yourAccountBlurb);
    txtBlurb.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.MontSerratRegular));

    btnSignUp = (Button) getActivity().findViewById(R.id.btnSignUp);
    btnSignUp.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.OpenSansSemiBold));

    txtLogin = (TextView) getActivity().findViewById(R.id.txtLogin);
    txtLogin.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.OpenSansSemiBold));
    txtLogin.setPaintFlags(txtLogin.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

    btnSignUp.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Fragment signup = new SignUp();
            FragmentTransaction signUpTransaction =
                getActivity().getSupportFragmentManager().beginTransaction();
            signUpTransaction.replace(R.id.fragmentReplacer, signup);
            signUpTransaction.addToBackStack(null);
            signUpTransaction.commit();
          }
        });

    txtLogin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Fragment login = new Login();
            FragmentTransaction loginTransaction = getFragmentManager().beginTransaction();
            loginTransaction.replace(R.id.fragmentReplacer, login);
            loginTransaction.addToBackStack(null);
            loginTransaction.commit();
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setTheme(R.style.Theme_CustomTheme);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.start_screen);
    getActionBar().hide();

    Parse.initialize(
        this,
        "yPiVUng1QaEHEfWRxY111LqvpF2QoGecWEHn0dpf",
        "YFXesKpPVUPIgD719giidQEkWhumoSjKCewBaDhI");

    /*ParseCloud.callFunctionInBackground("sendMessage",new HashMap<String,String>(), new FunctionCallback<String>() {
      public void done(String result, ParseException e) {
        if (e == null) {
          Toast.makeText(StartScreen.this,result,Toast.LENGTH_LONG).show();
        }
        else
        	Toast.makeText(StartScreen.this,e.getMessage(),Toast.LENGTH_LONG).show();
      }
    }); */

    // define custom font
    Typeface customFont = Typeface.createFromAsset(getAssets(), "fonts/customFont.ttf");

    signup = (TextView) findViewById(R.id.signup);
    signin = (TextView) findViewById(R.id.signin);
    howitworks = (TextView) findViewById(R.id.howitworks);
    title = (TextView) findViewById(R.id.title);
    howitworks.setPaintFlags(howitworks.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

    signup.setTypeface(customFont);
    signin.setTypeface(customFont);
    howitworks.setTypeface(customFont);
    title.setTypeface(customFont, Typeface.BOLD);

    signup.setOnClickListener(this);
    signin.setOnClickListener(this);
    howitworks.setOnClickListener(this);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    String baseInfos = book.getDate() + ", " + book.getNbPages() + " pages.";
    // The last two arguments ensure LayoutParams are inflated
    // properly.
    View rootView = inflater.inflate(R.layout.book_card, container, false);
    ((TextView) rootView.findViewById(R.id.book_title)).setText(book.getTitle());
    ((TextView) rootView.findViewById(R.id.base_infos)).setText(baseInfos);
    ((TextView) rootView.findViewById(R.id.synopsis)).setText(book.getSynopsis());

    for (final String author : book.getAuthor()) {
      TextView authorTextView = new TextView(getContext());
      authorTextView.setText(author);
      // Le nom des auteurs est mis en bleu souligné
      // afin que l'utilisateur l'assimile à un lien hypetexte
      // et comprenne qu'il peut cliquer dessus
      authorTextView.setTextColor(Color.BLUE);
      authorTextView.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);

      authorTextView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Log.w("Yo man !", author);
              DownloadPersonTask task = new DownloadPersonTask(BookCard.this);
              task.execute(author);
            }
          });
      ((LinearLayout) rootView.findViewById(R.id.authors)).addView(authorTextView);
    }

    // Download the thumbnail in async
    new DownloadImageTask((ImageView) rootView.findViewById(R.id.thumbnail))
        .execute(book.getThumbnail());
    return rootView;
  }
  private void updateUiForCoupon(CouponsVo couponsVo) {
    List<CouponsVo.OffersVo> offersVo = couponsVo.getOffers();
    float discountedAmount = mAmount;
    for (int i = 0; i < offersVo.size(); i++) {
      if (offersVo.get(i).getType().equalsIgnoreCase("Percentage")) {
        int percentage = offersVo.get(i).getDiscount();
        discountedAmount = discountedAmount - (discountedAmount * percentage / 100);
        discountedAmount = (float) Math.floor(discountedAmount);
      } else {
        int discount = offersVo.get(i).getDiscount();
        discountedAmount = discountedAmount - discount;
      }
    }

    if (discountedAmount < mAmount) {
      if (discountedAmount < 0) {
        discountedAmount = 0;
      }
      discountedPrice = (int) discountedAmount;

      TextView tvAmount = (TextView) findViewById(R.id.activity_payment_tv_eventamount);
      tvAmount.setTextColor(getResources().getColor(R.color.teal500));
      tvAmount.setPaintFlags(tvAmount.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

      TextView tvDiscountedAmount =
          (TextView) findViewById(R.id.activity_payment_tv_eventamount_discounted);
      Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome.ttf");
      tvDiscountedAmount.setTypeface(font);
      tvDiscountedAmount.setText(PSQConsts.UNICODE_RUPEE + " " + (int) discountedAmount);
      tvDiscountedAmount.setVisibility(View.VISIBLE);

      tvDiscount.setTypeface(font);
      tvDiscount.setText("Coupon Applied : " + couponCode);
      tvDiscount.setVisibility(View.VISIBLE);

      findViewById(R.id.activity_payment_coupon_cardview).setVisibility(View.GONE);
    }
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setResult(RESULT_USER_CANCELED);

    // getResourseIdByName(getPackageName(), "layout", "activity_invoice")

    System.out.println("Starting init...");

    setContentView(R.layout.activity_invoice);

    System.out.println("Layout set...");

    status = (TextView) findViewById(R.id.status);
    price = (TextView) findViewById(R.id.price);
    refund = (Button) findViewById(R.id.refund);

    launchWallet = (Button) findViewById(R.id.launchWallet);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    loadingQr = (ProgressBar) findViewById(R.id.loadingQr);
    qrView = (ImageView) findViewById(R.id.qr);

    showQR = (TextView) findViewById(R.id.showQr);
    address = (TextView) findViewById(R.id.address);
    timeRemaining = (TextView) findViewById(R.id.timeRemaining);
    conversion = (TextView) findViewById(R.id.conversion);

    Thread t =
        new Thread(
            new Runnable() {
              @Override
              public void run() {
                if (savedInstanceState != null) {
                  InvoiceActivity.this.mInvoice = savedInstanceState.getParcelable(INVOICE);
                  InvoiceActivity.this.client = savedInstanceState.getParcelable(CLIENT);
                  InvoiceActivity.this.triggeredWallet =
                      savedInstanceState.getBoolean(TRIGGERED_WALLET);
                } else {
                  InvoiceActivity.this.mInvoice = getIntent().getParcelableExtra(INVOICE);
                  InvoiceActivity.this.client = getIntent().getParcelableExtra(CLIENT);
                  InvoiceActivity.this.triggeredWallet =
                      getIntent().getBooleanExtra(TRIGGERED_WALLET, false);
                }
              }
            });

    t.start();
    while (mInvoice == null) {
      try {
        t.join();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }

    progressBar.setRotation(180);
    price.setText(mInvoice.getBtcPrice() + " BTC");
    timeRemaining.setText(getRemainingTimeAsString());
    conversion.setText(
        mInvoice.getBtcPrice() + " BTC = " + mInvoice.getPrice() + mInvoice.getCurrency());
    address.setText(getAddress());
    address.setPaintFlags(address.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    address.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            ClipboardManager ClipMan =
                (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            ClipMan.setPrimaryClip(
                ClipData.newPlainText("label", mInvoice.getPaymentUrls().getBIP73()));
            Toast toast =
                Toast.makeText(
                    getApplicationContext(),
                    "Copied payment address to clipboard",
                    Toast.LENGTH_LONG);
            toast.show();
          }
        });
    showQR.setPaintFlags(showQR.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    showQR.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            triggerQrLoad();
          }
        });
    launchWallet.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent bitcoinIntent = new Intent(Intent.ACTION_VIEW);
            bitcoinIntent.setData(Uri.parse(mInvoice.getBIP21due()));
            startActivity(bitcoinIntent);
          }
        });

    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
    if (mNfcAdapter != null) {
      // Register callback to set NDEF message
      mNfcAdapter.setNdefPushMessageCallback(this, this);

      // Register callback to listen for message-sent success
      mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
    } else {
      Log.i("InvoiceActivity", "NFC is not available on this device");
    }
    if (!triggeredWallet) {
      if (BitPayAndroid.isWalletAvailable(this)) {
        Intent bitcoinIntent = new Intent(Intent.ACTION_VIEW);
        bitcoinIntent.setData(Uri.parse(mInvoice.getBIP21due()));
        triggeredWallet = true;
        startActivity(bitcoinIntent);
      } else {
        Toast.makeText(
                getApplicationContext(),
                "You don't have any bitcoin wallets installed.",
                Toast.LENGTH_LONG)
            .show();
        triggerQrLoad();
      }
    } else {
      triggerStatusCheck();
    }
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();
    dialogFragment = this;

    album = this.getArguments().getString("ALBUM");
    artist = this.getArguments().getString("ARTIST");
    callingActivity = this.getArguments().getString("CALLING_FRAGMENT");

    rootView =
        (View)
            parentActivity.getLayoutInflater().inflate(R.layout.fragment_caution_edit_albums, null);

    cautionText = (TextView) rootView.findViewById(R.id.caution_text);
    cautionText.setText(R.string.caution_albums_text);
    cautionText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    cautionText.setPaintFlags(
        cautionText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    sharedPreferences =
        getActivity().getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE);

    dontShowAgainText = (TextView) rootView.findViewById(R.id.dont_show_again_text);
    dontShowAgainText.setTypeface(
        TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    dontShowAgainText.setPaintFlags(
        dontShowAgainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    dontShowAgainCheckbox = (CheckBox) rootView.findViewById(R.id.dont_show_again_checkbox);
    dontShowAgainCheckbox.setChecked(true);
    sharedPreferences.edit().putBoolean("SHOW_ALBUM_EDIT_CAUTION", false).commit();

    dontShowAgainCheckbox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {

            if (isChecked == true) {
              sharedPreferences.edit().putBoolean("SHOW_ALBUM_EDIT_CAUTION", false).commit();
            } else {
              sharedPreferences.edit().putBoolean("SHOW_ALBUM_EDIT_CAUTION", true).commit();
            }
          }
        });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    // Set the dialog title.
    builder.setTitle(R.string.caution);
    builder.setView(rootView);
    builder.setNegativeButton(
        R.string.no,
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface arg0, int arg1) {
            dialogFragment.dismiss();
          }
        });

    builder.setPositiveButton(
        R.string.yes,
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface arg0, int arg1) {
            dialogFragment.dismiss();

            FragmentTransaction ft = getFragmentManager().beginTransaction();
            Bundle bundle = new Bundle();
            bundle.putString("EDIT_TYPE", "ALBUM");
            bundle.putString("ALBUM", album);
            bundle.putString("ARTIST", artist);
            bundle.putString("CALLING_FRAGMENT", callingActivity);
            ID3sAlbumEditorDialog dialog = new ID3sAlbumEditorDialog();
            dialog.setArguments(bundle);
            dialog.show(ft, "id3EditorDialog");
          }
        });

    return builder.create();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_grid_view, container, false);
    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;
    mFragment = this;

    // Set the background color and the partial color bleed.
    mRootView.setBackgroundColor(UIElementsHelper.getBackgroundColor(mContext));

    // Grab the fragment. This will determine which data to load into the cursor.
    mFragmentId = getArguments().getInt(Common.FRAGMENT_ID);
    mFragmentTitle = getArguments().getString(MainActivity.FRAGMENT_HEADER);
    mDBColumnsMap = new HashMap<Integer, String>();

    mQuickScroll = (QuickScrollGridView) mRootView.findViewById(R.id.quickscrollgrid);

    // Set the adapter for the outer gridview.
    mGridView = (GridView) mRootView.findViewById(R.id.generalGridView);
    mGridViewContainer =
        (RelativeLayout) mRootView.findViewById(R.id.fragment_grid_view_frontal_layout);
    mGridView.setVerticalScrollBarEnabled(false);

    // Set the number of gridview columns based on the screen density and orientation.
    if (mApp.isPhoneInLandscape() || mApp.isTabletInLandscape()) {
      mGridView.setNumColumns(4);
    } else if (mApp.isPhoneInPortrait()) {
      mGridView.setNumColumns(2);
    } else if (mApp.isTabletInPortrait()) {
      mGridView.setNumColumns(3);
    }

    // KitKat translucent navigation/status bar.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      int topPadding = Common.getStatusBarHeight(mContext);

      // Calculate navigation bar height.
      int navigationBarHeight = 0;
      int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
      if (resourceId > 0) {
        navigationBarHeight = getResources().getDimensionPixelSize(resourceId);
      }

      mGridViewContainer.setPadding(0, topPadding, 0, 0);
      mGridView.setClipToPadding(false);
      mGridView.setPadding(0, mGridView.getPaddingTop(), 0, navigationBarHeight);
      mQuickScroll.setPadding(0, 0, 0, navigationBarHeight);
    }

    // Set the empty views.
    mEmptyTextView = (TextView) mRootView.findViewById(R.id.empty_view_text);
    mEmptyTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light"));
    mEmptyTextView.setPaintFlags(
        mEmptyTextView.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    // Create a set of options to optimize the bitmap memory usage.
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    options.inJustDecodeBounds = false;
    options.inPurgeable = true;

    mHandler.postDelayed(queryRunnable, 250);
    return mRootView;
  }
  public void displayCurrentInfo() {
    final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime);
    final TextView notificationText = (TextView) findViewById(R.id.notices);
    final TextView deltaText = (TextView) findViewById(R.id.bgDelta);
    if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) {
      currentBgValueText.setPaintFlags(
          currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
    Bg lastBgreading = Bg.last();

    if (lastBgreading != null) {
      notificationText.setText(lastBgreading.readingAge());
      String bgDelta = new String(String.format(Locale.ENGLISH, "%.2f", lastBgreading.bgdelta));
      if (lastBgreading.bgdelta >= 0) bgDelta = "+" + bgDelta;
      deltaText.setText(bgDelta);
      currentBgValueText.setText(
          extendedGraphBuilder.unitized_string(lastBgreading.sgv_double())
              + " "
              + lastBgreading.slopeArrow());

      if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) {
        notificationText.setTextColor(Color.parseColor("#C30909"));
        currentBgValueText.setPaintFlags(
            currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      } else {
        notificationText.setTextColor(Color.WHITE);
      }
      double estimate = lastBgreading.sgv_double();
      if (extendedGraphBuilder.unitized(estimate) <= extendedGraphBuilder.lowMark) {
        currentBgValueText.setTextColor(Color.parseColor("#C30909"));
      } else if (extendedGraphBuilder.unitized(estimate) >= extendedGraphBuilder.highMark) {
        currentBgValueText.setTextColor(Color.parseColor("#FFBB33"));
      } else {
        currentBgValueText.setTextColor(Color.WHITE);
      }
    }

    // Stats age update
    statsAge = (TextView) findViewById(R.id.statsAge);
    Stats lastRun = Stats.last();
    if (lastRun != null) statsAge.setText(lastRun.statAge());

    // OpenAPS age update
    openAPSAgeTextView = (TextView) findViewById(R.id.openapsAge);
    openAPSAgeTextView.setText(openAPSFragment.age());

    // Temp Basal running update
    Date timeNow = new Date();
    sysMsg = (TextView) findViewById(R.id.sysmsg);
    TempBasal lastTempBasal = TempBasal.last();
    String appStatus;
    if (lastTempBasal.isactive(null)) { // Active temp Basal
      appStatus =
          lastTempBasal.basal_adjustemnt
              + " Temp active: "
              + lastTempBasal.rate
              + "U("
              + lastTempBasal.ratePercent
              + "%) "
              + lastTempBasal.durationLeft()
              + "mins left";
    } else { // No temp Basal running, show default
      Double currentBasal = Profile.ProfileAsOf(timeNow, this.getBaseContext()).current_basal;
      appStatus = "No temp basal, current basal: " + currentBasal + "U";
    }
    sysMsg.setText(appStatus);
  }
 protected void setLinkMessageToView() {
   link_msg.setPaintFlags(link_msg.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
   link_msg.setText(preferredServerUrl);
 }