コード例 #1
0
 private void initialize(View fragmentView, Context context) {
   ButterKnife.bind(this, fragmentView);
   Typeface robotoBlack = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Black.ttf");
   txtGuideLine.setTypeface(robotoBlack);
   Typeface robotoCondensedLight =
       Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Light.ttf");
   edtNidName.setTypeface(robotoCondensedLight);
   edtNidBirthDate.setTypeface(robotoCondensedLight);
   edtNidNo.setTypeface(robotoCondensedLight);
   fab.setOnClickListener(fabOnClickListener);
   edtNidBirthDate.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           showDialog();
         }
       });
   imgDatePicker.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           showDialog();
         }
       });
 }
コード例 #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    MatchHistoryViewHolder holder = null;
    MatchHistoryListItem matchHistoryItem = getItem(position);

    LayoutInflater mInflater =
        (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.match_history_list_row, null);
      convertView.setLayoutParams(
          new ListView.LayoutParams(
              ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
      holder = new MatchHistoryViewHolder();
      holder.heroName = (TextView) convertView.findViewById(R.id.matchHistoryRow_HeroName);
      holder.heroPic = (RoundedImageView) convertView.findViewById(R.id.matchHistoryRow_HeroPic);
      holder.dateTime = (TextView) convertView.findViewById(R.id.matchHistoryRow_DateTime);
      String fontPath1 = "fonts/segoeui.ttf";
      String fontPath2 = "fonts/segoeuil.ttf";
      tf = Typeface.createFromAsset(this.context.getAssets(), fontPath1);
      holder.heroName.setTypeface(tf);
      tf = Typeface.createFromAsset(this.context.getAssets(), fontPath2);
      holder.dateTime.setTypeface(tf);
      convertView.setTag(holder);
    } else holder = (MatchHistoryViewHolder) convertView.getTag();

    holder.heroName.setText(matchHistoryItem.getHeroName());
    holder.dateTime.setText(matchHistoryItem.getDateTime());
    holder.heroPic.setImageBitmap(matchHistoryItem.getHeroPic());
    return convertView;
  }
コード例 #3
0
ファイル: AnkiFont.java プロジェクト: ankidroid/Anki-Android
  /**
   * Factory for AnkiFont creation. Creates a typeface wrapper from a font file representing.
   *
   * @param ctx Activity context, needed to access assets
   * @param path Path to typeface file, needed when this is a custom font.
   * @param fromAssets True if the font is to be found in assets of application
   * @return A new AnkiFont object or null if the file can't be interpreted as typeface.
   */
  public static AnkiFont createAnkiFont(Context ctx, String path, boolean fromAssets) {
    File fontfile = new File(path);
    String name = Utils.splitFilename(fontfile.getName())[0];
    String family = name;
    List<String> attributes = new ArrayList<>();

    if (fromAssets) {
      path = fAssetPathPrefix.concat(fontfile.getName());
    }
    Typeface tf = getTypeface(ctx, path);
    if (tf == null) {
      // unable to create typeface
      return null;
    }

    if (tf.isBold() || name.toLowerCase(Locale.US).contains("bold")) {
      attributes.add("font-weight: bolder;");
      family = family.replaceFirst("(?i)-?Bold", "");
    } else if (name.toLowerCase(Locale.US).contains("light")) {
      attributes.add("font-weight: lighter;");
      family = family.replaceFirst("(?i)-?Light", "");
    } else {
      attributes.add("font-weight: normal;");
    }
    if (tf.isItalic() || name.toLowerCase(Locale.US).contains("italic")) {
      attributes.add("font-style: italic;");
      family = family.replaceFirst("(?i)-?Italic", "");
    } else if (name.toLowerCase(Locale.US).contains("oblique")) {
      attributes.add("font-style: oblique;");
      family = family.replaceFirst("(?i)-?Oblique", "");
    } else {
      attributes.add("font-style: normal;");
    }
    if (name.toLowerCase(Locale.US).contains("condensed")
        || name.toLowerCase(Locale.US).contains("narrow")) {
      attributes.add("font-stretch: condensed;");
      family = family.replaceFirst("(?i)-?Condensed", "");
      family = family.replaceFirst("(?i)-?Narrow(er)?", "");
    } else if (name.toLowerCase(Locale.US).contains("expanded")
        || name.toLowerCase(Locale.US).contains("wide")) {
      attributes.add("font-stretch: expanded;");
      family = family.replaceFirst("(?i)-?Expanded", "");
      family = family.replaceFirst("(?i)-?Wide(r)?", "");
    }

    AnkiFont createdFont = new AnkiFont(name, family, attributes, path);

    // determine if override font or default font
    SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(ctx);
    String defaultFont = preferences.getString("defaultFont", "");
    boolean overrideFont = preferences.getString("overrideFontBehavior", "0").equals("1");
    if (defaultFont.equalsIgnoreCase(name)) {
      if (overrideFont) {
        createdFont.setAsOverride();
      } else {
        createdFont.setAsDefault();
      }
    }
    return createdFont;
  }
