mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-15 19:27:31 +00:00
convert some more classes to kotlin
This commit is contained in:
parent
1ad2b3e72b
commit
c003cf5900
@ -1,40 +1,43 @@
|
|||||||
package awais.instagrabber.fragments.settings;
|
package awais.instagrabber.fragments.settings
|
||||||
|
|
||||||
public final class PreferenceKeys {
|
object PreferenceKeys {
|
||||||
// new boolean prefs
|
// new boolean prefs
|
||||||
public static final String PREF_ENABLE_DM_NOTIFICATIONS = "enable_dm_notifications";
|
const val PREF_ENABLE_DM_NOTIFICATIONS = "enable_dm_notifications"
|
||||||
public static final String PREF_ENABLE_DM_AUTO_REFRESH = "enable_dm_auto_refresh";
|
const val PREF_ENABLE_DM_AUTO_REFRESH = "enable_dm_auto_refresh"
|
||||||
public static final String PREF_ENABLE_DM_AUTO_REFRESH_FREQ_UNIT = "enable_dm_auto_refresh_freq_unit";
|
const val PREF_ENABLE_DM_AUTO_REFRESH_FREQ_UNIT = "enable_dm_auto_refresh_freq_unit"
|
||||||
public static final String PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER = "enable_dm_auto_refresh_freq_number";
|
const val PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER = "enable_dm_auto_refresh_freq_number"
|
||||||
public static final String PREF_ENABLE_SENTRY = "enable_sentry";
|
const val PREF_ENABLE_SENTRY = "enable_sentry"
|
||||||
public static final String PREF_TAB_ORDER = "tab_order";
|
const val PREF_TAB_ORDER = "tab_order"
|
||||||
public static final String PREF_SHOWN_COUNT_TOOLTIP = "shown_count_tooltip";
|
const val PREF_SHOWN_COUNT_TOOLTIP = "shown_count_tooltip"
|
||||||
public static final String PREF_SEARCH_FOCUS_KEYBOARD = "search_focus_keyboard";
|
const val PREF_SEARCH_FOCUS_KEYBOARD = "search_focus_keyboard"
|
||||||
|
|
||||||
// string prefs
|
// string prefs
|
||||||
public static final String FOLDER_PATH = "custom_path";
|
const val FOLDER_PATH = "custom_path"
|
||||||
public static final String DATE_TIME_FORMAT = "date_time_format";
|
const val DATE_TIME_FORMAT = "date_time_format"
|
||||||
public static final String DATE_TIME_SELECTION = "date_time_selection";
|
const val DATE_TIME_SELECTION = "date_time_selection"
|
||||||
public static final String CUSTOM_DATE_TIME_FORMAT = "date_time_custom_format";
|
const val CUSTOM_DATE_TIME_FORMAT = "date_time_custom_format"
|
||||||
public static final String APP_THEME = "app_theme_v19";
|
const val APP_THEME = "app_theme_v19"
|
||||||
public static final String APP_LANGUAGE = "app_language_v19";
|
const val APP_LANGUAGE = "app_language_v19"
|
||||||
public static final String STORY_SORT = "story_sort";
|
const val STORY_SORT = "story_sort"
|
||||||
|
|
||||||
// set string prefs
|
// set string prefs
|
||||||
public static final String KEYWORD_FILTERS = "keyword_filters";
|
const val KEYWORD_FILTERS = "keyword_filters"
|
||||||
|
|
||||||
// old boolean prefs
|
// old boolean prefs
|
||||||
public static final String DOWNLOAD_USER_FOLDER = "download_user_folder";
|
const val DOWNLOAD_USER_FOLDER = "download_user_folder"
|
||||||
public static final String TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter";
|
const val TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter"
|
||||||
public static final String DOWNLOAD_PREPEND_USER_NAME = "download_user_name";
|
const val DOWNLOAD_PREPEND_USER_NAME = "download_user_name"
|
||||||
public static final String PLAY_IN_BACKGROUND = "play_in_background";
|
const val PLAY_IN_BACKGROUND = "play_in_background"
|
||||||
public static final String FOLDER_SAVE_TO = "saved_to";
|
const val FOLDER_SAVE_TO = "saved_to"
|
||||||
public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
|
const val AUTOPLAY_VIDEOS = "autoplay_videos"
|
||||||
public static final String MUTED_VIDEOS = "muted_videos";
|
const val MUTED_VIDEOS = "muted_videos"
|
||||||
public static final String SHOW_CAPTIONS = "show_captions";
|
const val SHOW_CAPTIONS = "show_captions"
|
||||||
public static final String CUSTOM_DATE_TIME_FORMAT_ENABLED = "data_time_custom_enabled";
|
const val CUSTOM_DATE_TIME_FORMAT_ENABLED = "data_time_custom_enabled"
|
||||||
public static final String SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
|
const val SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled"
|
||||||
public static final String MARK_AS_SEEN = "mark_as_seen";
|
const val MARK_AS_SEEN = "mark_as_seen"
|
||||||
public static final String HIDE_MUTED_REELS = "hide_muted_reels";
|
const val HIDE_MUTED_REELS = "hide_muted_reels"
|
||||||
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
|
const val DM_MARK_AS_SEEN = "dm_mark_as_seen"
|
||||||
public static final String CHECK_ACTIVITY = "check_activity";
|
const val CHECK_ACTIVITY = "check_activity"
|
||||||
public static final String CHECK_UPDATES = "check_updates";
|
const val CHECK_UPDATES = "check_updates"
|
||||||
public static final String FLAG_SECURE = "flag_secure";
|
const val FLAG_SECURE = "flag_secure"
|
||||||
}
|
}
|
@ -1,42 +1,45 @@
|
|||||||
package awais.instagrabber.utils;
|
package awais.instagrabber.utils
|
||||||
|
|
||||||
public final class Constants {
|
object Constants {
|
||||||
public static final String CRASH_REPORT_EMAIL = "barinsta@austinhuang.me";
|
const val CRASH_REPORT_EMAIL = "barinsta@austinhuang.me"
|
||||||
|
|
||||||
// int prefs, do not export
|
// int prefs, do not export
|
||||||
public static final String PREV_INSTALL_VERSION = "prevVersion";
|
const val PREV_INSTALL_VERSION = "prevVersion"
|
||||||
public static final String BROWSER_UA_CODE = "browser_ua_code";
|
const val BROWSER_UA_CODE = "browser_ua_code"
|
||||||
public static final String APP_UA_CODE = "app_ua_code";
|
const val APP_UA_CODE = "app_ua_code"
|
||||||
|
|
||||||
// never Export
|
// never Export
|
||||||
public static final String COOKIE = "cookie";
|
const val COOKIE = "cookie"
|
||||||
|
|
||||||
// deprecated: public static final String SHOW_QUICK_ACCESS_DIALOG = "show_quick_dlg";
|
// deprecated: public static final String SHOW_QUICK_ACCESS_DIALOG = "show_quick_dlg";
|
||||||
public static final String DEVICE_UUID = "device_uuid";
|
const val DEVICE_UUID = "device_uuid"
|
||||||
public static final String BROWSER_UA = "browser_ua";
|
const val BROWSER_UA = "browser_ua"
|
||||||
public static final String APP_UA = "app_ua";
|
const val APP_UA = "app_ua"
|
||||||
|
|
||||||
//////////////////////// EXTRAS ////////////////////////
|
//////////////////////// EXTRAS ////////////////////////
|
||||||
public static final String EXTRAS_USER = "user";
|
const val EXTRAS_USER = "user"
|
||||||
public static final String EXTRAS_HASHTAG = "hashtag";
|
const val EXTRAS_HASHTAG = "hashtag"
|
||||||
public static final String EXTRAS_LOCATION = "location";
|
const val EXTRAS_LOCATION = "location"
|
||||||
public static final String EXTRAS_USERNAME = "username";
|
const val EXTRAS_USERNAME = "username"
|
||||||
public static final String EXTRAS_ID = "id";
|
const val EXTRAS_ID = "id"
|
||||||
public static final String EXTRAS_POST = "post";
|
const val EXTRAS_POST = "post"
|
||||||
public static final String EXTRAS_PROFILE = "profile";
|
const val EXTRAS_PROFILE = "profile"
|
||||||
public static final String EXTRAS_TYPE = "type";
|
const val EXTRAS_TYPE = "type"
|
||||||
public static final String EXTRAS_NAME = "name";
|
const val EXTRAS_NAME = "name"
|
||||||
public static final String EXTRAS_STORIES = "stories";
|
const val EXTRAS_STORIES = "stories"
|
||||||
public static final String EXTRAS_HIGHLIGHT = "highlight";
|
const val EXTRAS_HIGHLIGHT = "highlight"
|
||||||
public static final String EXTRAS_INDEX = "index";
|
const val EXTRAS_INDEX = "index"
|
||||||
public static final String EXTRAS_THREAD_MODEL = "threadModel";
|
const val EXTRAS_THREAD_MODEL = "threadModel"
|
||||||
public static final String EXTRAS_FOLLOWERS = "followers";
|
const val EXTRAS_FOLLOWERS = "followers"
|
||||||
public static final String EXTRAS_SHORTCODE = "shortcode";
|
const val EXTRAS_SHORTCODE = "shortcode"
|
||||||
public static final String EXTRAS_END_CURSOR = "endCursor";
|
const val EXTRAS_END_CURSOR = "endCursor"
|
||||||
public static final String FEED = "feed";
|
const val FEED = "feed"
|
||||||
public static final String FEED_ORDER = "feedOrder";
|
const val FEED_ORDER = "feedOrder"
|
||||||
|
|
||||||
// Notification ids
|
// Notification ids
|
||||||
public static final int ACTIVITY_NOTIFICATION_ID = 10;
|
const val ACTIVITY_NOTIFICATION_ID = 10
|
||||||
public static final int DM_UNREAD_PARENT_NOTIFICATION_ID = 20;
|
const val DM_UNREAD_PARENT_NOTIFICATION_ID = 20
|
||||||
public static final int DM_CHECK_NOTIFICATION_ID = 11;
|
const val DM_CHECK_NOTIFICATION_ID = 11
|
||||||
|
|
||||||
// see https://github.com/dilame/instagram-private-api/blob/master/src/core/constants.ts
|
// see https://github.com/dilame/instagram-private-api/blob/master/src/core/constants.ts
|
||||||
// public static final String SUPPORTED_CAPABILITIES = "[ { \"name\": \"SUPPORTED_SDK_VERSIONS\", \"value\":" +
|
// public static final String SUPPORTED_CAPABILITIES = "[ { \"name\": \"SUPPORTED_SDK_VERSIONS\", \"value\":" +
|
||||||
@ -48,48 +51,42 @@ public final class Constants {
|
|||||||
// "\"gyroscope\", \"value\": \"gyroscope_enabled\" } ]";
|
// "\"gyroscope\", \"value\": \"gyroscope_enabled\" } ]";
|
||||||
// public static final String SIGNATURE_VERSION = "4";
|
// public static final String SIGNATURE_VERSION = "4";
|
||||||
// public static final String SIGNATURE_KEY = "9193488027538fd3450b83b7d05286d4ca9599a0f7eeed90d8c85925698a05dc";
|
// public static final String SIGNATURE_KEY = "9193488027538fd3450b83b7d05286d4ca9599a0f7eeed90d8c85925698a05dc";
|
||||||
public static final String BREADCRUMB_KEY = "iN4$aGr0m";
|
const val BREADCRUMB_KEY = "iN4\$aGr0m"
|
||||||
public static final int LOGIN_RESULT_CODE = 5000;
|
const val LOGIN_RESULT_CODE = 5000
|
||||||
public static final String SKIPPED_VERSION = "skipped_version";
|
const val SKIPPED_VERSION = "skipped_version"
|
||||||
public static final String DEFAULT_TAB = "default_tab";
|
const val DEFAULT_TAB = "default_tab"
|
||||||
public static final String PREF_DARK_THEME = "dark_theme";
|
const val PREF_DARK_THEME = "dark_theme"
|
||||||
public static final String PREF_LIGHT_THEME = "light_theme";
|
const val PREF_LIGHT_THEME = "light_theme"
|
||||||
public static final String DEFAULT_HASH_TAG_PIC = "https://www.instagram.com/static/images/hashtag/search-hashtag-default-avatar.png/1d8417c9a4f5.png";
|
const val DEFAULT_HASH_TAG_PIC = "https://www.instagram.com/static/images/hashtag/search-hashtag-default-avatar.png/1d8417c9a4f5.png"
|
||||||
public static final String SHARED_PREFERENCES_NAME = "settings";
|
const val SHARED_PREFERENCES_NAME = "settings"
|
||||||
public static final String PREF_POSTS_LAYOUT = "posts_layout";
|
const val PREF_POSTS_LAYOUT = "posts_layout"
|
||||||
public static final String PREF_PROFILE_POSTS_LAYOUT = "profile_posts_layout";
|
const val PREF_PROFILE_POSTS_LAYOUT = "profile_posts_layout"
|
||||||
public static final String PREF_TOPIC_POSTS_LAYOUT = "topic_posts_layout";
|
const val PREF_TOPIC_POSTS_LAYOUT = "topic_posts_layout"
|
||||||
public static final String PREF_HASHTAG_POSTS_LAYOUT = "hashtag_posts_layout";
|
const val PREF_HASHTAG_POSTS_LAYOUT = "hashtag_posts_layout"
|
||||||
public static final String PREF_LOCATION_POSTS_LAYOUT = "location_posts_layout";
|
const val PREF_LOCATION_POSTS_LAYOUT = "location_posts_layout"
|
||||||
public static final String PREF_LIKED_POSTS_LAYOUT = "liked_posts_layout";
|
const val PREF_LIKED_POSTS_LAYOUT = "liked_posts_layout"
|
||||||
public static final String PREF_TAGGED_POSTS_LAYOUT = "tagged_posts_layout";
|
const val PREF_TAGGED_POSTS_LAYOUT = "tagged_posts_layout"
|
||||||
public static final String PREF_SAVED_POSTS_LAYOUT = "saved_posts_layout";
|
const val PREF_SAVED_POSTS_LAYOUT = "saved_posts_layout"
|
||||||
public static final String PREF_EMOJI_VARIANTS = "emoji_variants";
|
const val PREF_EMOJI_VARIANTS = "emoji_variants"
|
||||||
public static final String PREF_REACTIONS = "reactions";
|
const val PREF_REACTIONS = "reactions"
|
||||||
|
const val ACTIVITY_CHANNEL_ID = "activity"
|
||||||
public static final String ACTIVITY_CHANNEL_ID = "activity";
|
const val ACTIVITY_CHANNEL_NAME = "Activity"
|
||||||
public static final String ACTIVITY_CHANNEL_NAME = "Activity";
|
const val DOWNLOAD_CHANNEL_ID = "download"
|
||||||
public static final String DOWNLOAD_CHANNEL_ID = "download";
|
const val DOWNLOAD_CHANNEL_NAME = "Downloads"
|
||||||
public static final String DOWNLOAD_CHANNEL_NAME = "Downloads";
|
const val DM_UNREAD_CHANNEL_ID = "dmUnread"
|
||||||
public static final String DM_UNREAD_CHANNEL_ID = "dmUnread";
|
const val DM_UNREAD_CHANNEL_NAME = "Messages"
|
||||||
public static final String DM_UNREAD_CHANNEL_NAME = "Messages";
|
const val SILENT_NOTIFICATIONS_CHANNEL_ID = "silentNotifications"
|
||||||
public static final String SILENT_NOTIFICATIONS_CHANNEL_ID = "silentNotifications";
|
const val SILENT_NOTIFICATIONS_CHANNEL_NAME = "Silent notifications"
|
||||||
public static final String SILENT_NOTIFICATIONS_CHANNEL_NAME = "Silent notifications";
|
const val NOTIF_GROUP_NAME = "awais.instagrabber.InstaNotif"
|
||||||
|
const val GROUP_KEY_DM = "awais.instagrabber.MESSAGES"
|
||||||
public static final String NOTIF_GROUP_NAME = "awais.instagrabber.InstaNotif";
|
const val GROUP_KEY_SILENT_NOTIFICATIONS = "awais.instagrabber.SILENT_NOTIFICATIONS"
|
||||||
public static final String GROUP_KEY_DM = "awais.instagrabber.MESSAGES";
|
const val SHOW_ACTIVITY_REQUEST_CODE = 1738
|
||||||
public static final String GROUP_KEY_SILENT_NOTIFICATIONS = "awais.instagrabber.SILENT_NOTIFICATIONS";
|
const val SHOW_DM_THREAD = 2000
|
||||||
|
const val DM_SYNC_SERVICE_REQUEST_CODE = 3000
|
||||||
public static final int SHOW_ACTIVITY_REQUEST_CODE = 1738;
|
const val GLOBAL_NETWORK_ERROR_DIALOG_REQUEST_CODE = 7777
|
||||||
public static final int SHOW_DM_THREAD = 2000;
|
const val ACTION_SHOW_ACTIVITY = "show_activity"
|
||||||
public static final int DM_SYNC_SERVICE_REQUEST_CODE = 3000;
|
const val ACTION_SHOW_DM_THREAD = "show_dm_thread"
|
||||||
public static final int GLOBAL_NETWORK_ERROR_DIALOG_REQUEST_CODE = 7777;
|
const val DM_THREAD_ACTION_EXTRA_THREAD_ID = "thread_id"
|
||||||
|
const val DM_THREAD_ACTION_EXTRA_THREAD_TITLE = "thread_title"
|
||||||
public static final String ACTION_SHOW_ACTIVITY = "show_activity";
|
const val X_IG_APP_ID = "936619743392459"
|
||||||
public static final String ACTION_SHOW_DM_THREAD = "show_dm_thread";
|
|
||||||
|
|
||||||
public static final String DM_THREAD_ACTION_EXTRA_THREAD_ID = "thread_id";
|
|
||||||
public static final String DM_THREAD_ACTION_EXTRA_THREAD_TITLE = "thread_title";
|
|
||||||
|
|
||||||
public static final String X_IG_APP_ID = "936619743392459";
|
|
||||||
}
|
}
|
@ -1,26 +1,22 @@
|
|||||||
package awais.instagrabber.utils;
|
package awais.instagrabber.utils
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context
|
||||||
|
import com.google.android.exoplayer2.database.ExoDatabaseProvider
|
||||||
|
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory
|
||||||
|
import com.google.android.exoplayer2.upstream.cache.CacheDataSource
|
||||||
|
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
|
||||||
|
import com.google.android.exoplayer2.upstream.cache.SimpleCache
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
object ExoplayerUtils {
|
||||||
|
private const val MAX_CACHE_BYTES: Long = 1048576
|
||||||
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
|
private val cacheEvictor = LeastRecentlyUsedCacheEvictor(MAX_CACHE_BYTES)
|
||||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
|
fun getCachedMediaSourceFactory(context: Context): DefaultMediaSourceFactory {
|
||||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
val exoDatabaseProvider = ExoDatabaseProvider(context)
|
||||||
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
|
val simpleCache = SimpleCache(context.cacheDir, cacheEvictor, exoDatabaseProvider)
|
||||||
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
|
val cacheDataSourceFactory = CacheDataSource.Factory()
|
||||||
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
|
|
||||||
|
|
||||||
public final class ExoplayerUtils {
|
|
||||||
private static final long MAX_CACHE_BYTES = 1048576;
|
|
||||||
private static final LeastRecentlyUsedCacheEvictor cacheEvictor = new LeastRecentlyUsedCacheEvictor(MAX_CACHE_BYTES);
|
|
||||||
|
|
||||||
public static DefaultMediaSourceFactory getCachedMediaSourceFactory(@NonNull final Context context) {
|
|
||||||
final ExoDatabaseProvider exoDatabaseProvider = new ExoDatabaseProvider(context);
|
|
||||||
final SimpleCache simpleCache = new SimpleCache(context.getCacheDir(), cacheEvictor, exoDatabaseProvider);
|
|
||||||
final CacheDataSource.Factory cacheDataSourceFactory = new CacheDataSource.Factory()
|
|
||||||
.setCache(simpleCache)
|
.setCache(simpleCache)
|
||||||
.setUpstreamDataSourceFactory(new DefaultHttpDataSourceFactory());
|
.setUpstreamDataSourceFactory(DefaultHttpDataSourceFactory())
|
||||||
return new DefaultMediaSourceFactory(cacheDataSourceFactory);
|
return DefaultMediaSourceFactory(cacheDataSourceFactory)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user