Improving design of "Repository Meta" (#362)
Merge branch 'master' into details-design Always open "Repository Meta" Fixing bugs. Merge remote-tracking branch 'remotes/main/master' into details-design Typo removal. Do not show pull requests when API returns null. Replacing size by watchers Removing unused imports. Moving time formatting into TimeHelper. Changing website icon and renaming button and dialog text. Further contentDescription Adding contentDescription Adding support for "timeFormat" Merge remote-tracking branch 'remotes/main/master' into details-design Full support for translation. Partially supporting translation. Adding "view additional information". Adding additional information. Adding forks count. First design changes. Improving usability by including whole header in "Details". Co-authored-by: opyale <example@example.com> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/362 Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package org.mian.gitnex.helpers;
|
||||
|
||||
import android.content.Context;
|
||||
import org.mian.gitnex.R;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -25,6 +28,30 @@ public class TimeHelper {
|
||||
|
||||
}
|
||||
|
||||
public static String formatTime(Date date, Locale locale, String timeFormat, Context context) {
|
||||
|
||||
switch (timeFormat) {
|
||||
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(Locale.getDefault());
|
||||
return prettyTime.format(date);
|
||||
}
|
||||
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String customDateFormatForToastDateFormat(Date customDate) {
|
||||
|
||||
DateFormat format = DateFormat.getDateTimeInstance();
|
||||
|
||||
Reference in New Issue
Block a user