コード例 #4
0
  /** Sets up the text and style properties for painting. */
  private void initPaints(Resources res) {
    final String monthTypeface = res.getString(R.string.date_picker_month_typeface);
    final String dayOfWeekTypeface = res.getString(R.string.date_picker_day_of_week_typeface);
    final String dayTypeface = res.getString(R.string.date_picker_day_typeface);

    final int monthTextSize = res.getDimensionPixelSize(R.dimen.date_picker_month_text_size);
    final int dayOfWeekTextSize =
        res.getDimensionPixelSize(R.dimen.date_picker_day_of_week_text_size);
    final int dayTextSize = res.getDimensionPixelSize(R.dimen.date_picker_day_text_size);

    mMonthPaint.setAntiAlias(true);
    mMonthPaint.setTextSize(monthTextSize);
    mMonthPaint.setTypeface(Typeface.create(monthTypeface, 0));
    mMonthPaint.setTextAlign(Align.CENTER);
    mMonthPaint.setStyle(Style.FILL);

    mDayOfWeekPaint.setAntiAlias(true);
    mDayOfWeekPaint.setTextSize(dayOfWeekTextSize);
    mDayOfWeekPaint.setTypeface(Typeface.create(dayOfWeekTypeface, 0));
    mDayOfWeekPaint.setTextAlign(Align.CENTER);
    mDayOfWeekPaint.setStyle(Style.FILL);

    mDaySelectorPaint.setAntiAlias(true);
    mDaySelectorPaint.setStyle(Style.FILL);

    mDayHighlightPaint.setAntiAlias(true);
    mDayHighlightPaint.setStyle(Style.FILL);

    mDayPaint.setAntiAlias(true);
    mDayPaint.setTextSize(dayTextSize);
    mDayPaint.setTypeface(Typeface.create(dayTypeface, 0));
    mDayPaint.setTextAlign(Align.CENTER);
    mDayPaint.setStyle(Style.FILL);
  }
コード例 #5
0
  @Override
  public View getView(int i, View convertView, ViewGroup viewGroup) {
    View rowView = convertView;
    final PasswordItem pass = values.get(i);

    // reuse for performance, holder pattern!
    if (rowView == null) {
      LayoutInflater inflater =
          (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_row_layout, viewGroup, false);

      ViewHolder viewHolder = new ViewHolder();
      viewHolder.name = (TextView) rowView.findViewById(R.id.label);
      viewHolder.back_name = (TextView) rowView.findViewById(R.id.label_back);
      viewHolder.type = (TextView) rowView.findViewById(R.id.type);
      rowView.setTag(viewHolder);
    }

    ViewHolder holder = (ViewHolder) rowView.getTag();

    holder.name.setText(pass.toString());
    holder.back_name.setText(pass.toString());

    if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
      holder.name.setTextColor(
          this.activity.getResources().getColor(android.R.color.holo_blue_dark));
      holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
      holder.type.setText("Category: ");
    } else {
      holder.type.setText("Password: ");
      holder.name.setTextColor(
          this.activity.getResources().getColor(android.R.color.holo_orange_dark));
      holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));

      holder.back_name.setTextColor(this.activity.getResources().getColor(android.R.color.white));
      holder.back_name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC));

      View.OnClickListener onClickListener =
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              switch (view.getId()) {
                case R.id.crypto_show_button:
                  activity.decryptPassword(pass);
                  break;
                case R.id.crypto_delete_button:
                  activity.deletePassword(pass);
                  break;
              }
            }
          };

      ((ImageButton) rowView.findViewById(R.id.crypto_show_button))
          .setOnClickListener(onClickListener);
      ((ImageButton) rowView.findViewById(R.id.crypto_delete_button))
          .setOnClickListener(onClickListener);
    }

    return rowView;
  }
