1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-03-15 08:51:36 +00:00

Merge branch 'master' into feature/search-history

This commit is contained in:
Ammar Githam 2021-04-14 00:18:25 +09:00
commit e69fc28ab2
34 changed files with 162 additions and 87 deletions

View file

@ -436,6 +436,13 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
private List<Tab> setupAnonBottomNav() {
final int selectedItemId = binding.bottomNavView.getSelectedItemId();
final Tab favoriteTab = new Tab(R.drawable.ic_star_24,
getString(R.string.title_favorites),
false,
"favorites_nav_graph",
R.navigation.favorites_nav_graph,
R.id.favorites_nav_graph,
R.id.favoritesFragment);
final Tab profileTab = new Tab(R.drawable.ic_person_24,
getString(R.string.profile),
false,
@ -452,12 +459,15 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
R.id.morePreferencesFragment);
final Menu menu = binding.bottomNavView.getMenu();
menu.clear();
menu.add(0, favoriteTab.getNavigationRootId(), 0, favoriteTab.getTitle()).setIcon(favoriteTab.getIconResId());
menu.add(0, profileTab.getNavigationRootId(), 0, profileTab.getTitle()).setIcon(profileTab.getIconResId());
menu.add(0, moreTab.getNavigationRootId(), 0, moreTab.getTitle()).setIcon(moreTab.getIconResId());
if (selectedItemId != R.id.profile_nav_graph && selectedItemId != R.id.more_nav_graph) {
if (selectedItemId != R.id.profile_nav_graph
&& selectedItemId != R.id.more_nav_graph
&& selectedItemId != R.id.favorites_nav_graph) {
setBottomNavSelectedTab(profileTab);
}
return ImmutableList.of(profileTab, moreTab);
return ImmutableList.of(favoriteTab, profileTab, moreTab);
}
private List<Tab> setupMainBottomNav() {

View file

@ -334,6 +334,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
if (bottomSheetBehavior != null) {
captionState = bottomSheetBehavior.getState();
}
if (settingsHelper.getBoolean(Constants.PLAY_IN_BACKGROUND)) return;
final Media media = viewModel.getMedia();
if (media == null) return;
switch (media.getMediaType()) {
@ -1022,6 +1023,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
// binding.postImage.setOnClickListener(v -> toggleDetails());
final AnimatedZoomableController zoomableController = AnimatedZoomableController.newInstance();
zoomableController.setMaxScaleFactor(3f);
zoomableController.setGestureZoomEnabled(true);
zoomableController.setEnabled(true);
binding.postImage.setZoomableController(zoomableController);
binding.postImage.setTapListener(new GestureDetector.SimpleOnGestureListener() {
@Override

View file

@ -17,16 +17,26 @@ public class PostPreferencesFragment extends BasePreferencesFragment {
final Context context = getContext();
if (context == null) return;
// generalCategory.addPreference(getAutoPlayVideosPreference(context));
screen.addPreference(getBackgroundPlayPreference(context));
screen.addPreference(getAlwaysMuteVideosPreference(context));
screen.addPreference(getShowCaptionPreference(context));
screen.addPreference(getToggleKeywordFilterPreference(context));
screen.addPreference(getEditKeywordFilterPreference(context));
}
private Preference getAutoPlayVideosPreference(@NonNull final Context context) {
// private Preference getAutoPlayVideosPreference(@NonNull final Context context) {
// final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
// preference.setKey(Constants.AUTOPLAY_VIDEOS);
// preference.setTitle(R.string.post_viewer_autoplay_video);
// preference.setIconSpaceReserved(false);
// return preference;
// }
private Preference getBackgroundPlayPreference(@NonNull final Context context) {
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(Constants.AUTOPLAY_VIDEOS);
preference.setTitle(R.string.post_viewer_autoplay_video);
preference.setKey(Constants.PLAY_IN_BACKGROUND);
preference.setTitle(R.string.post_viewer_background_play);
preference.setSummary(R.string.post_viewer_background_play_summary);
preference.setIconSpaceReserved(false);
return preference;
}

View file

@ -229,7 +229,6 @@ public class DirectItem implements Cloneable, Serializable {
public LocalDateTime getLocalDateTime() {
if (localDateTime == null) {
localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
;
}
return localDateTime;
}

View file

@ -21,6 +21,7 @@ public final class Constants {
public static final String DOWNLOAD_USER_FOLDER = "download_user_folder";
public static final String TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter";
public static final String DOWNLOAD_PREPEND_USER_NAME = "download_user_name";
public static final String PLAY_IN_BACKGROUND = "play_in_background";
// deprecated: public static final String BOTTOM_TOOLBAR = "bottom_toolbar";
public static final String FOLDER_SAVE_TO = "saved_to";
public static final String AUTOPLAY_VIDEOS = "autoplay_videos";

View file

@ -43,6 +43,7 @@ import static awais.instagrabber.utils.Constants.HIDE_MUTED_REELS;
import static awais.instagrabber.utils.Constants.KEYWORD_FILTERS;
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
import static awais.instagrabber.utils.Constants.PLAY_IN_BACKGROUND;
import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
import static awais.instagrabber.utils.Constants.PREF_EMOJI_VARIANTS;
import static awais.instagrabber.utils.Constants.PREF_HASHTAG_POSTS_LAYOUT;
@ -164,7 +165,7 @@ public final class SettingsHelper {
@StringDef({DOWNLOAD_USER_FOLDER, DOWNLOAD_PREPEND_USER_NAME, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
SHOW_CAPTIONS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH,
FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY, HIDE_MUTED_REELS})
FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY, HIDE_MUTED_REELS, PLAY_IN_BACKGROUND})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})