Example usage for twitter4j User getDescription

List of usage examples for twitter4j User getDescription

Introduction

In this page you can find the example usage for twitter4j User getDescription.

Prototype

String getDescription();

Source Link

Document

Returns the description of the user

Usage

From source file:com.speed.traquer.app.TraqComplaintTaxi.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_traq_complaint_taxi);
    easyTracker = EasyTracker.getInstance(TraqComplaintTaxi.this);
    //onCreateView(savedInstanceState);
    //InitialSetupUI();

    //Added UIHelper
    uiHelper = new UiLifecycleHelper(this, null);
    uiHelper.onCreate(savedInstanceState);

    inputTaxi = (EditText) findViewById(R.id.taxi_id);
    taxiDriver = (EditText) findViewById(R.id.taxi_driver);
    taxiLic = (EditText) findViewById(R.id.taxi_license);
    geoLat = (TextView) findViewById(R.id.geoLat);
    geoLong = (TextView) findViewById(R.id.geoLong);
    editDate = (EditText) findViewById(R.id.editDate);
    editTime = (EditText) findViewById(R.id.editTime);
    editCurrTime = (EditText) findViewById(R.id.editCurrTime);
    complainSend = (Button) findViewById(R.id.complain_send);

    ProgressBar barProgress = (ProgressBar) findViewById(R.id.progressLoading);
    ProgressBar barProgressFrom = (ProgressBar) findViewById(R.id.progressLoadingFrom);
    ProgressBar barProgressTo = (ProgressBar) findViewById(R.id.progressLoadingTo);

    actv_comp_taxi = (AutoCompleteTextView) findViewById(R.id.search_taxi_comp);
    SuggestionAdapter sa = new SuggestionAdapter(this, actv_comp_taxi.getText().toString(), taxiUrl,
            "compcode");
    sa.setLoadingIndicator(barProgress);
    actv_comp_taxi.setAdapter(sa);//w w w.  j a  v a 2  s.  co  m

    actv_from = (AutoCompleteTextView) findViewById(R.id.search_from);
    SuggestionAdapter saFrom = new SuggestionAdapter(this, actv_from.getText().toString(), locUrl, "location");
    saFrom.setLoadingIndicator(barProgressFrom);
    actv_from.setAdapter(saFrom);

    actv_to = (AutoCompleteTextView) findViewById(R.id.search_to);
    SuggestionAdapter saTo = new SuggestionAdapter(this, actv_to.getText().toString(), locUrl, "location");
    saTo.setLoadingIndicator(barProgressTo);
    actv_to.setAdapter(saTo);

    /*if(isNetworkConnected()) {
    new getTaxiComp().execute(new ApiConnector());
    }*/

    //Setting Fonts
    String fontPath = "fonts/segoeuil.ttf";
    Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
    complainSend.setTypeface(tf);
    inputTaxi.setTypeface(tf);
    editDate.setTypeface(tf);
    editTime.setTypeface(tf);
    actv_comp_taxi.setTypeface(tf);
    actv_to.setTypeface(tf);
    actv_from.setTypeface(tf);
    taxiDriver.setTypeface(tf);
    taxiLic.setTypeface(tf);

    TextView txtComp = (TextView) findViewById(R.id.taxi_comp);
    txtComp.setTypeface(tf);

    TextView txtTaxiDriver = (TextView) findViewById(R.id.txt_taxi_driver);
    txtTaxiDriver.setTypeface(tf);

    TextView txtTaxiLic = (TextView) findViewById(R.id.txt_taxi_license);
    txtTaxiLic.setTypeface(tf);

    TextView txtNumber = (TextView) findViewById(R.id.taxi_number);
    txtNumber.setTypeface(tf);

    TextView txtTo = (TextView) findViewById(R.id.to);
    txtTo.setTypeface(tf);

    TextView txtDate = (TextView) findViewById(R.id.date);
    txtDate.setTypeface(tf);

    TextView txtTime = (TextView) findViewById(R.id.time);
    txtTime.setTypeface(tf);

    gLongitude = this.getIntent().getExtras().getDouble("Longitude");
    gLatitude = this.getIntent().getExtras().getDouble("Latitude");
    speedTaxiExceed = this.getIntent().getExtras().getDouble("SpeedTaxiExceed");

    isTwitterSelected = false;
    isFacebookSelected = false;
    isDefaultSelected = false;
    isSmsSelected = false;

    geoLat.setText(Double.toString(gLatitude));
    geoLong.setText(Double.toString(gLongitude));

    rateBtnBus = (ImageButton) findViewById(R.id.btn_rate_bus);

    rateBtnBus.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (actv_comp_taxi.length() != 0) {
                final AlertDialog.Builder alertBox = new AlertDialog.Builder(TraqComplaintTaxi.this);
                alertBox.setIcon(R.drawable.info_icon);
                alertBox.setCancelable(false);
                alertBox.setTitle("Do you want to cancel complaint?");
                alertBox.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface arg0, int arg1) {
                        // finish used for destroyed activity
                        easyTracker.send(MapBuilder
                                .createEvent("Complaint", "Cancel Complaint (Yes)", "Complaint event", null)
                                .build());
                        finish();
                    }
                });

                alertBox.setNegativeButton("No", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int arg1) {
                        easyTracker.send(MapBuilder
                                .createEvent("Complaint", "Cancel Complaint (No)", "Complaint event", null)
                                .build());
                        dialog.cancel();
                    }
                });

                alertBox.show();
            } else {
                Intent intent = new Intent(getApplicationContext(), TraqComplaint.class);
                intent.putExtra("Latitude", gLatitude);
                intent.putExtra("Longitude", gLongitude);
                intent.putExtra("SpeedBusExceed", speedTaxiExceed);
                startActivity(intent);
            }
        }
    });

    complainSend.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String taxi_id = inputTaxi.getText().toString().toUpperCase();
            String taxi_comp = actv_comp_taxi.getText().toString();

            /*if(taxi_comp.length() == 0){
            Toast.makeText(TraqComplaintTaxi.this, "Taxi Company is required!", Toast.LENGTH_SHORT).show();
            }else */
            if (taxi_comp.length() < 2) {
                Toast.makeText(TraqComplaintTaxi.this, "Invalid Taxi Company.", Toast.LENGTH_SHORT).show();
            } else if (taxi_id.length() == 0) {
                Toast.makeText(TraqComplaintTaxi.this, "Taxi Plate Number is required!", Toast.LENGTH_SHORT)
                        .show();
            } else if (taxi_id.length() < 7) {
                Toast.makeText(TraqComplaintTaxi.this, "Invalid Taxi Number.", Toast.LENGTH_SHORT).show();
            } else {
                easyTracker.send(
                        MapBuilder.createEvent("Complaint", "Dialog Prompt", "Complaint event", null).build());
                PromptCustomDialog();
            }
        }
    });
    setCurrentDateOnView();
    getCurrentTime();

    //Shi Chuan's Code

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    cd = new ConnectionDetector(getApplicationContext());

    // Check if Internet present
    if (!cd.isConnectingToInternet()) {
        // Internet Connection is not present
        alert.showAlertDialog(TraqComplaintTaxi.this, "Internet Connection Error",
                "Please connect to working Internet connection", false);
        // stop executing code by return
        return;
    }

    // Check if twitter keys are set
    if (TWITTER_CONSUMER_KEY.trim().length() == 0 || TWITTER_CONSUMER_SECRET.trim().length() == 0) {
        // Internet Connection is not present
        alert.showAlertDialog(TraqComplaintTaxi.this, "Twitter oAuth tokens",
                "Please set your twitter oauth tokens first!", false);
        // stop executing code by return
        return;
    }

    // Shared Preferences
    mSharedPreferences = getApplicationContext().getSharedPreferences("MyPref", 0);

    /** This if conditions is tested once is
     * redirected from twitter page. Parse the uri to get oAuth
     * Verifier
     * */

    if (!isTwitterLoggedInAlready()) {
        Uri uri = getIntent().getData();
        if (uri != null && uri.toString().startsWith(TWITTER_CALLBACK_URL)) {
            // oAuth verifier
            String verifier = uri.getQueryParameter(URL_TWITTER_OAUTH_VERIFIER);

            try {
                // Get the access token
                AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);

                // Shared Preferences
                SharedPreferences.Editor e = mSharedPreferences.edit();

                // After getting access token, access token secret
                // store them in application preferences
                e.putString(PREF_KEY_OAUTH_TOKEN, accessToken.getToken());
                e.putString(PREF_KEY_OAUTH_SECRET, accessToken.getTokenSecret());
                // Store login status - true
                e.putBoolean(PREF_KEY_TWITTER_LOGIN, true);
                e.commit(); // save changes

                Log.e("Twitter OAuth Token", "> " + accessToken.getToken());

                // Getting user details from twitter
                // For now i am getting his name only
                long userID = accessToken.getUserId();
                User user = twitter.showUser(userID);

                String username = user.getName();
                String description = user.getDescription();

                // Displaying in xml ui
                //lblUserName.setText(Html.fromHtml("<b>Welcome " + username + "</b>" + description));
            } catch (Exception e) {
                // Check log for login errors
                Log.e("Twitter Login Error", "> " + e.getMessage());
            }
        }
    }

    //LocationManager lm = (LocationManager)  this.getSystemService(Context.LOCATION_SERVICE);
    //LocationListener ll = new passengerLocationListener();
    //lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);

}