コード例 #6
0
  public void Update(View rootView) {

    final Typeface custom_font_regular =
        Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Regular.otf");
    final Typeface custom_font_bold =
        Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Bold.otf");
    final Typeface custom_font_italic =
        Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Italic.otf");

    TextView vText = ((TextView) rootView.findViewById(R.id.sprintDetTitle));
    ((TextView) rootView.findViewById(R.id.sprintDetTitle)).setText(sprint.id);
    ((TextView) rootView.findViewById(R.id.sprintDetEstHours))
        .setText("Estimated Hours : " + Float.toString(sprint.estHours));
    ((TextView) rootView.findViewById(R.id.sprintDetEstWeeks))
        .setText("Estimated Weeks : " + Float.toString(sprint.estWeeks));
    ((TextView) rootView.findViewById(R.id.sprintDetCompletedHours))
        .setText("Completed Hours : " + Float.toString(sprint.completedHours));
    ((TextView) rootView.findViewById(R.id.sprintDetCompletedWeeks))
        .setText("Completed Weeks : " + Float.toString(sprint.completedWeeks));
    ((TextView) rootView.findViewById(R.id.sprintDetTitle)).setTypeface(custom_font_regular);
    ((TextView) rootView.findViewById(R.id.sprintDetEstHours)).setTypeface(custom_font_regular);
    ((TextView) rootView.findViewById(R.id.sprintDetEstWeeks)).setTypeface(custom_font_regular);
    ((TextView) rootView.findViewById(R.id.sprintDetCompletedHours))
        .setTypeface(custom_font_regular);
    ((TextView) rootView.findViewById(R.id.sprintDetCompletedWeeks))
        .setTypeface(custom_font_regular);

    while (mProgressStatus < 100) {
      mProgressStatus = (int) ((sprint.completedHours / sprint.estHours) * 100f);
      break;
    }

    mProgress.setProgress(mProgressStatus);
  }
コード例 #7
0
 public FlipAdapter(Context paramContext, List<Item> items) {
   this.items = items;
   this.context = paramContext;
   futuraTypeface = Typeface.createFromAsset(paramContext.getAssets(), "font/futura.ttf");
   muktiTypeface = Typeface.createFromAsset(paramContext.getAssets(), "font/mukti.ttf");
   this.inflater = LayoutInflater.from(paramContext);
 }
コード例 #8
0
ファイル: AboutActivity.java プロジェクト: Ag47/CLABS
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    //        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    // WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_about);

    // custom action bar
    Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    Typeface hotelFont = Typeface.createFromAsset(getAssets(), "fonts/OptimusPrinceps.ttf");
    Typeface iconFont = Typeface.createFromAsset(getAssets(), "fonts/NuevaStd-Bold.otf");
    Typeface arialFont = Typeface.createFromAsset(getAssets(), "fonts/arial.ttf");

    TextView activityTitle = (TextView) findViewById(R.id.activity_title);
    activityTitle.setTypeface(iconFont);

    TextView hotelName = (TextView) findViewById(R.id.hotel_name);
    hotelName.setTypeface(hotelFont);

    TextView roomNumber = (TextView) findViewById(R.id.room_number);
    roomNumber.setTypeface(hotelFont);
  }
