mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Merge branch 'master' into pr/503
This commit is contained in:
commit
7e88fda645
@ -92,16 +92,13 @@ dependencies {
|
|||||||
implementation "androidx.camera:camera-lifecycle:$camerax_version"
|
implementation "androidx.camera:camera-lifecycle:$camerax_version"
|
||||||
implementation "androidx.camera:camera-view:1.0.0-alpha20"
|
implementation "androidx.camera:camera-view:1.0.0-alpha20"
|
||||||
|
|
||||||
|
|
||||||
// EmojiCompat
|
// EmojiCompat
|
||||||
def emoji_compat_version = "1.1.0"
|
def emoji_compat_version = "1.1.0"
|
||||||
implementation "androidx.emoji:emoji:$emoji_compat_version"
|
implementation "androidx.emoji:emoji:$emoji_compat_version"
|
||||||
implementation "androidx.emoji:emoji-appcompat:$emoji_compat_version"
|
implementation "androidx.emoji:emoji-appcompat:$emoji_compat_version"
|
||||||
|
|
||||||
// implementation 'com.github.hendrawd:StorageUtil:1.1.0'
|
|
||||||
implementation 'me.austinhuang:AutoLinkTextViewV2:-SNAPSHOT'
|
implementation 'me.austinhuang:AutoLinkTextViewV2:-SNAPSHOT'
|
||||||
|
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
|
||||||
implementation 'com.facebook.fresco:fresco:2.3.0'
|
implementation 'com.facebook.fresco:fresco:2.3.0'
|
||||||
implementation 'com.facebook.fresco:animated-webp:2.3.0'
|
implementation 'com.facebook.fresco:animated-webp:2.3.0'
|
||||||
implementation 'com.facebook.fresco:webpsupport:2.3.0'
|
implementation 'com.facebook.fresco:webpsupport:2.3.0'
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
package awais.instagrabber.asyncs;
|
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.jsoup.select.Elements;
|
|
||||||
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import awais.instagrabber.BuildConfig;
|
|
||||||
import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
import awais.instagrabber.utils.Constants;
|
|
||||||
import awais.instagrabber.utils.NetworkUtils;
|
|
||||||
import awais.instagrabber.utils.TextUtils;
|
|
||||||
import awais.instagrabber.utils.Utils;
|
|
||||||
import awaisomereport.LogCollector;
|
|
||||||
|
|
||||||
import static awais.instagrabber.utils.Utils.logCollector;
|
|
||||||
|
|
||||||
public final class ProfilePictureFetcher extends AsyncTask<Void, Void, String> {
|
|
||||||
private final FetchListener<String> fetchListener;
|
|
||||||
private final String userName, userId, picUrl;
|
|
||||||
private final boolean isHashtag;
|
|
||||||
|
|
||||||
public ProfilePictureFetcher(final String userName, final String userId, final FetchListener<String> fetchListener,
|
|
||||||
final String picUrl, final boolean isHashtag) {
|
|
||||||
this.fetchListener = fetchListener;
|
|
||||||
this.userName = userName;
|
|
||||||
this.userId = userId;
|
|
||||||
this.picUrl = picUrl;
|
|
||||||
this.isHashtag = isHashtag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String doInBackground(final Void... voids) {
|
|
||||||
String out = null;
|
|
||||||
if (isHashtag) out = picUrl;
|
|
||||||
else if (Utils.settingsHelper.getBoolean(Constants.INSTADP)) try {
|
|
||||||
final HttpURLConnection backup =
|
|
||||||
(HttpURLConnection) new URL("https://instadp.com/fullsize/" + userName).openConnection();
|
|
||||||
backup.setUseCaches(false);
|
|
||||||
backup.setRequestMethod("GET");
|
|
||||||
backup.setRequestProperty("User-Agent", Constants.A_USER_AGENT);
|
|
||||||
|
|
||||||
final String instadp = backup.getResponseCode() == HttpURLConnection.HTTP_OK ? NetworkUtils.readFromConnection(backup) : null;
|
|
||||||
backup.disconnect();
|
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(instadp)) {
|
|
||||||
final Document doc = Jsoup.parse(instadp);
|
|
||||||
boolean fallback = false;
|
|
||||||
|
|
||||||
final int imgIndex = instadp.indexOf("preloadImg('"), lastIndex;
|
|
||||||
|
|
||||||
Element element = doc.selectFirst(".instadp");
|
|
||||||
if (element != null && (element = element.selectFirst(".picture")) != null)
|
|
||||||
out = element.attr("src");
|
|
||||||
else if ((element = doc.selectFirst(".download-btn")) != null)
|
|
||||||
out = element.attr("href");
|
|
||||||
else if (imgIndex != -1 && (lastIndex = instadp.indexOf("')", imgIndex)) != -1)
|
|
||||||
out = instadp.substring(imgIndex + 12, lastIndex);
|
|
||||||
else {
|
|
||||||
final Elements imgs = doc.getElementsByTag("img");
|
|
||||||
for (final Element img : imgs) {
|
|
||||||
final String imgStr = img.toString();
|
|
||||||
if (imgStr.contains("cdninstagram.com")) out = img.attr("src");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(out)) out = picUrl;
|
|
||||||
} catch (final Exception e) {
|
|
||||||
if (logCollector != null)
|
|
||||||
logCollector.appendException(e, LogCollector.LogFile.ASYNC_PROFILE_PICTURE_FETCHER, "doInBackground");
|
|
||||||
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
if (fetchListener != null) fetchListener.doBefore();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(final String result) {
|
|
||||||
if (fetchListener != null) fetchListener.onResult(result);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,10 +6,8 @@ import android.content.pm.PackageManager;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Animatable;
|
import android.graphics.drawable.Animatable;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -20,7 +18,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
|
|
||||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||||
import com.facebook.drawee.controller.BaseControllerListener;
|
import com.facebook.drawee.controller.BaseControllerListener;
|
||||||
@ -30,12 +27,7 @@ import com.facebook.imagepipeline.image.ImageInfo;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import awais.instagrabber.R;
|
import awais.instagrabber.R;
|
||||||
import awais.instagrabber.asyncs.ProfilePictureFetcher;
|
|
||||||
import awais.instagrabber.databinding.DialogProfilepicBinding;
|
import awais.instagrabber.databinding.DialogProfilepicBinding;
|
||||||
import awais.instagrabber.db.entities.Account;
|
|
||||||
import awais.instagrabber.db.repositories.RepositoryCallback;
|
|
||||||
import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
import awais.instagrabber.models.StoryModel;
|
|
||||||
import awais.instagrabber.repositories.responses.UserInfo;
|
import awais.instagrabber.repositories.responses.UserInfo;
|
||||||
import awais.instagrabber.utils.Constants;
|
import awais.instagrabber.utils.Constants;
|
||||||
import awais.instagrabber.utils.CookieUtils;
|
import awais.instagrabber.utils.CookieUtils;
|
||||||
@ -57,11 +49,6 @@ public class ProfilePicDialogFragment extends DialogFragment {
|
|||||||
private DialogProfilepicBinding binding;
|
private DialogProfilepicBinding binding;
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
private final FetchListener<String> fetchListener = profileUrl -> {
|
|
||||||
url = profileUrl;
|
|
||||||
setupPhoto();
|
|
||||||
};
|
|
||||||
|
|
||||||
public ProfilePicDialogFragment(final String id, final String name, final String fallbackUrl) {
|
public ProfilePicDialogFragment(final String id, final String name, final String fallbackUrl) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -133,7 +120,7 @@ public class ProfilePicDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(final UserInfo result) {
|
public void onSuccess(final UserInfo result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
fetchListener.onResult(result.getHDProfilePicUrl());
|
setupPhoto(result.getHDProfilePicUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,13 +132,12 @@ public class ProfilePicDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else new ProfilePictureFetcher(name, id, fetchListener, fallbackUrl, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
else setupPhoto(fallbackUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupPhoto() {
|
private void setupPhoto(final String result) {
|
||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(result)) url = fallbackUrl;
|
||||||
url = fallbackUrl;
|
else url = result;
|
||||||
}
|
|
||||||
final DraweeController controller = Fresco
|
final DraweeController controller = Fresco
|
||||||
.newDraweeControllerBuilder()
|
.newDraweeControllerBuilder()
|
||||||
.setUri(url)
|
.setUri(url)
|
||||||
|
@ -25,8 +25,6 @@ import java.util.concurrent.CyclicBarrier;
|
|||||||
|
|
||||||
import awais.instagrabber.R;
|
import awais.instagrabber.R;
|
||||||
import awais.instagrabber.adapters.FavoritesAdapter;
|
import awais.instagrabber.adapters.FavoritesAdapter;
|
||||||
import awais.instagrabber.asyncs.LocationFetcher;
|
|
||||||
import awais.instagrabber.asyncs.ProfileFetcher;
|
|
||||||
import awais.instagrabber.databinding.FragmentFavoritesBinding;
|
import awais.instagrabber.databinding.FragmentFavoritesBinding;
|
||||||
import awais.instagrabber.db.datasources.FavoriteDataSource;
|
import awais.instagrabber.db.datasources.FavoriteDataSource;
|
||||||
import awais.instagrabber.db.entities.Favorite;
|
import awais.instagrabber.db.entities.Favorite;
|
||||||
|
@ -43,7 +43,6 @@ public class AboutFragment extends BasePreferencesFragment {
|
|||||||
thirdPartyCategory.addPreference(getAutolinkPreference());
|
thirdPartyCategory.addPreference(getAutolinkPreference());
|
||||||
thirdPartyCategory.addPreference(getExoPlayerPreference());
|
thirdPartyCategory.addPreference(getExoPlayerPreference());
|
||||||
thirdPartyCategory.addPreference(getFrescoPreference());
|
thirdPartyCategory.addPreference(getFrescoPreference());
|
||||||
thirdPartyCategory.addPreference(getJsoupPreference());
|
|
||||||
thirdPartyCategory.addPreference(getMDIPreference());
|
thirdPartyCategory.addPreference(getMDIPreference());
|
||||||
thirdPartyCategory.addPreference(getRetrofitPreference());
|
thirdPartyCategory.addPreference(getRetrofitPreference());
|
||||||
}
|
}
|
||||||
@ -114,22 +113,6 @@ public class AboutFragment extends BasePreferencesFragment {
|
|||||||
return preference;
|
return preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preference getJsoupPreference() {
|
|
||||||
final Context context = getContext();
|
|
||||||
if (context == null) return null;
|
|
||||||
final Preference preference = new Preference(context);
|
|
||||||
preference.setTitle("jsoup");
|
|
||||||
preference.setSummary("Copyright (c) 2009-2020 Jonathan Hedley. MIT License.");
|
|
||||||
preference.setIconSpaceReserved(false);
|
|
||||||
preference.setOnPreferenceClickListener(p -> {
|
|
||||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setData(Uri.parse("https://jsoup.org/"));
|
|
||||||
startActivity(intent);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
return preference;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Preference getFrescoPreference() {
|
private Preference getFrescoPreference() {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
if (context == null) return null;
|
if (context == null) return null;
|
||||||
|
@ -83,14 +83,13 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
|
|||||||
loggedInUsersPreferenceCategory.addPreference(getMarkStoriesSeenPreference());
|
loggedInUsersPreferenceCategory.addPreference(getMarkStoriesSeenPreference());
|
||||||
loggedInUsersPreferenceCategory.addPreference(getMarkDMSeenPreference());
|
loggedInUsersPreferenceCategory.addPreference(getMarkDMSeenPreference());
|
||||||
loggedInUsersPreferenceCategory.addPreference(getEnableActivityNotificationsPreference());
|
loggedInUsersPreferenceCategory.addPreference(getEnableActivityNotificationsPreference());
|
||||||
} else {
|
|
||||||
final PreferenceCategory anonUsersPreferenceCategory = new PreferenceCategory(context);
|
|
||||||
screen.addPreference(anonUsersPreferenceCategory);
|
|
||||||
anonUsersPreferenceCategory.setIconSpaceReserved(false);
|
|
||||||
anonUsersPreferenceCategory.setTitle(R.string.anonymous_settings);
|
|
||||||
anonUsersPreferenceCategory.addPreference(getUseInstaDpPreference());
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// final PreferenceCategory anonUsersPreferenceCategory = new PreferenceCategory(context);
|
||||||
|
// screen.addPreference(anonUsersPreferenceCategory);
|
||||||
|
// anonUsersPreferenceCategory.setIconSpaceReserved(false);
|
||||||
|
// anonUsersPreferenceCategory.setTitle(R.string.anonymous_settings);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preference getLanguagePreference() {
|
private Preference getLanguagePreference() {
|
||||||
@ -260,16 +259,6 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
|
|||||||
return preference;
|
return preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preference getUseInstaDpPreference() {
|
|
||||||
final Context context = getContext();
|
|
||||||
if (context == null) return null;
|
|
||||||
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
|
|
||||||
preference.setKey(Constants.INSTADP);
|
|
||||||
preference.setTitle(R.string.instadp_settings);
|
|
||||||
preference.setIconSpaceReserved(false);
|
|
||||||
return preference;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Preference getPostTimePreference() {
|
private Preference getPostTimePreference() {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
if (context == null) return null;
|
if (context == null) return null;
|
||||||
|
@ -21,7 +21,7 @@ public final class Constants {
|
|||||||
public static final String SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
|
public static final String SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
|
||||||
public static final String MARK_AS_SEEN = "mark_as_seen";
|
public static final String MARK_AS_SEEN = "mark_as_seen";
|
||||||
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
|
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
|
||||||
public static final String INSTADP = "instadp";
|
// deprecated: public static final String INSTADP = "instadp";
|
||||||
// deprecated: public static final String STORIESIG = "storiesig";
|
// deprecated: public static final String STORIESIG = "storiesig";
|
||||||
// deprecated: public static final String STORY_VIEWER = "story_viewer";
|
// deprecated: public static final String STORY_VIEWER = "story_viewer";
|
||||||
// deprecated: public static final String AMOLED_THEME = "amoled_theme";
|
// deprecated: public static final String AMOLED_THEME = "amoled_theme";
|
||||||
|
@ -24,7 +24,6 @@ import static awais.instagrabber.utils.Constants.DM_MARK_AS_SEEN;
|
|||||||
import static awais.instagrabber.utils.Constants.DOWNLOAD_USER_FOLDER;
|
import static awais.instagrabber.utils.Constants.DOWNLOAD_USER_FOLDER;
|
||||||
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
|
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
|
||||||
import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
|
import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
|
||||||
import static awais.instagrabber.utils.Constants.INSTADP;
|
|
||||||
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
|
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
|
||||||
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
|
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
|
||||||
import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
|
import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
|
||||||
@ -128,7 +127,7 @@ public final class SettingsHelper {
|
|||||||
public @interface StringSettings {}
|
public @interface StringSettings {}
|
||||||
|
|
||||||
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
|
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
|
||||||
CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, INSTADP, CHECK_ACTIVITY,
|
CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
|
||||||
CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED})
|
CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED})
|
||||||
public @interface BooleanSettings {}
|
public @interface BooleanSettings {}
|
||||||
|
|
||||||
|
@ -3,25 +3,25 @@
|
|||||||
<string-array name="languages">
|
<string-array name="languages">
|
||||||
<item>System Default</item>
|
<item>System Default</item>
|
||||||
<item translatable="false">English</item>
|
<item translatable="false">English</item>
|
||||||
<item translatable="false">Français [Merci à @kernoeb et @PierreM0]</item>
|
<item translatable="false">Français</item>
|
||||||
<item translatable="false">Español [Gracias a @sguinetti, @akrai y @retiolus]</item>
|
<item translatable="false">Español</item>
|
||||||
<item translatable="false">简体中文</item>
|
<item translatable="false">简体中文</item>
|
||||||
<item translatable="false">Bahasa Indonesia [Terima kasih @Galang23]</item>
|
<item translatable="false">Bahasa Indonesia</item>
|
||||||
<item translatable="false">Italiano [Grazie a @RAR_Ramar e GiorgioHerbie]</item>
|
<item translatable="false">Italiano</item>
|
||||||
<item translatable="false">Deutsch [Danke an @peterge1998]</item>
|
<item translatable="false">Deutsch</item>
|
||||||
<item translatable="false">Polski [Podziękowania dla @Lego8486]</item>
|
<item translatable="false">Polski</item>
|
||||||
<item translatable="false">Türkçe [@faydin90 tarafından]</item>
|
<item translatable="false">Türkçe</item>
|
||||||
<item translatable="false">Português (Brasil) [Obrigado @wagnim, @RickyM7 e @cizordj]</item>
|
<item translatable="false">Português (Brasil)</item>
|
||||||
<item translatable="false">پارسی [ با سپاس از farzadx@ ]</item>
|
<item translatable="false">پارسی</item>
|
||||||
<item translatable="false">Македонски [Благодарност до @snajdovski]</item>
|
<item translatable="false">Македонски</item>
|
||||||
<item translatable="false">Tiếng Việt [bởi Yato Fouze]</item>
|
<item translatable="false">Tiếng Việt</item>
|
||||||
<item translatable="false">繁體中文 [感謝 @Still34]</item>
|
<item translatable="false">繁體中文</item>
|
||||||
<item translatable="false">Català [Gràcies a @retiolus]</item>
|
<item translatable="false">Català</item>
|
||||||
<item translatable="false">Русский [Спасибо @rikishi0071]</item>
|
<item translatable="false">Русский</item>
|
||||||
<item translatable="false">हिन्दी</item>
|
<item translatable="false">हिन्दी</item>
|
||||||
<item translatable="false">Nederlands [Met dank aan Lesley Natrop]</item>
|
<item translatable="false">Nederlands</item>
|
||||||
<item translatable="false">Slovenčina [Vďaka @CrafterSvK]</item>
|
<item translatable="false">Slovenčina</item>
|
||||||
<item translatable="false">日本語 [協力 ysakamoto]</item>
|
<item translatable="false">日本語</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="theme_presets">
|
<string-array name="theme_presets">
|
||||||
<item>Auto / Follow System</item>
|
<item>Auto / Follow System</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user