1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-03-05 20:11:36 +00:00

f-droid trial, fix #61, polish #65, fix invisible icon issue

This commit is contained in:
Austin Huang 2020-08-21 20:38:51 -04:00
parent c57fbd9d8e
commit 37cfba3666
No known key found for this signature in database
GPG key ID: 84C23AA04587A91F
37 changed files with 51 additions and 14 deletions

View file

@ -345,7 +345,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
ImageViewCompat.setImageTintList(iconFeed, colorStateList.withAlpha(otherIconAlpha));
} else {
// this changes toolbar title
main.mainBinding.toolbar.toolbar.setTitle(slideOffset >= 0.466 ? titleDiscover : main.userQuery);
main.mainBinding.toolbar.toolbar.setTitle(slideOffset >= 0.466 ? titleDiscover :
(main.userQuery == null ? resources.getString(R.string.app_name) : main.userQuery));
imageTintList = ImageViewCompat.getImageTintList(iconFeed);
alpha = imageTintList != null ? (imageTintList.getDefaultColor() & 0xFF_000000) >> 24 : 0;

View file

@ -15,7 +15,7 @@ public abstract class BaseLanguageActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Utils.changeTheme(this);
super.onCreate(savedInstanceState);
}
}

View file

@ -92,7 +92,7 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
private HashtagModel hashtagModel;
private LocationModel locationModel;
private StoryModel[] storyModels;
private MenuItem downloadAction;
private MenuItem downloadAction, favouriteAction;
private final FetchListener<PostModel[]> postsFetchListener = new FetchListener<PostModel[]>() {
@Override
public void onResult(final PostModel[] result) {
@ -755,12 +755,32 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
downloadAction = menu.findItem(R.id.downloadAction);
downloadAction.setVisible(false);
favouriteAction = menu.findItem(R.id.favouriteAction);
favouriteAction.setVisible(!Utils.isEmpty(cookie));
favouriteAction.setIcon(Utils.dataBox.getFavorite(userQuery) == null ? R.drawable.ic_not_liked : R.drawable.ic_like);
downloadAction.setOnMenuItemClickListener(item -> {
if (selectedItems.size() > 0) {
Utils.batchDownload(this, userQuery, DownloadMethod.DOWNLOAD_MAIN, selectedItems);
}
return true;
});
favouriteAction.setOnMenuItemClickListener(item -> {
if (Utils.dataBox.getFavorite(userQuery) == null) {
Utils.dataBox.addFavorite(new DataBox.FavoriteModel(userQuery, System.currentTimeMillis(),
locationModel != null ? locationModel.getName() : userQuery.replaceAll("^@", "")));
favouriteAction.setIcon(R.drawable.ic_like);
}
else {
Utils.dataBox.delFavorite(new DataBox.FavoriteModel(userQuery,
Long.parseLong(Utils.dataBox.getFavorite(userQuery).split("/")[1]),
locationModel != null ? locationModel.getName() : userQuery.replaceAll("^@", "")));
favouriteAction.setIcon(R.drawable.ic_not_liked);
}
return true;
});
return true;
}

View file

@ -172,6 +172,8 @@ public final class SavedViewer extends BaseLanguageActivity implements SwipeRefr
downloadAction = menu.findItem(R.id.downloadAction);
downloadAction.setVisible(false);
menu.findItem(R.id.favouriteAction).setVisible(false);
downloadAction.setOnMenuItemClickListener(item -> {
if (selectedItems.size() > 0) {
Utils.batchDownload(this, null, DownloadMethod.DOWNLOAD_SAVED, selectedItems);

View file

@ -38,11 +38,12 @@ public class DirectMessageStoryShareViewHolder extends DirectMessageItemViewHold
binding.tvMessage.setText(text);
binding.tvMessage.setVisibility(View.VISIBLE);
}
final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
final MediaItemType mediaType = reelShareMedia.getMediaType();
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
getGlideRequestManager().load(reelShareMedia.getThumbUrl()).into(binding.ivMediaPreview);
else {
final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
final MediaItemType mediaType = reelShareMedia.getMediaType();
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? View.VISIBLE : View.GONE);
getGlideRequestManager().load(reelShareMedia.getThumbUrl()).into(binding.ivMediaPreview);
}
}
}
}

View file

@ -299,9 +299,7 @@ public class DirectMessageThreadFragment extends Fragment {
dialogAdapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, dialogList);
new AlertDialog.Builder(requireContext())
//.setTitle(title)
.setAdapter(dialogAdapter, onDialogListener)
// .setNeutralButton(R.string.cancel, null)
.show();
}
};

View file

@ -690,7 +690,7 @@ public final class Utils {
JSONObject boldItem = bold.getJSONObject(q);
desc = desc.substring(0, boldItem.getInt("start") + q*7) + "<b>"
+ desc.substring(boldItem.getInt("start") + q*7, boldItem.getInt("end") + q*7)
+ "</b>" + desc.substring(boldItem.getInt("end") + q*7, desc.length());
+ "</b>" + desc.substring(boldItem.getInt("end") + q*7);
}
actionLogModel = new DirectItemActionLogModel(desc);
break;
@ -810,6 +810,7 @@ public final class Utils {
if (settingsHelper != null) {
isAmoledEnabled = settingsHelper.getBoolean(Constants.AMOLED_THEME);
}
AppCompatDelegate.setDefaultNightMode(themeCode);
// use amoled theme only if enabled in settings
if (isAmoledEnabled) {
// check if setting is set to 'Dark'
@ -827,7 +828,6 @@ public final class Utils {
return;
}
}
AppCompatDelegate.setDefaultNightMode(themeCode);
}
public static void setTooltipText(final View view, @StringRes final int tooltipTextRes) {