コード例 #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cancellation_confirmed);

    img_Back = (ImageView) findViewById(R.id.img_Back);

    img_Back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(CancellationConfirmedActivity.this, MainActivity.class);
            startActivity(i);

            finish();
          }
        });

    img_Check_mark = (ImageView) findViewById(R.id.img_Check_mark);

    txt_hearder = (TextView) findViewById(R.id.txt_hearder);
    txt_Cancellation_Confirm = (TextView) findViewById(R.id.txt_Cancellation_Confirm);

    btn_Keep_shopping = (Button) findViewById(R.id.btn_Keep_shopping);
    btn_View_all_orders = (Button) findViewById(R.id.btn_View_all_orders);

    Roboto_medium = Typeface.createFromAsset(getAssets(), "Roboto-Medium.ttf");
    Roboto_regular = Typeface.createFromAsset(getAssets(), "Roboto-Regular.ttf");

    txt_hearder.setTypeface(Roboto_medium);
    txt_Cancellation_Confirm.setTypeface(Roboto_regular);
    btn_Keep_shopping.setTypeface(Roboto_regular);
    btn_View_all_orders.setTypeface(Roboto_regular);
  }
コード例 #10
0
ファイル: FirstRun.java プロジェクト: kambl4/growdroid
  public void onCreate(Bundle savedInstanceState) {
    if (Utils.isTablet(this)) {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.firstrun);
    context = this;
    Utils.showWhatNewDialog(context);
    ActionBar actionBar = getSupportActionBar();
    TextView ganjdroid = new TextView(this);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/font3.ttf");
    ganjdroid.setTypeface(typeface);
    ganjdroid.setText("GrowDroid");
    ganjdroid.setTextSize(20);
    ganjdroid.setGravity(Gravity.CENTER);
    ganjdroid.setTextColor(getResources().getColor(R.color.white));
    actionBar.setCustomView(ganjdroid);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setLogo(getResources().getDrawable(R.drawable.ic_launcher));

    TextView textView = (TextView) findViewById(R.id.pressTextView);
    textView.setTypeface(
        Typeface.createFromAsset(context.getAssets(), "fonts/Roboto/Roboto-Thin.ttf"));
    RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.pressLayout);
    relativeLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(context, NewCycle.class);
            startActivity(intent);
          }
        });
  }
コード例 #11
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = getLayoutInflater();
      View list_object = inflater.inflate(R.layout.single_list_object, parent, false);

      TextView label = (TextView) list_object.findViewById(R.id.row_text);
      TextView title = (TextView) findViewById(R.id.txtHeader);
      Typeface font1 = Typeface.createFromAsset(getAssets(), "HelveticaNeueLTStd-Roman.otf");
      Typeface font2 = Typeface.createFromAsset(getAssets(), "HelveticaNeueLTStd-Bd.otf");
      label.setTypeface(font1);
      title.setTypeface(font2);
      String[] title_array = getResources().getStringArray(R.array.cat_00);
      title.setText(title_array[0]);

      String[] cat_array = getResources().getStringArray(R.array.cat_01);
      label.setText(cat_array[position]);
      ImageView icon = (ImageView) list_object.findViewById(R.id.icon);

      // open close list array to open ();
      if (SetItem[position] == "1") {
        icon.setImageResource(R.drawable.icon_unlock);
      } else {
        icon.setImageResource(R.drawable.icon_lock);
      }

      return list_object;
    }
コード例 #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    presenter = new LoginPresenter(this, new LoginService(this));

    // register buttonn
    Login_OnClickButtonListener();
    ClearDB_OnClickButtonListener();
    RegistrationLink_OnClickListener();

    // text handles
    header = (TextView) findViewById(R.id.textView_header);
    username = (EditText) findViewById(R.id.editText_username);
    password = (EditText) findViewById(R.id.editText_password);

    Typeface type = Typeface.createFromAsset(getAssets(), "fonts/Sansation-LightItalic.ttf");
    Typeface glyphicons = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf");

    // initialize values
    header.setTypeface(type);

    username.setText("");
    username.setTypeface(glyphicons);
    username.setHint("  \uf007    Username");

    password.setText("");
    password.setTypeface(glyphicons);
    password.setHint("  \uf023    Password");
  }
コード例 #13
0
 public FiveStepsTableArrayAdapter(Context var1, int var2, List var3) {
   super(var1, var2, var3);
   this.light = Typeface.createFromAsset(var1.getAssets(), "nexa_light.otf");
   this.bold = Typeface.createFromAsset(var1.getAssets(), "nexa_bold.otf");
   this.context = var1;
   this.mIdMap = var3;
 }
