mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47: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();
|
||||
if (setDefaultFromSettings) {
|
||||
final String defaultTabIdString = settingsHelper.getString(Constants.DEFAULT_TAB);
|
||||
if (!Utils.isEmpty(defaultTabIdString)) {
|
||||
try {
|
||||
final int defaultNavId = Integer.parseInt(defaultTabIdString);
|
||||
final int index = mainNavList.indexOf(defaultNavId);
|
||||
if (index >= 0) {
|
||||
firstFragmentGraphIndex = index;
|
||||
final Integer menuId = NAV_TO_MENU_ID_MAP.get(defaultNavId);
|
||||
if (menuId != null) {
|
||||
binding.bottomNavView.setSelectedItemId(menuId);
|
||||
}
|
||||
try {
|
||||
final int defaultNavId = Utils.isEmpty(defaultTabIdString) ? mainNavList.get(2) : Integer.parseInt(defaultTabIdString);
|
||||
final int index = mainNavList.indexOf(defaultNavId);
|
||||
if (index >= 0) {
|
||||
firstFragmentGraphIndex = index;
|
||||
final Integer menuId = NAV_TO_MENU_ID_MAP.get(defaultNavId);
|
||||
if (menuId != null) {
|
||||
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(
|
||||
@ -374,7 +372,7 @@ public class MainActivity extends BaseLanguageActivity {
|
||||
|
||||
private void setupMenu(final int backStackSize, final int destinationId) {
|
||||
if (searchMenuItem == null) return;
|
||||
if (backStackSize == 2 && destinationId != R.id.morePreferencesFragment) {
|
||||
if (backStackSize >= 2 && destinationId == R.id.profileFragment) {
|
||||
showSearch = true;
|
||||
searchMenuItem.setVisible(true);
|
||||
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.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()));
|
||||
final CharSequence postCaption = firstPost.getPostCaption();
|
||||
if (Utils.hasMentions(postCaption)) {
|
||||
binding.bottomPanel.viewerCaption.setMentionClickListener(mentionClickListener);
|
||||
binding.bottomPanel.viewerCaption
|
||||
.setText(Utils.getMentionText(postCaption), TextView.BufferType.SPANNABLE);
|
||||
binding.bottomPanel.viewerCaption.setMentionClickListener(mentionClickListener);
|
||||
} else {
|
||||
binding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
||||
binding.bottomPanel.viewerCaption.setText(postCaption);
|
||||
|
@ -152,7 +152,11 @@ public final class CommentsViewerFragment extends Fragment implements SwipeRefre
|
||||
public void afterTextChanged(final Editable s) {}
|
||||
});
|
||||
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.commentField.setEndIconOnClickListener(newCommentListener);
|
||||
|
@ -270,7 +270,7 @@ public class StoryViewerFragment extends Fragment {
|
||||
private void setupListeners() {
|
||||
final boolean hasFeedStories;
|
||||
List<?> models = null;
|
||||
if (currentFeedStoryIndex > 0) {
|
||||
if (currentFeedStoryIndex >= 0) {
|
||||
if (isHighlight) {
|
||||
final HighlightsViewModel highlightsViewModel = (HighlightsViewModel) viewModel;
|
||||
models = highlightsViewModel.getList().getValue();
|
||||
@ -498,11 +498,11 @@ public class StoryViewerFragment extends Fragment {
|
||||
// actionBar.setOnClickListener(v -> {
|
||||
// searchUsername(username);
|
||||
// });
|
||||
if (isHighlight) {
|
||||
actionBar.setSubtitle(getString(R.string.title_highlight, highlight));
|
||||
} else {
|
||||
actionBar.setSubtitle(R.string.title_user_story);
|
||||
}
|
||||
// if (isHighlight) {
|
||||
// actionBar.setSubtitle(getString(R.string.title_highlight, highlight));
|
||||
// } else {
|
||||
// actionBar.setSubtitle(R.string.title_user_story);
|
||||
// }
|
||||
}
|
||||
}
|
||||
storiesViewModel.getList().setValue(Collections.emptyList());
|
||||
@ -596,11 +596,9 @@ public class StoryViewerFragment extends Fragment {
|
||||
if (itemType == MediaItemType.MEDIA_TYPE_VIDEO) setupVideo();
|
||||
else setupImage();
|
||||
|
||||
if (Utils.isEmpty(highlight)) {
|
||||
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setSubtitle(Utils.datetimeParser.format(new Date(currentStory.getTimestamp() * 1000L)));
|
||||
}
|
||||
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setSubtitle(Utils.datetimeParser.format(new Date(currentStory.getTimestamp() * 1000L)));
|
||||
}
|
||||
|
||||
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.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -38,6 +39,7 @@ import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.DirectMessageMembersAdapter;
|
||||
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
|
||||
import awais.instagrabber.databinding.FragmentDirectMessagesSettingsBinding;
|
||||
import awais.instagrabber.fragments.PostViewFragmentDirections;
|
||||
import awais.instagrabber.interfaces.FetchListener;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
||||
@ -95,8 +97,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
||||
final Object tag = v.getTag();
|
||||
if (tag instanceof ProfileModel) {
|
||||
ProfileModel model = (ProfileModel) tag;
|
||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
||||
/*final NavDirections action = PostViewFragmentDirections
|
||||
.actionGlobalProfileFragment("@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(action);*/
|
||||
}
|
||||
};
|
||||
|
||||
@ -104,27 +107,23 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
||||
final Object tag = v.getTag();
|
||||
if (tag instanceof ProfileModel) {
|
||||
ProfileModel model = (ProfileModel) tag;
|
||||
if (!amAdmin || model.getId().equals(Utils.getUserIdFromCookie(cookie))) {
|
||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
||||
} else {
|
||||
final ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
|
||||
getString(R.string.open_profile),
|
||||
getString(R.string.dms_action_kick),
|
||||
});
|
||||
final DialogInterface.OnClickListener clickListener = (d, w) -> {
|
||||
if (w == 0) {
|
||||
// startActivity(new Intent(requireContext(), ProfileViewer.class)
|
||||
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
|
||||
} else if (w == 1) {
|
||||
new ChangeSettings().execute("remove_users", model.getId());
|
||||
onRefresh();
|
||||
}
|
||||
};
|
||||
new AlertDialog.Builder(requireContext())
|
||||
.setAdapter(adapter, clickListener)
|
||||
.show();
|
||||
}
|
||||
final ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
|
||||
getString(R.string.open_profile),
|
||||
getString(R.string.dms_action_kick),
|
||||
});
|
||||
final DialogInterface.OnClickListener clickListener = (d, w) -> {
|
||||
if (w == 0) {
|
||||
/*final NavDirections action = PostViewFragmentDirections
|
||||
.actionGlobalProfileFragment("@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(action);*/
|
||||
} else if (w == 1) {
|
||||
new ChangeSettings().execute("remove_users", model.getId());
|
||||
onRefresh();
|
||||
}
|
||||
};
|
||||
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);
|
||||
final String profileId = profileModel.getId();
|
||||
if (settingsHelper.getBoolean(Constants.STORIESIG)) {
|
||||
if (settingsHelper.getBoolean(Constants.STORIESIG) || isLoggedIn) {
|
||||
new iStoryStatusFetcher(profileId,
|
||||
profileModel.getUsername(),
|
||||
false,
|
||||
|
@ -121,7 +121,8 @@ public final class SettingsHelper {
|
||||
}
|
||||
|
||||
@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 {}
|
||||
|
||||
@StringDef({DOWNLOAD_USER_FOLDER, BOTTOM_TOOLBAR, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
|
||||
|
@ -52,6 +52,13 @@
|
||||
app:roundAsCircle="true" />
|
||||
</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>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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
|
||||
android:id="@+id/info"
|
||||
android:icon="@drawable/ic_outline_info_24"
|
||||
android:title="@string/dm_thread_info"
|
||||
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>
|
@ -2,16 +2,16 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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
|
||||
android:id="@+id/action_download"
|
||||
android:icon="@drawable/ic_download"
|
||||
android:title="@string/action_download"
|
||||
android:titleCondensed="@string/action_download"
|
||||
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>
|
@ -26,6 +26,6 @@
|
||||
<fragment
|
||||
android:id="@+id/discoverFragment"
|
||||
android:name="awais.instagrabber.fragments.main.DiscoverFragment"
|
||||
android:label="DiscoverFragment"
|
||||
android:label="@string/title_discover"
|
||||
tools:layout="@layout/fragment_discover" />
|
||||
</navigation>
|
@ -76,7 +76,7 @@
|
||||
<fragment
|
||||
android:id="@+id/feedFragment"
|
||||
android:name="awais.instagrabber.fragments.main.FeedFragment"
|
||||
android:label="FeedFragment"
|
||||
android:label="@string/feed"
|
||||
tools:layout="@layout/fragment_feed">
|
||||
<action
|
||||
android:id="@+id/action_feedFragment_to_storyViewerFragment"
|
||||
|
@ -7,7 +7,7 @@
|
||||
<fragment
|
||||
android:id="@+id/morePreferencesFragment"
|
||||
android:name="awais.instagrabber.fragments.settings.MorePreferencesFragment"
|
||||
android:label="More">
|
||||
android:label="@string/more">
|
||||
<action
|
||||
android:id="@+id/action_morePreferencesFragment_to_settingsPreferencesFragment"
|
||||
app:destination="@id/settingsPreferencesFragment" />
|
||||
|
@ -13,7 +13,7 @@
|
||||
<dimen name="story_item_width">45dp</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_profile_size">@dimen/feed_profile_size</dimen>
|
||||
|
Loading…
Reference in New Issue
Block a user