From source file:com.twitstreet.db.data.Stock.java

License:Open Source License

public Stock(twitter4j.User twUser) {
    this.setId(twUser.getId());
    this.setLongName(twUser.getName());
    this.setName(twUser.getScreenName());
    this.setTotal(twUser.getFollowersCount());
    this.setPictureUrl(twUser.getProfileImageURL().toExternalForm());
    this.setSold(0.0D);
    this.setVerified(twUser.isVerified());
    this.setLanguage(twUser.getLang());
    this.setCreatedAt(twUser.getCreatedAt());
    this.setLocation(twUser.getLocation());
    this.setDescription(twUser.getDescription());
}

From source file:com.twitt4droid.data.dao.impl.sqlite.UserSQLiteDAO.java

License:Apache License

/** {@inheritDoc} */
@Override//from w  ww  . j av a2 s  . c  o  m
public void save(User user) {
    getSQLiteTemplate().execute(getSqlString(R.string.twitt4droid_insert_user_sql),
            new String[] { Objects.toString(user.getId()), user.getName(), user.getScreenName(),
                    user.getProfileImageURL(), user.getProfileBannerURL(), user.getURL(), user.getDescription(),
                    user.getLocation() });
}

From source file:DataCollections.UserHelper.java

public User_dbo convertUserToUser_dbo(User user) {

    User_dbo u = new User_dbo();
    u.values[User_dbo.map.get("user_id")].setValue(String.valueOf(user.getId()));
    u.values[User_dbo.map.get("name")].setValue(removeEscapeCharacters(user.getName()));
    u.values[User_dbo.map.get("screename")].setValue(removeEscapeCharacters(user.getScreenName()));
    u.values[User_dbo.map.get("lang")].setValue(user.getLang());
    u.values[User_dbo.map.get("location")].setValue(removeEscapeCharacters(user.getLocation()));
    u.values[User_dbo.map.get("geoenabled")].setValue(String.valueOf(user.isGeoEnabled()));
    u.values[User_dbo.map.get("timezone")].setValue(user.getTimeZone());
    u.values[User_dbo.map.get("profileurl")].setValue(user.getURL());
    u.values[User_dbo.map.get("protected")].setValue(String.valueOf(user.isProtected()));
    u.values[User_dbo.map.get("verified")].setValue(String.valueOf(user.isVerified()));

    u.values[User_dbo.map.get("description")].setValue(removeEscapeCharacters(user.getDescription()));

    if (geoinfoavailable) {
        double[] geocoor = geohelper.searchGeoLocCoor(user.getLocation());
        u.values[User_dbo.map.get("probased_geoinfo")].setValue(String.valueOf("true"));
        //u.values[User_dbo.map.get("descbased_geoinfo")].setValue(String.valueOf("false"));
        u.values[User_dbo.map.get("probased_lat")].setValue(String.valueOf(geocoor[0]));
        u.values[User_dbo.map.get("probased_lon")].setValue(String.valueOf(geocoor[1]));
    }// ww  w  . jav a  2s.c o m
    u.values[User_dbo.map.get("udetails_processed")].setValue(String.valueOf(true));
    u.values[User_dbo.map.get("totaltweets")].setValue(String.valueOf(user.getStatusesCount()));
    return u;
}