コード例 #14
0
    public NormalBatteryMeterDrawable(Resources res, boolean horizontal) {
      super();
      mHorizontal = horizontal;
      mDisposed = false;

      mFramePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
      mFramePaint.setColor(res.getColor(R.color.batterymeter_frame_color));
      mFramePaint.setDither(true);
      mFramePaint.setStrokeWidth(0);
      mFramePaint.setStyle(Paint.Style.FILL_AND_STROKE);
      mFramePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_ATOP));

      mBatteryPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
      mBatteryPaint.setDither(true);
      mBatteryPaint.setStrokeWidth(0);
      mBatteryPaint.setStyle(Paint.Style.FILL_AND_STROKE);

      mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
      mTextPaint.setColor(res.getColor(R.color.batterymeter_bolt_color));
      Typeface font = Typeface.create("sans-serif-condensed", Typeface.BOLD);
      mTextPaint.setTypeface(font);
      mTextPaint.setTextAlign(Paint.Align.CENTER);

      mWarningTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
      mWarningTextPaint.setColor(mColors[1]);
      font = Typeface.create("sans-serif", Typeface.BOLD);
      mWarningTextPaint.setTypeface(font);
      mWarningTextPaint.setTextAlign(Paint.Align.CENTER);

      mBoltPaint = new Paint();
      mBoltPaint.setAntiAlias(true);
      mBoltPaint.setColor(res.getColor(R.color.batterymeter_bolt_color));
      mBoltPoints = loadBoltPoints(res);
    }
コード例 #15
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.editinterest);
   save = (Button) findViewById(R.id.submit_edit_interest);
   delete_button = (Button) findViewById(R.id.delete_interest);
   save.setOnClickListener(this);
   delete_button.setOnClickListener(this);
   editdescription = (EditText) findViewById(R.id.edit_interest);
   Spinner my_spin = (Spinner) findViewById(R.id.type_spinner);
   my_spin.setOnItemSelectedListener(this);
   editdescription.setText(UserProfile.description);
   ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, items);
   aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   my_spin.setAdapter(aa);
   my_spin.setSelection(aa.getPosition(UserProfile.type));
   Typeface font = Typeface.createFromAsset(getAssets(), "font/deftone_stylus.ttf");
   TextView txt = (TextView) findViewById(R.id.eTitle);
   txt.setTypeface(font);
   Typeface SEI = Typeface.createFromAsset(getAssets(), "font/deftone_stylus.ttf");
   TextView se = (TextView) findViewById(R.id.submit_edit_interest);
   se.setTypeface(SEI);
   Typeface DI = Typeface.createFromAsset(getAssets(), "font/deftone_stylus.ttf");
   TextView di = (TextView) findViewById(R.id.delete_interest);
   di.setTypeface(DI);
   Typeface ET = Typeface.createFromAsset(getAssets(), "font/Impact Label.ttf");
   TextView et = (TextView) findViewById(R.id.edittype);
   et.setTypeface(ET);
   Typeface ED = Typeface.createFromAsset(getAssets(), "font/Impact Label.ttf");
   TextView ed = (TextView) findViewById(R.id.eDesc);
   ed.setTypeface(ED);
 }
コード例 #16
0
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_twitter);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));

    for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) {
      TextView tv = (TextView) mTabsLinearLayout.getChildAt(i);

      if (i == 0) {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"));
      } else {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"));
      }
    }
  }
コード例 #17
0
ファイル: DialogStyleHelper.java プロジェクト: mshzhb/iAnkle
  // called when the alert dialog (mAlertDialog) is displayed
  @Override
  public void onShow(DialogInterface dialog) {

    // link the layout objects to the corresponding dialog-ui elements
    Button negativeButton = ((AlertDialog) dialog).getButton(BUTTON_NEGATIVE);
    Button neutralButton = ((AlertDialog) dialog).getButton(BUTTON_NEUTRAL);
    Button positiveButton = ((AlertDialog) dialog).getButton(BUTTON_POSITIVE);

    TextView dialogText = (TextView) ((AlertDialog) dialog).findViewById(android.R.id.message);

    // set the parameters for the negative button, if exists
    if (negativeButton != null) {
      negativeButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle));
      negativeButton.setTextColor(mButtonTextColor);
    }

    // set the parameters for the neutral button, if exists
    if (neutralButton != null) {
      neutralButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle));
      neutralButton.setTextColor(mButtonTextColor);
    }

    // set the parameters for the positive button, if exists
    if (positiveButton != null) {
      positiveButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle));
      positiveButton.setTextColor(mButtonTextColor);
    }

    // set the arguments for the displayed text message
    if (dialogText != null) {
      dialogText.setTypeface(Typeface.create(mMessageTextFont, mMessageTypefaceStyle));
      dialogText.setTextColor(mMessageTextColor);
    }
  }
