Example usage for android.graphics Typeface createFromAsset

List of usage examples for android.graphics Typeface createFromAsset

Introduction

In this page you can find the example usage for android.graphics Typeface createFromAsset.

Prototype

public static Typeface createFromAsset(AssetManager mgr, String path) 

Source Link

Document

Create a new typeface from the specified font data.

Usage

From source file:io.vit.vitio.Fragments.SubjectView.SubjectViewFragment.java

private void setFonts() {
    typeface = Typeface.createFromAsset(getResources().getAssets(), "fonts/Montserrat-Regular.ttf");
    subCode.setTypeface(typeface);/*from  ww w  . j  a va 2 s.com*/
    subName.setTypeface(typeface);
    subPer.setTypeface(typeface);
    subVenue.setTypeface(typeface);
    subType.setTypeface(typeface);
    subSlot.setTypeface(typeface);
    subFaculty.setTypeface(typeface);
    //subSchool.setTypeface(typeface);
    attended.setTypeface(typeface);
    attendClassText.setTypeface(typeface);
    missClassText.setTypeface(typeface);

}

From source file:com.uf.togathor.Togathor.java

@Override
public void onCreate() {
    super.onCreate();
    sInstance = this;
    mPreferences = new Preferences(this);
    mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName());
    gOpenFromBackground = true;//from  ww w  .  j  a v  a  2 s. co  m
    mFileDir = new FileDir(this);

    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
    googleAPIService = new GoogleAPIService(this);
    messagesDataSource = new MessagesDataSource(this);
    eventMessagesDataSource = new EventMessagesDataSource(this);
    contactsDataSource = new ContactsDataSource(this);
    startEventService();
    Authenticator.setDefault(new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication("s3lab", "S3LAB!!".toCharArray());
        }
    });

    // Create typefaces
    mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf");
    mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf");

    setTransportBasedOnScreenDensity(42);

    // Example interpolator; could use linear or accelerate interpolator
    // instead
    final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator();
    final LinearInterpolator linearInterpolator = new LinearInterpolator();
    final int slidingDuration = getResources().getInteger(R.integer.sliding_duration);

    // Set up animations
    mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0);
    mSlideInLeft.setDuration(slidingDuration);
    // mSlideInLeft.setFillAfter(true); // hmm not sure
    mSlideInLeft.setFillEnabled(false);
    mSlideInLeft.setInterpolator(linearInterpolator);

    mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0);
    mSlideOutRight.setDuration(slidingDuration);
    mSlideOutRight.setFillAfter(true);
    mSlideOutRight.setFillEnabled(true);
    mSlideOutRight.setInterpolator(linearInterpolator);

    mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0);
    mSlideOutLeft.setDuration(slidingDuration);
    mSlideOutLeft.setInterpolator(linearInterpolator);

    mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0);
    mSlideInRight.setDuration(slidingDuration);
    mSlideInRight.setFillAfter(true);
    mSlideInRight.setFillEnabled(true);
    mSlideInRight.setInterpolator(linearInterpolator);

    mSlideFromTop.setFillAfter(true);
    mSlideFromTop.setFillEnabled(true);
    mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime));
    mSlideFromTop.setInterpolator(linearInterpolator);

    mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime));
    mSlideOutTop.setInterpolator(linearInterpolator);

    String strUUID = UUID.randomUUID().toString();
    Logger.debug("uuid", strUUID);

    mBaseUrl = mPreferences.getUserServerURL();
}

From source file:com.scigames.slidegame.ObjectiveActivity.java

