mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
small polishings (see description)
* General (makeshift): Set default first-tab to be profile, adjust search button appearance logic, add fragment labels * DM inbox items: Adjust group chat avatar sizes, reinstate unread indicators * DM thread: Swap buttons per spirit of #122 * Profile: Fix story fetcher logic * Story: Fix bug where first story can't scroll to next user, unify subtitle to timestamp, swap buttons per #122 * Comment: Unfocus replying comment when X is pressed
This commit is contained in:
parent
8dafc8cac0
commit
2d44033d3c
@ -323,20 +323,18 @@ public class MainActivity extends BaseLanguageActivity {
|
|||||||
navIds.recycle();
|
navIds.recycle();
|
||||||
if (setDefaultFromSettings) {
|
if (setDefaultFromSettings) {
|
||||||
final String defaultTabIdString = settingsHelper.getString(Constants.DEFAULT_TAB);
|
final String defaultTabIdString = settingsHelper.getString(Constants.DEFAULT_TAB);
|
||||||
if (!Utils.isEmpty(defaultTabIdString)) {
|
try {
|
||||||
try {
|
final int defaultNavId = Utils.isEmpty(defaultTabIdString) ? mainNavList.get(2) : Integer.parseInt(defaultTabIdString);
|
||||||
final int defaultNavId = Integer.parseInt(defaultTabIdString);
|
final int index = mainNavList.indexOf(defaultNavId);
|
||||||
final int index = mainNavList.indexOf(defaultNavId);
|
if (index >= 0) {
|
||||||
if (index >= 0) {
|
firstFragmentGraphIndex = index;
|
||||||
firstFragmentGraphIndex = index;
|
final Integer menuId = NAV_TO_MENU_ID_MAP.get(defaultNavId);
|
||||||
final Integer menuId = NAV_TO_MENU_ID_MAP.get(defaultNavId);
|
if (menuId != null) {
|
||||||
if (menuId != null) {
|
binding.bottomNavView.setSelectedItemId(menuId);
|
||||||
binding.bottomNavView.setSelectedItemId(menuId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Log.e(TAG, "Error parsing id", e);
|
|
||||||
}
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.e(TAG, "Error parsing id", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final LiveData<NavController> navControllerLiveData = setupWithNavController(
|
final LiveData<NavController> navControllerLiveData = setupWithNavController(
|
||||||
@ -374,7 +372,7 @@ public class MainActivity extends BaseLanguageActivity {
|
|||||||
|
|
||||||
private void setupMenu(final int backStackSize, final int destinationId) {
|
private void setupMenu(final int backStackSize, final int destinationId) {
|
||||||
if (searchMenuItem == null) return;
|
if (searchMenuItem == null) return;
|
||||||
if (backStackSize == 2 && destinationId != R.id.morePreferencesFragment) {
|
if (backStackSize >= 2 && destinationId == R.id.profileFragment) {
|
||||||
showSearch = true;
|
showSearch = true;
|
||||||
searchMenuItem.setVisible(true);
|
searchMenuItem.setVisible(true);
|
||||||
return;
|
return;
|
||||||
|
@ -119,6 +119,6 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol
|
|||||||
}
|
}
|
||||||
binding.tvComment.setText(HtmlCompat.fromHtml(messageText.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT));
|
binding.tvComment.setText(HtmlCompat.fromHtml(messageText.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT));
|
||||||
binding.tvDate.setText(lastItemModel.getDateTime());
|
binding.tvDate.setText(lastItemModel.getDateTime());
|
||||||
// binding.unread.setVisibility(model.getUnreadCount() > 0L ? View.VISIBLE : View.GONE);
|
binding.unread.setVisibility(model.getUnreadCount() > 0L ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -79,9 +79,9 @@ public class PostViewerViewHolder extends RecyclerView.ViewHolder {
|
|||||||
binding.bottomPanel.commentsCount.setText(String.valueOf(firstPost.getCommentsCount()));
|
binding.bottomPanel.commentsCount.setText(String.valueOf(firstPost.getCommentsCount()));
|
||||||
final CharSequence postCaption = firstPost.getPostCaption();
|
final CharSequence postCaption = firstPost.getPostCaption();
|
||||||
if (Utils.hasMentions(postCaption)) {
|
if (Utils.hasMentions(postCaption)) {
|
||||||
|
binding.bottomPanel.viewerCaption.setMentionClickListener(mentionClickListener);
|
||||||
binding.bottomPanel.viewerCaption
|
binding.bottomPanel.viewerCaption
|
||||||
.setText(Utils.getMentionText(postCaption), TextView.BufferType.SPANNABLE);
|
.setText(Utils.getMentionText(postCaption), TextView.BufferType.SPANNABLE);
|
||||||
binding.bottomPanel.viewerCaption.setMentionClickListener(mentionClickListener);
|
|
||||||
} else {
|
} else {
|
||||||
binding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
binding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
||||||
binding.bottomPanel.viewerCaption.setText(postCaption);
|
binding.bottomPanel.viewerCaption.setText(postCaption);
|
||||||
|
@ -152,7 +152,11 @@ public final class CommentsViewerFragment extends Fragment implements SwipeRefre
|
|||||||
public void afterTextChanged(final Editable s) {}
|
public void afterTextChanged(final Editable s) {}
|
||||||
});
|
});
|
||||||
binding.commentField.setStartIconOnClickListener(v -> {
|
binding.commentField.setStartIconOnClickListener(v -> {
|
||||||
commentModel = null;
|
if (commentModel != null) {
|
||||||
|
final View focus = binding.rvComments.findViewWithTag(commentModel);
|
||||||
|
focus.setBackgroundColor(0x00000000);
|
||||||
|
commentModel = null;
|
||||||
|
}
|
||||||
binding.commentText.setText("");
|
binding.commentText.setText("");
|
||||||
});
|
});
|
||||||
binding.commentField.setEndIconOnClickListener(newCommentListener);
|
binding.commentField.setEndIconOnClickListener(newCommentListener);
|
||||||
|
@ -270,7 +270,7 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
private void setupListeners() {
|
private void setupListeners() {
|
||||||
final boolean hasFeedStories;
|
final boolean hasFeedStories;
|
||||||
List<?> models = null;
|
List<?> models = null;
|
||||||
if (currentFeedStoryIndex > 0) {
|
if (currentFeedStoryIndex >= 0) {
|
||||||
if (isHighlight) {
|
if (isHighlight) {
|
||||||
final HighlightsViewModel highlightsViewModel = (HighlightsViewModel) viewModel;
|
final HighlightsViewModel highlightsViewModel = (HighlightsViewModel) viewModel;
|
||||||
models = highlightsViewModel.getList().getValue();
|
models = highlightsViewModel.getList().getValue();
|
||||||
@ -498,11 +498,11 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
// actionBar.setOnClickListener(v -> {
|
// actionBar.setOnClickListener(v -> {
|
||||||
// searchUsername(username);
|
// searchUsername(username);
|
||||||
// });
|
// });
|
||||||
if (isHighlight) {
|
// if (isHighlight) {
|
||||||
actionBar.setSubtitle(getString(R.string.title_highlight, highlight));
|
// actionBar.setSubtitle(getString(R.string.title_highlight, highlight));
|
||||||
} else {
|
// } else {
|
||||||
actionBar.setSubtitle(R.string.title_user_story);
|
// actionBar.setSubtitle(R.string.title_user_story);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storiesViewModel.getList().setValue(Collections.emptyList());
|
storiesViewModel.getList().setValue(Collections.emptyList());
|
||||||
@ -596,11 +596,9 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
if (itemType == MediaItemType.MEDIA_TYPE_VIDEO) setupVideo();
|
if (itemType == MediaItemType.MEDIA_TYPE_VIDEO) setupVideo();
|
||||||
else setupImage();
|
else setupImage();
|
||||||
|
|
||||||
if (Utils.isEmpty(highlight)) {
|
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
||||||
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
if (actionBar != null) {
|
||||||
if (actionBar != null) {
|
actionBar.setSubtitle(Utils.datetimeParser.format(new Date(currentStory.getTimestamp() * 1000L)));
|
||||||
actionBar.setSubtitle(Utils.datetimeParser.format(new Date(currentStory.getTimestamp() * 1000L)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsHelper.getBoolean(MARK_AS_SEEN)) new SeenAction(cookie, currentStory).execute();
|
if (settingsHelper.getBoolean(MARK_AS_SEEN)) new SeenAction(cookie, currentStory).execute();
|
||||||
|
@ -21,6 +21,7 @@ import androidx.appcompat.widget.AppCompatButton;
|
|||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.navigation.NavDirections;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -38,6 +39,7 @@ import awais.instagrabber.R;
|
|||||||
import awais.instagrabber.adapters.DirectMessageMembersAdapter;
|
import awais.instagrabber.adapters.DirectMessageMembersAdapter;
|
||||||
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
|
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
|
||||||
import awais.instagrabber.databinding.FragmentDirectMessagesSettingsBinding;
|
import awais.instagrabber.databinding.FragmentDirectMessagesSettingsBinding;
|
||||||
|
import awais.instagrabber.fragments.PostViewFragmentDirections;
|
||||||
import awais.instagrabber.interfaces.FetchListener;
|
import awais.instagrabber.interfaces.FetchListener;
|
||||||
import awais.instagrabber.models.ProfileModel;
|
import awais.instagrabber.models.ProfileModel;
|
||||||
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
||||||
@ -95,8 +97,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
|||||||
final Object tag = v.getTag();
|
final Object tag = v.getTag();
|
||||||
if (tag instanceof ProfileModel) {
|
if (tag instanceof ProfileModel) {
|
||||||
ProfileModel model = (ProfileModel) tag;
|
ProfileModel model = (ProfileModel) tag;
|
||||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
/*final NavDirections action = PostViewFragmentDirections
|
||||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
.actionGlobalProfileFragment("@" + model.getUsername());
|
||||||
|
NavHostFragment.findNavController(this).navigate(action);*/
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,27 +107,23 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
|||||||
final Object tag = v.getTag();
|
final Object tag = v.getTag();
|
||||||
if (tag instanceof ProfileModel) {
|
if (tag instanceof ProfileModel) {
|
||||||
ProfileModel model = (ProfileModel) tag;
|
ProfileModel model = (ProfileModel) tag;
|
||||||
if (!amAdmin || model.getId().equals(Utils.getUserIdFromCookie(cookie))) {
|
final ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
|
||||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
getString(R.string.open_profile),
|
||||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
getString(R.string.dms_action_kick),
|
||||||
} else {
|
});
|
||||||
final ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
|
final DialogInterface.OnClickListener clickListener = (d, w) -> {
|
||||||
getString(R.string.open_profile),
|
if (w == 0) {
|
||||||
getString(R.string.dms_action_kick),
|
/*final NavDirections action = PostViewFragmentDirections
|
||||||
});
|
.actionGlobalProfileFragment("@" + model.getUsername());
|
||||||
final DialogInterface.OnClickListener clickListener = (d, w) -> {
|
NavHostFragment.findNavController(this).navigate(action);*/
|
||||||
if (w == 0) {
|
} else if (w == 1) {
|
||||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
new ChangeSettings().execute("remove_users", model.getId());
|
||||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
onRefresh();
|
||||||
} else if (w == 1) {
|
}
|
||||||
new ChangeSettings().execute("remove_users", model.getId());
|
};
|
||||||
onRefresh();
|
new AlertDialog.Builder(requireContext())
|
||||||
}
|
.setAdapter(adapter, clickListener)
|
||||||
};
|
.show();
|
||||||
new AlertDialog.Builder(requireContext())
|
|
||||||
.setAdapter(adapter, clickListener)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
|
binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
|
||||||
final String profileId = profileModel.getId();
|
final String profileId = profileModel.getId();
|
||||||
if (settingsHelper.getBoolean(Constants.STORIESIG)) {
|
if (settingsHelper.getBoolean(Constants.STORIESIG) || isLoggedIn) {
|
||||||
new iStoryStatusFetcher(profileId,
|
new iStoryStatusFetcher(profileId,
|
||||||
profileModel.getUsername(),
|
profileModel.getUsername(),
|
||||||
false,
|
false,
|
||||||
|
@ -121,7 +121,8 @@ public final class SettingsHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@StringDef(
|
@StringDef(
|
||||||
{APP_LANGUAGE, APP_THEME, COOKIE, FOLDER_PATH, DATE_TIME_FORMAT, DATE_TIME_SELECTION, CUSTOM_DATE_TIME_FORMAT, DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB})
|
{APP_LANGUAGE, APP_THEME, COOKIE, FOLDER_PATH, DATE_TIME_FORMAT, DATE_TIME_SELECTION, CUSTOM_DATE_TIME_FORMAT,
|
||||||
|
DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB})
|
||||||
public @interface StringSettings {}
|
public @interface StringSettings {}
|
||||||
|
|
||||||
@StringDef({DOWNLOAD_USER_FOLDER, BOTTOM_TOOLBAR, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
|
@StringDef({DOWNLOAD_USER_FOLDER, BOTTOM_TOOLBAR, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
|
||||||
|
@ -52,6 +52,13 @@
|
|||||||
app:roundAsCircle="true" />
|
app:roundAsCircle="true" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/unread"
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
app:srcCompat="@drawable/circle" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/mark_as_seen"
|
||||||
|
android:icon="@drawable/ic_outline_views_24"
|
||||||
|
android:title="@string/mark_as_seen"
|
||||||
|
app:showAsAction="always" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/info"
|
android:id="@+id/info"
|
||||||
android:icon="@drawable/ic_outline_info_24"
|
android:icon="@drawable/ic_outline_info_24"
|
||||||
android:title="@string/dm_thread_info"
|
android:title="@string/dm_thread_info"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
<item
|
|
||||||
android:id="@+id/mark_as_seen"
|
|
||||||
android:icon="@drawable/ic_outline_views_24"
|
|
||||||
android:title="@string/mark_as_seen"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
</menu>
|
</menu>
|
@ -2,16 +2,16 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_dms"
|
||||||
|
android:icon="@drawable/ic_send_24"
|
||||||
|
android:title="@string/action_dms"
|
||||||
|
android:titleCondensed="@string/action_dms"
|
||||||
|
app:showAsAction="always" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_download"
|
android:id="@+id/action_download"
|
||||||
android:icon="@drawable/ic_download"
|
android:icon="@drawable/ic_download"
|
||||||
android:title="@string/action_download"
|
android:title="@string/action_download"
|
||||||
android:titleCondensed="@string/action_download"
|
android:titleCondensed="@string/action_download"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_dms"
|
|
||||||
android:icon="@drawable/ic_send_24"
|
|
||||||
android:title="@string/action_dms"
|
|
||||||
android:titleCondensed="@string/action_dms"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
</menu>
|
</menu>
|
@ -26,6 +26,6 @@
|
|||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/discoverFragment"
|
android:id="@+id/discoverFragment"
|
||||||
android:name="awais.instagrabber.fragments.main.DiscoverFragment"
|
android:name="awais.instagrabber.fragments.main.DiscoverFragment"
|
||||||
android:label="DiscoverFragment"
|
android:label="@string/title_discover"
|
||||||
tools:layout="@layout/fragment_discover" />
|
tools:layout="@layout/fragment_discover" />
|
||||||
</navigation>
|
</navigation>
|
@ -76,7 +76,7 @@
|
|||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/feedFragment"
|
android:id="@+id/feedFragment"
|
||||||
android:name="awais.instagrabber.fragments.main.FeedFragment"
|
android:name="awais.instagrabber.fragments.main.FeedFragment"
|
||||||
android:label="FeedFragment"
|
android:label="@string/feed"
|
||||||
tools:layout="@layout/fragment_feed">
|
tools:layout="@layout/fragment_feed">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_feedFragment_to_storyViewerFragment"
|
android:id="@+id/action_feedFragment_to_storyViewerFragment"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/morePreferencesFragment"
|
android:id="@+id/morePreferencesFragment"
|
||||||
android:name="awais.instagrabber.fragments.settings.MorePreferencesFragment"
|
android:name="awais.instagrabber.fragments.settings.MorePreferencesFragment"
|
||||||
android:label="More">
|
android:label="@string/more">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_morePreferencesFragment_to_settingsPreferencesFragment"
|
android:id="@+id/action_morePreferencesFragment_to_settingsPreferencesFragment"
|
||||||
app:destination="@id/settingsPreferencesFragment" />
|
app:destination="@id/settingsPreferencesFragment" />
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<dimen name="story_item_width">45dp</dimen>
|
<dimen name="story_item_width">45dp</dimen>
|
||||||
|
|
||||||
<dimen name="simple_item_picture_size">80dp</dimen>
|
<dimen name="simple_item_picture_size">80dp</dimen>
|
||||||
<dimen name="simple_item_picture_size_half">40dp</dimen>
|
<dimen name="simple_item_picture_size_half">35dp</dimen>
|
||||||
|
|
||||||
<dimen name="message_item_size">@dimen/simple_item_picture_size</dimen>
|
<dimen name="message_item_size">@dimen/simple_item_picture_size</dimen>
|
||||||
<dimen name="message_item_profile_size">@dimen/feed_profile_size</dimen>
|
<dimen name="message_item_profile_size">@dimen/feed_profile_size</dimen>
|
||||||
|
Loading…
Reference in New Issue
Block a user