コード例 #18
0
 public static Typeface getTypeface(Context ctx, String path) {
   if (path.startsWith(fAssetPathPrefix)) {
     return Typeface.createFromAsset(ctx.getAssets(), path.replaceFirst("/android_asset/", ""));
   } else {
     return Typeface.createFromFile(path);
   }
 }
コード例 #19
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_splash);
   mLogo = (ImageView) findViewById(R.id.logo);
   Glide.with(Splash.this).load(R.drawable.app_icon_512x512).into(mLogo);
   Typeface typeface1 = Typeface.createFromAsset(getAssets(), "comfortaa_bold.ttf");
   Typeface typeface2 = Typeface.createFromAsset(getAssets(), "comfortaa_light.ttf");
   TextView textView1 = (TextView) findViewById(R.id.cm);
   TextView textView2 = (TextView) findViewById(R.id.walking_street);
   textView1.setTypeface(typeface1);
   textView2.setTypeface(typeface2);
   handler = new Handler();
   runnable =
       new Runnable() {
         @Override
         public void run() {
           Intent intent;
           if (checkLogin()) {
             intent = new Intent(Splash.this, MainActivity.class);
           } else {
             intent = new Intent(Splash.this, LoginActivity.class);
           }
           startActivity(intent);
           finish();
         }
       };
 }
コード例 #20
0
 public FavouriteVendorAdapter(Activity context, ArrayList<FavVendor> objects) {
   this.mContext = context;
   this.studentList = objects;
   prefsManager = new PrefsManager(context);
   typeHeading = Typeface.createFromAsset(mContext.getAssets(), "fonts/Lato-Heavy.ttf");
   typeiconfamily = Typeface.createFromAsset(mContext.getAssets(), "fonts/Lato-Bold.ttf");
   typeregular = Typeface.createFromAsset(mContext.getAssets(), "fonts/LATO-REGULAR.TTF");
 }
コード例 #21
0
  private void updateHint() {
    Editable text = getText();
    CharSequence hintText = getHint();
    if (text == null || hintText == null) {
      return;
    }

    // Show hint if we need to
    if (prefix.length() > 0) {
      HintSpan[] hints = text.getSpans(0, text.length(), HintSpan.class);
      HintSpan hint = null;
      int testLength = prefix.length();
      if (hints.length > 0) {
        hint = hints[0];
        testLength += text.getSpanEnd(hint) - text.getSpanStart(hint);
      }

      if (text.length() == testLength) {
        hintVisible = true;

        if (hint != null) {
          return; // hint already visible
        }

        // We need to display the hint manually
        Typeface tf = getTypeface();
        int style = Typeface.NORMAL;
        if (tf != null) {
          style = tf.getStyle();
        }
        ColorStateList colors = getHintTextColors();

        HintSpan hintSpan = new HintSpan(null, style, (int) getTextSize(), colors, colors);
        text.insert(prefix.length(), hintText);
        text.setSpan(
            hintSpan,
            prefix.length(),
            prefix.length() + getHint().length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        setSelection(prefix.length());

      } else {
        if (hint == null) {
          return; // hint already removed
        }

        // Remove the hint. There should only ever be one
        int sStart = text.getSpanStart(hint);
        int sEnd = text.getSpanEnd(hint);

        text.removeSpan(hint);
        text.replace(sStart, sEnd, "");

        hintVisible = false;
      }
    }
  }
コード例 #22
0
ファイル: DHTextView.java プロジェクト: VenomVendor/DailyHunt
 private void initCustom(Context context, AttributeSet attrs) {
   TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.DHTypeface);
   String fontName = styledAttrs.getString(R.styleable.DHTypeface_typeface);
   styledAttrs.recycle();
   if (fontName != null) {
     Typeface typeface = TypefaceCache.getInstance().getTypeface(context.getAssets(), fontName);
     this.setTypeface(typeface, typeface.getStyle());
   }
 }
