use of org.ocpsoft.prettytime.PrettyTime in project AnimeTaste by daimajia.
the class PlayActivity method onCreate.
@Override
public void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
AVOSCloud.initialize(this, "w43xht9daji0uut74pseeiibax8c2tnzxowmx9f81nvtpims", "86q8251hrodk6wnf4znistay1mva9rm1xikvp1s9mhp5n7od");
mPrettyTime = new PrettyTime();
mContext = this;
if (getIntent().getExtras().containsKey("Animation")) {
mAnimation = getIntent().getParcelableExtra("Animation");
}
mDownloadHelper = new DownloadHelper(this);
if (savedInstance != null && savedInstance.containsKey("Animation")) {
mAnimation = savedInstance.getParcelable("Animation");
mLastPos = savedInstance.getInt("LastPosition");
}
mUser = new User(mContext);
setContentView(R.layout.activity_play);
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
mCurrentScape = OrientationHelper.PORTRAIT;
mTitleTextView = (TextView) findViewById(R.id.title);
mContentTextView = (TextView) findViewById(R.id.content);
mDetailImageView = (ImageView) findViewById(R.id.detailPic);
mVideoAction = findViewById(R.id.VideoAction);
mAuthorTextView = (TextView) findViewById(R.id.author);
mPrePlayButton = (ImageButton) findViewById(R.id.pre_play_button);
mLoadingGif = (GifMovieView) findViewById(R.id.loading_gif);
mComments = (LinearLayout) findViewById(R.id.comments);
mRecommendView = findViewById(R.id.recommand_view);
mPlayBtn = (Button) findViewById(R.id.play_btn);
mProgress = (SeekBar) findViewById(R.id.media_progress);
mDuration = (TextView) findViewById(R.id.time_total);
mCurPosition = (TextView) findViewById(R.id.time_current);
mController = (RelativeLayout) findViewById(R.id.controlbar);
mViewHolder = (RelativeLayout) findViewById(R.id.view_holder);
mVV = (BVideoView) findViewById(R.id.video_view);
mCommentEditText = (EditText) findViewById(R.id.comment_edit_text);
mHeaderWrapper = (RelativeLayout) findViewById(R.id.header_wrapper);
mZoomButton = (Button) findViewById(R.id.zoom_btn);
mRecomendView = (LinearLayout) findViewById(R.id.recommend_list);
mRobotoBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf");
mRobotoThin = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Thin.ttf");
initPlayer();
initContent();
mAnimation.recordWatch();
ApiConnector.instance().getRandom(5, mRandomHandler);
new CommentsTask().execute();
getSupportActionBar().setDisplayUseLogoEnabled(false);
showWhatsNew();
}
use of org.ocpsoft.prettytime.PrettyTime in project glimmr by brk3.
the class MainActivity method buildActivityStream.
/**
* An item can be a photo or photoset.
* An event can be a comment, note, or fav on that item.
*/
private List<Object> buildActivityStream(List<Item> activityItems) {
List<Object> ret = new ArrayList<Object>();
if (activityItems == null) {
return ret;
}
PrettyTime prettyTime = new PrettyTime(Locale.getDefault());
String html = "<small><i>%s</i></small><br>" + "%s <font color=\"#ff0084\"><b>%s</b></font> <i>ā%sā</i>";
for (Item i : activityItems) {
if ("photo".equals(i.getType())) {
StringBuilder itemString = new StringBuilder();
for (int j = i.getEvents().size() - 1; j >= 0; j--) {
Event e = ((List<Event>) i.getEvents()).get(j);
String pTime = prettyTime.format(e.getDateadded());
String author = e.getUsername();
if (mUser != null && mUser.getUsername().equals(author)) {
author = getString(R.string.you);
}
if ("comment".equals(e.getType())) {
itemString.append(String.format(html, pTime, author, getString(R.string.commented_on), i.getTitle()));
} else if ("fave".equals(e.getType())) {
itemString.append(String.format(html, pTime, author, getString(R.string.favorited), i.getTitle()));
} else {
Log.e(TAG, "unsupported Event type: " + e.getType());
continue;
}
if (j > 0) {
itemString.append("<br><br>");
}
}
if (!itemString.toString().isEmpty()) {
ret.add(new MenuDrawerActivityItem(itemString.toString(), -1));
}
}
}
return ret;
}
use of org.ocpsoft.prettytime.PrettyTime in project midpoint by Evolveum.
the class SystemInfoPanel method createUptimeModel.
private IModel<String> createUptimeModel() {
return new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
SystemInfoDto dto = getModelObject();
PrettyTime time = new PrettyTime();
return time.format(new Date(System.currentTimeMillis() - dto.uptime));
}
};
}
use of org.ocpsoft.prettytime.PrettyTime in project glimmr by brk3.
the class CommentsFragment method newInstance.
public static CommentsFragment newInstance(Photo p) {
CommentsFragment f = new CommentsFragment();
f.mPhoto = p;
f.mPrettyTime = new PrettyTime(Locale.getDefault());
return f;
}
Aggregations