/** Called with the activity is first created. */
@Override//from w ww.j  a va  2  s .  c  o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Log.d(TAG, "super.OnCreate");
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    rfidIn = i.getStringExtra("rfid");
    studentIdIn = i.getStringExtra("studentId");
    slideLevelIn = i.getStringExtra("slideLevel");
    //       photoUrl = i.getStringExtra("photo");
    //       photoUrl = "http://db.scigam.es/" + photoUrl;
    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.objective_page);
    Log.d(TAG, "...setContentView");
    objectiveImgNum = 0;

    //resultImg[0] = "http://db.scigam.es/narrative_images/Level0/results/_0012_Layer-Comp-13.png";
    //resultImg[1] = "http://db.scigam.es/narrative_images/Level0/results/_0012_Layer-Comp-13.png";

    alertDialog = new AlertDialog.Builder(ObjectiveActivity.this).create();
    alertDialog.setTitle("No Registration System Attached ");
    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            finish();
        }
    });

    infoDialog = new AlertDialog.Builder(ObjectiveActivity.this).create();
    infoDialog.setTitle("Debug Info");
    infoDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
        }
    });

    needSlideDataDialog = new AlertDialog.Builder(ObjectiveActivity.this).create();
    needSlideDataDialog.setTitle("Debug Info");
    needSlideDataDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            Intent i = new Intent(ObjectiveActivity.this, LoginActivity.class);
            Log.d(TAG, "new LoginActivity Intent");
            i.putExtra("page", "login");
            Log.d(TAG, "startActivity...");
            ObjectiveActivity.this.startActivity(i);
            Log.d(TAG, "...startActivity");
        }
    });

    ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    reviewBtnNext = (Button) findViewById(R.id.btn_next);
    reviewBtnNext.setOnClickListener(mNext);
    reviewBtnNext.setVisibility(View.INVISIBLE);
    reviewBtnBack = (Button) findViewById(R.id.btn_back);
    reviewBtnBack.setOnClickListener(mBack);
    reviewBtnBack.setVisibility(View.INVISIBLE);
    btnContinue = (Button) findViewById(R.id.btn_continue);
    btnContinue.setOnClickListener(mContinue);

    getObjectiveImages(slideLevelIn);
    //level 0 : 50 kin, 50 therm
    //level 1 : 60 kin, 40 therm
    //level 2 : 40 kin, 60 therm
    //level 3 : 70 kin, 30 therm
    //level 4 : 30 kin, 70 therm
}

From source file:com.derrick.movies.MovieDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movies_details);
    ButterKnife.bind(this);

    toolbar = (Toolbar) findViewById(R.id.flexible_example_toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override/*from   w  w w .  ja v a2 s  . c o m*/
        public void onClick(View v) {
            onBackPressed();
        }
    });

    AppBarLayout appbar = (AppBarLayout) findViewById(R.id.flexible_example_appbar);
    appbar.addOnOffsetChangedListener(this);

    ImageView image = (ImageView) findViewById(R.id.thumbnail);
    txt_exp_synopsis = (ExpandableTextView) findViewById(R.id.expand_text_view);

    ViewCompat.setTransitionName(image, EXTRA_IMAGE);
    ViewCompat.setTransitionName(imageBackdrop, EXTRA_IMAGE);
    poster = getIntent().getStringExtra(EXTRA_IMAGE);
    title = getIntent().getStringExtra(EXTRA_TITLE);
    backdrop = getIntent().getStringExtra(EXTRA_BACKDROP);
    movie_id = getIntent().getIntExtra(EXTRA_ID, -1);
    overview = getIntent().getStringExtra(EXTRA_OVERVIEW);

    toolbarLayout.setTitle(title);
    loadPoster(getBaseContext(), poster, image);
    loadBackDrop(getBaseContext(), backdrop, imageBackdrop);

    //set font family of synopsis and tagline
    robotoCondensed = Typeface.createFromAsset(this.getAssets(), "fonts/RobotoSlab-Regular.ttf");
    txt_synopsis.setTypeface(robotoCondensed);
    txt_tagline.setTypeface(robotoCondensed);

    layoutMore.setOnClickListener(this);
    trailerSlider.setOnClickListener(this);

    getMovieDetails(movie_id);

}

From source file:com.scigames.slidegame.ReviewActivity.java