From source file:de.binfalse.jatter.processors.JabberMessageProcessor.java

License:Open Source License

/**
 * Translate user.//  w w w .j  a v a2s  . c  o m
 *
 * @param user the user
 * @param profile the profile
 * @return the string
 */
public static String translateUser(User user, String profile) {
    String ret = "profile of *" + profile + "*\n" + "name: " + user.getName() + "\n" + "screen name: "
            + user.getScreenName() + "\n" + "id: " + user.getId() + "\n";

    if (user.getDescription() != null)
        ret += "description: " + user.getDescription() + "\n";
    if (user.getURL() != null)
        ret += "url: " + JatterTools.expandUrl(user.getURL()) + "\n";
    if (user.getLang() != null)
        ret += "language: " + user.getLang() + "\n";
    if (user.getLocation() != null)
        ret += "location: " + user.getLocation() + "\n";
    if (user.getTimeZone() != null)
        ret += "time zone: " + user.getTimeZone() + "\n";

    ret += "tweets: " + user.getStatusesCount() + "\n";
    ret += "favourites: " + user.getFavouritesCount() + "\n";
    ret += "followers: " + user.getFollowersCount() + "\n";
    ret += "friends: " + user.getFriendsCount() + "\n";

    if (user.getStatus() != null)
        ret += "last status: " + TwitterStatusProcessor.translateTwitterStatus(user.getStatus());
    return ret;
}