コード例 #23
0
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
    // here we are setting our data
    // that means, take the data from the cursor and put it in views
    TextView code = (TextView) view.findViewById(R.id.txtCodel);
    TextView title = (TextView) view.findViewById(R.id.txtTitle);
    TextView lessontime = (TextView) view.findViewById(R.id.txtTimes);
    TextView teacher = (TextView) view.findViewById(R.id.txtTeacher);
    TextView location = (TextView) view.findViewById(R.id.txtLocation);
    TextView txtPm = (TextView) view.findViewById(R.id.textView1);
    TextView color = (TextView) view.findViewById(R.id.txtcolor);

    code.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(3))));
    title.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(4))));
    teacher.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(8))));
    location.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(9))));
    color.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(7))));

    Typeface font = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf");
    Typeface font_a = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Medium.ttf");
    Typeface font_b = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Regular.ttf");
    Typeface font_c = Typeface.createFromAsset(context.getAssets(), "fonts/DistProTh.otf");
    Typeface font_d = Typeface.createFromAsset(context.getAssets(), "fonts/DroidSans.ttf");
    code.setTypeface(font_b);
    lessontime.setTypeface(font_c);
    title.setTypeface(font_a);
    teacher.setTypeface(font_b);
    location.setTypeface(font_b);
    txtPm.setTypeface(font_b);

    String startTime = cursor.getString(cursor.getColumnIndex(cursor.getColumnName(5)));
    String endTime = cursor.getString(cursor.getColumnIndex(cursor.getColumnName(6)));
    String pn = "am";
    double a = Float.parseFloat(startTime) / 100;
    double c = Float.parseFloat(endTime) / 100;

    if (a > 12) {
      // pn="am";
      txtPm.setText(pn);
      a = a - 12;
      if (a < 1) a = a + 1;
    }

    if (c > 12) {
      pn = "pm";
      txtPm.setText(pn);
      c = c - 12;
      if (c < 0.59) c = c + 1;
    } else {
      pn = "am";
      txtPm.setText(pn);
    }
    String m = df.format(a) + "-" + df.format(c);
    m = m.replaceAll("[.]", ":");
    lessontime.setText(m);
  }
コード例 #24
0
  public SettingsDialog(Context context) {
    super(context, R.style.FullscreenDialogTheme);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.settings_dialog);

    settings = context.getSharedPreferences("NotifyMeSettings", context.MODE_PRIVATE);
    prefEditor = settings.edit();

    Typeface font = Typeface.createFromAsset(context.getAssets(), "fonts/VarelaRound-Regular.ttf");
    Typeface font2 =
        Typeface.createFromAsset(context.getAssets(), "fonts/DINEngschrift-Regular.ttf");

    dialogText = (TextView) findViewById(R.id.settings_header);
    dialogText.setTypeface(font);

    deleteAllButton = (Button) findViewById(R.id.delete_all);
    deleteAllButton.setTypeface(font2);

    saveButton = (Button) findViewById(R.id.save_button);
    saveButton.setTypeface(font2);

    toneBox = (CheckBox) findViewById(R.id.toneCheckBox);
    vibrateBox = (CheckBox) findViewById(R.id.vibrateCheckBox);
    toneBox.setTypeface(font);
    vibrateBox.setTypeface(font);

    if (settings.contains("tone") == false) {
      toneBox.setChecked(true);
    } else {
      if (settings.getBoolean("tone", true)) {
        toneBox.setChecked(true);
      } else {
        toneBox.setChecked(false);
      }
    }

    if (settings.contains("vibration") == false) {
      vibrateBox.setChecked(true);
    } else {
      if (settings.getBoolean("vibration", true)) {
        vibrateBox.setChecked(true);
      } else {
        vibrateBox.setChecked(false);
      }
    }

    saveButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            prefEditor.putBoolean("tone", toneBox.isChecked());
            prefEditor.putBoolean("vibration", vibrateBox.isChecked());
            prefEditor.commit();
            cancel();
          }
        });
  }