/** Called with the activity is first created. */
@Override/*  w  w  w .  j a  v a 2  s .co  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Log.d(TAG, "super.OnCreate");
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    rfidIn = i.getStringExtra("rfid");
    //       photoUrl = i.getStringExtra("photo");
    //       photoUrl = "http://mysweetwebsite.com/" + photoUrl;
    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.review_page);
    mAnimationView = (ReviewAnimationView) findViewById(R.id.review);
    mAnimationThread = mAnimationView.getThread();

    //load fonts
    ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    Log.d(TAG, "...setContentView");
    resultImgNum = 0;
    scoreImgNum = 0;

    //resultImg[0] = "http://mysweetwebsite.com/narrative_images/Level0/results/_0012_Layer-Comp-13.png";
    //resultImg[1] = "http://mysweetwebsite.com/narrative_images/Level0/results/_0012_Layer-Comp-13.png";

    alertDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    alertDialog.setTitle("alert title");
    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            finish();
        }
    });

    infoDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    infoDialog.setTitle("Debug Info");
    infoDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
        }
    });

    needSlideDataDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    needSlideDataDialog.setTitle("Debug Info");
    needSlideDataDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            Intent i = new Intent(ReviewActivity.this, LoginActivity.class);
            Log.d(TAG, "new LoginActivity Intent");
            i.putExtra("page", "login");
            Log.d(TAG, "startActivity...");
            ReviewActivity.this.startActivity(i);
            Log.d(TAG, "...startActivity");
        }
    });

    //display name and profile info
    Resources res = getResources();
    title = (TextView) findViewById(R.id.title);
    mLevel = (TextView) findViewById(R.id.level);
    mScore = (TextView) findViewById(R.id.score);
    //mScoreFinal = (TextView)findViewById(R.id.score_final);
    mFabric = (TextView) findViewById(R.id.fabric);
    mAttempt = (TextView) findViewById(R.id.attempt);
    //set their font
    setTextViewFont(Museo700Regular, title);
    setTextViewFont(Museo500Regular, mLevel, mScore, mFabric);
    //make them invisible to start
    title.setVisibility(View.INVISIBLE);
    mLevel.setVisibility(View.INVISIBLE);
    mScore.setVisibility(View.INVISIBLE);
    //mScoreFinal.setVisibility(View.INVISIBLE);
    mFabric.setVisibility(View.INVISIBLE);
    mAttempt.setVisibility(View.INVISIBLE);
    Log.d(TAG, "...Profile Info");

    reviewBtnNext = (Button) findViewById(R.id.btn_next);
    reviewBtnNext.setOnClickListener(mNext);
    reviewBtnNext.setVisibility(View.INVISIBLE);
    reviewBtnBack = (Button) findViewById(R.id.btn_back);
    reviewBtnBack.setOnClickListener(mBack);
    reviewBtnBack.setVisibility(View.INVISIBLE);
    btnContinue = (Button) findViewById(R.id.btn_continue);
    btnContinue.setOnClickListener(mContinue);

    if (isNetworkAvailable()) {
        task.cancel(true);
        //create a new async task for every time you hit login (each can only run once ever)
        task = new SciGamesHttpPoster(ReviewActivity.this, "http://mysweetwebsite.com/pull/slide_results.php");
        //set listener
        task.setOnResultsListener(ReviewActivity.this);
        //prepare key value pairs to send
        String[] keyVals = { "rfid", rfidIn };
        //create AsyncTask, then execute
        AsyncTask<String, Void, JSONObject> serverResponse = null;
        serverResponse = task.execute(keyVals);
    } else {
        alertDialog.setMessage(
                "You're not connected to the internet. Make sure this tablet is logged into a working Wifi Network.");
        alertDialog.show();
    }
}

From source file:pk.edu.ucp.fall16_mad_c.RecipeAdapter.java

/**
 * Get a View that displays the data at the specified position in the data set. You can either
 * create a View manually or inflate it from an XML layout file. When the View is inflated, the
 * parent View (GridView, ListView...) will apply default layout parameters unless you use
 * {@link LayoutInflater#inflate(int, ViewGroup, boolean)}
 * to specify a root view and to prevent attachment to the root.
 *
 * @param position    The position of the item within the adapter's data set of the item whose view
 *                    we want./*from   ww w.j  ava 2s  .c  o  m*/
 * @param convertView The old view to reuse, if possible. Note: You should check that this view
 *                    is non-null and of an appropriate type before using. If it is not possible to convert
 *                    this view to display the correct data, this method can create a new view.
 *                    Heterogeneous lists can specify their number of view types, so that this View is
 *                    always of the right type (see {@link #getViewTypeCount()} and
 *                    {@link #getItemViewType(int)}).
 * @param parent      The parent that this view will eventually be attached to
 * @return A View corresponding to the data at the specified position.
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    // Get view for row item
    mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = mInflater.inflate(R.layout.list_item_complex, parent, false);
    Log.d(TAG, "CreateCount = " + ++createCount);

    // Get relevant subviews of row view
    TextView titleTextView = (TextView) rowView.findViewById(R.id.recipe_list_title);
    TextView subtitleTextView = (TextView) rowView.findViewById(R.id.recipe_list_subtitle);
    TextView foodTypeTextView = (TextView) rowView.findViewById(R.id.recipe_food_type);
    ImageView thumbnailImageView = (ImageView) rowView.findViewById(R.id.recipe_list_thumbnail);

    //Get corresponding recipe for row
    Recipe recipe = (Recipe) getItem(position);

    // Update row view's textviews to display recipe information
    titleTextView.setText(recipe.title);
    subtitleTextView.setText(recipe.description);
    foodTypeTextView.setText(recipe.foodType);

    if (position % 2 == 0) {
        thumbnailImageView.setImageResource(R.drawable.bouncing_ball_00);
    } else {
        thumbnailImageView.setImageResource(R.drawable.arrow);
    }

    // Style text views
    Typeface titleTypeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/JosefinSans-Bold.ttf");
    titleTextView.setTypeface(titleTypeFace);
    Typeface subtitleTypeFace = Typeface.createFromAsset(mContext.getAssets(),
            "fonts/JosefinSans-SemiBoldItalic.ttf");
    subtitleTextView.setTypeface(subtitleTypeFace);
    Typeface detailTypeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/Quicksand-Bold.otf");
    foodTypeTextView.setTypeface(detailTypeFace);
    foodTypeTextView.setTextColor(android.support.v4.content.ContextCompat.getColor(mContext, R.color.red));

    return rowView;
}

From source file:markson.visuals.sitapp.eventActivity.java

public void json() {

    ListAdapter adapter = new SimpleAdapter(this, mylist, R.layout.jsontest,
            new String[] { "name", "description" }, new int[] { R.id.item_title, R.id.item_subtitle });

    setListAdapter(adapter);/*ww  w .ja  v  a  2s .c om*/

    final ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            @SuppressWarnings("unchecked")
            HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);
            // Toast.makeText(eventActivity.this,"ID '" + o.get("link") +
            // "' was clicked.",Toast.LENGTH_SHORT).show();

            TextView title = (TextView) findViewById(R.id.item_title);
            Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/roboto/Roboto-Regular.ttf");
            title.setTypeface(tf);

            TextView subtitle = (TextView) findViewById(R.id.item_subtitle);
            subtitle.setTypeface(tf);

            date = o.get("pubDate");
            link = o.get("link");
            description = o.get("description");
            name = o.get("name");
            download();
        }
    });
}