From source file:de.jetwick.data.JUser.java

License:Apache License

/**
 * This method refreshes the properties of this user by the specified
 * Twitter4j user//from  w w w  .j av  a  2s.  c om
 * @param user
 */
public Status updateFieldsBy(User user) {
    twitterId = user.getId();
    setProtected(user.isProtected());
    setTwitterCreatedAt(user.getCreatedAt());
    setDescription(user.getDescription());
    addLanguage(user.getLang());
    setLocation(TwitterSearch.toStandardLocation(user.getLocation()));
    setRealName(user.getName());

    // user.getFollowersCount();
    // user.getFriendsCount();
    // user.getTimeZone()

    if (user.getProfileImageURL() != null)
        setProfileImageUrl(user.getProfileImageURL().toString());

    if (user.getURL() != null)
        setWebUrl(user.getURL().toString());

    setFollowersCount(user.getFollowersCount());
    setFriendsCount(user.getFriendsCount());
    return user.getStatus();
}

From source file:de.vanita5.twittnuker.model.ParcelableUser.java

License:Open Source License

public ParcelableUser(final User user, final long account_id, final long position) {
    this.position = position;
    this.account_id = account_id;
    final URLEntity[] urls_url_entities = user.getURLEntities();
    id = user.getId();/*from   ww  w  .jav a  2 s  .c om*/
    created_at = getTime(user.getCreatedAt());
    is_protected = user.isProtected();
    is_verified = user.isVerified();
    name = user.getName();
    screen_name = user.getScreenName();
    description_plain = user.getDescription();
    description_html = formatUserDescription(user);
    description_expanded = formatExpandedUserDescription(user);
    location = user.getLocation();
    profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
    profile_banner_url = user.getProfileBannerImageUrl();
    url = ParseUtils.parseString(user.getURL());
    url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0
            ? ParseUtils.parseString(urls_url_entities[0].getExpandedURL())
            : null;
    is_follow_request_sent = user.isFollowRequestSent();
    followers_count = user.getFollowersCount();
    friends_count = user.getFriendsCount();
    statuses_count = user.getStatusesCount();
    favorites_count = user.getFavouritesCount();
    listed_count = user.getListedCount();
    is_cache = false;
    is_following = user.isFollowing();
    description_unescaped = toPlainText(description_html);
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeCachedUserContentValues(final User user) {
    if (user == null || user.getId() <= 0)
        return null;
    final String profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
    final String url = ParseUtils.parseString(user.getURL());
    final URLEntity[] urls = user.getURLEntities();
    final ContentValues values = new ContentValues();
    values.put(CachedUsers.USER_ID, user.getId());
    values.put(CachedUsers.NAME, user.getName());
    values.put(CachedUsers.SCREEN_NAME, user.getScreenName());
    values.put(CachedUsers.PROFILE_IMAGE_URL, profile_image_url);
    values.put(CachedUsers.CREATED_AT, user.getCreatedAt().getTime());
    values.put(CachedUsers.IS_PROTECTED, user.isProtected());
    values.put(CachedUsers.IS_VERIFIED, user.isVerified());
    values.put(CachedUsers.IS_FOLLOWING, user.isFollowing());
    values.put(CachedUsers.FAVORITES_COUNT, user.getFavouritesCount());
    values.put(CachedUsers.FOLLOWERS_COUNT, user.getFollowersCount());
    values.put(CachedUsers.FRIENDS_COUNT, user.getFriendsCount());
    values.put(CachedUsers.STATUSES_COUNT, user.getStatusesCount());
    values.put(CachedUsers.LISTED_COUNT, user.getListedCount());
    values.put(CachedUsers.LOCATION, user.getLocation());
    values.put(CachedUsers.DESCRIPTION_PLAIN, user.getDescription());
    values.put(CachedUsers.DESCRIPTION_HTML, Utils.formatUserDescription(user));
    values.put(CachedUsers.DESCRIPTION_EXPANDED, Utils.formatExpandedUserDescription(user));
    values.put(CachedUsers.URL, url);
    values.put(CachedUsers.URL_EXPANDED,
            url != null && urls != null && urls.length > 0 ? ParseUtils.parseString(urls[0].getExpandedURL())
                    : null);//from  w w w . j  a v a  2 s .co m
    values.put(CachedUsers.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    return values;
}

From source file:de.vanita5.twittnuker.util.TwitterContentUtils.java

License:Open Source License

public static String formatExpandedUserDescription(final User user) {
    if (user == null)
        return null;
    final String text = user.getDescription();
    if (text == null)
        return null;
    final HtmlBuilder builder = new HtmlBuilder(text, false, true, true);
    final URLEntity[] urls = user.getDescriptionEntities();
    if (urls != null) {
        for (final URLEntity url : urls) {
            final String expanded_url = ParseUtils.parseString(url.getExpandedURL());
            if (expanded_url != null) {
                builder.addLink(expanded_url, expanded_url, url.getStart(), url.getEnd());
            }// w  w w.  ja va2  s  .com
        }
    }
    return toPlainText(builder.build().replace("\n", "<br/>"));
}

From source file:de.vanita5.twittnuker.util.TwitterContentUtils.java

License:Open Source License

public static String formatUserDescription(final User user) {
    if (user == null)
        return null;
    final String text = user.getDescription();
    if (text == null)
        return null;
    final HtmlBuilder builder = new HtmlBuilder(text, false, true, true);
    final URLEntity[] urls = user.getDescriptionEntities();
    if (urls != null) {
        for (final URLEntity url : urls) {
            final URL expanded_url = url.getExpandedURL();
            if (expanded_url != null) {
                builder.addLink(ParseUtils.parseString(expanded_url), url.getDisplayURL(), url.getStart(),
                        url.getEnd());//from   w  ww.ja  va  2 s .  c o  m
            }
        }
    }
    return builder.build().replace("\n", "<br/>");
}