コード例 #25
0
ファイル: EditProfile.java プロジェクト: darivb/Muze
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.edit_profile, null);

    user = ParseUser.getCurrentUser();

    bariol_regular_tf =
        Typeface.createFromAsset(getActivity().getAssets(), "fonts/Bariol_Regular.otf");
    bariol_bold_tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Bariol_Bold.otf");

    context = getActivity();
    name = (EditText) root.findViewById(R.id.name);
    website = (EditText) root.findViewById(R.id.website);
    bio = (EditText) root.findViewById(R.id.bio);
    email = (EditText) root.findViewById(R.id.email);
    phoneNumber = (EditText) root.findViewById(R.id.phone);
    genderSpinner = (Spinner) root.findViewById(R.id.gender_spinner);

    TextView title = (TextView) root.findViewById(R.id.textView);
    ImageView close = (ImageView) root.findViewById(R.id.close);
    ImageView approveChanges = (ImageView) root.findViewById(R.id.check);

    title.setTypeface(bariol_bold_tf);

    close.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            android.app.FragmentManager manager = getFragmentManager();
            manager.popBackStack();
          }
        });

    approveChanges.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            saveChanges(user);
            android.app.FragmentManager manager = getFragmentManager();
            manager.popBackStack();
          }
        });
    setTypeface();
    CustomSpinnerAdapter adapter =
        new CustomSpinnerAdapter(
            context,
            R.layout.spinner_item,
            Arrays.asList(getResources().getStringArray(R.array.genders)));

    genderSpinner.setAdapter(adapter);

    setInformation(user);

    return root;
  }
コード例 #26
0
 public EventPagerAdapter(Context context, List<Event> eventList) {
   this.context = context;
   this.eventList = eventList;
   semiBold =
       Typeface.createFromAsset(
           context.getApplicationContext().getAssets(), "fonts/GillSans-SemiBold.ttf");
   light =
       Typeface.createFromAsset(
           context.getApplicationContext().getAssets(), "fonts/GillSans-Light.ttf");
 }
コード例 #27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mActivity = (MainActivity) getActivity();

    mRobotoLight = Typeface.createFromAsset(mActivity.getAssets(), "Roboto-Light.ttf");
    mRobotoLightItalic = Typeface.createFromAsset(mActivity.getAssets(), "Roboto-LightItalic.ttf");
    mRoboto = Typeface.createFromAsset(mActivity.getAssets(), "Roboto-Regular.ttf");
  }
コード例 #28
0
 public void setTypeface(Typeface tf, int style) {
   if (style == Typeface.BOLD) {
     super.setTypeface(
         Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Bold.ttf"));
   } else if (style == Typeface.ITALIC) {
     super.setTypeface(
         Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Italic.ttf"));
   } else {
     super.setTypeface(
         Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Regular.ttf"));
   }
 }
コード例 #29
0
    public void whatTypeFace(String type) {

      if ("kaushanregular.otf".equals(type)) {
        setTypeface(Typeface.createFromAsset(getAssets(), type));
      }
      if ("robotobold.ttf".equals(type)) {
        setTypeface(Typeface.createFromAsset(getAssets(), type));
      }
      if ("robotoregular.ttf".equals(type)) {
        setTypeface(Typeface.createFromAsset(getAssets(), type));
      }
    }
コード例 #30
0
  public void setFonts() {
    Typeface fontLogo = Typeface.createFromAsset(getAssets(), "HouseSlant-Regular.otf");
    Typeface fontOthers = Typeface.createFromAsset(getAssets(), "Montserrat-Regular.ttf");

    Button button = (Button) findViewById(R.id.button_play);
    TextView appLogoName = (TextView) findViewById(R.id.app_name);
    TextView headline = (TextView) findViewById(R.id.headline);

    button.setTypeface(fontOthers);
    appLogoName.setTypeface(fontLogo);
    headline.setTypeface(fontOthers);
  }