From source file:com.scigames.slidereview.ReviewActivity.java

/** Called with the activity is first created. */
@Override/*from  ww  w  .j av  a2 s. c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Log.d(TAG, "super.OnCreate");
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    rfidIn = i.getStringExtra("rfid");
    //       photoUrl = i.getStringExtra("photo");
    //       photoUrl = "http://mysweetwebsite.com/" + photoUrl;
    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.review_page);
    mAnimationView = (ReviewAnimationView) findViewById(R.id.review);
    mAnimationThread = mAnimationView.getThread();

    //load fonts
    ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    Log.d(TAG, "...setContentView");
    resultImgNum = 0;
    scoreImgNum = 0;

    //resultImg[0] = "http://mysweetwebsite.com/narrative_images/Level0/results/_0012_Layer-Comp-13.png";
    //resultImg[1] = "http://mysweetwebsite.com/narrative_images/Level0/results/_0012_Layer-Comp-13.png";

    alertDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    alertDialog.setTitle("alert title");
    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            finish();
        }
    });

    infoDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    infoDialog.setTitle("Debug Info");
    infoDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
        }
    });

    needSlideDataDialog = new AlertDialog.Builder(ReviewActivity.this).create();
    needSlideDataDialog.setTitle("Debug Info");
    needSlideDataDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            //Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
            Intent i = new Intent(ReviewActivity.this, LoginActivity.class);
            Log.d(TAG, "new LoginActivity Intent");
            i.putExtra("page", "login");
            Log.d(TAG, "startActivity...");
            ReviewActivity.this.startActivity(i);
            Log.d(TAG, "...startActivity");
        }
    });

    //display name and profile info
    Resources res = getResources();
    title = (TextView) findViewById(R.id.title);
    mLevel = (TextView) findViewById(R.id.level);
    mScore = (TextView) findViewById(R.id.score);
    //mScoreFinal = (TextView)findViewById(R.id.score_final);
    mFabric = (TextView) findViewById(R.id.fabric);
    mAttempt = (TextView) findViewById(R.id.attempt);
    //set their font
    setTextViewFont(Museo700Regular, title);
    setTextViewFont(Museo500Regular, mLevel, mScore, mFabric);
    //make them invisible to start
    title.setVisibility(View.INVISIBLE);
    mLevel.setVisibility(View.INVISIBLE);
    mScore.setVisibility(View.INVISIBLE);
    //mScoreFinal.setVisibility(View.INVISIBLE);
    mFabric.setVisibility(View.INVISIBLE);
    mAttempt.setVisibility(View.INVISIBLE);
    Log.d(TAG, "...Profile Info");

    reviewBtnNext = (Button) findViewById(R.id.btn_next);
    reviewBtnNext.setOnClickListener(mNext);
    reviewBtnNext.setVisibility(View.INVISIBLE);
    reviewBtnBack = (Button) findViewById(R.id.btn_back);
    reviewBtnBack.setOnClickListener(mBack);
    reviewBtnBack.setVisibility(View.INVISIBLE);
    btnContinue = (Button) findViewById(R.id.btn_continue);
    btnContinue.setOnClickListener(mContinue);

    if (isNetworkAvailable()) {
        task.cancel(true);
        //create a new async task for every time you hit login (each can only run once ever)
        task = new SciGamesHttpPoster(ReviewActivity.this, "http://db.scigam.es/pull/slide_results.php");
        //set listener
        task.setOnResultsListener(ReviewActivity.this);
        //prepare key value pairs to send
        String[] keyVals = { "rfid", rfidIn };
        //create AsyncTask, then execute
        AsyncTask<String, Void, JSONObject> serverResponse = null;
        serverResponse = task.execute(keyVals);
    } else {
        alertDialog.setMessage(
                "You're not connected to the internet. Make sure this tablet is logged into a working Wifi Network.");
        alertDialog.show();
    }
}

From source file:com.scigames.registration.Registration1UserNameActivity.java

/** Called with the activity is first created. */
@Override/* w ww  .  j av a  2  s.c  o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "...getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    passwordIn = i.getStringExtra("pword");

    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration1_username);
    Log.d(TAG, "...setContentView");

    lastName = (EditText) findViewById(R.id.last_name);
    password = (EditText) findViewById(R.id.password);
    password_confirm = (EditText) findViewById(R.id.confirm_password);
    firstName = (EditText) findViewById(R.id.first_name);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    firstName.setCursorVisible(false);
    firstName.setInputType(InputType.TYPE_NULL);
    firstName.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            firstName.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
            firstName
                    .setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
            firstName.setCursorVisible(true);
            firstName.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });

    Log.d(TAG, "...instantiateEditTexts");

    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    Log.d(TAG, "...instantiateButtons");

    Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    setEditTextFont(Museo500Regular, firstName, lastName, password, password_confirm);

    //set info to what we know already
    firstName.setText(firstNameIn);
    lastName.setText(lastNameIn);
    //password.setText(passwordIn);
    Log.d(TAG, "...setTexts with incoming name/pw");

    //set listener
    task.setOnResultsListener(this);

    alertDialog = new AlertDialog.Builder(Registration1UserNameActivity.this).create();
    // Setting Dialog Title
    alertDialog.setTitle("Login Failed");
    // Setting Dialog Message
    alertDialog.setMessage("Welcome to AndroidHive.info");
    // Setting Icon to Dialog
    //alertDialog.setIcon(R.drawable.tick);

    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:br.com.GUI.perfil.PerfilPersonal.java

public void mapearComponentes() {
    img = (ImageView) getActivity().findViewById(R.id.imgFotoPerfilPersonal);

    img.setOnClickListener(new OnClickListener() {

        @Override/*from   w w  w.  j  ava2s  .  c om*/
        public void onClick(View arg0) {
            alterarFoto();

        }
    });

    pref = getActivity().getApplicationContext().getSharedPreferences("MyPref", 0);
    editor = pref.edit();
    nome = (EditText) getActivity().findViewById(R.id.edtNome);
    dataNascimentoDia = (NumberPicker) getActivity().findViewById(R.id.nmbDataNascimentoDiaPersonal);
    dataNascimentoDia.setMaxValue(31);
    dataNascimentoDia.setMinValue(1);

    dataNascimentoMes = (NumberPicker) getActivity().findViewById(R.id.nmbDataNascimentoMesPersonal);
    dataNascimentoMes.setMaxValue(12);
    dataNascimentoMes.setMinValue(1);

    dataNascimentoAno = (NumberPicker) getActivity().findViewById(R.id.nmbDataNascimentoAnoPersonal);
    Calendar c = Calendar.getInstance();
    int ano = c.get(Calendar.YEAR);
    dataNascimentoAno.setMaxValue(ano);
    dataNascimentoAno.setMinValue(1900);
    dataNascimentoAno.setValue(ano - 18);

    telefone = (EditText) getActivity().findViewById(R.id.edtTelefone);
    email = (EditText) getActivity().findViewById(R.id.edtEmail);
    Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "BebasNeue Bold.ttf");
    atualizar = (Button) getActivity().findViewById(R.id.btnAtualizarPerfilPersonal);
    atualizar.setTypeface(font);

    atualizar.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            atualizarDadosPersonal();
        }
    });
    b = new Banco(getActivity(), null, null, 0);

}