Added an expanded view of the date format type selection
Full date in private messages Minor improvements Fixed a bug with anti-deletion of messages
This commit is contained in:
@@ -22,6 +22,7 @@ import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.vtosters.lite.UserProfile;
|
||||
import com.vtosters.lite.VKActivity;
|
||||
@@ -143,6 +144,10 @@ public class Globals {
|
||||
return getContext().getString(getIdentifier(resourcename, "string"));
|
||||
} // Get string via getIdentifier
|
||||
|
||||
public static String getStringDate(@StringRes int i, Object... objArr) {
|
||||
return getContext().getString(i, objArr);
|
||||
}
|
||||
|
||||
public static String getPackageName() {
|
||||
return getContext().getPackageName();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.mig
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.Globals.fixGapps;
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getString;
|
||||
import static ru.vtosters.lite.utils.Globals.getStringDate;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserId;
|
||||
import static ru.vtosters.lite.utils.Globals.registerActivities;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.setupFilters;
|
||||
@@ -20,8 +23,11 @@ import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.vk.core.util.Screen;
|
||||
import com.vk.im.engine.models.users.UserSex;
|
||||
import com.vtosters.lite.data.Users;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Preferences {
|
||||
@@ -181,10 +187,6 @@ public class Preferences {
|
||||
setupFilters();
|
||||
}
|
||||
|
||||
public static boolean fulltime() {
|
||||
return getBoolValue("fulltime", true);
|
||||
}
|
||||
|
||||
public static boolean gcmfix() {
|
||||
return getBoolValue("gcmfix", true);
|
||||
}
|
||||
@@ -367,4 +369,35 @@ public class Preferences {
|
||||
|
||||
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
|
||||
}
|
||||
|
||||
|
||||
public static boolean fulltime() {
|
||||
return getPrefsValue(" ").equals("noyear") || getPrefsValue("dateformat").equals("full") || getPrefsValue("dateformat").equals("noseconds");
|
||||
}
|
||||
|
||||
public static String getDateFormat() {
|
||||
if (getPrefsValue("dateformat").equals("noyear")) {
|
||||
return getString("fulltime2");
|
||||
}
|
||||
|
||||
if (getPrefsValue("dateformat").equals("full")) {
|
||||
return getString("fulltime");
|
||||
}
|
||||
|
||||
return getString("fulltime3");
|
||||
}
|
||||
|
||||
public static String getFormattedDate(UserSex type, long time){
|
||||
SimpleDateFormat date = new SimpleDateFormat(getDateFormat(), Locale.getDefault());
|
||||
|
||||
if(!fulltime()) return null;
|
||||
|
||||
try {
|
||||
return getStringDate(type == UserSex.FEMALE ? getIdentifier("last_seen_profile_f", "string") : getIdentifier("last_seen_profile_m", "string"), new Object[]{date.format(new Date(time))});
|
||||
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user