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) {

View File

@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#333333">
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

View File

@ -22,6 +22,7 @@
android:layout_height="24dp"
android:layout_gravity="end|top"
android:layout_margin="8dp"
android:visibility="gone"
app:srcCompat="@drawable/video" />
</FrameLayout>

View File

@ -6,4 +6,9 @@
android:id="@+id/downloadAction"
android:icon="@drawable/ic_download"
app:showAsAction="always|collapseActionView" />
<item
android:id="@+id/favouriteAction"
android:icon="@drawable/ic_not_liked"
app:showAsAction="always|collapseActionView" />
</menu>

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -1 +0,0 @@
InstaGrabber Revived