mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Remove unused files
This commit is contained in:
parent
466ac22d23
commit
95b362970b
File diff suppressed because it is too large
Load Diff
@ -1,94 +0,0 @@
|
|||||||
// package awais.instagrabber.activities;
|
|
||||||
//
|
|
||||||
// import android.os.Bundle;
|
|
||||||
// import android.view.View;
|
|
||||||
// import android.widget.TextView;
|
|
||||||
//
|
|
||||||
// import androidx.annotation.NonNull;
|
|
||||||
// import androidx.annotation.Nullable;
|
|
||||||
// import androidx.appcompat.widget.AppCompatImageView;
|
|
||||||
// import androidx.appcompat.widget.Toolbar;
|
|
||||||
// import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
||||||
// import androidx.navigation.NavController;
|
|
||||||
// import androidx.navigation.NavDestination;
|
|
||||||
// import androidx.navigation.Navigation;
|
|
||||||
// import androidx.navigation.ui.AppBarConfiguration;
|
|
||||||
// import androidx.navigation.ui.NavigationUI;
|
|
||||||
//
|
|
||||||
// import awais.instagrabber.R;
|
|
||||||
// import awais.instagrabber.databinding.ActivityDirectMessagesBinding;
|
|
||||||
// import awais.instagrabber.fragments.directmessages.DirectMessageThreadFragmentArgs;
|
|
||||||
// import awais.instagrabber.utils.Constants;
|
|
||||||
// import static awais.instagrabber.utils.Utils.settingsHelper;
|
|
||||||
//
|
|
||||||
// @Deprecated
|
|
||||||
// public class DirectMessagesActivity extends BaseLanguageActivity implements NavController.OnDestinationChangedListener {
|
|
||||||
//
|
|
||||||
// private TextView toolbarTitle;
|
|
||||||
// private AppCompatImageView dmInfo, dmSeen;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
// final ActivityDirectMessagesBinding binding = ActivityDirectMessagesBinding.inflate(getLayoutInflater());
|
|
||||||
// final CoordinatorLayout root = binding.getRoot();
|
|
||||||
// setContentView(root);
|
|
||||||
//
|
|
||||||
// toolbarTitle = binding.toolbarTitle;
|
|
||||||
//
|
|
||||||
// final Toolbar toolbar = binding.toolbar;
|
|
||||||
// setSupportActionBar(toolbar);
|
|
||||||
//
|
|
||||||
// dmInfo = binding.dmInfo;
|
|
||||||
// dmSeen = binding.dmSeen;
|
|
||||||
//
|
|
||||||
// final NavController navController = Navigation.findNavController(this, R.id.direct_messages_nav_host_fragment);
|
|
||||||
// navController.addOnDestinationChangedListener(this);
|
|
||||||
// final AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
|
|
||||||
// NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onDestinationChanged(@NonNull final NavController controller,
|
|
||||||
// @NonNull final NavDestination destination,
|
|
||||||
// @Nullable final Bundle arguments) {
|
|
||||||
// switch (destination.getId()) {
|
|
||||||
// case R.id.directMessagesInboxFragment:
|
|
||||||
// setToolbarTitle(R.string.action_dms);
|
|
||||||
// dmInfo.setVisibility(View.GONE);
|
|
||||||
// dmSeen.setVisibility(View.GONE);
|
|
||||||
// return;
|
|
||||||
// case R.id.directMessagesThreadFragment:
|
|
||||||
// if (arguments == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// final String title = DirectMessageThreadFragmentArgs.fromBundle(arguments).getTitle();
|
|
||||||
// setToolbarTitle(title);
|
|
||||||
// dmInfo.setVisibility(View.VISIBLE);
|
|
||||||
// dmSeen.setVisibility(settingsHelper.getBoolean(Constants.DM_MARK_AS_SEEN) ? View.GONE : View.VISIBLE);
|
|
||||||
// return;
|
|
||||||
// case R.id.directMessagesSettingsFragment:
|
|
||||||
// if (arguments == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// setToolbarTitle(R.string.action_settings);
|
|
||||||
// dmInfo.setVisibility(View.GONE);
|
|
||||||
// dmSeen.setVisibility(View.GONE);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setToolbarTitle(final String text) {
|
|
||||||
// if (toolbarTitle == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// toolbarTitle.setText(text);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setToolbarTitle(final int resourceId) {
|
|
||||||
// if (toolbarTitle == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// toolbarTitle.setText(resourceId);
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,607 +0,0 @@
|
|||||||
// package awais.instagrabber.activities;
|
|
||||||
//
|
|
||||||
// import android.app.Notification;
|
|
||||||
// import android.app.PendingIntent;
|
|
||||||
// import android.content.DialogInterface;
|
|
||||||
// import android.content.Intent;
|
|
||||||
// import android.content.pm.PackageManager;
|
|
||||||
// import android.content.res.Resources;
|
|
||||||
// import android.database.MatrixCursor;
|
|
||||||
// import android.os.AsyncTask;
|
|
||||||
// import android.os.Bundle;
|
|
||||||
// import android.os.Handler;
|
|
||||||
// import android.os.PersistableBundle;
|
|
||||||
// import android.provider.BaseColumns;
|
|
||||||
// import android.text.TextUtils;
|
|
||||||
// import android.view.Menu;
|
|
||||||
// import android.view.MenuItem;
|
|
||||||
// import android.view.View;
|
|
||||||
// import android.widget.ArrayAdapter;
|
|
||||||
// import android.widget.AutoCompleteTextView;
|
|
||||||
// import android.widget.Toast;
|
|
||||||
//
|
|
||||||
// import androidx.annotation.NonNull;
|
|
||||||
// import androidx.annotation.Nullable;
|
|
||||||
// import androidx.appcompat.app.AlertDialog;
|
|
||||||
// import androidx.appcompat.widget.SearchView;
|
|
||||||
// import androidx.core.app.NotificationCompat;
|
|
||||||
// import androidx.fragment.app.FragmentManager;
|
|
||||||
// import androidx.recyclerview.widget.GridLayoutManager;
|
|
||||||
//
|
|
||||||
// import java.util.ArrayList;
|
|
||||||
// import java.util.List;
|
|
||||||
// import java.util.Stack;
|
|
||||||
//
|
|
||||||
// import awais.instagrabber.MainHelper;
|
|
||||||
// import awais.instagrabber.R;
|
|
||||||
// import awais.instagrabber.adapters.HighlightsAdapter;
|
|
||||||
// import awais.instagrabber.adapters.SuggestionsAdapter;
|
|
||||||
// import awais.instagrabber.asyncs.GetActivityAsyncTask;
|
|
||||||
// import awais.instagrabber.asyncs.SuggestionsFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.UsernameFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.i.iStoryStatusFetcher;
|
|
||||||
// import awais.instagrabber.customviews.MouseDrawer;
|
|
||||||
// import awais.instagrabber.databinding.ActivityMainbackupBinding;
|
|
||||||
// import awais.instagrabber.dialogs.AboutDialog;
|
|
||||||
// import awais.instagrabber.dialogs.QuickAccessDialog;
|
|
||||||
// import awais.instagrabber.dialogs.SettingsDialog;
|
|
||||||
// import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
// import awais.instagrabber.interfaces.ItemGetter;
|
|
||||||
// import awais.instagrabber.models.DiscoverItemModel;
|
|
||||||
// import awais.instagrabber.models.FeedModel;
|
|
||||||
// import awais.instagrabber.models.HashtagModel;
|
|
||||||
// import awais.instagrabber.models.HighlightModel;
|
|
||||||
// import awais.instagrabber.models.LocationModel;
|
|
||||||
// import awais.instagrabber.models.PostModel;
|
|
||||||
// import awais.instagrabber.models.ProfileModel;
|
|
||||||
// import awais.instagrabber.models.StoryModel;
|
|
||||||
// import awais.instagrabber.models.SuggestionModel;
|
|
||||||
// import awais.instagrabber.models.enums.DownloadMethod;
|
|
||||||
// import awais.instagrabber.models.enums.PostItemType;
|
|
||||||
// import awais.instagrabber.models.enums.SuggestionType;
|
|
||||||
// import awais.instagrabber.utils.Constants;
|
|
||||||
// import awais.instagrabber.utils.DataBox;
|
|
||||||
// import awais.instagrabber.utils.FlavorTown;
|
|
||||||
// import awais.instagrabber.utils.Utils;
|
|
||||||
//
|
|
||||||
// import static awais.instagrabber.utils.Utils.CHANNEL_ID;
|
|
||||||
// import static awais.instagrabber.utils.Utils.notificationManager;
|
|
||||||
// import static awais.instagrabber.utils.Utils.settingsHelper;
|
|
||||||
//
|
|
||||||
// @Deprecated
|
|
||||||
// public final class MainActivityBackup extends BaseLanguageActivity {
|
|
||||||
// private static final int INITIAL_DELAY_MILLIS = 200;
|
|
||||||
// private static final int DELAY_MILLIS = 60000;
|
|
||||||
// public static FetchListener<String> scanHack;
|
|
||||||
// public static ItemGetter itemGetter;
|
|
||||||
//
|
|
||||||
// public final ArrayList<PostModel> allItems = new ArrayList<>();
|
|
||||||
// public final ArrayList<FeedModel> feedItems = new ArrayList<>();
|
|
||||||
// public final ArrayList<DiscoverItemModel> discoverItems = new ArrayList<>();
|
|
||||||
// public final ArrayList<PostModel> selectedItems = new ArrayList<>();
|
|
||||||
// public final ArrayList<DiscoverItemModel> selectedDiscoverItems = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// public final HighlightsAdapter highlightsAdapter = new HighlightsAdapter(null, new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(final View v) {
|
|
||||||
// final Object tag = v.getTag();
|
|
||||||
// if (tag instanceof HighlightModel) {
|
|
||||||
// final HighlightModel highlightModel = (HighlightModel) tag;
|
|
||||||
// new iStoryStatusFetcher(highlightModel.getId(), null, false, false,
|
|
||||||
// (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
|
|
||||||
// if (result != null && result.length > 0) {
|
|
||||||
// // startActivity(new Intent(MainActivityBackup.this, StoryViewer.class)
|
|
||||||
// // .putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
|
||||||
// // .putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
|
|
||||||
// // .putExtra(Constants.EXTRAS_STORIES, result)
|
|
||||||
// // );
|
|
||||||
// } else
|
|
||||||
// Toast.makeText(MainActivityBackup.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// private SuggestionsAdapter suggestionAdapter;
|
|
||||||
// private MenuItem searchAction;
|
|
||||||
// public @NonNull
|
|
||||||
// ActivityMainbackupBinding mainBinding;
|
|
||||||
// public SearchView searchView;
|
|
||||||
// public MenuItem downloadAction, settingsAction, dmsAction, notifAction;
|
|
||||||
// public StoryModel[] storyModels;
|
|
||||||
// public String userQuery = null, cookie, uid = null;
|
|
||||||
// public MainHelper mainHelper;
|
|
||||||
// public ProfileModel profileModel;
|
|
||||||
// public HashtagModel hashtagModel;
|
|
||||||
// public LocationModel locationModel;
|
|
||||||
// private AutoCompleteTextView searchAutoComplete;
|
|
||||||
// private ArrayAdapter<String> profileDialogAdapter;
|
|
||||||
// private DialogInterface.OnClickListener profileDialogListener;
|
|
||||||
// private Stack<String> queriesStack;
|
|
||||||
// private DataBox.CookieModel cookieModel;
|
|
||||||
// private Runnable runnable;
|
|
||||||
// private Handler handler;
|
|
||||||
// private boolean isLoggedIn;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onCreate(@Nullable final Bundle bundle) {
|
|
||||||
// super.onCreate(bundle);
|
|
||||||
// mainBinding = ActivityMainbackupBinding.inflate(getLayoutInflater());
|
|
||||||
// setContentView(mainBinding.getRoot());
|
|
||||||
//
|
|
||||||
// if (settingsHelper.getBoolean(Constants.CHECK_UPDATES)) FlavorTown.updateCheck(this);
|
|
||||||
// FlavorTown.changelogCheck(this);
|
|
||||||
//
|
|
||||||
// cookie = settingsHelper.getString(Constants.COOKIE);
|
|
||||||
// uid = Utils.getUserIdFromCookie(cookie);
|
|
||||||
// Utils.setupCookies(cookie);
|
|
||||||
//
|
|
||||||
// MainHelper.stopCurrentExecutor();
|
|
||||||
// mainHelper = new MainHelper(this);
|
|
||||||
// if (bundle == null) {
|
|
||||||
// queriesStack = new Stack<>();
|
|
||||||
// userQuery = null;
|
|
||||||
// } else {
|
|
||||||
// setStack(bundle);
|
|
||||||
// userQuery = bundle.getString("query");
|
|
||||||
// }
|
|
||||||
// isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
|
|
||||||
//
|
|
||||||
// itemGetter = itemGetType -> {
|
|
||||||
// if (itemGetType == PostItemType.MAIN) return allItems;
|
|
||||||
// if (itemGetType == PostItemType.DISCOVER) return discoverItems;
|
|
||||||
// if (itemGetType == PostItemType.FEED) return feedItems;
|
|
||||||
// return null;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// scanHack = result -> {
|
|
||||||
// if (mainHelper != null && !Utils.isEmpty(result)) {
|
|
||||||
// closeAnyOpenDrawer();
|
|
||||||
// addToStack();
|
|
||||||
// userQuery = (result.contains("/") || result.startsWith("#") || result.startsWith("@")) ? result : ("@" + result);
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// // searches for your userid and returns username
|
|
||||||
// if (uid != null) {
|
|
||||||
// final FetchListener<String> fetchListener = username -> {
|
|
||||||
// if (!Utils.isEmpty(username)) {
|
|
||||||
// // if (!BuildConfig.DEBUG) {
|
|
||||||
// userQuery = username;
|
|
||||||
// if (mainHelper != null && !mainBinding.profileView.swipeRefreshLayout.isRefreshing())
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
// // }
|
|
||||||
// // adds cookies to database for quick access
|
|
||||||
// cookieModel = Utils.dataBox.getCookie(uid);
|
|
||||||
// if (Utils.dataBox.getCookieCount() == 0 || cookieModel == null || Utils.isEmpty(cookieModel.getUsername()))
|
|
||||||
// Utils.dataBox.addUserCookie(new DataBox.CookieModel(uid, username, cookie));
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// boolean found = false;
|
|
||||||
// cookieModel = Utils.dataBox.getCookie(uid);
|
|
||||||
// if (cookieModel != null) {
|
|
||||||
// final String username = cookieModel.getUsername();
|
|
||||||
// if (username != null) {
|
|
||||||
// found = true;
|
|
||||||
// fetchListener.onResult("@" + username);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!found) // if not in database, fetch info from instagram
|
|
||||||
// new UsernameFetcher(uid, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// suggestionAdapter = new SuggestionsAdapter(this, v -> {
|
|
||||||
// final Object tag = v.getTag();
|
|
||||||
// if (tag instanceof CharSequence) {
|
|
||||||
// addToStack();
|
|
||||||
// userQuery = tag.toString();
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
// }
|
|
||||||
// if (searchView != null && !searchView.isIconified()) {
|
|
||||||
// if (searchAction != null) searchAction.collapseActionView();
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// final Resources resources = getResources();
|
|
||||||
// profileDialogAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
|
|
||||||
// new String[]{resources.getString(R.string.view_pfp), resources.getString(R.string.show_stories)});
|
|
||||||
// profileDialogListener = (dialog, which) -> {
|
|
||||||
// final Intent intent;
|
|
||||||
// if (which == 0 || storyModels == null || storyModels.length < 1) {
|
|
||||||
// intent = new Intent(this, ProfilePicViewer.class).putExtra(
|
|
||||||
// ((hashtagModel != null) ? Constants.EXTRAS_HASHTAG : (locationModel != null ? Constants.EXTRAS_LOCATION : Constants.EXTRAS_PROFILE)),
|
|
||||||
// ((hashtagModel != null) ? hashtagModel : (locationModel != null ? locationModel : profileModel)));
|
|
||||||
// } else {
|
|
||||||
// // intent = new Intent(this, StoryViewer.class).putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
|
||||||
// // .putExtra(Constants.EXTRAS_STORIES, storyModels)
|
|
||||||
// // .putExtra(Constants.EXTRAS_HASHTAG, (hashtagModel != null));
|
|
||||||
// }
|
|
||||||
// // startActivity(intent);
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// final View.OnClickListener onClickListener = v -> {
|
|
||||||
// if (v == mainBinding.profileView.mainBiography) {
|
|
||||||
// Utils.copyText(this, mainBinding.profileView.mainBiography.getText().toString());
|
|
||||||
// } else if (v == mainBinding.profileView.locationBiography) {
|
|
||||||
// Utils.copyText(this, mainBinding.profileView.locationBiography.getText().toString());
|
|
||||||
// } else if (v == mainBinding.profileView.mainProfileImage || v == mainBinding.profileView.mainHashtagImage || v == mainBinding.profileView.mainLocationImage) {
|
|
||||||
// if (storyModels == null || storyModels.length <= 0) {
|
|
||||||
// profileDialogListener.onClick(null, 0);
|
|
||||||
// } else {
|
|
||||||
// // because sometimes configuration changes made this crash on some phones
|
|
||||||
// new AlertDialog.Builder(this).setAdapter(profileDialogAdapter, profileDialogListener)
|
|
||||||
// .setNeutralButton(R.string.cancel, null).show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// mainBinding.profileView.mainBiography.setOnClickListener(onClickListener);
|
|
||||||
// mainBinding.profileView.locationBiography.setOnClickListener(onClickListener);
|
|
||||||
// mainBinding.profileView.mainProfileImage.setOnClickListener(onClickListener);
|
|
||||||
// mainBinding.profileView.mainHashtagImage.setOnClickListener(onClickListener);
|
|
||||||
// mainBinding.profileView.mainLocationImage.setOnClickListener(onClickListener);
|
|
||||||
//
|
|
||||||
// mainBinding.profileView.mainBiography.setEnabled(false);
|
|
||||||
// mainBinding.profileView.mainProfileImage.setEnabled(false);
|
|
||||||
// mainBinding.profileView.mainHashtagImage.setEnabled(false);
|
|
||||||
// mainBinding.profileView.mainLocationImage.setEnabled(false);
|
|
||||||
//
|
|
||||||
// final boolean isQueryNull = userQuery == null;
|
|
||||||
// if (isQueryNull) {
|
|
||||||
// allItems.clear();
|
|
||||||
// mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_outline_info_24);
|
|
||||||
// mainBinding.profileView.privatePage2.setTextSize(20);
|
|
||||||
// mainBinding.profileView.privatePage2.setText(isLoggedIn ? R.string.no_acc_logged_in : R.string.no_acc);
|
|
||||||
// mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
// if (!mainBinding.profileView.swipeRefreshLayout.isRefreshing() && userQuery != null)
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
//
|
|
||||||
// mainHelper.onIntent(getIntent());
|
|
||||||
//
|
|
||||||
// handler = new Handler();
|
|
||||||
// runnable = () -> {
|
|
||||||
// final GetActivityAsyncTask activityAsyncTask = new GetActivityAsyncTask(uid, cookie, result -> {
|
|
||||||
// if (result == null || notificationManager == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// final List<String> list = new ArrayList<>();
|
|
||||||
// if (result.getRelationshipsCount() != 0) {
|
|
||||||
// list.add(getString(R.string.activity_count_relationship, result.getRelationshipsCount()));
|
|
||||||
// }
|
|
||||||
// if (result.getUserTagsCount() != 0) {
|
|
||||||
// list.add(getString(R.string.activity_count_usertags, result.getUserTagsCount()));
|
|
||||||
// }
|
|
||||||
// if (result.getCommentsCount() != 0) {
|
|
||||||
// list.add(getString(R.string.activity_count_comments, result.getCommentsCount()));
|
|
||||||
// }
|
|
||||||
// if (result.getCommentLikesCount() != 0) {
|
|
||||||
// list.add(getString(R.string.activity_count_commentlikes, result.getCommentLikesCount()));
|
|
||||||
// }
|
|
||||||
// if (result.getLikesCount() != 0) {
|
|
||||||
// list.add(getString(R.string.activity_count_likes, result.getLikesCount()));
|
|
||||||
// }
|
|
||||||
// if (list.isEmpty()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// final String join = TextUtils.join(", ", list);
|
|
||||||
// final String notificationString = getString(R.string.activity_count_prefix) + " " + join + ".";
|
|
||||||
// final Intent intent = new Intent(getApplicationContext(), NotificationsViewer.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
// final Notification notification = new NotificationCompat.Builder(MainActivityBackup.this, CHANNEL_ID)
|
|
||||||
// .setCategory(NotificationCompat.CATEGORY_STATUS)
|
|
||||||
// .setSmallIcon(R.drawable.ic_notif)
|
|
||||||
// .setAutoCancel(true)
|
|
||||||
// .setPriority(NotificationCompat.PRIORITY_MIN)
|
|
||||||
// .setContentText(notificationString)
|
|
||||||
// .setContentIntent(PendingIntent.getActivity(getApplicationContext(), 1738, intent, PendingIntent.FLAG_UPDATE_CURRENT))
|
|
||||||
// .build();
|
|
||||||
// notificationManager.cancel(1800000000);
|
|
||||||
// notificationManager.notify(1800000000, notification);
|
|
||||||
// });
|
|
||||||
// activityAsyncTask.execute();
|
|
||||||
// if (!Utils.isEmpty(cookie) && Utils.settingsHelper.getBoolean(Constants.CHECK_ACTIVITY))
|
|
||||||
// activityAsyncTask.execute();
|
|
||||||
// handler.postDelayed(runnable, DELAY_MILLIS);
|
|
||||||
// };
|
|
||||||
// handler.postDelayed(runnable, INITIAL_DELAY_MILLIS);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void downloadSelectedItems() {
|
|
||||||
// if (selectedItems.size() > 0) {
|
|
||||||
// Utils.batchDownload(this, userQuery, DownloadMethod.DOWNLOAD_MAIN, selectedItems);
|
|
||||||
// } else if (selectedDiscoverItems.size() > 0) {
|
|
||||||
// Utils.batchDownload(this, null, DownloadMethod.DOWNLOAD_DISCOVER, selectedDiscoverItems);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onNewIntent(final Intent intent) {
|
|
||||||
// super.onNewIntent(intent);
|
|
||||||
// mainHelper.onIntent(intent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSaveInstanceState(@NonNull final Bundle outState, @NonNull final PersistableBundle outPersistentState) {
|
|
||||||
// outState.putString("query", userQuery);
|
|
||||||
// outState.putSerializable("stack", queriesStack);
|
|
||||||
// super.onSaveInstanceState(outState, outPersistentState);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRestoreInstanceState(@Nullable final Bundle savedInstanceState, @Nullable final PersistableBundle persistentState) {
|
|
||||||
// super.onRestoreInstanceState(savedInstanceState, persistentState);
|
|
||||||
// if (savedInstanceState != null) {
|
|
||||||
// userQuery = savedInstanceState.getString("query");
|
|
||||||
// setStack(savedInstanceState);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onSaveInstanceState(@NonNull final Bundle outState) {
|
|
||||||
// outState.putString("query", userQuery);
|
|
||||||
// outState.putSerializable("stack", queriesStack);
|
|
||||||
// super.onSaveInstanceState(outState);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onRestoreInstanceState(@NonNull final Bundle savedInstanceState) {
|
|
||||||
// super.onRestoreInstanceState(savedInstanceState);
|
|
||||||
// userQuery = savedInstanceState.getString("query");
|
|
||||||
// setStack(savedInstanceState);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onCreateOptionsMenu(final Menu menu) {
|
|
||||||
// getMenuInflater().inflate(R.menu.menu, menu);
|
|
||||||
//
|
|
||||||
// final FragmentManager fragmentManager = getSupportFragmentManager();
|
|
||||||
// final MenuItem quickAccessAction = menu.findItem(R.id.action_quickaccess).setVisible(true);
|
|
||||||
//
|
|
||||||
// final MenuItem.OnMenuItemClickListener clickListener = item -> {
|
|
||||||
// if (item == downloadAction)
|
|
||||||
// downloadSelectedItems();
|
|
||||||
// else if (item == dmsAction)
|
|
||||||
// startActivity(new Intent(this, DirectMessagesActivity.class));
|
|
||||||
// else if (item == notifAction)
|
|
||||||
// startActivity(new Intent(this, NotificationsViewer.class));
|
|
||||||
// else if (item == settingsAction)
|
|
||||||
// new SettingsDialog().show(fragmentManager, "settings");
|
|
||||||
// else if (item == quickAccessAction)
|
|
||||||
// new QuickAccessDialog()
|
|
||||||
// .setQuery(userQuery, locationModel != null ? locationModel.getName() : userQuery)
|
|
||||||
// .show(fragmentManager, "quickAccess");
|
|
||||||
// else
|
|
||||||
// new AboutDialog().show(fragmentManager, "about");
|
|
||||||
// return true;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// quickAccessAction.setOnMenuItemClickListener(clickListener);
|
|
||||||
// menu.findItem(R.id.action_about).setVisible(true).setOnMenuItemClickListener(clickListener);
|
|
||||||
// dmsAction = menu.findItem(R.id.action_dms).setOnMenuItemClickListener(clickListener);
|
|
||||||
// notifAction = menu.findItem(R.id.action_notif).setOnMenuItemClickListener(clickListener);
|
|
||||||
// settingsAction = menu.findItem(R.id.action_settings).setVisible(true).setOnMenuItemClickListener(clickListener);
|
|
||||||
// downloadAction = menu.findItem(R.id.action_download).setOnMenuItemClickListener(clickListener);
|
|
||||||
//
|
|
||||||
// if (!Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE))) {
|
|
||||||
// notifAction.setVisible(true);
|
|
||||||
// dmsAction.setVisible(true).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// searchAction = menu.findItem(R.id.action_search);
|
|
||||||
// searchView = (SearchView) searchAction.getActionView();
|
|
||||||
// final View searchText = searchView.findViewById(R.id.search_src_text);
|
|
||||||
// if (searchText instanceof AutoCompleteTextView)
|
|
||||||
// searchAutoComplete = (AutoCompleteTextView) searchText;
|
|
||||||
//
|
|
||||||
// searchView.setQueryHint(getResources().getString(R.string.action_search));
|
|
||||||
// searchView.setSuggestionsAdapter(suggestionAdapter);
|
|
||||||
// searchView.setOnSearchClickListener(v -> {
|
|
||||||
// searchView.setQuery((cookieModel != null && userQuery != null && userQuery.equals("@" + cookieModel.getUsername())) ? "" : userQuery, false);
|
|
||||||
// menu.findItem(R.id.action_about).setVisible(false);
|
|
||||||
// menu.findItem(R.id.action_settings).setVisible(false);
|
|
||||||
// menu.findItem(R.id.action_dms).setVisible(false);
|
|
||||||
// menu.findItem(R.id.action_quickaccess).setVisible(false);
|
|
||||||
// menu.findItem(R.id.action_notif).setVisible(false);
|
|
||||||
// });
|
|
||||||
// searchAction.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
||||||
// @Override
|
|
||||||
// public boolean onMenuItemActionExpand(MenuItem item) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onMenuItemActionCollapse(MenuItem item) {
|
|
||||||
// menu.findItem(R.id.action_about).setVisible(true);
|
|
||||||
// menu.findItem(R.id.action_settings).setVisible(true);
|
|
||||||
// menu.findItem(R.id.action_dms).setVisible(!Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE)));
|
|
||||||
// menu.findItem(R.id.action_quickaccess).setVisible(true);
|
|
||||||
// menu.findItem(R.id.action_notif).setVisible(true);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
|
||||||
// private boolean searchUser, searchHash;
|
|
||||||
// private AsyncTask<?, ?, ?> prevSuggestionAsync;
|
|
||||||
// private final String[] COLUMNS = {BaseColumns._ID, Constants.EXTRAS_USERNAME, Constants.EXTRAS_NAME,
|
|
||||||
// Constants.EXTRAS_TYPE, "pfp", "verified"};
|
|
||||||
// private final FetchListener<SuggestionModel[]> fetchListener = new FetchListener<SuggestionModel[]>() {
|
|
||||||
// @Override
|
|
||||||
// public void doBefore() {
|
|
||||||
// suggestionAdapter.changeCursor(null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onResult(final SuggestionModel[] result) {
|
|
||||||
// final MatrixCursor cursor;
|
|
||||||
// if (result == null) cursor = null;
|
|
||||||
// else {
|
|
||||||
// cursor = new MatrixCursor(COLUMNS, 0);
|
|
||||||
// for (int i = 0; i < result.length; i++) {
|
|
||||||
// final SuggestionModel suggestionModel = result[i];
|
|
||||||
// if (suggestionModel != null) {
|
|
||||||
// final SuggestionType suggestionType = suggestionModel.getSuggestionType();
|
|
||||||
// final Object[] objects = {i,
|
|
||||||
// (suggestionType == SuggestionType.TYPE_LOCATION) ? suggestionModel.getName() : suggestionModel.getUsername(),
|
|
||||||
// (suggestionType == SuggestionType.TYPE_LOCATION) ? suggestionModel.getUsername() : suggestionModel.getName(),
|
|
||||||
// suggestionType, suggestionModel.getProfilePic(), suggestionModel.isVerified()};
|
|
||||||
//
|
|
||||||
// if (!searchHash && !searchUser) cursor.addRow(objects);
|
|
||||||
// else {
|
|
||||||
// final boolean isCurrHash = suggestionType == SuggestionType.TYPE_HASHTAG;
|
|
||||||
// if (searchHash && isCurrHash || !searchHash && !isCurrHash)
|
|
||||||
// cursor.addRow(objects);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// suggestionAdapter.changeCursor(cursor);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// private void cancelSuggestionsAsync() {
|
|
||||||
// if (prevSuggestionAsync != null)
|
|
||||||
// try {
|
|
||||||
// prevSuggestionAsync.cancel(true);
|
|
||||||
// } catch (final Exception ignored) {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onQueryTextSubmit(final String query) {
|
|
||||||
// cancelSuggestionsAsync();
|
|
||||||
// menu.findItem(R.id.action_about).setVisible(true);
|
|
||||||
// menu.findItem(R.id.action_settings).setVisible(true);
|
|
||||||
//
|
|
||||||
// closeAnyOpenDrawer();
|
|
||||||
// addToStack();
|
|
||||||
// userQuery = (query.contains("@") || query.contains("#")) ? query : ("@" + query);
|
|
||||||
// searchAction.collapseActionView();
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onQueryTextChange(final String newText) {
|
|
||||||
// cancelSuggestionsAsync();
|
|
||||||
//
|
|
||||||
// if (!Utils.isEmpty(newText)) {
|
|
||||||
// searchUser = newText.charAt(0) == '@';
|
|
||||||
// searchHash = newText.charAt(0) == '#';
|
|
||||||
//
|
|
||||||
// if (newText.length() == 1 && (searchHash || searchUser)) {
|
|
||||||
// if (searchAutoComplete != null) searchAutoComplete.setThreshold(2);
|
|
||||||
// } else {
|
|
||||||
// if (searchAutoComplete != null) searchAutoComplete.setThreshold(1);
|
|
||||||
// prevSuggestionAsync = new SuggestionsFetcher(fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
|
||||||
// searchUser || searchHash ? newText.substring(1) : newText);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onBackPressed() {
|
|
||||||
// if (closeAnyOpenDrawer()) return;
|
|
||||||
//
|
|
||||||
// if (searchView != null && !searchView.isIconified()) {
|
|
||||||
// if (searchAction != null) searchAction.collapseActionView();
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// searchView.setIconified(true);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!mainHelper.isSelectionCleared()) return;
|
|
||||||
//
|
|
||||||
// final GridLayoutManager layoutManager = (GridLayoutManager) mainBinding.profileView.mainPosts.getLayoutManager();
|
|
||||||
// if (layoutManager != null && layoutManager.findFirstCompletelyVisibleItemPosition() >= layoutManager.getSpanCount()) {
|
|
||||||
// mainBinding.profileView.mainPosts.smoothScrollToPosition(0);
|
|
||||||
// mainBinding.profileView.appBarLayout.setExpanded(true, true);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (queriesStack != null && queriesStack.size() > 0) {
|
|
||||||
// userQuery = queriesStack.pop();
|
|
||||||
// if (userQuery != null) {
|
|
||||||
// mainHelper.onRefresh();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// finish();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) {
|
|
||||||
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
// if (requestCode == 8020 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
|
||||||
// downloadSelectedItems();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onActivityResult(final int requestCode, final int resultCode, @Nullable final Intent data) {
|
|
||||||
// super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
// if (requestCode == 9629 && (resultCode == 1692 || resultCode == RESULT_CANCELED))
|
|
||||||
// finish();
|
|
||||||
// else if (requestCode == 6007)
|
|
||||||
// Utils.showImportExportDialog(this);
|
|
||||||
// // else if (requestCode == 6969 && mainHelper.currentFeedPlayer != null)
|
|
||||||
// // mainHelper.currentFeedPlayer.setPlayWhenReady(true);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onPause() {
|
|
||||||
// if (mainHelper != null) mainHelper.onPause();
|
|
||||||
// if (handler != null && runnable != null) {
|
|
||||||
// handler.removeCallbacks(runnable);
|
|
||||||
// }
|
|
||||||
// super.onPause();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onResume() {
|
|
||||||
// if (mainHelper != null) mainHelper.onResume();
|
|
||||||
// if (handler != null && runnable != null) {
|
|
||||||
// handler.postDelayed(runnable, INITIAL_DELAY_MILLIS);
|
|
||||||
// }
|
|
||||||
// super.onResume();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setStack(final Bundle bundle) {
|
|
||||||
// final Object stack = bundle != null ? bundle.get("stack") : null;
|
|
||||||
// if (stack instanceof Stack) //noinspection unchecked
|
|
||||||
// queriesStack = (Stack<String>) stack;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void addToStack() {
|
|
||||||
// if (userQuery != null) {
|
|
||||||
// if (queriesStack == null) queriesStack = new Stack<>();
|
|
||||||
// queriesStack.add(userQuery);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private boolean closeAnyOpenDrawer() {
|
|
||||||
// final int childCount = mainBinding.drawerLayout.getChildCount();
|
|
||||||
// for (int i = 0; i < childCount; i++) {
|
|
||||||
// final View child = mainBinding.drawerLayout.getChildAt(i);
|
|
||||||
// final MouseDrawer.LayoutParams childLp = (MouseDrawer.LayoutParams) child.getLayoutParams();
|
|
||||||
//
|
|
||||||
// if ((childLp.openState & MouseDrawer.LayoutParams.FLAG_IS_OPENED) == 1 ||
|
|
||||||
// (childLp.openState & MouseDrawer.LayoutParams.FLAG_IS_OPENING) == 2 ||
|
|
||||||
// childLp.onScreen >= 0.6 || childLp.isPeeking) {
|
|
||||||
// mainBinding.drawerLayout.closeDrawer(child);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,786 +0,0 @@
|
|||||||
// package awais.instagrabber.activities;
|
|
||||||
//
|
|
||||||
// import android.annotation.SuppressLint;
|
|
||||||
// import android.content.DialogInterface;
|
|
||||||
// import android.content.Intent;
|
|
||||||
// import android.content.pm.PackageManager;
|
|
||||||
// import android.content.res.ColorStateList;
|
|
||||||
// import android.content.res.Resources;
|
|
||||||
// import android.graphics.drawable.Animatable;
|
|
||||||
// import android.net.Uri;
|
|
||||||
// import android.os.AsyncTask;
|
|
||||||
// import android.os.Build;
|
|
||||||
// import android.os.Bundle;
|
|
||||||
// import android.os.Handler;
|
|
||||||
// import android.text.SpannableString;
|
|
||||||
// import android.text.method.LinkMovementMethod;
|
|
||||||
// import android.util.Log;
|
|
||||||
// import android.view.MotionEvent;
|
|
||||||
// import android.view.View;
|
|
||||||
// import android.widget.ArrayAdapter;
|
|
||||||
// import android.widget.LinearLayout;
|
|
||||||
// import android.widget.RelativeLayout;
|
|
||||||
// import android.widget.TextView;
|
|
||||||
// import android.widget.Toast;
|
|
||||||
//
|
|
||||||
// import androidx.annotation.NonNull;
|
|
||||||
// import androidx.annotation.Nullable;
|
|
||||||
// import androidx.appcompat.app.AlertDialog;
|
|
||||||
// import androidx.core.app.ActivityCompat;
|
|
||||||
// import androidx.core.content.ContextCompat;
|
|
||||||
// import androidx.core.view.GestureDetectorCompat;
|
|
||||||
// import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
// import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
//
|
|
||||||
// import com.facebook.drawee.backends.pipeline.Fresco;
|
|
||||||
// import com.facebook.drawee.controller.BaseControllerListener;
|
|
||||||
// import com.facebook.imagepipeline.image.ImageInfo;
|
|
||||||
// import com.facebook.imagepipeline.request.ImageRequest;
|
|
||||||
// import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|
||||||
// import com.google.android.exoplayer2.SimpleExoPlayer;
|
|
||||||
// import com.google.android.exoplayer2.source.MediaSource;
|
|
||||||
// import com.google.android.exoplayer2.source.MediaSourceEventListener;
|
|
||||||
// import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
|
||||||
// import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
|
||||||
//
|
|
||||||
// import java.io.IOException;
|
|
||||||
// import java.net.HttpURLConnection;
|
|
||||||
// import java.net.URL;
|
|
||||||
// import java.util.ArrayList;
|
|
||||||
// import java.util.Collections;
|
|
||||||
// import java.util.List;
|
|
||||||
//
|
|
||||||
// import awais.instagrabber.R;
|
|
||||||
// import awais.instagrabber.adapters.PostsMediaAdapter;
|
|
||||||
// import awais.instagrabber.asyncs.PostFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.ProfileFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.i.iPostFetcher;
|
|
||||||
// import awais.instagrabber.customviews.CommentMentionClickSpan;
|
|
||||||
// import awais.instagrabber.customviews.helpers.SwipeGestureListener;
|
|
||||||
// import awais.instagrabber.databinding.ItemFullPostViewBkBinding;
|
|
||||||
// import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
// import awais.instagrabber.interfaces.SwipeEvent;
|
|
||||||
// import awais.instagrabber.models.BasePostModel;
|
|
||||||
// import awais.instagrabber.models.PostModel;
|
|
||||||
// import awais.instagrabber.models.ProfileModel;
|
|
||||||
// import awais.instagrabber.models.ViewerPostModel;
|
|
||||||
// import awais.instagrabber.models.enums.DownloadMethod;
|
|
||||||
// import awais.instagrabber.models.enums.MediaItemType;
|
|
||||||
// import awais.instagrabber.models.enums.PostItemType;
|
|
||||||
// import awais.instagrabber.utils.Constants;
|
|
||||||
// import awais.instagrabber.utils.Utils;
|
|
||||||
//
|
|
||||||
// import static awais.instagrabber.utils.Utils.settingsHelper;
|
|
||||||
//
|
|
||||||
// @Deprecated
|
|
||||||
// public final class PostViewer extends BaseLanguageActivity {
|
|
||||||
// private ItemFullPostViewBkBinding viewerBinding;
|
|
||||||
// private String url, prevUsername;
|
|
||||||
// private ProfileModel profileModel;
|
|
||||||
// private BasePostModel postModel;
|
|
||||||
// private ViewerPostModel viewerPostModel;
|
|
||||||
// private SimpleExoPlayer player;
|
|
||||||
// private ArrayAdapter<String> profileDialogAdapter;
|
|
||||||
// private View viewsContainer, viewerCaptionParent;
|
|
||||||
// private GestureDetectorCompat gestureDetector;
|
|
||||||
// private SwipeEvent swipeEvent;
|
|
||||||
// private CharSequence postCaption = null, postUserId;
|
|
||||||
// private Resources resources;
|
|
||||||
// private boolean session = false, isFromShare, liked, saved, ok = false;
|
|
||||||
// private int slidePos = 0, lastSlidePos = 0;
|
|
||||||
// private PostItemType postItemType;
|
|
||||||
// @SuppressLint("ClickableViewAccessibility")
|
|
||||||
// final View.OnTouchListener gestureTouchListener = new View.OnTouchListener() {
|
|
||||||
// private float startX;
|
|
||||||
// private float startY;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onTouch(final View v, final MotionEvent event) {
|
|
||||||
// if (v == viewerCaptionParent) {
|
|
||||||
// switch (event.getAction()) {
|
|
||||||
// case MotionEvent.ACTION_DOWN:
|
|
||||||
// startX = event.getX();
|
|
||||||
// startY = event.getY();
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case MotionEvent.ACTION_UP:
|
|
||||||
// if (!(Utils.isEmpty(postCaption) ||
|
|
||||||
// Math.abs(startX - event.getX()) > 50 || Math.abs(startY - event.getY()) > 50)) {
|
|
||||||
// Utils.copyText(PostViewer.this, postCaption);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return gestureDetector.onTouchEvent(event);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// private final DialogInterface.OnClickListener profileDialogListener = (dialog, which) -> {
|
|
||||||
// final String username = viewerPostModel.getProfileModel().getUsername();
|
|
||||||
//
|
|
||||||
// if (which == 0) {
|
|
||||||
// searchUsername(username);
|
|
||||||
// } else if (profileModel != null && which == 1) {
|
|
||||||
// startActivity(new Intent(this, ProfilePicViewer.class)
|
|
||||||
// .putExtra(Constants.EXTRAS_PROFILE, profileModel));
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// private final View.OnClickListener onClickListener = new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(final View v) {
|
|
||||||
// if (v == viewerBinding.topPanel.ivProfilePic) {
|
|
||||||
// new AlertDialog.Builder(PostViewer.this).setAdapter(profileDialogAdapter, profileDialogListener)
|
|
||||||
// .setNeutralButton(R.string.cancel, null)
|
|
||||||
// .setTitle(viewerPostModel.getProfileModel().getUsername()).show();
|
|
||||||
//
|
|
||||||
// } else if (v == viewerBinding.ivToggleFullScreen) {
|
|
||||||
// toggleFullscreen();
|
|
||||||
//
|
|
||||||
// final LinearLayout topPanelRoot = viewerBinding.topPanel.getRoot();
|
|
||||||
// final int iconRes;
|
|
||||||
//
|
|
||||||
// if (containerLayoutParams.weight != 3.3f) {
|
|
||||||
// containerLayoutParams.weight = 3.3f;
|
|
||||||
// iconRes = R.drawable.ic_fullscreen_exit;
|
|
||||||
// topPanelRoot.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.btnDownload.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setVisibility(View.GONE);
|
|
||||||
// } else {
|
|
||||||
// containerLayoutParams.weight = (viewerBinding.mediaList.getVisibility() == View.VISIBLE) ? 1.35f : 1.9f;
|
|
||||||
// containerLayoutParams.weight += (Utils.isEmpty(settingsHelper.getString(Constants.COOKIE))) ? 0.3f : 0;
|
|
||||||
// iconRes = R.drawable.ic_fullscreen;
|
|
||||||
// topPanelRoot.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.btnDownload.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// viewerBinding.ivToggleFullScreen.setImageResource(iconRes);
|
|
||||||
// viewerBinding.container.setLayoutParams(containerLayoutParams);
|
|
||||||
//
|
|
||||||
// } else if (v == viewerBinding.bottomPanel.btnMute) {
|
|
||||||
// if (player != null) {
|
|
||||||
// final float intVol = player.getVolume() == 0f ? 1f : 0f;
|
|
||||||
// player.setVolume(intVol);
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setImageResource(intVol == 0f ? R.drawable.ic_volume_off_24 : R.drawable.ic_volume_up_24);
|
|
||||||
// Utils.sessionVolumeFull = intVol == 1f;
|
|
||||||
// }
|
|
||||||
// } else if (v == viewerBinding.btnLike) {
|
|
||||||
// new PostAction().execute("likes");
|
|
||||||
// } else if (v == viewerBinding.btnBookmark) {
|
|
||||||
// new PostAction().execute("save");
|
|
||||||
// } else {
|
|
||||||
// final Object tag = v.getTag();
|
|
||||||
// if (tag instanceof ViewerPostModel) {
|
|
||||||
// viewerPostModel = (ViewerPostModel) tag;
|
|
||||||
// slidePos = Math.max(0, viewerPostModel.getPosition());
|
|
||||||
// refreshPost();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// private final View.OnClickListener downloadClickListener = v -> {
|
|
||||||
// if (ContextCompat.checkSelfPermission(this, Utils.PERMS[0]) == PackageManager.PERMISSION_GRANTED)
|
|
||||||
// showDownloadDialog();
|
|
||||||
// else
|
|
||||||
// ActivityCompat.requestPermissions(this, Utils.PERMS, 8020);
|
|
||||||
// };
|
|
||||||
// private final PostsMediaAdapter mediaAdapter = new PostsMediaAdapter(null, onClickListener);
|
|
||||||
// private LinearLayout.LayoutParams containerLayoutParams;
|
|
||||||
// private final FetchListener<ViewerPostModel[]> pfl = result -> {
|
|
||||||
// if (result == null || result.length < 1) {
|
|
||||||
// Toast.makeText(this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// viewerPostModel = result[0];
|
|
||||||
//
|
|
||||||
// mediaAdapter.setData(result);
|
|
||||||
// if (result.length > 1) {
|
|
||||||
// viewerBinding.mediaList.setLayoutParams(new LinearLayout.LayoutParams(
|
|
||||||
// LinearLayout.LayoutParams.MATCH_PARENT, 0, 0.55f
|
|
||||||
// ));
|
|
||||||
// containerLayoutParams.weight = 1.35f;
|
|
||||||
// containerLayoutParams.weight += (Utils.isEmpty(settingsHelper.getString(Constants.COOKIE))) ? 0.3f : 0;
|
|
||||||
// viewerBinding.container.setLayoutParams(containerLayoutParams);
|
|
||||||
// viewerBinding.mediaList.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// viewerCaptionParent.setOnTouchListener(gestureTouchListener);
|
|
||||||
// viewerBinding.playerView.setOnTouchListener(gestureTouchListener);
|
|
||||||
// // viewerBinding.imageViewer.setOnSingleFlingListener((e1, e2, velocityX, velocityY) -> {
|
|
||||||
// // final float diffX = e2.getX() - e1.getX();
|
|
||||||
// // if (Math.abs(diffX) > Math.abs(e2.getY() - e1.getY()) && Math.abs(diffX) > SwipeGestureListener.SWIPE_THRESHOLD
|
|
||||||
// // && Math.abs(velocityX) > SwipeGestureListener.SWIPE_VELOCITY_THRESHOLD) {
|
|
||||||
// // swipeEvent.onSwipe(diffX > 0);
|
|
||||||
// // return true;
|
|
||||||
// // }
|
|
||||||
// // return false;
|
|
||||||
// // });
|
|
||||||
//
|
|
||||||
// final long commentsCount = viewerPostModel.getCommentsCount();
|
|
||||||
// viewerBinding.bottomPanel.commentsCount.setText(String.valueOf(commentsCount));
|
|
||||||
// viewerBinding.bottomPanel.btnComments.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// viewerBinding.bottomPanel.btnComments.setOnClickListener(v -> startActivityForResult(
|
|
||||||
// new Intent(this, CommentsViewerFragment.class)
|
|
||||||
// .putExtra(Constants.EXTRAS_SHORTCODE, postModel.getShortCode())
|
|
||||||
// .putExtra(Constants.EXTRAS_POST, viewerPostModel.getPostId())
|
|
||||||
// .putExtra(Constants.EXTRAS_USER, postUserId),
|
|
||||||
// 6969));
|
|
||||||
// viewerBinding.bottomPanel.btnComments.setClickable(true);
|
|
||||||
// viewerBinding.bottomPanel.btnComments.setEnabled(true);
|
|
||||||
//
|
|
||||||
// if (postModel instanceof PostModel) {
|
|
||||||
// final PostModel postModel = (PostModel) this.postModel;
|
|
||||||
// postModel.setPostId(viewerPostModel.getPostId());
|
|
||||||
// postModel.setTimestamp(viewerPostModel.getTimestamp());
|
|
||||||
// postModel.setPostCaption(viewerPostModel.getPostCaption());
|
|
||||||
// if (!ok) {
|
|
||||||
// liked = viewerPostModel.getLike();
|
|
||||||
// saved = viewerPostModel.getBookmark();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// setupPostInfoBar("@" + viewerPostModel.getProfileModel().getUsername(), viewerPostModel.getItemType(),
|
|
||||||
// viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
|
||||||
//
|
|
||||||
// postCaption = postModel.getPostCaption();
|
|
||||||
// viewerCaptionParent.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// viewerBinding.bottomPanel.btnDownload.setOnClickListener(downloadClickListener);
|
|
||||||
//
|
|
||||||
// refreshPost();
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
// viewerBinding = ItemFullPostViewBkBinding.inflate(getLayoutInflater());
|
|
||||||
// setContentView(viewerBinding.getRoot());
|
|
||||||
//
|
|
||||||
// final Intent intent = getIntent();
|
|
||||||
// if (intent == null || !intent.hasExtra(Constants.EXTRAS_POST)
|
|
||||||
// || (postModel = (PostModel) intent.getSerializableExtra(Constants.EXTRAS_POST)) == null) {
|
|
||||||
// Utils.errorFinish(this);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// containerLayoutParams = (LinearLayout.LayoutParams) viewerBinding.container.getLayoutParams();
|
|
||||||
//
|
|
||||||
// if (intent.hasExtra(Constants.EXTRAS_TYPE))
|
|
||||||
// postItemType = (PostItemType) intent.getSerializableExtra(Constants.EXTRAS_TYPE);
|
|
||||||
//
|
|
||||||
// resources = getResources();
|
|
||||||
//
|
|
||||||
// viewerBinding.topPanel.title.setMovementMethod(new LinkMovementMethod());
|
|
||||||
// viewerBinding.topPanel.title.setMentionClickListener((view, text, isHashtag, isLocation) -> searchUsername(text));
|
|
||||||
// viewerBinding.topPanel.ivProfilePic.setOnClickListener(onClickListener);
|
|
||||||
//
|
|
||||||
// viewerBinding.ivToggleFullScreen.setOnClickListener(onClickListener);
|
|
||||||
// if (Utils.isEmpty(settingsHelper.getString(Constants.COOKIE))) {
|
|
||||||
// viewerBinding.btnLike.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.btnBookmark.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.postActions.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.postActions.setLayoutParams(new LinearLayout.LayoutParams(
|
|
||||||
// LinearLayout.LayoutParams.MATCH_PARENT, 0, 0
|
|
||||||
// ));
|
|
||||||
// containerLayoutParams.weight = (containerLayoutParams.weight == 3.3f) ? 3.3f : 2.2f;
|
|
||||||
// viewerBinding.container.setLayoutParams(containerLayoutParams);
|
|
||||||
// } else {
|
|
||||||
// viewerBinding.btnLike.setOnClickListener(onClickListener);
|
|
||||||
// viewerBinding.btnBookmark.setOnClickListener(onClickListener);
|
|
||||||
// }
|
|
||||||
// viewerBinding.btnDownload.setOnClickListener(downloadClickListener);
|
|
||||||
//
|
|
||||||
// profileDialogAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
|
|
||||||
// new String[]{resources.getString(R.string.open_profile), resources.getString(R.string.view_pfp)});
|
|
||||||
//
|
|
||||||
// postModel.setPosition(intent.getIntExtra(Constants.EXTRAS_INDEX, -1));
|
|
||||||
//
|
|
||||||
// final boolean postIdNull = postModel.getPostId() == null;
|
|
||||||
// if (!postIdNull)
|
|
||||||
// setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null, null);
|
|
||||||
//
|
|
||||||
// isFromShare = postModel.getPosition() == -1 || postIdNull;
|
|
||||||
//
|
|
||||||
// viewerCaptionParent = (View) viewerBinding.bottomPanel.viewerCaption.getParent();
|
|
||||||
// viewsContainer = (View) viewerBinding.bottomPanel.videoViewsContainer;
|
|
||||||
//
|
|
||||||
// viewerBinding.mediaList.setLayoutManager(new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false));
|
|
||||||
// viewerBinding.mediaList.setAdapter(mediaAdapter);
|
|
||||||
// viewerBinding.mediaList.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// swipeEvent = isRight -> {
|
|
||||||
// final List<? extends BasePostModel> itemGetterItems;
|
|
||||||
// final boolean isSwipeable;
|
|
||||||
//
|
|
||||||
// // if (postItemType == PostItemType.SAVED && SavedViewerFragment.itemGetter != null) {
|
|
||||||
// // itemGetterItems = SavedViewerFragment.itemGetter.get(postItemType);
|
|
||||||
// // isSwipeable = !(itemGetterItems.size() < 1 || postItemType == PostItemType.SAVED && isFromShare);
|
|
||||||
// // } else
|
|
||||||
// if (postItemType != null && MainActivityBackup.itemGetter != null) {
|
|
||||||
// itemGetterItems = MainActivityBackup.itemGetter.get(postItemType);
|
|
||||||
// isSwipeable = !(itemGetterItems.size() < 1 || postItemType == PostItemType.MAIN && isFromShare);
|
|
||||||
// } else {
|
|
||||||
// itemGetterItems = null;
|
|
||||||
// isSwipeable = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final BasePostModel[] basePostModels = mediaAdapter.getPostModels();
|
|
||||||
// final int slides = basePostModels.length;
|
|
||||||
//
|
|
||||||
// int position = postModel.getPosition();
|
|
||||||
//
|
|
||||||
// if (isRight) {
|
|
||||||
// --slidePos;
|
|
||||||
// if (!isSwipeable && slidePos < 0) slidePos = 0;
|
|
||||||
// if (slides > 0 && slidePos >= 0) {
|
|
||||||
// if (basePostModels[slidePos] instanceof ViewerPostModel) {
|
|
||||||
// viewerPostModel = (ViewerPostModel) basePostModels[slidePos];
|
|
||||||
// }
|
|
||||||
// refreshPost();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (isSwipeable && --position < 0) position = itemGetterItems.size() - 1;
|
|
||||||
// } else {
|
|
||||||
// ++slidePos;
|
|
||||||
// if (!isSwipeable && slidePos >= slides) slidePos = slides - 1;
|
|
||||||
// if (slides > 0 && slidePos < slides) {
|
|
||||||
// if (basePostModels[slidePos] instanceof ViewerPostModel) {
|
|
||||||
// viewerPostModel = (ViewerPostModel) basePostModels[slidePos];
|
|
||||||
// }
|
|
||||||
// refreshPost();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (isSwipeable && ++position >= itemGetterItems.size()) position = 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (isSwipeable) {
|
|
||||||
// slidePos = 0;
|
|
||||||
// ok = false;
|
|
||||||
// Log.d("AWAISKING_APP", "swipe left <<< post[" + position + "]: " + postModel + " -- " + slides);
|
|
||||||
// postModel = itemGetterItems.get(position);
|
|
||||||
// postModel.setPosition(position);
|
|
||||||
// viewPost();
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// gestureDetector = new GestureDetectorCompat(this, new SwipeGestureListener(swipeEvent));
|
|
||||||
//
|
|
||||||
// viewPost();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void viewPost() {
|
|
||||||
// lastSlidePos = 0;
|
|
||||||
// mediaAdapter.setData(null);
|
|
||||||
// viewsContainer.setVisibility(View.GONE);
|
|
||||||
// viewerCaptionParent.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.mediaList.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.btnDownload.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.btnComments.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.btnDownload.setVisibility(View.INVISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setText(null);
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
|
||||||
//
|
|
||||||
// viewerBinding.playerView.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.playerView.setPlayer(null);
|
|
||||||
// viewerBinding.imageViewer.setController(null);
|
|
||||||
//
|
|
||||||
// if (postModel.getShortCode() != null)
|
|
||||||
// new PostFetcher(postModel.getShortCode(), pfl).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// else if (postModel.getPostId() != null)
|
|
||||||
// new iPostFetcher(postModel.getPostId(), pfl).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void searchUsername(final String text) {
|
|
||||||
// // startActivity(
|
|
||||||
// // new Intent(getApplicationContext(), ProfileViewer.class)
|
|
||||||
// // .putExtra(Constants.EXTRAS_USERNAME, text)
|
|
||||||
// // );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setupVideo() {
|
|
||||||
// viewerBinding.playerView.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.btnDownload.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.imageViewer.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.imageViewer.setController(null);
|
|
||||||
//
|
|
||||||
// if (viewerPostModel.getVideoViews() > -1) {
|
|
||||||
// viewsContainer.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.tvVideoViews.setText(String.valueOf(viewerPostModel.getVideoViews()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// player = new SimpleExoPlayer.Builder(this).build();
|
|
||||||
// viewerBinding.playerView.setPlayer(player);
|
|
||||||
// float vol = Utils.settingsHelper.getBoolean(Constants.MUTED_VIDEOS) ? 0f : 1f;
|
|
||||||
// if (vol == 0f && Utils.sessionVolumeFull) vol = 1f;
|
|
||||||
//
|
|
||||||
// player.setVolume(vol);
|
|
||||||
// player.setPlayWhenReady(Utils.settingsHelper.getBoolean(Constants.AUTOPLAY_VIDEOS));
|
|
||||||
// final ProgressiveMediaSource mediaSource = new ProgressiveMediaSource.Factory(new DefaultDataSourceFactory(this, "instagram"))
|
|
||||||
// .createMediaSource(Uri.parse(url));
|
|
||||||
// mediaSource.addEventListener(new Handler(), new MediaSourceEventListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onLoadCompleted(final int windowIndex,
|
|
||||||
// @Nullable final MediaSource.MediaPeriodId mediaPeriodId,
|
|
||||||
// final LoadEventInfo loadEventInfo,
|
|
||||||
// final MediaLoadData mediaLoadData) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onLoadStarted(final int windowIndex,
|
|
||||||
// @Nullable final MediaSource.MediaPeriodId mediaPeriodId,
|
|
||||||
// final LoadEventInfo loadEventInfo,
|
|
||||||
// final MediaLoadData mediaLoadData) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onLoadCanceled(final int windowIndex,
|
|
||||||
// @Nullable final MediaSource.MediaPeriodId mediaPeriodId,
|
|
||||||
// final LoadEventInfo loadEventInfo,
|
|
||||||
// final MediaLoadData mediaLoadData) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onLoadError(final int windowIndex,
|
|
||||||
// @Nullable final MediaSource.MediaPeriodId mediaPeriodId,
|
|
||||||
// final LoadEventInfo loadEventInfo,
|
|
||||||
// final MediaLoadData mediaLoadData,
|
|
||||||
// final IOException error,
|
|
||||||
// final boolean wasCanceled) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// player.prepare(mediaSource);
|
|
||||||
//
|
|
||||||
// player.setVolume(vol);
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setImageResource(vol == 0f ? R.drawable.ic_volume_up_24 : R.drawable.ic_volume_off_24);
|
|
||||||
//
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setOnClickListener(onClickListener);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setupImage() {
|
|
||||||
// viewsContainer.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.playerView.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.progressView.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.bottomPanel.btnMute.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.btnDownload.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.imageViewer.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// final ImageRequest requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
|
|
||||||
// .setLocalThumbnailPreviewsEnabled(true)
|
|
||||||
// .setProgressiveRenderingEnabled(true)
|
|
||||||
// .build();
|
|
||||||
// viewerBinding.imageViewer.setController(
|
|
||||||
// Fresco.newDraweeControllerBuilder()
|
|
||||||
// .setImageRequest(requestBuilder)
|
|
||||||
// .setOldController(viewerBinding.imageViewer.getController())
|
|
||||||
// .setLowResImageRequest(ImageRequest.fromUri(url))
|
|
||||||
// .setControllerListener(new BaseControllerListener<ImageInfo>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(final String id, final Throwable throwable) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFinalImageSet(final String id, final ImageInfo imageInfo, final Animatable animatable) {
|
|
||||||
// viewerBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .build()
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void showDownloadDialog() {
|
|
||||||
// final ArrayList<BasePostModel> postModels = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// if (!session && viewerBinding.mediaList.getVisibility() == View.VISIBLE) {
|
|
||||||
// final DialogInterface.OnClickListener clickListener = (dialog, which) -> {
|
|
||||||
// postModels.clear();
|
|
||||||
//
|
|
||||||
// if (which == DialogInterface.BUTTON_NEGATIVE) {
|
|
||||||
// final BasePostModel[] adapterPostModels = mediaAdapter.getPostModels();
|
|
||||||
// for (int i = 0, size = mediaAdapter.getItemCount(); i < size; ++i) {
|
|
||||||
// if (adapterPostModels[i] instanceof ViewerPostModel)
|
|
||||||
// postModels.add(adapterPostModels[i]);
|
|
||||||
// }
|
|
||||||
// } else if (which == DialogInterface.BUTTON_POSITIVE) {
|
|
||||||
// postModels.add(viewerPostModel);
|
|
||||||
// } else {
|
|
||||||
// session = true;
|
|
||||||
// postModels.add(viewerPostModel);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (postModels.size() > 0)
|
|
||||||
// Utils.batchDownload(this, viewerPostModel.getProfileModel().getUsername(), DownloadMethod.DOWNLOAD_POST_VIEWER, postModels);
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// new AlertDialog.Builder(this).setTitle(R.string.post_viewer_download_dialog_title)
|
|
||||||
// .setMessage(R.string.post_viewer_download_message)
|
|
||||||
// .setNeutralButton(R.string.post_viewer_download_session, clickListener)
|
|
||||||
// .setPositiveButton(R.string.post_viewer_download_current, clickListener)
|
|
||||||
// .setNegativeButton(R.string.post_viewer_download_album, clickListener).show();
|
|
||||||
// } else {
|
|
||||||
// Utils.batchDownload(this, viewerPostModel.getProfileModel().getUsername(), DownloadMethod.DOWNLOAD_POST_VIEWER,
|
|
||||||
// Collections.singletonList(viewerPostModel));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) {
|
|
||||||
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
// if (requestCode == 8020 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
|
||||||
// showDownloadDialog();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onActivityResult(final int requestCode, final int resultCode, @Nullable final Intent data) {
|
|
||||||
// super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
// if (resultCode == 6969) {
|
|
||||||
// setResult(RESULT_OK);
|
|
||||||
// finish();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onPause() {
|
|
||||||
// super.onPause();
|
|
||||||
// if (Build.VERSION.SDK_INT < 24) releasePlayer();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onStop() {
|
|
||||||
// super.onStop();
|
|
||||||
// if (Build.VERSION.SDK_INT >= 24) releasePlayer();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onResume() {
|
|
||||||
// super.onResume();
|
|
||||||
// if (player == null && viewerPostModel != null && viewerPostModel.getItemType() == MediaItemType.MEDIA_TYPE_VIDEO)
|
|
||||||
// setupVideo();
|
|
||||||
// else if (player != null) {
|
|
||||||
// player.setPlayWhenReady(true);
|
|
||||||
// player.getPlaybackState();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void refreshPost() {
|
|
||||||
// if (containerLayoutParams.weight != 3.3f) {
|
|
||||||
// containerLayoutParams.weight = (viewerBinding.mediaList.getVisibility() == View.VISIBLE) ? 1.35f : 1.9f;
|
|
||||||
// viewerBinding.container.setLayoutParams(containerLayoutParams);
|
|
||||||
// }
|
|
||||||
// if (viewerBinding.mediaList.getVisibility() == View.VISIBLE) {
|
|
||||||
// ViewerPostModel item = mediaAdapter.getItemAt(lastSlidePos);
|
|
||||||
// if (item != null) {
|
|
||||||
// item.setCurrentSlide(false);
|
|
||||||
// mediaAdapter.notifyItemChanged(lastSlidePos, item);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// item = mediaAdapter.getItemAt(slidePos);
|
|
||||||
// if (item != null) {
|
|
||||||
// item.setCurrentSlide(true);
|
|
||||||
// mediaAdapter.notifyItemChanged(slidePos, item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// lastSlidePos = slidePos;
|
|
||||||
//
|
|
||||||
// postCaption = viewerPostModel.getPostCaption();
|
|
||||||
//
|
|
||||||
// if (Utils.hasMentions(postCaption)) {
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setText(Utils.getMentionText(postCaption), TextView.BufferType.SPANNABLE);
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setMentionClickListener((view, text, isHashtag, isLocation) -> searchUsername(text));
|
|
||||||
// } else {
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
|
||||||
// viewerBinding.bottomPanel.viewerCaption.setText(postCaption);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// setupPostInfoBar("@" + viewerPostModel.getProfileModel().getUsername(), viewerPostModel.getItemType(),
|
|
||||||
// viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
|
||||||
//
|
|
||||||
// if (postModel instanceof PostModel) {
|
|
||||||
// final PostModel postModel = (PostModel) this.postModel;
|
|
||||||
// postModel.setPostId(viewerPostModel.getPostId());
|
|
||||||
// postModel.setTimestamp(viewerPostModel.getTimestamp());
|
|
||||||
// postModel.setPostCaption(viewerPostModel.getPostCaption());
|
|
||||||
// if (liked == true) {
|
|
||||||
// viewerBinding.btnLike.setText(resources.getString(R.string.unlike, viewerPostModel.getLikes()
|
|
||||||
// + ((ok && viewerPostModel.getLike() != liked) ? (liked ? 1L : -1L) : 0L)));
|
|
||||||
// viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// getApplicationContext(), R.color.btn_pink_background)));
|
|
||||||
// } else {
|
|
||||||
// viewerBinding.btnLike.setText(resources.getString(R.string.like, viewerPostModel.getLikes()
|
|
||||||
// + ((ok && viewerPostModel.getLike() != liked) ? (liked ? 1L : -1L) : 0L)));
|
|
||||||
// viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// getApplicationContext(), R.color.btn_lightpink_background)));
|
|
||||||
// }
|
|
||||||
// if (saved == true) {
|
|
||||||
// viewerBinding.btnBookmark.setText(R.string.unbookmark);
|
|
||||||
// viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// getApplicationContext(), R.color.btn_orange_background)));
|
|
||||||
// } else {
|
|
||||||
// viewerBinding.btnBookmark.setText(R.string.bookmark);
|
|
||||||
// viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// getApplicationContext(), R.color.btn_lightorange_background)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setText(viewerPostModel.getPostDate());
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setVisibility(containerLayoutParams.weight != 3.3f ? View.VISIBLE : View.GONE);
|
|
||||||
// viewerBinding.bottomPanel.tvPostDate.setSelected(true);
|
|
||||||
//
|
|
||||||
// url = viewerPostModel.getDisplayUrl();
|
|
||||||
// releasePlayer();
|
|
||||||
//
|
|
||||||
// viewerBinding.btnDownload.setVisibility(containerLayoutParams.weight == 3.3f ? View.VISIBLE : View.GONE);
|
|
||||||
// if (viewerPostModel.getItemType() == MediaItemType.MEDIA_TYPE_VIDEO) setupVideo();
|
|
||||||
// else setupImage();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void releasePlayer() {
|
|
||||||
// if (player != null) {
|
|
||||||
// player.release();
|
|
||||||
// player = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final String locationName, final String location) {
|
|
||||||
// if (prevUsername == null || !prevUsername.equals(from)) {
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setImageBitmap(null);
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setImageDrawable(null);
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setImageResource(0);
|
|
||||||
// viewerBinding.topPanel.ivProfilePic.setImageRequest(null);
|
|
||||||
//
|
|
||||||
// if (!Utils.isEmpty(from) && from.charAt(0) == '@')
|
|
||||||
// new ProfileFetcher(from.substring(1), result -> {
|
|
||||||
// profileModel = result;
|
|
||||||
//
|
|
||||||
// if (result != null) {
|
|
||||||
// // final String hdProfilePic = result.getHdProfilePic();
|
|
||||||
// // final String sdProfilePic = result.getSdProfilePic();
|
|
||||||
// postUserId = result.getId();
|
|
||||||
//
|
|
||||||
// // final boolean hdPicEmpty = Utils.isEmpty(hdProfilePic);
|
|
||||||
// // glideRequestManager.load(hdPicEmpty ? sdProfilePic : hdProfilePic).listener(new RequestListener<Drawable>() {
|
|
||||||
// // private boolean loaded = true;
|
|
||||||
// //
|
|
||||||
// // @Override
|
|
||||||
// // public boolean onLoadFailed(@Nullable final GlideException e, final Object model, final Target<Drawable> target, final boolean isFirstResource) {
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setEnabled(false);
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setOnClickListener(null);
|
|
||||||
// // if (loaded) {
|
|
||||||
// // loaded = false;
|
|
||||||
// // if (!Utils.isEmpty(sdProfilePic)) glideRequestManager.load(sdProfilePic).listener(this)
|
|
||||||
// // .into(viewerBinding.topPanel.ivProfilePic);
|
|
||||||
// // }
|
|
||||||
// // return false;
|
|
||||||
// // }
|
|
||||||
// //
|
|
||||||
// // @Override
|
|
||||||
// // public boolean onResourceReady(final Drawable resource, final Object model, final Target<Drawable> target, final DataSource dataSource, final boolean isFirstResource) {
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setEnabled(true);
|
|
||||||
// // viewerBinding.topPanel.ivProfilePic.setOnClickListener(onClickListener);
|
|
||||||
// // return false;
|
|
||||||
// // }
|
|
||||||
// // }).into(viewerBinding.topPanel.ivProfilePic);
|
|
||||||
// viewerBinding.topPanel.ivProfilePic.setImageURI(profileModel.getSdProfilePic());
|
|
||||||
//
|
|
||||||
// final View viewStoryPost = findViewById(R.id.viewStoryPost);
|
|
||||||
// if (viewStoryPost != null) {
|
|
||||||
// viewStoryPost.setOnClickListener(v -> {
|
|
||||||
// if (result.isPrivate())
|
|
||||||
// Toast.makeText(getApplicationContext(), R.string.share_private_post, Toast.LENGTH_LONG).show();
|
|
||||||
// Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
|
||||||
// sharingIntent.setType("text/plain");
|
|
||||||
// sharingIntent.putExtra(Intent.EXTRA_TEXT, "https://instagram.com/p/" + postModel.getShortCode());
|
|
||||||
// startActivity(Intent.createChooser(sharingIntent,
|
|
||||||
// (result.isPrivate())
|
|
||||||
// ? getString(R.string.share_private_post)
|
|
||||||
// : getString(R.string.share_public_post)));
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// prevUsername = from;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final String titlePrefix = resources.getString(mediaItemType == MediaItemType.MEDIA_TYPE_VIDEO ?
|
|
||||||
// R.string.post_viewer_video_post : R.string.post_viewer_image_post);
|
|
||||||
// if (Utils.isEmpty(from)) viewerBinding.topPanel.title.setText(titlePrefix);
|
|
||||||
// else {
|
|
||||||
// final int titleLen = from.length();
|
|
||||||
// final SpannableString spannableString = new SpannableString(from);
|
|
||||||
// spannableString.setSpan(new CommentMentionClickSpan(), 0, titleLen, 0);
|
|
||||||
// viewerBinding.topPanel.title.setText(spannableString);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (location == null) {
|
|
||||||
// viewerBinding.topPanel.location.setVisibility(View.GONE);
|
|
||||||
// viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
|
||||||
// RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT
|
|
||||||
// ));
|
|
||||||
// } else {
|
|
||||||
// viewerBinding.topPanel.location.setVisibility(View.VISIBLE);
|
|
||||||
// viewerBinding.topPanel.location.setText(locationName);
|
|
||||||
// viewerBinding.topPanel.location.setOnClickListener(v -> searchUsername(location));
|
|
||||||
// viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
|
||||||
// RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void toggleFullscreen() {
|
|
||||||
// final View decorView = getWindow().getDecorView();
|
|
||||||
// int newUiOptions = decorView.getSystemUiVisibility();
|
|
||||||
// newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
|
||||||
// newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
|
|
||||||
// newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
|
||||||
// decorView.setSystemUiVisibility(newUiOptions);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class PostAction extends AsyncTask<String, Void, Void> {
|
|
||||||
// String action;
|
|
||||||
//
|
|
||||||
// protected Void doInBackground(String... rawAction) {
|
|
||||||
// action = rawAction[0];
|
|
||||||
// final String url = "https://www.instagram.com/web/" + action + "/" + postModel.getPostId() + "/" + (action == "save" ?
|
|
||||||
// (saved ? "unsave/" : "save/") :
|
|
||||||
// (liked ? "unlike/" : "like/"));
|
|
||||||
// try {
|
|
||||||
// final HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
|
|
||||||
// urlConnection.setRequestMethod("POST");
|
|
||||||
// urlConnection.setUseCaches(false);
|
|
||||||
// urlConnection.setRequestProperty("User-Agent", Constants.USER_AGENT);
|
|
||||||
// urlConnection.setRequestProperty("x-csrftoken",
|
|
||||||
// settingsHelper.getString(Constants.COOKIE).split("csrftoken=")[1].split(";")[0]);
|
|
||||||
// urlConnection.connect();
|
|
||||||
// if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
|
||||||
// ok = true;
|
|
||||||
// }
|
|
||||||
// urlConnection.disconnect();
|
|
||||||
// } catch (Throwable ex) {
|
|
||||||
// Log.e("austin_debug", action + ": " + ex);
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onPostExecute(Void result) {
|
|
||||||
// if (ok == true && action == "likes") {
|
|
||||||
// liked = !liked;
|
|
||||||
// refreshPost();
|
|
||||||
// } else if (ok == true && action == "save") {
|
|
||||||
// saved = !saved;
|
|
||||||
// refreshPost();
|
|
||||||
// } else
|
|
||||||
// Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,223 +0,0 @@
|
|||||||
// package awais.instagrabber.activities;
|
|
||||||
//
|
|
||||||
// import android.content.Intent;
|
|
||||||
// import android.graphics.Bitmap;
|
|
||||||
// import android.graphics.drawable.BitmapDrawable;
|
|
||||||
// import android.graphics.drawable.Drawable;
|
|
||||||
// import android.os.AsyncTask;
|
|
||||||
// import android.os.Bundle;
|
|
||||||
// import android.os.Environment;
|
|
||||||
// import android.view.Menu;
|
|
||||||
// import android.view.MenuItem;
|
|
||||||
// import android.view.View;
|
|
||||||
// import android.widget.Toast;
|
|
||||||
//
|
|
||||||
// import androidx.annotation.Nullable;
|
|
||||||
// import androidx.fragment.app.FragmentManager;
|
|
||||||
//
|
|
||||||
// import com.bumptech.glide.Glide;
|
|
||||||
// import com.bumptech.glide.RequestManager;
|
|
||||||
// import com.bumptech.glide.load.DataSource;
|
|
||||||
// import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
// import com.bumptech.glide.request.RequestListener;
|
|
||||||
// import com.bumptech.glide.request.target.Target;
|
|
||||||
//
|
|
||||||
// import java.io.File;
|
|
||||||
//
|
|
||||||
// import awais.instagrabber.R;
|
|
||||||
// import awais.instagrabber.asyncs.DownloadAsync;
|
|
||||||
// import awais.instagrabber.asyncs.ProfilePictureFetcher;
|
|
||||||
// import awais.instagrabber.databinding.ActivityProfilepicBinding;
|
|
||||||
// import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
// import awais.instagrabber.models.HashtagModel;
|
|
||||||
// import awais.instagrabber.models.LocationModel;
|
|
||||||
// import awais.instagrabber.models.ProfileModel;
|
|
||||||
// import awais.instagrabber.utils.Constants;
|
|
||||||
// import awais.instagrabber.utils.Utils;
|
|
||||||
//
|
|
||||||
// public final class ProfilePicViewer extends BaseLanguageActivity {
|
|
||||||
// private ActivityProfilepicBinding profileBinding;
|
|
||||||
// private ProfileModel profileModel;
|
|
||||||
// private HashtagModel hashtagModel;
|
|
||||||
// private LocationModel locationModel;
|
|
||||||
// private MenuItem menuItemDownload;
|
|
||||||
// private String profilePicUrl;
|
|
||||||
// private FragmentManager fragmentManager;
|
|
||||||
// private FetchListener<String> fetchListener;
|
|
||||||
// private boolean errorHandled = false;
|
|
||||||
// private boolean fallbackToProfile = false;
|
|
||||||
// private boolean destroyed = false;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
// profileBinding = ActivityProfilepicBinding.inflate(getLayoutInflater());
|
|
||||||
// setContentView(profileBinding.getRoot());
|
|
||||||
//
|
|
||||||
// final Intent intent = getIntent();
|
|
||||||
// if (intent == null || (!intent.hasExtra(Constants.EXTRAS_PROFILE) && !intent.hasExtra(Constants.EXTRAS_HASHTAG) && !intent
|
|
||||||
// .hasExtra(Constants.EXTRAS_LOCATION))
|
|
||||||
// || ((profileModel = (ProfileModel) intent.getSerializableExtra(Constants.EXTRAS_PROFILE)) == null
|
|
||||||
// && (hashtagModel = (HashtagModel) intent.getSerializableExtra(Constants.EXTRAS_HASHTAG)) == null
|
|
||||||
// && (locationModel = (LocationModel) intent.getSerializableExtra(Constants.EXTRAS_LOCATION)) == null)) {
|
|
||||||
// Utils.errorFinish(this);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fragmentManager = getSupportFragmentManager();
|
|
||||||
//
|
|
||||||
// final String id = hashtagModel != null ? hashtagModel.getId() : (locationModel != null ? locationModel.getId() : profileModel.getId());
|
|
||||||
// final String username = hashtagModel != null
|
|
||||||
// ? hashtagModel.getName()
|
|
||||||
// : (locationModel != null ? locationModel.getName() : profileModel.getUsername());
|
|
||||||
//
|
|
||||||
// // profileBinding.toolbar.toolbar.setTitle(username);
|
|
||||||
//
|
|
||||||
// profileBinding.progressView.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.imageViewer.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// // profileBinding.imageViewer.setZoomable(true);
|
|
||||||
// // profileBinding.imageViewer.setZoomTransitionDuration(420);
|
|
||||||
// // profileBinding.imageViewer.setMaximumScale(7.2f);
|
|
||||||
//
|
|
||||||
// fetchListener = profileUrl -> {
|
|
||||||
// profilePicUrl = profileUrl;
|
|
||||||
//
|
|
||||||
// if (!fallbackToProfile && Utils.isEmpty(profilePicUrl)) {
|
|
||||||
// fallbackToProfile = true;
|
|
||||||
// new ProfilePictureFetcher(username, id, fetchListener, profilePicUrl, (hashtagModel != null || locationModel != null))
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (errorHandled && fallbackToProfile || Utils.isEmpty(profilePicUrl))
|
|
||||||
// profilePicUrl = hashtagModel != null
|
|
||||||
// ? hashtagModel.getSdProfilePic()
|
|
||||||
// : (locationModel != null ? locationModel.getSdProfilePic() : profileModel.getHdProfilePic());
|
|
||||||
//
|
|
||||||
// if (destroyed == true) return;
|
|
||||||
//
|
|
||||||
// final RequestManager glideRequestManager = Glide.with(this);
|
|
||||||
//
|
|
||||||
// glideRequestManager.load(profilePicUrl).addListener(new RequestListener<Drawable>() {
|
|
||||||
// @Override
|
|
||||||
// public boolean onLoadFailed(@Nullable final GlideException e,
|
|
||||||
// final Object model,
|
|
||||||
// final Target<Drawable> target,
|
|
||||||
// final boolean isFirstResource) {
|
|
||||||
// fallbackToProfile = true;
|
|
||||||
// if (!errorHandled) {
|
|
||||||
// errorHandled = true;
|
|
||||||
// new ProfilePictureFetcher(username, id, fetchListener, profilePicUrl, (hashtagModel != null || locationModel != null))
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// profileBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onResourceReady(final Drawable resource,
|
|
||||||
// final Object model,
|
|
||||||
// final Target<Drawable> target,
|
|
||||||
// final DataSource dataSource,
|
|
||||||
// final boolean isFirstResource) {
|
|
||||||
// if (menuItemDownload != null) menuItemDownload.setEnabled(true);
|
|
||||||
// showImageInfo();
|
|
||||||
// profileBinding.progressView.setVisibility(View.GONE);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void showImageInfo() {
|
|
||||||
// final Drawable drawable = profileBinding.imageViewer.getDrawable();
|
|
||||||
// if (drawable != null) {
|
|
||||||
// final StringBuilder info = new StringBuilder(
|
|
||||||
// getString(R.string.profile_viewer_imageinfo, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()));
|
|
||||||
// if (drawable instanceof BitmapDrawable) {
|
|
||||||
// final Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
|
|
||||||
// if (bitmap != null) {
|
|
||||||
// final String colorDepthPrefix = getString(R.string.profile_viewer_colordepth_prefix);
|
|
||||||
// switch (bitmap.getConfig()) {
|
|
||||||
// case ALPHA_8:
|
|
||||||
// info.append(colorDepthPrefix).append(" 8-bits(A)");
|
|
||||||
// break;
|
|
||||||
// case RGB_565:
|
|
||||||
// info.append(colorDepthPrefix).append(" 16-bits-A");
|
|
||||||
// break;
|
|
||||||
// case ARGB_4444:
|
|
||||||
// info.append(colorDepthPrefix).append(" 16-bits+A");
|
|
||||||
// break;
|
|
||||||
// case ARGB_8888:
|
|
||||||
// info.append(colorDepthPrefix).append(" 32-bits+A");
|
|
||||||
// break;
|
|
||||||
// case RGBA_F16:
|
|
||||||
// info.append(colorDepthPrefix).append(" 64-bits+A");
|
|
||||||
// break;
|
|
||||||
// case HARDWARE:
|
|
||||||
// info.append(colorDepthPrefix).append(" auto");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // profileBinding.imageInfo.setText(info);
|
|
||||||
// // profileBinding.imageInfo.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }).error(glideRequestManager.load(profilePicUrl)).into(profileBinding.imageViewer);
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// new ProfilePictureFetcher(username, id, fetchListener, profilePicUrl, (hashtagModel != null || locationModel != null))
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void downloadProfilePicture() {
|
|
||||||
// int error = 0;
|
|
||||||
//
|
|
||||||
// if (profileModel != null) {
|
|
||||||
// final File dir = new File(Environment.getExternalStorageDirectory(), "Download");
|
|
||||||
// if (dir.exists() || dir.mkdirs()) {
|
|
||||||
//
|
|
||||||
// final File saveFile = new File(dir, profileModel.getUsername() + '_' + System.currentTimeMillis()
|
|
||||||
// + Utils.getExtensionFromModel(profilePicUrl, profileModel));
|
|
||||||
//
|
|
||||||
// new DownloadAsync(this,
|
|
||||||
// profilePicUrl,
|
|
||||||
// saveFile,
|
|
||||||
// result -> {
|
|
||||||
// final int toastRes = result != null && result.exists() ?
|
|
||||||
// R.string.downloader_downloaded_in_folder : R.string.downloader_error_download_file;
|
|
||||||
// Toast.makeText(this, toastRes, Toast.LENGTH_SHORT).show();
|
|
||||||
// }).setItems(null, profileModel.getUsername()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// } else error = 1;
|
|
||||||
// } else error = 2;
|
|
||||||
//
|
|
||||||
// if (error == 1) Toast.makeText(this, R.string.downloader_error_creating_folder, Toast.LENGTH_SHORT).show();
|
|
||||||
// else if (error == 2) Toast.makeText(this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onDestroy() {
|
|
||||||
// super.onDestroy();
|
|
||||||
// getDelegate().onDestroy();
|
|
||||||
// destroyed = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onCreateOptionsMenu(final Menu menu) {
|
|
||||||
// getMenuInflater().inflate(R.menu.menu, menu);
|
|
||||||
//
|
|
||||||
// final MenuItem.OnMenuItemClickListener menuItemClickListener = item -> {
|
|
||||||
// if (item == menuItemDownload) {
|
|
||||||
// downloadProfilePicture();
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// menu.findItem(R.id.action_search).setVisible(false);
|
|
||||||
// menuItemDownload = menu.findItem(R.id.action_download);
|
|
||||||
// menuItemDownload.setVisible(true);
|
|
||||||
// menuItemDownload.setEnabled(false);
|
|
||||||
// menuItemDownload.setOnMenuItemClickListener(menuItemClickListener);
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,950 +0,0 @@
|
|||||||
// package awais.instagrabber.activities;
|
|
||||||
//
|
|
||||||
// import android.content.DialogInterface;
|
|
||||||
// import android.content.Intent;
|
|
||||||
// import android.content.pm.PackageManager;
|
|
||||||
// import android.content.res.ColorStateList;
|
|
||||||
// import android.content.res.Resources;
|
|
||||||
// import android.graphics.Bitmap;
|
|
||||||
// import android.graphics.BitmapFactory;
|
|
||||||
// import android.graphics.Typeface;
|
|
||||||
// import android.net.Uri;
|
|
||||||
// import android.os.AsyncTask;
|
|
||||||
// import android.os.Bundle;
|
|
||||||
// import android.text.SpannableStringBuilder;
|
|
||||||
// import android.text.method.LinkMovementMethod;
|
|
||||||
// import android.text.style.RelativeSizeSpan;
|
|
||||||
// import android.text.style.StyleSpan;
|
|
||||||
// import android.util.Log;
|
|
||||||
// import android.view.Menu;
|
|
||||||
// import android.view.MenuItem;
|
|
||||||
// import android.view.View;
|
|
||||||
// import android.widget.ArrayAdapter;
|
|
||||||
// import android.widget.TextView;
|
|
||||||
// import android.widget.Toast;
|
|
||||||
//
|
|
||||||
// import androidx.annotation.NonNull;
|
|
||||||
// import androidx.annotation.Nullable;
|
|
||||||
// import androidx.appcompat.app.AlertDialog;
|
|
||||||
// import androidx.core.content.ContextCompat;
|
|
||||||
// import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
// import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
||||||
//
|
|
||||||
// import java.io.DataOutputStream;
|
|
||||||
// import java.io.InputStream;
|
|
||||||
// import java.net.HttpURLConnection;
|
|
||||||
// import java.net.URL;
|
|
||||||
// import java.util.ArrayList;
|
|
||||||
// import java.util.Arrays;
|
|
||||||
//
|
|
||||||
// import awais.instagrabber.BuildConfig;
|
|
||||||
// import awais.instagrabber.R;
|
|
||||||
// import awais.instagrabber.adapters.HighlightsAdapter;
|
|
||||||
// import awais.instagrabber.adapters.PostsAdapter;
|
|
||||||
// import awais.instagrabber.asyncs.HashtagFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.HighlightsFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.LocationFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.PostsFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.ProfileFetcher;
|
|
||||||
// import awais.instagrabber.asyncs.i.iStoryStatusFetcher;
|
|
||||||
// import awais.instagrabber.customviews.RamboTextView;
|
|
||||||
// import awais.instagrabber.customviews.helpers.GridAutofitLayoutManager;
|
|
||||||
// import awais.instagrabber.customviews.helpers.GridSpacingItemDecoration;
|
|
||||||
// import awais.instagrabber.customviews.helpers.RecyclerLazyLoader;
|
|
||||||
// import awais.instagrabber.databinding.ActivityProfileBinding;
|
|
||||||
// import awais.instagrabber.fragments.SavedViewerFragment;
|
|
||||||
// import awais.instagrabber.interfaces.FetchListener;
|
|
||||||
// import awais.instagrabber.interfaces.MentionClickListener;
|
|
||||||
// import awais.instagrabber.models.BasePostModel;
|
|
||||||
// import awais.instagrabber.models.HashtagModel;
|
|
||||||
// import awais.instagrabber.models.HighlightModel;
|
|
||||||
// import awais.instagrabber.models.LocationModel;
|
|
||||||
// import awais.instagrabber.models.PostModel;
|
|
||||||
// import awais.instagrabber.models.ProfileModel;
|
|
||||||
// import awais.instagrabber.models.StoryModel;
|
|
||||||
// import awais.instagrabber.models.enums.DownloadMethod;
|
|
||||||
// import awais.instagrabber.models.enums.PostItemType;
|
|
||||||
// import awais.instagrabber.utils.Constants;
|
|
||||||
// import awais.instagrabber.utils.DataBox;
|
|
||||||
// import awais.instagrabber.utils.Utils;
|
|
||||||
// import awaisomereport.LogCollector;
|
|
||||||
//
|
|
||||||
// import static awais.instagrabber.utils.Constants.AUTOLOAD_POSTS;
|
|
||||||
// import static awais.instagrabber.utils.Utils.logCollector;
|
|
||||||
//
|
|
||||||
// @Deprecated
|
|
||||||
// public final class ProfileViewer extends BaseLanguageActivity implements SwipeRefreshLayout.OnRefreshListener {
|
|
||||||
// private final ArrayList<PostModel> allItems = new ArrayList<>(), selectedItems = new ArrayList<>();
|
|
||||||
// private static AsyncTask<?, ?, ?> currentlyExecuting;
|
|
||||||
// private final boolean autoloadPosts = Utils.settingsHelper.getBoolean(AUTOLOAD_POSTS);
|
|
||||||
// private boolean hasNextPage = false;
|
|
||||||
// private View collapsingToolbar;
|
|
||||||
// private String endCursor = null;
|
|
||||||
// private ProfileModel profileModel;
|
|
||||||
// private HashtagModel hashtagModel;
|
|
||||||
// private LocationModel locationModel;
|
|
||||||
// private StoryModel[] storyModels;
|
|
||||||
// private MenuItem downloadAction, favouriteAction;
|
|
||||||
// private final FetchListener<PostModel[]> postsFetchListener = new FetchListener<PostModel[]>() {
|
|
||||||
// @Override
|
|
||||||
// public void onResult(final PostModel[] result) {
|
|
||||||
// if (result != null) {
|
|
||||||
// final int oldSize = allItems.size();
|
|
||||||
// allItems.addAll(Arrays.asList(result));
|
|
||||||
//
|
|
||||||
// postsAdapter.notifyItemRangeInserted(oldSize, result.length);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainPosts.post(() -> {
|
|
||||||
// profileBinding.profileView.mainPosts.setNestedScrollingEnabled(true);
|
|
||||||
// profileBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// if (isHashtag)
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(userQuery);
|
|
||||||
// else if (isLocation)
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(locationModel.getName());
|
|
||||||
// else profileBinding.toolbar.toolbar.setTitle("@" + profileModel.getUsername());
|
|
||||||
//
|
|
||||||
// final PostModel model = result[result.length - 1];
|
|
||||||
// if (model != null) {
|
|
||||||
// endCursor = model.getEndCursor();
|
|
||||||
// hasNextPage = model.hasNextPage();
|
|
||||||
// if (autoloadPosts && hasNextPage)
|
|
||||||
// currentlyExecuting = new PostsFetcher(
|
|
||||||
// profileModel != null ? profileModel.getId()
|
|
||||||
// : (hashtagModel != null ? (hashtagModel.getName()) : locationModel.getId()),
|
|
||||||
// profileModel != null ? PostItemType.MAIN : (hashtagModel != null ? PostItemType.HASHTAG : PostItemType.LOCATION),
|
|
||||||
// endCursor,
|
|
||||||
// this)
|
|
||||||
// .setUsername((isLocation || isHashtag) ? null : profileModel.getUsername())
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// else {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// }
|
|
||||||
// model.setPageCursor(false, null);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// profileBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
|
|
||||||
// profileBinding.profileView.privatePage2.setText(R.string.empty_acc);
|
|
||||||
// profileBinding.profileView.privatePage.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// private final MentionClickListener mentionClickListener = new MentionClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(final RamboTextView view, final String text, final boolean isHashtag, final boolean isLocation) {
|
|
||||||
// startActivity(new Intent(getApplicationContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// public final HighlightsAdapter highlightsAdapter = new HighlightsAdapter(null, new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(final View v) {
|
|
||||||
// final Object tag = v.getTag();
|
|
||||||
// if (tag instanceof HighlightModel) {
|
|
||||||
// final HighlightModel highlightModel = (HighlightModel) tag;
|
|
||||||
// new iStoryStatusFetcher(highlightModel.getId(), null, false, false,
|
|
||||||
// (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
|
|
||||||
// if (result != null && result.length > 0) {
|
|
||||||
// // startActivity(new Intent(ProfileViewer.this, StoryViewer.class)
|
|
||||||
// // .putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
|
||||||
// // .putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
|
|
||||||
// // .putExtra(Constants.EXTRAS_STORIES, result)
|
|
||||||
// // );
|
|
||||||
// } else
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// private Resources resources;
|
|
||||||
// private RecyclerLazyLoader lazyLoader;
|
|
||||||
// private boolean isHashtag, isUser, isLocation;
|
|
||||||
// private PostsAdapter postsAdapter;
|
|
||||||
// private String cookie = Utils.settingsHelper.getString(Constants.COOKIE), userQuery;
|
|
||||||
// public boolean isLoggedIn = !Utils.isEmpty(cookie);
|
|
||||||
// private ActivityProfileBinding profileBinding;
|
|
||||||
// private ArrayAdapter<String> profileDialogAdapter;
|
|
||||||
// private DialogInterface.OnClickListener profileDialogListener;
|
|
||||||
//
|
|
||||||
// protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
|
||||||
// stopCurrentExecutor();
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
//
|
|
||||||
// final Intent intent = getIntent();
|
|
||||||
// if (intent == null || !intent.hasExtra(Constants.EXTRAS_USERNAME)
|
|
||||||
// || Utils.isEmpty((userQuery = intent.getStringExtra(Constants.EXTRAS_USERNAME)))) {
|
|
||||||
// Utils.errorFinish(this);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// userQuery = (userQuery.contains("/") || userQuery.startsWith("#") || userQuery.startsWith("@")) ? userQuery : ("@" + userQuery);
|
|
||||||
//
|
|
||||||
// profileBinding = ActivityProfileBinding.inflate(getLayoutInflater());
|
|
||||||
// setContentView(profileBinding.getRoot());
|
|
||||||
//
|
|
||||||
// resources = getResources();
|
|
||||||
//
|
|
||||||
// profileDialogAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
|
|
||||||
// new String[]{resources.getString(R.string.view_pfp), resources.getString(R.string.show_stories)});
|
|
||||||
// profileDialogListener = (dialog, which) -> {
|
|
||||||
// final Intent newintent;
|
|
||||||
// if (which == 0 || storyModels == null || storyModels.length < 1) {
|
|
||||||
// newintent = new Intent(this, ProfilePicViewer.class).putExtra(
|
|
||||||
// ((hashtagModel != null)
|
|
||||||
// ? Constants.EXTRAS_HASHTAG
|
|
||||||
// : (locationModel != null ? Constants.EXTRAS_LOCATION : Constants.EXTRAS_PROFILE)),
|
|
||||||
// ((hashtagModel != null) ? hashtagModel : (locationModel != null ? locationModel : profileModel)));
|
|
||||||
// }
|
|
||||||
// // else
|
|
||||||
// // newintent = new Intent(this, StoryViewer.class).putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
|
||||||
// // .putExtra(Constants.EXTRAS_STORIES, storyModels)
|
|
||||||
// // .putExtra(Constants.EXTRAS_HASHTAG, (hashtagModel != null));
|
|
||||||
// // startActivity(newintent);
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setOnRefreshListener(this);
|
|
||||||
// profileBinding.profileView.mainUrl.setMovementMethod(new LinkMovementMethod());
|
|
||||||
//
|
|
||||||
// isLoggedIn = !Utils.isEmpty(cookie);
|
|
||||||
//
|
|
||||||
// collapsingToolbar = profileBinding.profileView.appBarLayout.getChildAt(0);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
|
|
||||||
// profileBinding.profileView.highlightsList.setLayoutManager(
|
|
||||||
// new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false));
|
|
||||||
// profileBinding.profileView.highlightsList.setAdapter(highlightsAdapter);
|
|
||||||
//
|
|
||||||
// setSupportActionBar(profileBinding.toolbar.toolbar);
|
|
||||||
//
|
|
||||||
// // change the next number to adjust grid
|
|
||||||
// final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(ProfileViewer.this, Utils.convertDpToPx(110));
|
|
||||||
// profileBinding.profileView.mainPosts.setLayoutManager(layoutManager);
|
|
||||||
// profileBinding.profileView.mainPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
|
|
||||||
// // profileBinding.profileView.mainPosts.setAdapter(postsAdapter = new PostsAdapter(allItems, v -> {
|
|
||||||
// // final Object tag = v.getTag();
|
|
||||||
// // if (tag instanceof PostModel) {
|
|
||||||
// // final PostModel postModel = (PostModel) tag;
|
|
||||||
// //
|
|
||||||
// // if (postsAdapter.isSelecting) toggleSelection(postModel);
|
|
||||||
// // else startActivity(new Intent(ProfileViewer.this, PostViewer.class)
|
|
||||||
// // .putExtra(Constants.EXTRAS_INDEX, postModel.getPosition())
|
|
||||||
// // .putExtra(Constants.EXTRAS_POST, postModel)
|
|
||||||
// // .putExtra(Constants.EXTRAS_USER, userQuery)
|
|
||||||
// // .putExtra(Constants.EXTRAS_TYPE, ItemGetType.MAIN_ITEMS));
|
|
||||||
// // }
|
|
||||||
// // }, v -> { // long click listener
|
|
||||||
// // final Object tag = v.getTag();
|
|
||||||
// // if (tag instanceof PostModel) {
|
|
||||||
// // postsAdapter.isSelecting = true;
|
|
||||||
// // toggleSelection((PostModel) tag);
|
|
||||||
// // }
|
|
||||||
// // return true;
|
|
||||||
// // }));
|
|
||||||
//
|
|
||||||
// this.lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
|
|
||||||
// if ((!autoloadPosts || isHashtag) && hasNextPage) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(true);
|
|
||||||
// stopCurrentExecutor();
|
|
||||||
// currentlyExecuting = new PostsFetcher(profileModel != null ? profileModel.getId()
|
|
||||||
// : (hashtagModel != null
|
|
||||||
// ? ("#" + hashtagModel.getName())
|
|
||||||
// : locationModel.getId()),
|
|
||||||
// profileModel != null
|
|
||||||
// ? PostItemType.MAIN
|
|
||||||
// : (hashtagModel != null ? PostItemType.HASHTAG : PostItemType.LOCATION),
|
|
||||||
// endCursor, postsFetchListener)
|
|
||||||
// .setUsername((isHashtag || isLocation) ? null : profileModel.getUsername())
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// endCursor = null;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// profileBinding.profileView.mainPosts.addOnScrollListener(lazyLoader);
|
|
||||||
//
|
|
||||||
// final View.OnClickListener onClickListener = v -> {
|
|
||||||
// if (v == profileBinding.profileView.mainBiography) {
|
|
||||||
// Utils.copyText(this, profileBinding.profileView.mainBiography.getText().toString());
|
|
||||||
// } else if (v == profileBinding.profileView.locationBiography) {
|
|
||||||
// Utils.copyText(this, profileBinding.profileView.locationBiography.getText().toString());
|
|
||||||
// } else if (v == profileBinding.profileView.mainProfileImage || v == profileBinding.profileView.mainHashtagImage || v == profileBinding.profileView.mainLocationImage) {
|
|
||||||
// if (storyModels == null || storyModels.length <= 0) {
|
|
||||||
// profileDialogListener.onClick(null, 0);
|
|
||||||
// } else {
|
|
||||||
// // because sometimes configuration changes made this crash on some phones
|
|
||||||
// new AlertDialog.Builder(this).setAdapter(profileDialogAdapter, profileDialogListener)
|
|
||||||
// .setNeutralButton(R.string.cancel, null).show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainBiography.setOnClickListener(onClickListener);
|
|
||||||
// profileBinding.profileView.locationBiography.setOnClickListener(onClickListener);
|
|
||||||
// profileBinding.profileView.mainProfileImage.setOnClickListener(onClickListener);
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setOnClickListener(onClickListener);
|
|
||||||
// profileBinding.profileView.mainLocationImage.setOnClickListener(onClickListener);
|
|
||||||
//
|
|
||||||
// this.onRefresh();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRefresh() {
|
|
||||||
// if (lazyLoader != null) lazyLoader.resetState();
|
|
||||||
// stopCurrentExecutor();
|
|
||||||
// allItems.clear();
|
|
||||||
// selectedItems.clear();
|
|
||||||
// if (postsAdapter != null) {
|
|
||||||
// // postsAdapter.isSelecting = false;
|
|
||||||
// postsAdapter.notifyDataSetChanged();
|
|
||||||
// }
|
|
||||||
// profileBinding.profileView.appBarLayout.setExpanded(true, true);
|
|
||||||
// profileBinding.profileView.privatePage.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.privatePage2.setTextSize(28);
|
|
||||||
// // profileBinding.profileView.mainProfileImage.setImageBitmap(null);
|
|
||||||
// // profileBinding.profileView.mainHashtagImage.setImageBitmap(null);
|
|
||||||
// // profileBinding.profileView.mainLocationImage.setImageBitmap(null);
|
|
||||||
// profileBinding.profileView.mainUrl.setText(null);
|
|
||||||
// profileBinding.profileView.locationUrl.setText(null);
|
|
||||||
// profileBinding.profileView.mainFullName.setText(null);
|
|
||||||
// profileBinding.profileView.locationFullName.setText(null);
|
|
||||||
// profileBinding.profileView.mainPostCount.setText(null);
|
|
||||||
// profileBinding.profileView.mainLocPostCount.setText(null);
|
|
||||||
// profileBinding.profileView.mainTagPostCount.setText(null);
|
|
||||||
// profileBinding.profileView.mainFollowers.setText(null);
|
|
||||||
// profileBinding.profileView.mainFollowing.setText(null);
|
|
||||||
// profileBinding.profileView.mainBiography.setText(null);
|
|
||||||
// profileBinding.profileView.locationBiography.setText(null);
|
|
||||||
// profileBinding.profileView.mainBiography.setEnabled(false);
|
|
||||||
// profileBinding.profileView.locationBiography.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainProfileImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainLocationImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainBiography.setMentionClickListener(null);
|
|
||||||
// profileBinding.profileView.locationBiography.setMentionClickListener(null);
|
|
||||||
// profileBinding.profileView.mainUrl.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.locationUrl.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.isVerified.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnFollow.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnRestrict.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnBlock.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnSaved.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnLiked.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnTagged.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnMap.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.btnFollow.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnRestrict.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnBlock.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnSaved.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnLiked.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnTagged.setOnClickListener(profileActionListener);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setOnClickListener(profileActionListener);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.infoContainer.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.tagInfoContainer.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.locInfoContainer.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
|
|
||||||
// profileBinding.profileView.highlightsList.setVisibility(View.GONE);
|
|
||||||
// collapsingToolbar.setVisibility(View.GONE);
|
|
||||||
// highlightsAdapter.setData(null);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(userQuery != null);
|
|
||||||
// if (userQuery == null) {
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(R.string.app_name);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// isHashtag = userQuery.charAt(0) == '#';
|
|
||||||
// isUser = userQuery.charAt(0) == '@';
|
|
||||||
// isLocation = userQuery.contains("/");
|
|
||||||
// collapsingToolbar.setVisibility(isUser ? View.VISIBLE : View.GONE);
|
|
||||||
//
|
|
||||||
// if (isHashtag) {
|
|
||||||
// profileModel = null;
|
|
||||||
// locationModel = null;
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(userQuery);
|
|
||||||
// profileBinding.profileView.tagInfoContainer.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// currentlyExecuting = new HashtagFetcher(userQuery.substring(1), result -> {
|
|
||||||
// hashtagModel = result;
|
|
||||||
//
|
|
||||||
// if (hashtagModel == null) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(R.string.app_name);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// currentlyExecuting = new PostsFetcher(userQuery, PostItemType.HASHTAG, null, postsFetchListener)
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.btnFollowTag.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// if (isLoggedIn) {
|
|
||||||
// new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, false, stories -> {
|
|
||||||
// storyModels = stories;
|
|
||||||
// if (stories != null && stories.length > 0)
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setStoriesBorder();
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
//
|
|
||||||
// if (hashtagModel.getFollowing()) {
|
|
||||||
// profileBinding.profileView.btnFollowTag.setText(R.string.unfollow);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_purple_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnFollowTag.setText(R.string.follow);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_pink_background)));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (Utils.dataBox.getFavorite(userQuery) != null) {
|
|
||||||
// profileBinding.profileView.btnFollowTag.setText(R.string.unfavorite_short);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_purple_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnFollowTag.setText(R.string.favorite_short);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_pink_background)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // profileBinding.profileView.mainHashtagImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setImageURI(hashtagModel.getSdProfilePic());
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setEnabled(true);
|
|
||||||
//
|
|
||||||
// final String postCount = String.valueOf(hashtagModel.getPostCount());
|
|
||||||
//
|
|
||||||
// SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
|
|
||||||
// span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
|
||||||
// span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
|
||||||
// profileBinding.profileView.mainTagPostCount.setText(span);
|
|
||||||
// profileBinding.profileView.mainTagPostCount.setVisibility(View.VISIBLE);
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// } else if (isUser) {
|
|
||||||
// hashtagModel = null;
|
|
||||||
// locationModel = null;
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(userQuery);
|
|
||||||
// profileBinding.profileView.infoContainer.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnFollowTag.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// currentlyExecuting = new ProfileFetcher(userQuery.substring(1), result -> {
|
|
||||||
// profileModel = result;
|
|
||||||
//
|
|
||||||
// if (profileModel == null) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(R.string.app_name);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
|
|
||||||
// final String profileId = profileModel.getId();
|
|
||||||
//
|
|
||||||
// if (isLoggedIn || Utils.settingsHelper.getBoolean(Constants.STORIESIG)) {
|
|
||||||
// new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false,
|
|
||||||
// (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), false,
|
|
||||||
// stories -> {
|
|
||||||
// storyModels = stories;
|
|
||||||
// if (stories != null && stories.length > 0)
|
|
||||||
// profileBinding.profileView.mainProfileImage.setStoriesBorder();
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
//
|
|
||||||
// new HighlightsFetcher(profileId, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), hls -> {
|
|
||||||
// if (hls != null && hls.length > 0) {
|
|
||||||
// profileBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
|
|
||||||
// highlightsAdapter.setData(hls);
|
|
||||||
// } else profileBinding.profileView.highlightsList.setVisibility(View.GONE);
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (isLoggedIn) {
|
|
||||||
// final String myId = Utils.getUserIdFromCookie(cookie);
|
|
||||||
// if (!profileId.equals(myId)) {
|
|
||||||
// profileBinding.profileView.btnTagged.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnSaved.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnLiked.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
|
|
||||||
// if (profileModel.getFollowing() == true) {
|
|
||||||
// profileBinding.profileView.btnFollow.setText(R.string.unfollow);
|
|
||||||
// profileBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_purple_background)));
|
|
||||||
// } else if (profileModel.getRequested() == true) {
|
|
||||||
// profileBinding.profileView.btnFollow.setText(R.string.cancel);
|
|
||||||
// profileBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_purple_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnFollow.setText(R.string.follow);
|
|
||||||
// profileBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_pink_background)));
|
|
||||||
// }
|
|
||||||
// profileBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
|
|
||||||
// if (profileModel.getRestricted() == true) {
|
|
||||||
// profileBinding.profileView.btnRestrict.setText(R.string.unrestrict);
|
|
||||||
// profileBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_green_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnRestrict.setText(R.string.restrict);
|
|
||||||
// profileBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_orange_background)));
|
|
||||||
// }
|
|
||||||
// if (profileModel.isReallyPrivate()) {
|
|
||||||
// profileBinding.profileView.btnBlock.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnTagged.setVisibility(View.GONE);
|
|
||||||
// if (profileModel.getBlocked() == true) {
|
|
||||||
// profileBinding.profileView.btnBlock.setText(R.string.unblock);
|
|
||||||
// profileBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_green_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnBlock.setText(R.string.block);
|
|
||||||
// profileBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_red_background)));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnBlock.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
|
|
||||||
// if (profileModel.getBlocked() == true) {
|
|
||||||
// profileBinding.profileView.btnSaved.setText(R.string.unblock);
|
|
||||||
// profileBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_green_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnSaved.setText(R.string.block);
|
|
||||||
// profileBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_red_background)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnLiked.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnSaved.setText(R.string.saved);
|
|
||||||
// profileBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_orange_background)));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (Utils.dataBox.getFavorite(userQuery) != null) {
|
|
||||||
// profileBinding.profileView.btnFollow.setText(R.string.unfavorite_short);
|
|
||||||
// profileBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_purple_background)));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnFollow.setText(R.string.favorite_short);
|
|
||||||
// profileBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_pink_background)));
|
|
||||||
// }
|
|
||||||
// profileBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
|
|
||||||
// if (!profileModel.isReallyPrivate()) {
|
|
||||||
// profileBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnRestrict.setText(R.string.tagged);
|
|
||||||
// profileBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
|
|
||||||
// ProfileViewer.this, R.color.btn_blue_background)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // profileBinding.profileView.mainProfileImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainProfileImage.setImageURI(profileModel.getSdProfilePic(), null);
|
|
||||||
// // profileBinding.profileView.mainProfileImage.setEnabled(true);
|
|
||||||
//
|
|
||||||
// final long followersCount = profileModel.getFollowersCount();
|
|
||||||
// final long followingCount = profileModel.getFollowingCount();
|
|
||||||
//
|
|
||||||
// final String postCount = String.valueOf(profileModel.getPostCount());
|
|
||||||
//
|
|
||||||
// SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
|
|
||||||
// span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
|
||||||
// span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
|
||||||
// profileBinding.profileView.mainPostCount.setText(span);
|
|
||||||
//
|
|
||||||
// final String followersCountStr = String.valueOf(followersCount);
|
|
||||||
// final int followersCountStrLen = followersCountStr.length();
|
|
||||||
// span = new SpannableStringBuilder(resources.getString(R.string.main_posts_followers, followersCountStr));
|
|
||||||
// span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0);
|
|
||||||
// span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0);
|
|
||||||
// profileBinding.profileView.mainFollowers.setText(span);
|
|
||||||
//
|
|
||||||
// final String followingCountStr = String.valueOf(followingCount);
|
|
||||||
// final int followingCountStrLen = followingCountStr.length();
|
|
||||||
// span = new SpannableStringBuilder(resources.getString(R.string.main_posts_following, followingCountStr));
|
|
||||||
// span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0);
|
|
||||||
// span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
|
|
||||||
// profileBinding.profileView.mainFollowing.setText(span);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainFullName
|
|
||||||
// .setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername() : profileModel.getName());
|
|
||||||
//
|
|
||||||
// CharSequence biography = profileModel.getBiography();
|
|
||||||
// profileBinding.profileView.mainBiography.setCaptionIsExpandable(true);
|
|
||||||
// profileBinding.profileView.mainBiography.setCaptionIsExpanded(true);
|
|
||||||
// if (Utils.hasMentions(biography)) {
|
|
||||||
// biography = Utils.getMentionText(biography);
|
|
||||||
// profileBinding.profileView.mainBiography.setText(biography, TextView.BufferType.SPANNABLE);
|
|
||||||
// profileBinding.profileView.mainBiography.setMentionClickListener(mentionClickListener);
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.mainBiography.setText(biography);
|
|
||||||
// profileBinding.profileView.mainBiography.setMentionClickListener(null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final String url = profileModel.getUrl();
|
|
||||||
// if (Utils.isEmpty(url)) {
|
|
||||||
// profileBinding.profileView.mainUrl.setVisibility(View.GONE);
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.mainUrl.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.mainUrl.setText(Utils.getSpannableUrl(url));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.mainFullName.setSelected(true);
|
|
||||||
// profileBinding.profileView.mainBiography.setEnabled(true);
|
|
||||||
//
|
|
||||||
// if (!profileModel.isReallyPrivate()) {
|
|
||||||
// profileBinding.profileView.mainFollowing.setClickable(true);
|
|
||||||
// profileBinding.profileView.mainFollowers.setClickable(true);
|
|
||||||
//
|
|
||||||
// if (isLoggedIn) {
|
|
||||||
// // final View.OnClickListener followClickListener = v -> startActivity(
|
|
||||||
// // new Intent(ProfileViewer.this, FollowViewerFragment.class)
|
|
||||||
// // .putExtra(Constants.EXTRAS_FOLLOWERS, v == profileBinding.profileView.mainFollowers)
|
|
||||||
// // .putExtra(Constants.EXTRAS_NAME, profileModel.getUsername())
|
|
||||||
// // .putExtra(Constants.EXTRAS_ID, profileId));
|
|
||||||
// //
|
|
||||||
// // profileBinding.profileView.mainFollowers.setOnClickListener(followersCount > 0 ? followClickListener : null);
|
|
||||||
// // profileBinding.profileView.mainFollowing.setOnClickListener(followingCount > 0 ? followClickListener : null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (profileModel.getPostCount() == 0) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// profileBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
|
|
||||||
// profileBinding.profileView.privatePage2.setText(R.string.empty_acc);
|
|
||||||
// profileBinding.profileView.privatePage.setVisibility(View.VISIBLE);
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(true);
|
|
||||||
// profileBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
|
|
||||||
// currentlyExecuting = new PostsFetcher(profileId, PostItemType.MAIN, null, postsFetchListener)
|
|
||||||
// .setUsername(profileModel.getUsername())
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.mainFollowers.setClickable(false);
|
|
||||||
// profileBinding.profileView.mainFollowing.setClickable(false);
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// // error
|
|
||||||
// profileBinding.profileView.privatePage1.setImageResource(R.drawable.lock);
|
|
||||||
// profileBinding.profileView.privatePage2.setText(R.string.priv_acc);
|
|
||||||
// profileBinding.profileView.privatePage.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.mainPosts.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// } else if (isLocation) {
|
|
||||||
// profileModel = null;
|
|
||||||
// hashtagModel = null;
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(userQuery);
|
|
||||||
// profileBinding.profileView.locInfoContainer.setVisibility(View.VISIBLE);
|
|
||||||
//
|
|
||||||
// currentlyExecuting = new LocationFetcher(userQuery.split("/")[0], result -> {
|
|
||||||
// locationModel = result;
|
|
||||||
//
|
|
||||||
// if (locationModel == null) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(R.string.app_name);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// profileBinding.toolbar.toolbar.setTitle(locationModel.getName());
|
|
||||||
//
|
|
||||||
// final String profileId = locationModel.getId();
|
|
||||||
//
|
|
||||||
// if (isLoggedIn) {
|
|
||||||
// new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, stories -> {
|
|
||||||
// storyModels = stories;
|
|
||||||
// if (stories != null && stories.length > 0)
|
|
||||||
// profileBinding.profileView.mainLocationImage.setStoriesBorder();
|
|
||||||
// }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // profileBinding.profileView.mainLocationImage.setEnabled(false);
|
|
||||||
// profileBinding.profileView.mainLocationImage.setImageURI(locationModel.getSdProfilePic());
|
|
||||||
// profileBinding.profileView.mainLocationImage.setEnabled(true);
|
|
||||||
//
|
|
||||||
// final String postCount = String.valueOf(locationModel.getPostCount());
|
|
||||||
//
|
|
||||||
// SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
|
|
||||||
// span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
|
||||||
// span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
|
||||||
// profileBinding.profileView.mainLocPostCount.setText(span);
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.locationFullName.setText(locationModel.getName());
|
|
||||||
//
|
|
||||||
// CharSequence biography = locationModel.getBio();
|
|
||||||
// profileBinding.profileView.locationBiography.setCaptionIsExpandable(true);
|
|
||||||
// profileBinding.profileView.locationBiography.setCaptionIsExpanded(true);
|
|
||||||
//
|
|
||||||
// if (Utils.isEmpty(biography)) {
|
|
||||||
// profileBinding.profileView.locationBiography.setVisibility(View.GONE);
|
|
||||||
// } else if (Utils.hasMentions(biography)) {
|
|
||||||
// profileBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
|
|
||||||
// biography = Utils.getMentionText(biography);
|
|
||||||
// profileBinding.profileView.locationBiography.setText(biography, TextView.BufferType.SPANNABLE);
|
|
||||||
// profileBinding.profileView.locationBiography.setMentionClickListener(mentionClickListener);
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.locationBiography.setText(biography);
|
|
||||||
// profileBinding.profileView.locationBiography.setMentionClickListener(null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) {
|
|
||||||
// profileBinding.profileView.btnMap.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.btnMap.setOnClickListener(v -> {
|
|
||||||
// final Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
// intent.setData(Uri.parse(locationModel.getGeo()));
|
|
||||||
// startActivity(intent);
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.btnMap.setVisibility(View.GONE);
|
|
||||||
// profileBinding.profileView.btnMap.setOnClickListener(null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final String url = locationModel.getUrl();
|
|
||||||
// if (Utils.isEmpty(url)) {
|
|
||||||
// profileBinding.profileView.locationUrl.setVisibility(View.GONE);
|
|
||||||
// } else if (!url.startsWith("http")) {
|
|
||||||
// profileBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.locationUrl.setText(Utils.getSpannableUrl("http://" + url));
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
|
|
||||||
// profileBinding.profileView.locationUrl.setText(Utils.getSpannableUrl(url));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// profileBinding.profileView.locationFullName.setSelected(true);
|
|
||||||
// profileBinding.profileView.locationBiography.setEnabled(true);
|
|
||||||
//
|
|
||||||
// if (locationModel.getPostCount() == 0) {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(false);
|
|
||||||
// profileBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
|
|
||||||
// profileBinding.profileView.privatePage2.setText(R.string.empty_acc);
|
|
||||||
// profileBinding.profileView.privatePage.setVisibility(View.VISIBLE);
|
|
||||||
// } else {
|
|
||||||
// profileBinding.profileView.swipeRefreshLayout.setRefreshing(true);
|
|
||||||
// profileBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
|
|
||||||
// currentlyExecuting = new PostsFetcher(profileId, PostItemType.LOCATION, null, postsFetchListener)
|
|
||||||
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void stopCurrentExecutor() {
|
|
||||||
// if (currentlyExecuting != null) {
|
|
||||||
// try {
|
|
||||||
// currentlyExecuting.cancel(true);
|
|
||||||
// } catch (final Exception e) {
|
|
||||||
// if (logCollector != null)
|
|
||||||
// logCollector.appendException(e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
|
|
||||||
// if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onCreateOptionsMenu(final Menu menu) {
|
|
||||||
// getMenuInflater().inflate(R.menu.saved, menu);
|
|
||||||
//
|
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void toggleSelection(final PostModel postModel) {
|
|
||||||
// if (postModel != null && postsAdapter != null) {
|
|
||||||
// if (postModel.isSelected()) selectedItems.remove(postModel);
|
|
||||||
// else if (selectedItems.size() >= 100) {
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.downloader_too_many, Toast.LENGTH_SHORT);
|
|
||||||
// return;
|
|
||||||
// } else selectedItems.add(postModel);
|
|
||||||
// postModel.setSelected(!postModel.isSelected());
|
|
||||||
// notifyAdapter(postModel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void notifyAdapter(final PostModel postModel) {
|
|
||||||
// // if (selectedItems.size() < 1) postsAdapter.isSelecting = false;
|
|
||||||
// // if (postModel.getPosition() < 0) postsAdapter.notifyDataSetChanged();
|
|
||||||
// // else postsAdapter.notifyItemChanged(postModel.getPosition(), postModel);
|
|
||||||
// //
|
|
||||||
// // if (downloadAction != null) downloadAction.setVisible(postsAdapter.isSelecting);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) {
|
|
||||||
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
// if (requestCode == 8020 && grantResults[0] == PackageManager.PERMISSION_GRANTED && selectedItems.size() > 0)
|
|
||||||
// Utils.batchDownload(this, userQuery, DownloadMethod.DOWNLOAD_MAIN, selectedItems);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void deselectSelection(final BasePostModel postModel) {
|
|
||||||
// if (postModel instanceof PostModel) {
|
|
||||||
// selectedItems.remove(postModel);
|
|
||||||
// postModel.setSelected(false);
|
|
||||||
// if (postsAdapter != null) notifyAdapter((PostModel) postModel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class MyTask extends AsyncTask<Void, Bitmap, Void> {
|
|
||||||
// private Bitmap mIcon_val;
|
|
||||||
//
|
|
||||||
// protected Void doInBackground(Void... voids) {
|
|
||||||
// try {
|
|
||||||
// String url;
|
|
||||||
// if (hashtagModel != null) {
|
|
||||||
// url = hashtagModel.getSdProfilePic();
|
|
||||||
// } else if (locationModel != null) {
|
|
||||||
// url = locationModel.getSdProfilePic();
|
|
||||||
// } else {
|
|
||||||
// url = profileModel.getSdProfilePic();
|
|
||||||
// }
|
|
||||||
// mIcon_val = BitmapFactory.decodeStream((InputStream) new URL(url).getContent());
|
|
||||||
// } catch (Throwable ex) {
|
|
||||||
// Log.e("austin_debug", "bitmap: " + ex);
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onPostExecute(Void result) {
|
|
||||||
// if (hashtagModel != null)
|
|
||||||
// profileBinding.profileView.mainHashtagImage.setImageBitmap(mIcon_val);
|
|
||||||
// else if (locationModel != null)
|
|
||||||
// profileBinding.profileView.mainLocationImage.setImageBitmap(mIcon_val);
|
|
||||||
// else profileBinding.profileView.mainProfileImage.setImageBitmap(mIcon_val);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private final View.OnClickListener profileActionListener = new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(final View v) {
|
|
||||||
// final boolean iamme = (isLoggedIn && profileModel != null) && Utils.getUserIdFromCookie(cookie).equals(profileModel.getId());
|
|
||||||
// if (!isLoggedIn && Utils.dataBox.getFavorite(userQuery) != null && v == profileBinding.profileView.btnFollow) {
|
|
||||||
// Utils.dataBox.delFavorite(new DataBox.FavoriteModel(userQuery,
|
|
||||||
// Long.parseLong(Utils.dataBox.getFavorite(userQuery).split("/")[1]),
|
|
||||||
// locationModel != null
|
|
||||||
// ? locationModel.getName()
|
|
||||||
// : userQuery.replaceAll("^@", "")));
|
|
||||||
// onRefresh();
|
|
||||||
// } else if (!isLoggedIn && (v == profileBinding.profileView.btnFollow || v == profileBinding.profileView.btnFollowTag)) {
|
|
||||||
// Utils.dataBox.addFavorite(new DataBox.FavoriteModel(userQuery, System.currentTimeMillis(),
|
|
||||||
// locationModel != null
|
|
||||||
// ? locationModel.getName()
|
|
||||||
// : userQuery.replaceAll("^@", "")));
|
|
||||||
// onRefresh();
|
|
||||||
// } else if (v == profileBinding.profileView.btnFollow) {
|
|
||||||
// new ProfileAction().execute("follow");
|
|
||||||
// } else if (v == profileBinding.profileView.btnRestrict && isLoggedIn) {
|
|
||||||
// new ProfileAction().execute("restrict");
|
|
||||||
// } else if (v == profileBinding.profileView.btnSaved && !iamme) {
|
|
||||||
// new ProfileAction().execute("block");
|
|
||||||
// } else if (v == profileBinding.profileView.btnFollowTag) {
|
|
||||||
// new ProfileAction().execute("followtag");
|
|
||||||
// } else if (v == profileBinding.profileView.btnTagged || (v == profileBinding.profileView.btnRestrict && !isLoggedIn)) {
|
|
||||||
// startActivity(new Intent(ProfileViewer.this, SavedViewerFragment.class)
|
|
||||||
// .putExtra(Constants.EXTRAS_INDEX, "%" + profileModel.getId())
|
|
||||||
// .putExtra(Constants.EXTRAS_USER, "@" + profileModel.getUsername())
|
|
||||||
// );
|
|
||||||
// } else if (v == profileBinding.profileView.btnSaved) {
|
|
||||||
// startActivity(new Intent(ProfileViewer.this, SavedViewerFragment.class)
|
|
||||||
// .putExtra(Constants.EXTRAS_INDEX, "$" + profileModel.getId())
|
|
||||||
// .putExtra(Constants.EXTRAS_USER, "@" + profileModel.getUsername())
|
|
||||||
// );
|
|
||||||
// } else if (v == profileBinding.profileView.btnLiked) {
|
|
||||||
// startActivity(new Intent(ProfileViewer.this, SavedViewerFragment.class)
|
|
||||||
// .putExtra(Constants.EXTRAS_INDEX, "^" + profileModel.getId())
|
|
||||||
// .putExtra(Constants.EXTRAS_USER, "@" + profileModel.getUsername())
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class ProfileAction extends AsyncTask<String, Void, Void> {
|
|
||||||
// boolean ok = false;
|
|
||||||
// String action;
|
|
||||||
//
|
|
||||||
// protected Void doInBackground(String... rawAction) {
|
|
||||||
// action = rawAction[0];
|
|
||||||
// final String url = "https://www.instagram.com/web/" +
|
|
||||||
// ((action.equals("followtag") && hashtagModel != null) ? ("tags/" +
|
|
||||||
// (hashtagModel.getFollowing() ? "unfollow/" : "follow/") + hashtagModel.getName() + "/") : (
|
|
||||||
// ((action.equals("restrict") && profileModel != null)
|
|
||||||
// ? "restrict_action"
|
|
||||||
// : ("friendships/" + profileModel.getId())) + "/" +
|
|
||||||
// ((action.equals("follow") && profileModel != null) ?
|
|
||||||
// ((profileModel.getFollowing() ||
|
|
||||||
// (!profileModel.getFollowing() && profileModel.getRequested()))
|
|
||||||
// ? "unfollow/" : "follow/") :
|
|
||||||
// ((action.equals("restrict") && profileModel != null) ?
|
|
||||||
// (profileModel.getRestricted() ? "unrestrict/" : "restrict/") :
|
|
||||||
// (profileModel.getBlocked() ? "unblock/" : "block/")))));
|
|
||||||
// try {
|
|
||||||
// final HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
|
|
||||||
// urlConnection.setRequestMethod("POST");
|
|
||||||
// urlConnection.setUseCaches(false);
|
|
||||||
// urlConnection.setRequestProperty("User-Agent", Constants.USER_AGENT);
|
|
||||||
// urlConnection.setRequestProperty("x-csrftoken", cookie.split("csrftoken=")[1].split(";")[0]);
|
|
||||||
// if (action == "restrict") {
|
|
||||||
// final String urlParameters = "target_user_id=" + profileModel.getId();
|
|
||||||
// urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
|
||||||
// urlConnection.setRequestProperty("Content-Length", "" +
|
|
||||||
// urlParameters.getBytes().length);
|
|
||||||
// urlConnection.setDoOutput(true);
|
|
||||||
// DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream());
|
|
||||||
// wr.writeBytes(urlParameters);
|
|
||||||
// wr.flush();
|
|
||||||
// wr.close();
|
|
||||||
// } else urlConnection.connect();
|
|
||||||
// if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
|
||||||
// ok = true;
|
|
||||||
// } else
|
|
||||||
// Toast.makeText(ProfileViewer.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
// urlConnection.disconnect();
|
|
||||||
// } catch (Throwable ex) {
|
|
||||||
// Log.e("austin_debug", action + ": " + ex);
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onPostExecute(Void result) {
|
|
||||||
// if (ok) {
|
|
||||||
// onRefresh();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
Loading…
Reference in New Issue
Block a user